Automatic email when members permissions levels raised

My members don't get immediate access to my site, until they are verified and approved. I'd like to send an automatic email when members permissions levels are raised.

Can you tell me how to do this please?

Stephen O'Donnell

  • Ash

    Hello @stephen_o_donnell0

    You can try the following code:

    add_action( 'membership_move_level', 'membership_move_level_cb', 99, 3 );
    function membership_move_level_cb( $fromlevel_id, $tolevel_id, $user_id ){
        if( $tolevel_id == 302 ){
            $user_info = get_userdata( $user_id );
            $to = $user_info->user_email;
            $subject = 'EMAIL SUBJECT';
            $body = 'EMAIL BODY';
            wp_mail( $to, $subject, $body );
        }
    }

    You need to modify the higher level id, subject and email text.

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Note that, this will only work when you move to a level.

    Cheers
    Ash

  • Michael Bissett

    Hey @stephen_o_donnell0, just jumping in for Ash here. :slight_smile:

    I'd like to take this one step further, and set this up for you, could you please send in the following:

    - Mark to my attention, the subject line should contain only: ATTN: Michael Bissett
    - Do not include anything else in the subject line, doing so may delay our response due to how email filtering works.
    - Link back to this thread
    - Include WordPress admin access details
    - Include FTP log-in details
    - Include the name of the Membership level you're approving users to
    - Include any relevant URLs for your site

    On the contact form, select "I have a different question", this ensures it comes through and gets assigned to me.

    https://premium.wpmudev.org/contact/

    Thanks a bunch, hope you're having a great weekend! :slight_smile:

    Kind Regards,
    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.