• Resolved johnnyenglish14

    (@johnnyenglish14)


    Hi there,
    I’m trying to edit the message that gets sent by WP to the user when they register and need to click the activation link. I see in the link below that Forminator edits the link info in the email before it gets sent.
    https://docs.hookmax.com/plugin/forminator/1.16.2/class/Forminator_CForm_User_Signups/#

    I found a mu-plugin workaround to change the email but it’s only changing the subject and not the message content so I think it’s something in Forminator that is making it not work. I asked the guy who made it and he said it’s probably Forminator doing something. He did say something about the priorities for the hook but I got no idea.

    This is what I have for the code. Do you know how it can be fixed to make it work?
    I edited the activation link part to “?page=account_activation&key=$key” as that what comes in the email but nothing.
    Thanks.

    <?php
     /**
     * Plugin Name: Custom Activation Email
     * Description: Change what is sent for the email activation.
     */ 
    add_filter('wp_mail_from', 'new_mail_from');
    add_filter('wp_mail_from_name', 'new_mail_from_name');
    
    function new_mail_from($old) {
    return 'SENDER EMAIL';
    }
    function new_mail_from_name($old) {
    return 'SENDER NAME';
    }
    
    add_filter( 'wpmu_signup_user_notification_subject', 'my_activation_subject', 10, 4 );
    
    function my_activation_subject( $text ) {
    return 'Activate your account for SITE NAME';
    }
    
    add_filter('wpmu_signup_user_notification_email', 'my_custom_email_message', 10, 4);
    
    function my_custom_email_message($message, $user, $user_email, $key) {
    $message = sprintf(__(( "To activate your new account, please click the following link:\n\n%s\n\n After you activate you will be able to log in.\n\n" ),
    $user, $user_email, $key, $meta),site_url( "?page=account_activation&key=$key" ));
    return sprintf($message);
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @johnnyenglish14

    I hope you’re well today!

    This code uses core WordPress filters only. Please try snippet from this post instead:

    https://www.ads-software.com/support/topic/customize-user-activation-link-email-template-2/#post-16027657

    Best regards,
    Adam

    Thread Starter johnnyenglish14

    (@johnnyenglish14)

    Hi thanks for the reply.
    I had already come across that topic in my searches and it looks like to me it’s only dealing with the post activation email and not the actual email activation.
    I’m trying to edit the email message that gets sent out to verify the users email address before the account gets activated.
    As I mentioned, the code successfully changes the subject but not the message.
    In the link I provided I can see Forminator edits the key in some way. Does it need to utilize the same things it does in that linked php file?

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @johnnyenglish14,

    and it looks like to me it’s only dealing with the post activation email and not the actual email activation.

    I’m afraid, I’m a bit lost by what you meant by “post activation” email. Could you please share a screenshot regarding the exact email and its content that you are noticing that isn’t working so that we could have a better idea?

    The plugin also offers an option to disable the “Activation Email” are you referring to that?

    Screenshot:

    Screenshot at 19:45:29.png

    As I mentioned, the code successfully changes the subject but not the message.
    In the link I provided I can see Forminator edits the key in some way. Does it need to utilize the same things it does in that linked php file?

    The code what you have shared doesn’t seem to work on my test server when checked, so what we could suggest based on that is limited.

    If you could clarify which exactly email you notice on your side then we could check if there is any custom code that could be suggested based on that.

    Please advise if I’m missing out on anything. Looking forward to your response.

    Kind Regards,

    Nithin

    Thread Starter johnnyenglish14

    (@johnnyenglish14)

    I was talking about editing the email that comes with the link to activate the account if you set the registration to “email activation”. I was able to fix it though thanks to help from someone else. In that image you shared it was actually because I had that set to none that I wasn’t able to edit the message.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Edit the user activation email for registration’ is closed to new replies.