Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

[Resolved] Send out email automatically when status changes

Simple Membership Plugin › Forums › Simple Membership Plugin › Send out email automatically when status changes

  • This topic has 8 replies, 3 voices, and was last updated 1 year, 3 months ago by saschapi.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • February 26, 2025 at 10:13 am #29788
    saschapi
    Participant

    Is there a filter or action I can hook into to send out an email automatically if an admin switches the status for a member let’s say from “pending” to “active”? I know that I could train my admins to use the checkbox and send out manually, but it would save a lot of trouble (and forgotten emails) if that would be possible automatically?

    Thanks in advance for any hint into this direction. 🙂

    Cheers Sascha

    February 26, 2025 at 11:34 pm #29790
    The Assurer
    Moderator

    Are you trying to do this???
    https://simple-membership-plugin.com/manually-approve-members-membership-site/

    February 27, 2025 at 7:40 am #29792
    saschapi
    Participant

    Thanks for your reply.

    Not exactly. In fact I am trying to have both email verification AND manual approval. For our region and the specific task at hand it is a must by some regulation. I got it to work just fine by filtering the status after email approval.

    Everything works as it should, I would just love to have an automatic email send out when the account goes to active. Everything else is already working as it should.

    March 1, 2025 at 6:03 pm #29800
    The Assurer
    Moderator

    I believe this is an Either/Or but not both situation, but I will touch base with the developer.

    March 3, 2025 at 1:32 am #29803
    The Assurer
    Moderator

    Per the developer, it’s an Either/Or but Not both (Exclusive OR) situation. This is made clear in the “yellow box” of the documentation I provided a link to.

    March 3, 2025 at 8:41 am #29805
    saschapi
    Participant

    Hi again. Thank you for your answer. I understand that.

    That’s why I asked this specific question. So it is NOT possible to send out mail automatically when the account status changes? The answer you gave per the developer tackles the use case, but not my original question if there are any hooks that can be used to send out mails if the account status changes.

    March 4, 2025 at 2:58 am #29807
    The Assurer
    Moderator

    my original question if there are any hooks that can be used to send out mails if the account status changes.

    No.

    SWPM is Open Source code. You are more than welcome to hire someone to add the functionality that you require, or you can use our Paid Support service:
    https://simple-membership-plugin.com/paid-support-simple-membership-plugin/

    March 4, 2025 at 5:05 am #29813
    admin
    Keymaster

    Hi, If all you need just a hook, we can add a hook.

    We are generally very receptive to incorporating new action or filter hooks into our plugins. If you have specific suggestions, please feel free to indicate the exact file and line number where you believe a hook would be beneficial. Alternatively, you are welcome to submit a pull request with your proposed hook to our plugin’s GitHub repository.

    March 5, 2025 at 9:33 am #29818
    saschapi
    Participant

    @all I found the hook that I need in the code. It is already there. 🙂

    For anybody else that is looking for something like this. I implemented the following action in a plugin to send out an email automatically if the status from a member switches from “pending” to “active”. It uses the subject and body text from the bulk status update emails.

    // Add Action Hook to Account status change
    add_action('swpm_admin_account_status_updated','send_email_at_status_change', 10, 1 );
    function send_email_at_status_change($info_array) {
    	
    			$member_id = $info_array['member_id'];
    			$from_status = $info_array['from_status'];
    			$to_status = $info_array['to_status'];
    	
    			if($from_status == 'pending' && $to_status == 'active') {
    				
    				$settings = SwpmSettings::get_instance();
    
    				$to_email = SwpmMemberUtils::get_member_field_by_id($member_id,'email');
    				
    				$subject = $settings->get_value( 'bulk-activate-notify-mail-subject' );
    				if ( empty( $subject ) ) {
    								$subject = 'Account Activated!';
    				}
    				$body = $settings->get_value( 'bulk-activate-notify-mail-body' );
    				if ( empty( $body ) ) {
    								$body = 'Hi, Your account has been activated successfully!';
    				}
    
    				$from_address = $settings->get_value( 'email-from' );
    				$headers = 'From: ' . $from_address . "\r\n";
    
    				//Send the activation email one by one to all the selected members.
    				$subject = apply_filters( 'swpm_email_bulk_set_status_subject', $subject );
    				$body = apply_filters( 'swpm_email_bulk_set_status_body', $body ).' ID/from/to: ';
    				$to_email = trim($to_email);
    				SwpmMiscUtils::mail( $to_email, $subject, $body, $headers );
    				SwpmLog::log_simple_debug( 'Bulk activation email notification sent. Activation email sent to the following email: ' . $to_email, true );
    				
    			}
                            
    }
  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy