-
gdpodesta
-
-
Offline
-
Senior Member
-
- Posts: 75
- Thank you received: 8
-
Karma: -42
-
|
In my component, I'm have a table for "Professors". The table stores all sorts of information about the professor, and in the case of a new record, creates a new Joomla user account. I have this all working just fine in the postSaveHook function with the fields generated from the XML.
To finished, I have to obtain the password for the Joomla user account, so I need an input field for the user to provide it, but the password is not to be stored in the table with the other Professor info, only used in the CreateUser function. The postSaveHook function only provides the data that was saved (and described in the related XML), so if I put such an input on the page, where is it available "in the flow of things" so that I can create the user account with the password that the user provided with the input field, but not have to save in in my table?
|
|
-
JoomGuy
-
-
Offline
-
Moderator
-
-
Joomla Enthusiast, Lover of Cooking
- Posts: 1115
- Thank you received: 195
-
Karma: 64
-
|
Somebody else asked a related question - not quite the same but nevertheless, I think the best solution would be to create a user/profile plugin.
Of course this would be outside of cook however, it could easily be added to your manifest and installed in one go.
The advantage of this approach is that you could create an independant profile and data set for each type of user + you can hook in to login/logout, registrations and all that good stuff.
Search the forum for 'profile plugin'. I have linked to a few relevant posts quite recently as well as the joomla docs for it.
Hope it helps,
Gez
|
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
Last Edit: 14 Dec 2012 08:32 by JoomGuy.
|
-
JoomGuy
-
-
Offline
-
Moderator
-
-
Joomla Enthusiast, Lover of Cooking
- Posts: 1115
- Thank you received: 195
-
Karma: 64
-
|
|
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
|
-
JoomGuy
-
-
Offline
-
Moderator
-
-
Joomla Enthusiast, Lover of Cooking
- Posts: 1115
- Thank you received: 195
-
Karma: 64
-
|
Actually, another way (following your exact route) may be to add the password field to your XML. You don't have to store it in your table but, you can obviously then retrieve it from $data in your model, right?
Never tried this but I can't see a reason why it wouldn't work.
Is the purpose of putting the password field in your form like a 'confirm' password for them to be able to submit your form? I mean, are they already signed in at this point and you just want to check again?
Gez
|
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
|
-
gdpodesta
-
-
Offline
-
Senior Member
-
- Posts: 75
- Thank you received: 8
-
Karma: -42
-
|
In fairness, that would work for the example I gave, but there are a number of other pages with varying information that is retrieved from API calls and is used on the pages that my component has, but updates a number of other databases in other systems, not the table for my component.
I'm sure I'll figure something out, I just hoped there was a sweet spot where everything on the page is available. My "prime directive" is to do everything the right way for Joomla, MVC, and Cook.
|
|
-
JoomGuy
-
-
Offline
-
Moderator
-
-
Joomla Enthusiast, Lover of Cooking
- Posts: 1115
- Thank you received: 195
-
Karma: 64
-
|
If the 'extra' data that you want is largely going to be user data (like password that you gave in the example) then I think that the user plugin (login and/or profile) will really be the best way.
If it is not limited to user data then, a series of plugins for other (and your own) component(s) would be the way to go... That way, no matter where you are in your component, you can trigger events, return data, update or whatever you want using the 3rd party or your own data models etc.
hope it helps,
Gez
|
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
|
-
admin
-
-
Offline
-
Administrator
-
-
Chef
- Posts: 3711
- Thank you received: 987
-
Karma: 140
-
|
To get your posted var anywhere in your component :
$password = $jinput->get('password', null, 'STRING');
($jinput must be initialized)
You can do that in your controller, when save() returns true.
|
Coding is now a piece of cake
The following user(s) said Thank You: gdpodesta
|
-
gdpodesta
-
-
Offline
-
Senior Member
-
- Posts: 75
- Thank you received: 8
-
Karma: -42
-
|
I think this is what i was looking for. I used "password" only as an example of data that was being captured on the form, sometimes user input, sometimes API results. In both cases, the data is not being saved in the record being edited, but is necessary at the time of that record update to do various kinds of external updates (DB & API).
|
|
-
admin
-
-
Offline
-
Administrator
-
-
Chef
- Posts: 3711
- Thank you received: 987
-
Karma: 140
-
|
With JInput, you can capturate anything you want coming fro GET or POST, and when you want during the process.
|
Coding is now a piece of cake
The following user(s) said Thank You: gdpodesta
|
|