You can use these filters to modify the subject and message content of the notifications:
– affiliates_new_affiliate_registration_subject
– affiliates_new_affiliate_registration_message
The filters are documented here https://docs.itthinx.com/document/affiliates/api/filters/ – they essentially receive the notification subject/message and context parameters, to return the potentially modified subject/message.
Pls i am novice. Where exactly do i go to in order to insert that filter.
In …/plugins/affiliates/lib/core/class-affiliates-notifications.php file you will see this:
case self::DEFAULT_REGISTRATION_ACTIVE_MESSAGE :
$text = __(
'Username: [username]<br/>
Password: [password]<br/>
[site_login_url]<br/>
<br/>
Thanks for joining the Affiliate Program.<br/>',
'affiliates'
);
break;
Just change the [site_login_url] to the URL you want to use for login.
Plugin Author
Kento
(@proaktion)
Unless you plan to maintain a fork of https://github.com/itthinx/affiliates with your modifications, I would advise against modifying the plugin’s code directly and use the recommended filters instead. There are several reasons for that, one of them is that your modifications are overwritten when you next update the plugin. The filters provide a better and maintainable way to make sure that your customization persists through future updates.
You can return the customized message via the filter:
add_filter( 'affiliates_new_affiliate_user_registration_message', 'my_affiliates_new_affiliate_user_registration_message', 9, 2 );
function my_affiliates_new_affiliate_user_registration_message( $message, $params ) {
$message =
'Username: [username]<br/>
Password: [password]<br/>
https://example.com/your-site-login-url/<br/>
<br/>
Thanks for joining the Affiliate Program.<br/>';
return $message;
}
As to where you would add the filter, you could add it to your theme’s functions.php
– see the following sections of the WordPress documentation for more details:
https://developer.wordpress.org/plugins/hooks/actions/
https://developer.wordpress.org/plugins/hooks/filters/
-
This reply was modified 3 years, 1 month ago by Kento. Reason: updated the filter priority so it is executed before token substitution happens
-
This reply was modified 3 years, 1 month ago by Kento. Reason: filter correction
Ok. Thank you. I will inject ir to my theme function.php via code snippet plugin
@proaktion after injecting the filter Affiliate stop send new member notification upon registration. So i removed it back and move back to the method giving by @osisis and it worked again.
Plugin Author
Kento
(@proaktion)
As of version 4.10.0 these new filters are available:
- affiliates_updated_affiliate_status_params
- affiliates_new_affiliate_registration_params
- affiliates_new_affiliate_user_registration_params
They are documented on https://docs.itthinx.com/document/affiliates/api/filters/ and for this case, the site_login_url
is relevant. Implementing the filter allows to modify that appropriately.
add_filter( 'affiliates_new_affiliate_user_registration_params', 'my_affiliates_new_affiliate_user_registration_params' );
function my_affiliates_new_affiliate_user_registration_params( $params ) {
$params['site_login_url'] = 'https://example.com/my-login/';
return $params;
}