Hey @nigelrs,
Thank you for reaching out! Yep, the way it currently works is somewhat unintuitive. We have some plans to refactor this part of the plugin to make it more user friendly. However, at this time I can’t say exactly when these changes will happen.
In the meantime, I recommend you to add the following code to your website:
function slicewp_custom_user_action_register_affiliate_new_message() {
// Verify for nonce.
if ( empty( $_POST['slicewp_token'] ) || ! wp_verify_nonce( $_POST['slicewp_token'], 'slicewp_register_affiliate' ) ) {
return;
}
if ( is_user_logged_in() ) {
return;
}
$notice = '<p>This account already exists. Please firstly log into your account and then return to complete the registration.</p>';
if ( ! empty( $_POST['user_login'] ) && username_exists( $_POST['user_login'] ) ) {
slicewp_user_notices()->register_notice( 'user_login_exists_error', $notice, 'error' );
}
if ( email_exists( $_POST['user_email'] ) ) {
slicewp_user_notices()->register_notice( 'user_email_exists_error', $notice, 'error' );
}
}
add_action( 'slicewp_user_action_register_affiliate', 'slicewp_custom_user_action_register_affiliate_new_message', 60 );
Please copy the code and add it to your website. If you’re not sure how to add code snippets to your site, you can use the Code Snippets plugin (https://ww.wp.xz.cn/plugins/code-snippets/).
The code will modify the default error message with a custom one. Please make sure to change the “This account already exists. Please firstly log into your account and then return to complete the registration.” text from the code to whatever you’d like to appear as the error.
Please try it out and let me know how it goes.
Thank you and best wishes,
Mihai
Thank you, I have used code snippets, it is giving me this warning:
Don’t Panic
The code snippet you are trying to save produced a fatal error on line 5:
syntax error, unexpected token “return”
The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.
Line 5 is just the ‘return;’ in the code line below:
if ( empty( $_POST[‘slicewp_token’] ) || ! wp_verify_nonce( $_POST[‘slicewp_token’], ‘slicewp_register_affiliate’ ) ) {
return;
Hey @nigelrs,
Can you please try again by copying the code from this Github gist: https://gist.githubusercontent.com/IovaMihai/c92704db2eff9a3eb115a447ed1bfa1c/raw/09f2c8a64b23393117c6974a79738c7530281e54/slicewp_custom_user_action_register_affiliate_new_message
I’m not sure why it’s throwing this error on your end. I’ve just retried the snippet on my end and it’s working nicely.
Thank you and best wishes,
Mihai
Thanks, this is working now and I have amended the text. Looking forward to road testing this out and seeing the best methods to recruit affiliates.
Hey @nigelrs,
Awesome! I’m happy to hear that it’s working now. If you face any other obstacles, just open a new support topic and I’ll get back to you as soon as possible.
Thank you and best wishes,
Mihai