WordPress.org

Forums

WP-Members
[resolved] Filtering Emails with "wpmem_email_newreg" (5 posts)

  1. widecast
    Member
    Posted 1 year ago #

    Hi there,

    Awesome plugin. I love that there are so many hooks and filters. I'm having a problem with filtering emails.

    I'm trying to add an image to the top of the emails like so:

    //wp-members customize emails
    function my_email_filter( $email_content )
    {
    	// the content of the email comes to
    	// the filter in the parameter $email_content
    
    	// you can do whatever you want to it here:
    	// add to it:
    
    	$email_content = '<img src="http://www.mywebsite.com/logo.png">'
    		. $email_content;
    
    	// or you could use something like php's
    	// str_replace to filter the string and
    	// add/remove content, etc.
    
    	// whatever you do, you need to return
    	// the filtered result:
    
    	return $email_content;
    }
    add_filter( 'wpmem_email_newreg', 'my_email_filter' );

    However the registration emails aren't being modified. I'm running the latest version of WP-Members.

    Any ideas what might be going wrong?

    Thank you!

    http://wordpress.org/plugins/wp-members/

  2. Chad Butler
    Member
    Plugin Author

    Posted 1 year ago #

    wp_mail by default sends emails as plain text. You can't add an image unless the email format is HTML.

  3. widecast
    Member
    Posted 1 year ago #

    Hey Chad,

    Thanks for the info. I didn't know that.

    I'm still having the same problem even when I replace the image with arbitrary text. Not getting appended.

    Any other possible reasons for this that I should explore?

    David

  4. Chad Butler
    Member
    Plugin Author

    Posted 1 year ago #

    Is it possible that you are using the wrong email filter? If you have registration moderation turned on, you would need to use the wpmem_email_newmod filter.

    There is a different filter hook for each of the different emails that the plugin would send. There is a list here under "Email".

  5. widecast
    Member
    Posted 1 year ago #

    That must be it! I do have registration moderation turned on.

    I overlooked the possibility that there was a different filter for the moderation emails. Thanks for the nudge in the right direction.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP-Members
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.