• Resolved smweblinks

    (@smweblinks)


    Hello

    I just added a filter affiliates_new_affiliate_registration_message to my functions.php file in child theme and nothing is changing. Any ideas?

    
    

    add_filter( ‘affiliates_new_affiliate_user_registration_message’, ‘example_user_registration_message’, 10, 2 );
    function example_user_registration_message( $message, $params ) {
    $message = ‘Write here whatever you prefer your user should read in the welcome email.’;
    $message .= ‘User info can be found in the params array, like user object, username, user_id’;

    return $message;
    }

    https://gist.github.com/geotsiokos/8656fe8a7efa379c88dc6bf8074ac12a

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    If you are still getting the default notification message then please try to change the filter call priority to 11 instead of 10 and give it another try with a new affiliate registration.

    In this case we obviously take for granted that your site is capable of sending emails in general, there are no errors generated when a new affiliate user registers and that the snippet is placed in functions.php of your active theme. I’m pretty sure that all of the above applies but mentioning them again in case you need to further review your setup.

    Kind regards,
    George

    Thread Starter smweblinks

    (@smweblinks)

    Hi,
    Thanks, I changed filter call priority to 11 instead of 10 then custom message is worked.
    Can you please help with code how can i send custom message with username, password and login url.

    Plugin Author Kento

    (@proaktion)

    Hi,

    As you can see here https://github.com/itthinx/affiliates/blob/master/lib/core/class-affiliates-registration.php#L882 the filter receives several values in its second parameter $params. You can use those as desired in the message. You should apply proper escaping to the values received.

    Based on the example given above:

    ...
    $message = sprintf(
        '<p>Howdy, thanks for joining!</p><p>Your username is %s and your password is: %s</p>' .
        '<p>You can log in <a href="%s">here</a>.</p>',
        esc_html( $params['username'] ),
        esc_html( $params['password'] ),
        esc_url( $params['site_login_url'] )
    );
    return $message
    ...
    Thread Starter smweblinks

    (@smweblinks)

    thank you so much it work

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding filter to customize the message’ is closed to new replies.