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

  1. widecast
    Posted 2 years 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!


  2. Chad Butler
    Plugin Author

    Posted 2 years ago #

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

  3. widecast
    Posted 2 years 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?


  4. Chad Butler
    Plugin Author

    Posted 2 years 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
    Posted 2 years 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: Membership Framework
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.