• 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

Use jQuery to create a Log In/Log Out menu link

Chad Butler · Aug 3, 2017 ·

This article is provided free. Find out how you can get full access to premium content, including how-to articles and support forums, as well as priority email support and member exclusive plugin extensions..

 

This simple tutorial will help you create a Log In/Log Out menu link that will display a link to the login page when the user is not logged in and a link to log out when they are logged in.

This has now been incorporated into the plugin as a standard feature – all you need to do is add a login link to the menu and give it a custom class of “wpmem_loginout”. See documentation on this feature.  This tutorial remains primarily for informational and educational purposes OR if you’d simply like to customize the login/out menu item. 

Continue Reading →

WP-Members 3.1.9

Chad Butler · Jul 28, 2017 ·

This article is provided free. Find out how you can get full access to premium content, including how-to articles and support forums, as well as priority email support and member exclusive plugin extensions..

 

The WP-Members 3.1.9 release should clean up some loose ends before the next major update (where there will be some settings changes and some other feature changes).  There are not any major changes in 3.1.9 that would prevent rolling back to a previous version.

Here’s an overview of the changes in this release.  Continue Reading →

WP-Members 3.1.8

Chad Butler · May 31, 2017 ·

This article is provided free. Find out how you can get full access to premium content, including how-to articles and support forums, as well as priority email support and member exclusive plugin extensions..

 

WP-Members 3.1.8 is complete and is now available for upgrading.

Here is what’s in store for you in this new release:  Continue Reading →

wpmem_export_args

Description

Filters the default settings for WP-Members’ user export process.

Defaults:

$defaults = array( 
    'export'         => 'all', 
    'filename'       => 'wp-members-user-export-' . date( "Y-m-d" ) . '.csv', 
    'fields'         => $export_fields, // (from wpmem_export_fields fitler)
    'entity_decode'  => false,
    'date_format'    => 'Y-m-d', // Use PHP date format
    'required_caps'  => 'list_users', // WP capability required to export
    
    'export_fields'  => '', // Deprecated 3.4.0, use 'fields' instead.
    'exclude_fields' => '', // Deprecated 3.4.0, use the wpmem_export_fields filter hook instead.
);

Parameters

$args
(array) (required) An array of any defaults being changed.

$tag
(string) (optional) The export being performed, default value: “default“

Example

/**
 * This example sets the export function to decode HTML entities
 * in the export.
 */
 
add_filter( 'wpmem_export_args', 'my_export_args' );
 
function my_export_args( $args ) {
     
    $args['entity_decode'] = true;
 
    return $args;
}

Changelog

  • Introduced in version 2.9.7
  • 3.4.0 Filters all defaults, then uses wp_parse_args() to fill missing defaults
  • 3.4.0 Added $tag parameter
  • 3.4.0 Deprecated exclude_fields (unset using wpmem_export_fields instead)
  • 3.4.0 Deprecated export_fields, use fields instead

Source

wpmem_export_args is located in includes/class-wp-members-user-export.php

wpmem_fields

Description

This filter allows you to make changes to the fields settings array before the fields are passed to the form building functions.  This allows you to add/subtract fields from different forms and/or on different pages.

For example, you may wish to display fields on the user profile update that are not included in registration.  This function allows you to make those changes in one place so that you do not have to worry about filtering the fields out of the form and then also filtering them for processing.  Both are handled by this filter.

Parameters

$fields
(array) (required) The form fields settings array.

$tag
(string) (optional) Indicates the process for the form (register|profile|register_wp|profile_dashboard|profile_admin).

Examples

Remove default address/phone fields from the WP-Members registration form, but not the user profile update form:

/**
 * This example removes the WP-Members default address/phone fields
 * from the form if it is being displayed for registration, but
 * would leave them in for user profile update or any other 
 * process.
 */
add_filter( 'wpmem_fields', 'my_remove_reg_fields_filter', 10, 2 );
function my_remove_reg_fields_filter( $fields, $tag ) {
 
    if ( 'register' == $tag ) {
        unset( $fields['billing_address_1'] );
        unset( $fields['billing_address_2'] );
        unset( $fields['billing_city']      );
        unset( $fields['billing_state']     );
        unset( $fields['billing_postcode']  );
        unset( $fields['billing_country']   );
        unset( $fields['billing_phone']     );
    }
     
    return $fields;
}

