I am about to use the Change User Action to automatically change the user group of a given user if he clicks a button (in a mini form). I looked at the action properties, and on tab1 I see the username, pw, email, etc. And on tab2 I see the user group and a selection to "update self" and to "enable old password".
Before I go on a lengthy trial and error trip, can you tell me whether I can just leave tab1 fields empty, select a new user group on tab2 and set "update self" and "enable old password"? Or will I have to read the current user and pull all values into all fields? And if the latter, how do I do it?
;-)
Thanks much for your help.
Before I go on a lengthy trial and error trip, can you tell me whether I can just leave tab1 fields empty, select a new user group on tab2 and set "update self" and "enable old password"? Or will I have to read the current user and pull all values into all fields? And if the latter, how do I do it?
;-)
Thanks much for your help.
Hi iko,
I've never used the Joomla! User Create/Update action so probably don't know much more than you do. Looking at the Help tab and the code I think that: (a) you can ignore all the fields that you don't need updated; (b) It will get the User Object for the current User so you don't need to pre-load that data; and (c) the 'Enable Old Password' option is a security check that requires the user to enter their password before their details can be updated.
Hope that helps
Bob
I've never used the Joomla! User Create/Update action so probably don't know much more than you do. Looking at the Help tab and the code I think that: (a) you can ignore all the fields that you don't need updated; (b) It will get the User Object for the current User so you don't need to pre-load that data; and (c) the 'Enable Old Password' option is a security check that requires the user to enter their password before their details can be updated.
Hope that helps
Bob
Unfortunately, no luck.
I tried changing the user group by setting a new one in SETTINGS, and I selected Update SELF. I tried both Enable Old Password YES and NO. I left all other fields and options empty. The action fails.
Can we get MAX to explain the usage in a little more detail?
Me stuck.
;-)
I tried changing the user group by setting a new one in SETTINGS, and I selected Update SELF. I tried both Enable Old Password YES and NO. I left all other fields and options empty. The action fails.
Can we get MAX to explain the usage in a little more detail?
Me stuck.
;-)
So I checked the code for this action and it seems that it requires name, email, username no matter whether you want to update self or not. The code that distinguishes between Create and Update happens only thereafter...
I don't see why you would need these if you are logged in and want to change your own info? I think it should be fixed ;-)
I can change the code, but I would prefer if I could stay in sync with your published version for future updates etc.
Thanks
I don't see why you would need these if you are logged in and want to change your own info? I think it should be fixed ;-)
I can change the code, but I would prefer if I could stay in sync with your published version for future updates etc.
Thanks
//check empty fields
$checks = array('name', 'username', 'email');
foreach($checks as $check){
if(!trim($form->data[$check])){
$this->events['fail'] = 1;
$form->validation_errors[$params->get($check)] = 'You must provide your '.$check.'.';
//return false;
}
}
if($this->events['fail'] == 1){
return false;
}
//case create/update
if($params->get('function', 0) == 0){
So I ended up changing the code and it works nicely, however it would be better to put my stuff into another action. Any guidance on how to write new actions and make them available in the admin backend?
Hi Iko,
I'm still learning about actions so hard to write a full manual (even if I had the time). I usually pick one similar (or very simple) action and modify it to do what I want - easy to say and harder to do.
The most important thing to do is to change **every** instance of the action name to be consistent with your new action name - and some of these are tucked away.
If you look at one of my more recent ones (the Mollie action is the latest but isn't free) you'll see that I have modified the underlying code to make some of the updating simpler - for example defining the action name in a variable. The Mollie action is also multi-language enabled and uses included files quite a lot.
The action_name.ctf file defines the admin display
The action_name.php file defines the action functionality
The cfaction_action_name.php file - I think this optional file defines the action functionality when the Show HTML action runs (but I'm still not certain).
The cfaction_action_name.ctp file - is a helper file needed if you have a cfaction_action_name.php file in the action.
Bob
I'm still learning about actions so hard to write a full manual (even if I had the time). I usually pick one similar (or very simple) action and modify it to do what I want - easy to say and harder to do.
The most important thing to do is to change **every** instance of the action name to be consistent with your new action name - and some of these are tucked away.
If you look at one of my more recent ones (the Mollie action is the latest but isn't free) you'll see that I have modified the underlying code to make some of the updating simpler - for example defining the action name in a variable. The Mollie action is also multi-language enabled and uses included files quite a lot.
The action_name.ctf file defines the admin display
The action_name.php file defines the action functionality
The cfaction_action_name.php file - I think this optional file defines the action functionality when the Show HTML action runs (but I'm still not certain).
The cfaction_action_name.ctp file - is a helper file needed if you have a cfaction_action_name.php file in the action.
Bob
Hi guys,
Yes, just like the "update details" page in Joomla, you have all the fields so you can update all your details, is this wrong ? 🙂
Please remember that you can override the fields values after the form is submitted using a custom code action:
Regards,
Max
it seems that it requires name, email, username no matter whether you want to update self or notYes, just like the "update details" page in Joomla, you have all the fields so you can update all your details, is this wrong ? 🙂
Please remember that you can override the fields values after the form is submitted using a custom code action:
<?php
$form->data['field_name'] = 'any value here';
?>
Regards,
Max
This topic is locked and no more replies can be posted.
