• Resolved johanna75

    (@johanna75)


    I found this hook but it need a very small change to match my needs.
    When someone update a profile (user or admin) an email is send to admin BUT i need an email is send to user (not admin).
    Can anybody help on this?

    add_action( 'um_after_user_updated', 'my_after_user_updated', 10, 3 );
    function my_after_user_updated( $user_id, $args, $userinfo ) {
            um_fetch_user($user_id);
    	$groupMember = um_user('display_name');
            $groupMmbr_name = um_user('user_login');
    	$loggedIn_user = wp_get_current_user();
            $loggedIn_userEml =  $loggedIn_user->user_email;
            $headers = array('Content-Type: text/html; charset=UTF-8', 'Cc:hbaum@salisburypreschool.org', 'Bcc:webdev@somewebdevdomain.com', 'From:Some Profile Update <do_not_reply@somegroupsitedomain.com>', 'Reply-To:No-reply Email<do_not_reply@somegroupsitedomain.com>');
            wp_mail( 'groupManager@somegroupsitedomain.com', 'The '.$groupMember.'profile was updated.', 'The <b>'.$groupMember.'</b>profile was updated by the user with this email address: '.$loggedIn_userEml.'.  <a href="https://somegroupsitedomain.com/user/'.$groupMmbr_name.'/?profiletab=main&um_action=edit"><b>Click here</b></a> to visit this profile online.<br><br><i style="color:#767676; font-size:11px; text-align:center;"><b>NOTE:</b> you must be logged in first to see this profile.</i>',$headers);
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @johanna75

    Have you tried adding the $loggedIn_userEml to the first parameter of wp_mail($loggedIn_userEml, ….)?

    add_action( 'um_after_user_updated', 'my_after_user_updated', 10, 3 );
    function my_after_user_updated( $user_id, $args, $userinfo ) {
            um_fetch_user($user_id);
    	$groupMember = um_user('display_name');
            $groupMmbr_name = um_user('user_login');
    	$loggedIn_user = wp_get_current_user();
            $loggedIn_userEml =  $loggedIn_user->user_email;
            $headers = array('Content-Type: text/html; charset=UTF-8', 'Cc:hbaum@salisburypreschool.org', 'Bcc:webdev@somewebdevdomain.com', 'From:Some Profile Update <do_not_reply@somegroupsitedomain.com>', 'Reply-To:No-reply Email<do_not_reply@somegroupsitedomain.com>');
            wp_mail( $loggedIn_userEml, 'The '.$groupMember.'profile was updated.', 'The <b>'.$groupMember.'</b>profile was updated by the user with this email address: '.$loggedIn_userEml.'.  <a href="https://somegroupsitedomain.com/user/'.$groupMmbr_name.'/?profiletab=main&um_action=edit"><b>Click here</b></a> to visit this profile online.<br><br><i style="color:#767676; font-size:11px; text-align:center;"><b>NOTE:</b> you must be logged in first to see this profile.</i>',$headers);
    }

    Regards,

    Thread Starter johanna75

    (@johanna75)

    Thanks for help. I tested and i have somewhere an error on but unfortunatly i’m not a dev, and i just need in the mail the text “Your profil has been updated” :
    is_readable(): open_basedir restriction in effect. File(/dev/urandom) is not within the allowed path(s): (/var/www/sites/(mylink hiden).com/:/var/log/php-fpm/:/usr/lib/php/:/usr/share/pear:/tmp:/etc/hosteur/php_set_envs.php)

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @johanna75

    Could you please contact your hosting provider and see if they can update the PHP settings? Send them this link https://stackoverflow.com/a/25447785

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. 🙂

    Regards,

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Help on a hook for sending user email when admin update profile’ is closed to new replies.