• Skip to primary navigation
  • Skip to main content

RocketGeek

Home of WP-Members, The Original WordPress Membership Plugin

  • WordPress Plugins
    • WP-Members
      • FAQs
      • Quick Start
      • Documentation
      • Extensions
    • Advanced Options
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Download Protect
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Invite Codes
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • MailChimp Integration
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • PayPal Subscriptions
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Salesforce Web-to-Lead
    • Security
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Text Editor
      • Purchase the Plugin
      • Get the Pro Bundle
    • User List
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • User Tracking
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Memberships for WooCommerce
    • WordPass
  • Blog
    • Basics
    • Tips and Tricks
    • Filters
    • Actions
    • Code Snippets
    • Shortcodes
    • Design
    • Release Announcements
  • Store
    • Cart
    • Checkout
  • Contact
  • Log In
  • Show Search
Hide Search
Home » Search for "short code"

Search Results for: short code

wpmem_email_filter

Description

Filters the email and some of the email settings.

Parameters

$email
(array) (required) An array of information for the email process:

  • subj – the email subject
  • body – the email body/content
  • tag- what email is being sent (newreg|newmod|appmod|repass|getuser)
  • toggle – deprecated in 3.2 – use tag instead
  • user_id – the user’s ID
  • user_login – the user’s username
  • user_email – the user’s email address
  • blogname – the name of the blog (get_option ( ‘blogname’ ))
  • exp_type – the user’s subscription type (PayPal Extension Only)
  • exp_date – the user’s expiration date (PayPal Extension Only)
  • wpmem_msurl – the URL of the User Profile shortcode page, if set
  • reg_link – the URL of the page the user registered on
  • do_shortcodes – true|false boolean to enable the WP-Members email shortcodes (default: true)
  • add_footer – true|false boolean to enable adding the footer to the email (default: true)
  • footer – the default footer (3.1 and higher only)
  • disable – true|false boolean to disable sending the email (default: false)
  • headers – the email headers

$wpmem_fields
(array) (optional) The WP-Members fields array.

$field_data
(array)(optional) An array of the registration data.

Usage

This example runs a filter that will output the contents of the $arr, $wpmem_fields, and $fields_data arrays and send them to you in the new registration email. This is just an example to show you what data is available in the filter.

/**
 * While this may seem a little complex as an example, it
 * is intended to give you an idea of the values that are
 * passed to this filter.  Since some of the data pieces
 * are dependent on the custom fields you have created
 * in your installation, the values may differ from
 * site to site based on your settings.
 *
 * What this example does is take the three arrays that come
 * through the filter (one required, two optional), puts the 
 * data in those arrays into a readable format, and replaces
 * the default email body with the values in these arrays.
 *
 * If you test register with this filter in place, you should
 * receive an email containing the values in these arrays
 * when you completed the registration - that will give you an
 * idea of what data is available to you to be used in
 * your own filter functions.
 */
add_filter( 'wpmem_email_filter', 'my_email_filter', 10, 3 );
function my_email_filter( $email, $wpmem_fields, $field_data ){

    /*
     * Use some of the settings in $email to turn off some
     * things we don't need for this:
     * * do_shortcodes = false (otherwise when display the
     *   keys for the last array, the key values would be
     *   parsed by the shortcode parser.
     * * add_footer = false (we don't need it for the 
     *   example; besides, this is a good example of
     *   toggleing one of the settings.
     */
    $email['do_shortcodes'] = false;
    $email['add_footer']    = false;

    // Give our email a new subject.
    $email['subj'] = 'Test Registration Email (arrays)';
    
    // Start with an empty variable for our new body content.
    $body = '';
    
    /*
     * This parses through the main $arr array and puts the contents
     * into a format for reading in the resulting email.
     */
    $body .= 'MAIN $arr CONTAINS THE FOLLOWING: ' . "\r\n\r\n";
    foreach ( $email as $key => $val ) {
        $body .= '[' . $key . '] => ' . $val . "\r\n";
    }
    
    /*
     * This parses through the contents of the $wpmem_fields array 
     * and adds this content to the email body. Each of the values
     * is also an array, so this loops though those as well.
     *
     * Note that this array is passed optionally to the filter. It
     * is only there to provide possible data you may want to have 
     * when filtering the main email array $arr.
     */
    $body .= "\r\n\r\n" 
        . 'WP-Members FIELDS $wpmem_fields CONTAINS THE FOLLOWING: ' 
        . "\r\n\r\n";
    foreach ( $wpmem_fields as $key => $val ) {
        $body .= '[' . $key . '] => array(' . "\r\n";
        foreach ( $val as $sub_key => $sub_val ) {
            $body .= "\t" . '[' . $sub_key . '] => ' . $sub_val . "\r\n";
        }
        $body .= ')' . "\r\n";
    }
    
    /*
     * This parses through the contents of the $field_data array 
     * and adds it to the new email body in a readable way.
     *
     * Note that this array is passed optionally to the filter. It
     * is only there to provide possible data you may want to have 
     * when filtering the main email array $arr.  This example tests
     * to see if this a new registration email and only adds this
     * if it is.
     */
    if ( 'newreg' == $email['tag'] ) {
        $body .= "\r\n\r\n" 
            . 'FIELD DATA ARRAY $field_data CONTAINS THE FOLLOWING: ' 
            . "\r\n\r\n";
        foreach ( $field_data as $key => $val ) {
            $body.= '[' . $key . '] => ' . $val . "\r\n";
        }
    }
    
    // Make the body of the email our new body that we just built out of all the arrays.
    $email['body'] = $body;
    

    // Return our filtered results.
    return $email;
}

