User tests: Successful: Unsuccessful:
To be able to override form field attribute by plugin, these lines must be moved in the preprocessForm
method.
I wanted to send a custom email to new users.
If I disable email sending in the joomla user plugin (with mail_to_user
), com_users sets required
attribute for password fields to true
. It is not what I wanted.
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
I have a user plugin which send a custom email when a user is created.
If I don't disable the field mail_to_user
in the joomla user plugin already existing, two emails will be sent (one with the joomla user plugin and one with my plugin).
But if I disable the field mail_to_user
, the password fields (in the user form) will be set to true with the actual code (in administrator/components/com_users/models/user.php in the getForm
method).
So I needed a way to change the 'required' attribute because I wanted to let the password fields required attribute to false (the password will be autogenerated and sent by email with my plugin).
So I move the code which set required attribute from the getForm
method to the preprocessForm
method because in the preprocessForm
parent method, the event onContentPrepareForm
is triggered and I can set the field attribute to what I want.
It can be also useful for developers who want to set other fields attributes to what they want in their own plugin
Category | ⇒ | Plugins |
If you don't like that the Joomla-User-Plugin sends an email just fork it, rename it, change what you need, install it, unpublish the distributed one. It is also not really a good idea to send passwords with email because this is an unsafe way for such information. (I know Joomla! does it but that doesn't make it better).
Again we still need proper testing instructions for this. Atm I am not in favor of a change here because this is an area a lot people made changes to let the registration work different, so I can't tell from code review what side effects this change will have. My gut feeling says there will be side effects.
I can't unpublish the joomla user plugin because if I do so, it generates an error. Indeed, this plugin is required in the User Model in the getForm
method ($plugin = JPluginHelper::getPlugin('user', 'joomla');
). You can try unpublishing the plugin and you'll see that you'll have an error in the user form.
Also, if I make changes in the joomla plugin, these will be overridden at the next update of Joomla.
To test, you can :
1. Install a user plugin with a onUserAfterSave
method (you can use the joomla user plugin method)
2. Set to No the 'Notification Mail to User' field in the joomla user plugin configuration
3. Go to the user form
You'll see that the password fields are required. And I don't want them required but you can't do in another way if the joomla user plugin is unpublished. But if you publish it, you can't do your own email template.
And I know that this is unsafe but I need to do this way.
Hi Max,
Sorry Max but this is not a bug.
So this is a question for the support or features of Joomla.
Because this is a really special question and not something that is not good in joomla or not working well.
http://forum.joomla.org/
I wish you all the best with this feature.
@brianteeman Can you close this request?
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-04-15 13:22:37 |
Closed_By | ⇒ | brianteeman |
If you like to have a chance to get this into Joomla! you need to explain better what you are trying to do. Why do you like to have registered users without a password? Doesn't makes sense to me. We also need instructions how to test this change.