• 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

WP-Members User List 2.0.0 testing

Chad Butler · May 11, 2019 ·

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 User List is getting a much needed major rebuild.  This will result in the 2.0.0 version, bringing it up-to-date with the other 2.0 series extensions. It will be more object oriented and includes some new features.  Continue Reading →

wpmem_update_user_role()

Description

Updates a user’s role.

Parameters

$user_id
(int) (required) The user ID to update.

$role
(string) (required) The role slug.

$action
(string) (optional) The update action (add|remove|set default:set).

Examples

// Basic usage of how the function is applied:
wpmem_update_user_role( $user_id, $role, $action );


/*
 * This practical example below will set a role for 
 * a user when they register. In this example, it 
 * will set the role to 'my_custom_role'.
 *
 * The example uses the 'wpmem_post_register_data'
 * action to apply the role at registration.
 * @see: https://rocketgeek.com/plugins/wp-members/docs/filter-hooks/wpmem_post_register_data/ 
 */
add_action( 'wpmem_post_register_data', 'my_set_user_role' );
function my_set_user_role( $fields ) {

    $user_id = $fields['ID'];
    $role    = 'my_custom_role';
    
    /*
     * Note how the optional $action is not used because 
     * we are just setting a single role. You could "add" 
     * another role to the user's existing role(s) (which
     * in this example would already be the WP default 
     * role from WP's general settings).
     */
    wpmem_update_user_role( $user_id, $role );
}

Changelog

Introduced in version 3.2.0

Source

wpmem_update_user_role() is located in /inc/api-users.php.

WP-Members 3.2.6

Chad Butler · Mar 27, 2019 ·

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.2.6 is a security release with some additional updates.  Because this includes a security update, it is recommended that you take steps to update from previous versions.

Here is an overview of what is included in this update:

Security

There is a potential exploit with regard to the password change. It’s a limited exploit, but I feel any potential risk no matter how small needs to be addressed and closed.  In this case, the fix is twofold and completely closes the discovered exploit and goes beyond that requirement.  The function for password change can only be fired if the user is logged in.  Additionally, a nonce has been added to the plugin’s short form (used for login, password change, password reset, and forgot username forms).  Nonces were made a default of the long form in the previous version (it was previously optional). So this version adds that to the short form.

API Updates

Some of the functions in the plugin’s API were updated and improved.

  • wpmem_user_data() – Added “all” as an argument so the function can return all user meta or just WP-Members fields only.
  • wpmem_set_user_product() – Added “date” argument to specify a specific expiration date. Default remains “false” and will set user expiration from the current date.
  • wpmem_admin_after_profile_table & wpmem_user_after_profile_table actions – These fire after the HTML table in the admin/dashboard profile and can be used for adding to what is displayed after WP-Members custom fields.
  • wpmem_login_form_rows filter – Added $arr argument passed to the filter. This contains an array containing all of the setup for the form (primarily what is filterable through wpmem_login_form_args, but here it is available if needed for determining how you will filter the rows array).

Other Improvements

The logic for the function behind the [wpmem_field] had a ground-up rebuild.  This will make the function more efficient and also easier to maintain in the future as new features are added.  (Note: While this is not a “feature,” it is noted here so that if you experience any unexpected behavior in the [wpmem_field] shortcode following the upgrade, please let me know about it so it can be determined if it is related to the update.)

The registration form field validation was updated to evaluate required fields as “not null” instead of false/empty.  This allows for “0” values which would previously have been evaluated as “false” and thus lead to the form returning an empty required field error if a “0” was entered.  Since the current logic has been in place for almost 10 years, I’m surprised this hasn’t actually come up before, but with the addition of support for the HTML number field type, I did have a user indicate that they needed their number field to accept a minimum value of “0” – so now you can do that.

Added file post ID to the post_data array.  The post_data array is passed through various filters and actions during the registration process.  In the case of a file field type (“file” or “image”), this array of data now includes the post ID for the attachment.  While this can be used for various things, the primary reason for inclusion was being able to easily find a file uploaded during registration for attachment to an email (i.e. sent as an attachment to the admin notification).  While that could previously be done without this addition, the change makes it much simpler and eliminates any setup steps – the post ID needed is included in the data array.

Email Format

WP-Members relies on WP’s wp_mail() function to send email.  It’s important to understand a few things about wp_mail():

  • By default, all emails are plain text.
  • You can send HTML formatted email by changing the content type.
  • The default “from” address is WP’s default – wordpress@yourdomain.com.
  • The absolute best thing you can do for yourself to solve all email problems is to use SMTP to send your email!

Sending HTML Email

If you want to send HTML formatted email, you need to change the content type.

The plugin includes a setting in the Emails tab to automatically send emails as HTML format. (NOTE: When sending HTML formatted email, URLs are not “automatically” made clickable. You need to apply proper HTML markup for links and any other formatted text.)

Change ALL WP emails to HTML format

Use the wp_mail_content_type filter to set the content type to “text/html”:

add_filter( 'wp_mail_content_type', 'my_set_mail_content_type' );
function my_set_mail_content_type( $content_type ) {
    return 'text/html';
}

Change only WP-Members generated emails to HTML format

The wpmem_email_headers filter allows you to filter the email headers. Use that to set the email type as “text/html”:

add_filter( 'wpmem_email_headers', 'my_wpmem_html_email' );
function my_wpmem_html_email() {
    return "Content-Type: text/html" . "\r\n";
}

Adding one of above filter function to your functions.php file or a custom plugin file will allow you to send HTML formatted emails.  Now you can use HTML in the email content in the plugin’s email management tab (be sure to include appropriate shortcodes for data being sent).  There is more information on how to use code snippets from this site here.

WP-Members 3.2.5

Chad Butler · Jan 3, 2019 ·

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..

 

A new year, and a fresh upgrade for WP-Members!  Version 3.2.5 is a feature release with some fixes.  Continue Reading →

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 21
  • Page 22
  • Page 23
  • Page 24
  • Page 25
  • 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