This example disables any specified emails (by tag):

/**
 * This example allows you to disable any of the WP-Members
 * emails to users (for admin emails, use wpmem_notify_filter).
 * Just update the settings array according to the emails you 
 * want to disable.
 */
 add_filter( 'wpmem_email_filter', function( $email, $wpmem_fields, $field_data ) {
    
    // Set what emails will be disabled. Example array includes
    // all possibilities, remove unnecessary tags.
    $settings = array(
        'newreg',    // new registration (non-moderated)
        'newmod',    // new registration (moderated)
        'appmod',    // user approved (moderated)
        'repass',    // password reset
        'getuser',   // forgot username
    );
    
    // Check which email is being sent ($arr['tag']). If it is in
    // the $settings array, disable it.
    if ( in_array( $email['tag'], $settings ) ) {
        $email['disable'] = true;
    }
    
    return $email;
 
 }, 10, 3 );

Changelog

Introduced in version 2.9.7

toggle replaced with tag in 3.2.0

Source

wpmem_email_filter is located in includes/class-wp-members-email.php.

Set user forum access when using bbPress with the PayPal subscription extension

Chad Butler · Nov 2, 2014 ·

When using WP-Members with bbPress and the WP-Members PayPal subscription extension, there are some additional considerations for your setup to integrate these plugins smoothly and restrict forum access for paid users who have a valid expiration date.  

Continue Reading →

Add front end field sorting to the User List

Chad Butler · Nov 1, 2014 ·

This set of code snippets will add a list of sorting links to the top of the User List, a link for each of the fields displayed in the main list. 

Continue Reading →

WP-Members Documentation

Getting Started

Recommended WordPress Settings

Plugin Settings

  • Options

  • Fields

  • Dialogs

  • Emails

Managing Content

  • Restricting Posts

  • Restricting Pages

  • Show Excerpts

Managing Users

Registration

  • Choosing Fields

  • Create a Registration Page

  • Moderating Registration

  • Using CAPTCHA

  • Turn Off Registration

User Profile Area

  • Creating a User Profile Area

  • User Profile Location

Customizing Emails

  • Set a Custom Email Address

  • Custom Email Content

  • Email Shortcodes

Customizing Forms

Shortcodes

  • Page

  • Login Status

  • Fields

  • Email

  • Other

Filter and Action Hooks

FAQs

wpmem_ul_settings_args

Description

This filter allows you to pass arguments to the User List to override default values set in the admin or passed through the shortcode. The wpmem_list_users function uses the wp_parse_args function to merge arguments passed through this filter with the following defaults:

$defaults = shortcode_atts( array(
    'display_style'=> 'list',       // list|table
    'role'         => 'subsriber',  // role to filter by
    'active_only'  => true,
    'verified_only' => true,
    'exclude'      => '',           // comma separated string of user ids
    'number'       => 10,           // number to display per page
    'search'       => true,         // is search enabled, "true"
    'search_by'    => '',           // comma separated string of meta keys
    'fields'       => 'user_login,member_since',
    'local_avatar' => false,        // whether to use a local avatar or gravatar
    'avatar'       => 45,           // size of the avatar in pixels
    'h2'           => 'first_last', // 
    'order_by'     => 'user_login',
    'order_meta'   => '',
    'order'        => 'ASC',
    'show_titles'  => false,
    'show_empty'   => true,
    'filter_key'   => '',
    'filter_value' => '',
    'fe_user_edit' => false,
), $atts, $tag );

Parameters

$args
(array) (required) An array of arguments that are to override form $defaults.

Changelog

Introduced in extension version 1.4

Source

wpmem_ul_settings_args is located in wp-members-user-list.php

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 34
  • Page 35
  • Page 36
  • Page 37
  • Page 38
  • Interim pages omitted …
  • Page 52
  • Go to Next Page »

Ready to get started?

Join Today!

© 2025 · butlerblog.com · RocketGeek is built using WordPress, WP-Members, and the Genesis Framework

  • butlerblog.com
  • WP-Members Support Subscription
  • Terms of Service
  • Privacy Policy
  • Refund Policy