awesomemotive / easy-digital-downloads

Sell digital downloads through WordPress
https://easydigitaldownloads.com
GNU General Public License v2.0
862 stars 475 forks source link

Pass $data in "edd_process_register_form" hook #5383

Open turtlepod opened 7 years ago

turtlepod commented 7 years ago

In "edd_process_register_form" and "edd_pre_process_register_form" it's best to add the $data var in the hook, so it will be more useful. https://github.com/easydigitaldownloads/easy-digital-downloads/blob/master/includes/login-register.php#L146 https://github.com/easydigitaldownloads/easy-digital-downloads/blob/master/includes/login-register.php#L180

example code:

do_action( 'edd_pre_process_register_form', $data );
do_action( 'edd_process_register_form', $data );
pippinsplugins commented 7 years ago

$data is the same as $_POST here.

turtlepod commented 7 years ago

Yes. I'm aware of that.

hmm. I think probably better remove the $_POST in that function and simply use $data (merge them). and than make it filterable (at the top) so we can manipulate the $data based on other submitted data, etc. (just an idea)

cklosowski commented 7 years ago

I'm not sure that allowing altering that $data is a completely safe choice. I don't mind making a comment that states that $_POST is the same as data, so that developers who hook this area know to use $_POST but I think allowing filter the data is a risk that developers could then alter or corrupt the data structure we're expecting in $data and since this is the user's login, email, and password, could lead to the possible alteration of the customer's chosen login details, which would make for a poor user experience (by accident, more than likely).