Similar to the above example, but uses an array of meta keys, removing from the registration form any field whose meta key is in the array.

/**
 * Remove fields from the registration form using and array of
 * meta keys. Loops through the array to remove (unset) fields 
 * found in the array from the settings.
 */
add_filter( 'wpmem_fields', 'my_remove_reg_fields_by_array', 10, 2 );
function my_remove_reg_fields_by_array( $fields, $tag ) {
 
    if ( 'register' == $tag ) {
     
        $remove_meta = array ( 'billing_address_1', 'billing_address_2', 'billing_postcode', 'billing_country' );
         
        foreach ( $remove_meta as $meta ) {
            unset( $fields[ $meta ] );
        }
    }
     
    return $fields;
}

An example of removing a field from the user profile update form but not the registration:

/**
 * This example removes a field (in this example - phone1) from
 * the user profile update. That way, the user cannot update 
 * or change this field after registration.
 */
add_filter( 'wpmem_fields', function ( $fields, $tag ) {
 
    if ( 'profile' == $tag || 'profile_dashboard' == $tag ) {
        unset( $fields['phone1'] );
    }
     
    return $fields;
}, 10, 2 );


/**
 * Same as above for several field meta keys in an array.
 */
add_filter( 'wpmem_fields', function ( $fields, $tag ) {
    
    // Only remove if we're on the profile or profile_dashboard view.
    if ( 'profile' == $tag || 'profile_dashboard' == $tag ) {
 
        // An array of field meta keys to remove.
        $remove_fields = array( 'my_field1', 'my_field2', 'my_field3' );
        
        // Loop through the array and unset the key from the $fields array.
        foreach ( $remove_fields as $remove_field ) {
            unset( $fields[ $remove_field ] );
        }
    }
     
    return $fields;
}, 10, 2 );

Notes

The array key for each field in the array is its meta key. Each field in the array is an array of setting values as noted below.

All fields must include the following:

  • label (string) The text for the field’s label.
  • name (string) The field’s meta key. This is what will be stored in the database (wp_usermeta for non-native fields). Avoid spaces and hyphens (recommended: all lowercase characters, numbers, and underscores only).
  • type (string) The field type:
    • text
    • email
    • select
    • multiselect
    • checkbox
    • multicheckbox
    • radio
    • textarea
    • url
    • number
    • date
    • password
    • file
    • image (a “file” input type, but handles images specifically)
    • hidden
    • option (subset of “select”)
    • membership
  • register (bool|int) 1 if included in registration form, 0 if admin only
  • required (bool|int) 1 if required
  • profile (bool|int) For future development
  • native (bool|int) 1 if a native WP field

The following values are supported by all fields, but are optional (the above are required)

  • id (string) (optional) The “id” attribute of the HTML5 tag. Defaults to the field meta key if not specified.
  • class (string) A custom CSS class name (defaults to “textbox” if no class is given)

The following values are supported by text, url, email, and password field types.

  • placeholder (string) Placeholder text for an empty field
  • title (string)
  • pattern (string) A regular expression (regex) pattern as supported by HTML5

The following values are supported by the number field type:

  • placeholder (string) Placeholder text for an empty field
  • title (string)
  • min
  • max

The following values are supported by the date field type:

  • placeholder (string) Placeholder text for an empty field
  • title (string)
  • pattern (string) A regular expression (regex) pattern as supported by HTML5
  • min
  • max

The following values are supported by the checkbox field type:

  • checked_value (string) The value to save if the checkbox is checked.
  • checked_default (bool|int) If the checkbox should be loaded as checked by default (1|true)
  • checkbox_label (int) Defines if the checkbox label is added before or after the HTML input for the checkbox. 1 loads after (to the right). Defaults to 0 (loads label first/to the right).

Changelog

Introduced in version 3.1.7

Source

wpmem_fields is located in includes/api/api-forms.php

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 26
  • Page 27
  • Page 28
  • Page 29
  • Page 30
  • 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