Skip to content

New Plugin Events onUserBeforeDataValidation#10351

Closed
rdeutz wants to merge 1 commit intojoomla:stagingfrom
rdeutz:add_user_plugin_event
Closed

New Plugin Events onUserBeforeDataValidation#10351
rdeutz wants to merge 1 commit intojoomla:stagingfrom
rdeutz:add_user_plugin_event

Conversation

@rdeutz
Copy link
Copy Markdown
Contributor

@rdeutz rdeutz commented May 9, 2016

Summary of Changes

The new event allows to hock into the validation of the user data, it allows user plugins to change request data and e.g. an easy way of implement something like registerWithEmail.

Can be merged on review

The new event allows to hock into the validation of the user data, it allows user plugins to change request data and e.g. an easy way of implement something like registerWithEmail.
@wilsonge
Copy link
Copy Markdown
Contributor

wilsonge commented May 9, 2016

I strongly disagree with this. We have an API for this stuff https://docs.joomla.org/Server-side_form_validation with JFormFieldRule - this PR is encouraging bad practice. At validation of data you should NEVER be modifying the form definition OR the data itself - it should be done in the existing plugin event onContentPrepareForm.

@wilsonge wilsonge closed this May 9, 2016
@rdeutz
Copy link
Copy Markdown
Contributor Author

rdeutz commented May 9, 2016

This hasn't to do with validation it allows manipulation and this is need when you try to implement something like this #10347

@rdeutz rdeutz reopened this May 9, 2016
@wilsonge
Copy link
Copy Markdown
Contributor

wilsonge commented May 9, 2016

I have seen that plugin and in there you are not using onUserAfterDataValidation and as far as I can tell the code in onUserBeforeDataValidation could be moved into onContentPrepareForm without affecting anything

@rdeutz
Copy link
Copy Markdown
Contributor Author

rdeutz commented May 9, 2016

We can remove the onUserAfterDataValidation I only though it might be good to have a change to get the validation result and maybe to access some of the error messages. For the other event you can move it but then it will not work because the validation works on the requestdata see https://github.com/joomla/joomla-cms/blob/staging/components/com_users/controllers/registration.php#L137

and you can't manipulate this in onContentPrepareForm, here you get plain nothing beside the default group mapping

@rdeutz
Copy link
Copy Markdown
Contributor Author

rdeutz commented May 12, 2016

@pe7er Peter if you have a chance can you take a look here if this addition would allow you to write the plugin you tried to write, thanks.

@pe7er
Copy link
Copy Markdown
Contributor

pe7er commented May 12, 2016

@rdeutz Ok, I will do so when I can make some time (which is not before JAB16)

@wilsonge wilsonge mentioned this pull request Jun 7, 2016
@wilsonge
Copy link
Copy Markdown
Contributor

wilsonge commented Jun 7, 2016

See #10751

@wilsonge wilsonge closed this Jun 7, 2016
@wilsonge wilsonge mentioned this pull request Jan 18, 2017
@rdeutz rdeutz deleted the add_user_plugin_event branch February 20, 2020 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants