plugins - Send Custom welcome email to specific user group

i want Send Custom welcome Email to specific user groupalso i build a real estate site , and i want when a new buyer reg

i want Send Custom welcome Email to specific user group

also i build a real estate site , and i want when a new buyer register to the buyer user group , also i want Custom email to be sent to him with some information ...

also i have already add this cod to the sb_welcome_email_editor but it don't work

// Change "from" email

 add_filter( 'wp_mail_from', 'new_mail_from_name' );

 function new_mail_from_name() {

 return '[email protected]';
 }

 // Change "from" name
 add_filter( 'wp_mail_from_name', 'new_mail_from' );

 function new_mail_from() {

 return 'Your site';
 }

can you help on this please ?

i want Send Custom welcome Email to specific user group

also i build a real estate site , and i want when a new buyer register to the buyer user group , also i want Custom email to be sent to him with some information ...

also i have already add this cod to the sb_welcome_email_editor but it don't work

// Change "from" email

 add_filter( 'wp_mail_from', 'new_mail_from_name' );

 function new_mail_from_name() {

 return '[email protected]';
 }

 // Change "from" name
 add_filter( 'wp_mail_from_name', 'new_mail_from' );

 function new_mail_from() {

 return 'Your site';
 }

can you help on this please ?

Share Improve this question edited May 21, 2020 at 9:05 fuxia 107k38 gold badges255 silver badges459 bronze badges asked May 21, 2020 at 3:44 Safrout lahmarSafrout lahmar 111 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

You have your functions mixed up - the new_mail_from is for the address, not the name, and the new_mail_from_name is for the name, not the address.

Also, WordPress changed the tests for users/groups from the old Roles to the new Capabilities so assuming your "buyer" user group has some specific Capability you can target then you could do something like this:

    // Change default WordPress email address for Buyers
    if(current_user_can( 'something_only_buyers_can_do' ) {
       function new_mail_from($old) {
       return '[email protected]';
     }
       function new_mail_from_name($old) {
       return 'Your Site';
     }
    add_filter('wp_mail_from', 'new_mail_from');
    add_filter('wp_mail_from_name', 'new_mail_from_name');

    }

You could still try using the old Roles but no telling how long that will work, using Capabilities is more future-proof.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742399923a4436706.html

相关推荐

  • plugins - Send Custom welcome email to specific user group

    i want Send Custom welcome Email to specific user groupalso i build a real estate site , and i want when a new buyer reg

    1天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信