Is there a way to not have a redirect link when PRO accounts are being made?

Top WooCommerce & WordPress Plugins Forums Email Verification for WooCommerce Is there a way to not have a redirect link when PRO accounts are being made?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #101564
    Gabriel Garriga
    Participant

    Hello

    We have a PRO account (B2B) on our website that requires manual approval. When the PRO registration goes through the “Activate your account” email re-direct link “click here” allows them to log-in into their account even though it has not been manually approve by our staff. Is there a way to not have this re-direct link when PRO accounts are being made? Maybe a different email from Standard accounts?

    Thanks!

    #101565
    blankMoshtafizur
    Moderator
    Plugin Support

    Hello Gabriel,

    Thank you for reaching out to us.

    You may navigate to WooCommerce > Settings > Email Verification > General and disable the Login on activation option. This would prevent all of your users from automatically logging in after the account is verified. But you can’t send different activation emails depending on the account type and prevent a user from logging in once they’ve registered and verified¬†the account. However, I have forwarded your idea to our development team. They will check the viability of this and get back to you as soon as they can.

    Please let me know if you have any other questions.

    #101566
    blankPablo
    Moderator
    Plugin Support

    Hi Gabriel,

    I believe you can get what you want by using some of our filters. Considering the pro-account is a user role, you could try to add this to your functions.php:

    add_action( 'alg_wc_ev_email_content_final', 'alg_wc_ev_my_custom_activation_email', 9, 2 );
    add_action( 'alg_wc_ev_email_subject_final', 'alg_wc_ev_my_custom_activation_email', 9, 2 );
    add_action( 'alg_wc_ev_email_content_heading', 'alg_wc_ev_my_custom_activation_email', 12, 2 );
    function alg_wc_ev_my_custom_activation_email( $email_content, $args ) {
       if (
          'activation_email_separate' !== $args['context'] ||
          empty( $user_id = $args['user_id'] ) ||
          ! is_a( $user = get_user_by( 'ID', $user_id ), 'WP_User' ) ||
          ! in_array( 'pro-account', $user->roles )
       ) {
          return $email_content;
       }
       // Email Content.
       $email_content = 'Custom email CONTENT, including some placeholder present on the Email Settings page, like %user_display_name%.';
       if ( 'alg_wc_ev_email_subject_final' === current_filter() ) {
          // Email Subject.
          $email_content = 'Custom SUBJECT';
       } elseif ( 'alg_wc_ev_email_content_heading' === current_filter() ) {
          // Email Heading.
          $email_content = 'Custom HEADING';
       }
       // Placeholders.
       $placeholders  = array_merge( $args['placeholders'], alg_wc_ev_get_user_placeholders( array( 'user_id' => $user_id ) ) );
       $email_content = str_replace( array_keys( $placeholders ), $placeholders, $email_content );
       return $email_content;
    }

    Let me know if you need more help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.