• 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_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

Updating to 3.1.7 – What you need to know

Chad Butler · Apr 1, 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.7 will be released Monday evening, April 3.  There are some great improvements in the plugin that I am excited about, but if you are an existing user, there are some significant changes you should be aware of before blindly updating.

Note that there are no database changes updating to 3.1.7 from any flavor of 3.1.  So you can roll back to the previous version if necessary.  Continue Reading →

Download Protect

The Download Protect extension allows you to load files such as images, documents, etc to a protected directory that requires the user to be logged in to access.

This extension is available with the WP-Members Pro Bundle, WP-Members Lifetime Support, or is also available individually.

Settings

When you install the extension, it will add a “Downloads” tab to the WP-Members admin area.  This tab is for managing the extension’s settings.

User IDs to exclude
This setting allows you to identify user IDs that you want to exclude from download stats tracking.  Values should be the numeric ID of the user and all IDs should be separated by commas (do NOT use commas in IDs that are in the thousans; i.e. 14567 should not have a comma in it).

Set Error Page Location
This is a page you need to create to handle any errors, such as a non-logged in user attempting to download, or if something goes wrong with the download.

Download Files

The plugin adds a menu item for uploading files.  This is found under Media > Download Protect

This screen will give you a table of any media files you have uploaded to the protected download directory.  This table includes link information (download links are by key and not by file name) for each file, and also allows you to edit any files should an uploaded file need to be updated.

Download Tracking

Under Dashboard > Download Tracking is a screen that allows you to track what files have been downloaded by what users.  The main screen is a list of all downloads and shows the date, the user, the file information (title and file name), the page they click on, and the user’s IP address.

This screen allows you to filter by user and by file so you can view more specific information.  You can filter by:

  • User to show all files downloaded by a selected user
  • File to show all users who have downloaded a selected file
  • User & File to show how many times a selected user downloaded a selected file

Additionally, a truncated version of this table is included on the admin user profile page for each user showing the last 5 downloads (this value can be filtered to show more or less) with a link back to the main tracking page to show all downloads for that user.

Installation

Download the zip package from the downloads page.  You can install this via the WP admin by going to Plugins > Add New and selecting Upload.

Once installed, the first thing you want to do is create an error page.  This page is where a user will be directed in the event of an error when downloading (such as if a user is not logged in).  On this page, place the following shortcode:

[wpmem_dp_error]

Once this page is created, go to Settings > WP-Members and option the Downloads tab.  Use the selector for “Set Error Page Location” to select the page you create for download errors.

If you have any users you want to exclude from download tracking, enter their IDs separated by commas into “User IDs to exclude”.

Save your settings.

Now you are ready to upload some files.  Go to Media > Download Protect and click “Add New”.  This will give you a dialog to upload a file.  Give the file a title (whatever identifies it to you) and click “Choose File” to open a file selector.  Once the file is selected, click “Upload File”.

You can also edit or delete files from this list.  To edit or delete a file, mouse over the file name and click the appropriate link from the hover menu.

Editing a file gives you the option to upload a new version of the file and/or change the file’s title.  Note that none of the file’s information changes – specifically, the file’s identifying key.  So any changes will be tracked in the statistics as the same as the previous file.  If your new version needs to be tracked separately, it should be loaded as a new file.

Note that the download link is dependent upon the file’s key.  So if you edit a file, you do not need to change the key.  If you delete and/or replace, you’ll need to either edit your download links or remove them.

Once files have been loaded you can create links for your users to download.  The list of files offers two options.  First it gives you the file’s direct link.  This can be used in the WP post editor when creating a link.  Alternatively, it gives you a shortcode that will generate a download link using the file information.  Either can be used.

Once files are loaded and some have been downloaded, you can view download statistics on the Dashboard > Download Tracking screen.

This extension is available with the WP-Members Pro Bundle, WP-Members Lifetime Support, or is also available individually.

wpmem_is_reg_page()

Description

Compares the wpmem_reg_page value (passed through the form) with the register page URL from settings.

This utility function that will tell you if the current (or requested) page is the set registration page. This can be useful in various applications where a condition may exist that you want to occur if the current page is or is not the registration page.

Parameters

$check
(mixed) (optional) Page slug or ID of the page to check. Default: false

Return Value

boolean true|false

Usage

Examples

Notes

Page slug or ID can be passed to check a specific page. If no value is passed as an argument, the function will use get_the_ID() to get the post ID of the current item in the Loop.

Changelog

Introduced in version 3.1.4
Added default of current page ID in 3.1.7

Source

wpmem_is_reg_page() is located in /inc/api/php.

WP-Members 3.1.7

Chad Butler · Jan 20, 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..

 

For the past few months, I have been working diligently on the next release of WP-Members.  This release will continue improving and expanding the handling of forms and form fields that is the major focus of 3.1.

Today I am publicly announcing the alpha release of 3.1.7.  The version released to GitHub is a stable release and includes some changes I am hoping people will begin using and testing now so they can be tested and ready for moving this version to beta and production release.

UPDATE: 3.1.7 is now out as the production release.  There is another post that points out some key information on changes and how/if they affect you.  I also added a similar topic to the wordpress.org forum.

Continue Reading →

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