Editing the EDD-Auto-Register plugin
-
Hi,
I’m trying to edit the plugin edd-auto-register.php in order to restrict its action to only one product (the one with ID 80). I checked with EDD and there is no filter that would allow it at this time.
So, I’m trying to edit the plugin PHP but I’m having a hard time just finding how to make this work. Maybe there is a syntax error that I’m missing or it is because how the way EDD plugins are updated or cached. Please, could you help me with this?
Here is what I’ve done:
1) Plugin was installed and working well (v1.3.13). Disable the plugin.
2) Edit the file edd-auto-register.php by adding these 5 lines changes:
(adding from line 380)
public function create_user( $payment_data = array(), $payment_id = 0 ) { // First line added - Return false if product is excluded $download_id = $my_download->get_ID(); if ( $download_id <> 80 ) { return false; } // User account already associated
… remaining code without changes
3) Activate the plugin and flush the server cache.
4) Make sure the email address used to test the transaction is not user (delete user from previous test).
5) Make the transaction that should register the user buying the product id 80.
Then the payment form returns the message
“Unable to complete your request. Please try again.”
To be able to complete a transaction, I have to:
1) Desactivate the plugin.
2) Revert the changes (remove the 5 lines above).
3) Activate the plugin.
4) Complete the transaction.Then, the user is added, email sent, etc.
Do you see a PHP syntax error? Or an error in my procedure? Any help appreciated.
Thanks,
Jean
- The topic ‘Editing the EDD-Auto-Register plugin’ is closed to new replies.