WP-Members 3.1.1 is primarily a feature release continuing development objectives from the 3.1 project.
New API introduced
The plugin will begin to expand the API for customization. This release packages a number of useful functions that you can use without having to get too deep into the plugin’s code. The User Guide will begin to be updated to reflect these functions that can be used with the plugin’s filters and actions, or within filters and actions from WP, your theme, or other plugins.
The following functions are being introduced in 3.1.1:
- wpmem_redirect_to_login() – This function was actually introduced in 3.0.2, but is now officially part of the API. This function can be used to redirect blocked content to a defined login page (using the WP-Members setting for login page).
- wpmem_user_has_role() – Returns true|false whether a user has a requested role.
- wpmem_is_blocked() – This function is intended to replace the wpmem_block() function. The function name should be a little more clear what it tells you – if content is blocked or not.
- wpmem_login_url() – Returns the full URL for the login page setting.
- wpmem_register_url() – Returns the full URL for the register page setting.
- wpmem_profile_url() – Returns the full URL for the user profile page setting.
- wpmem_current_url() – Returns the full URL for the current page.
- wpmem_gettext() – Returns a requested string.
- wpmem_use_custom_dialog() – Used for the creation and use of custom dialog messages.
- wpmem_add_custom_dialog() – Used for creating of custom dialog messages (adds them to the dialog message settings array and the Dialogs admin panel).
- wpmem_add_custom_email() – Used for creating custom email messages that may be used in addition to the plugin’s default message.
Shortcodes
There was an update to the [wpmem_logged_in] shortcode so that wrapped content will not be displayed on a user profile page action.
One new shortcode has been added – log in
This new shortcode will display a link to log in or out depending on the user’s current login state. This shortcode accepts the following parameters:
- login_redirect_to – optional URL to redirect to upon login (defaults to current URL, unless wpmem_login_redirect filter is applied)
- logout_redirect_to – same as above except for logout
- login_link_text – the text displayed for the login link, defaults to “log in”
- logout_link_text – same as above except for “log out”
Default delimiter
The introduction of new multiple select/checkbox field types has led to an additional need for these fields. Initially, the saved meta data was(is) being saved delimited by a pipe character (“|”). This was not so as to not run into problems between use on PHP 5.2.x vs PHP 5.3 where these are handled differently. Most users probably use PHP 5.3 or higher (at least you should be), but the technical minimum for WordPress is still 5.2.4. I won’t go into the ugly details of this and I’ll keep my opinion about it to myself. Suffice to say that’s the reason for the pipe character delimiter.
But not everyone wants or needs this, and in some integration instances, you may find that you need to have the data delimited by some other character (specifically a comma). And if you’re on PHP 5.3, then that’s probably fine (I prefer a comma as well).
So WP-Members 3.1.1 will allow you to select your delimiter for this data. It can be pipe or comma (if someone has another need that makes sense, I’ll add it). You’ll have the option of adding this when you set up the field (multiple checkbox or multiselect). If you already have one of these field set up, you are using the pipe character, and allowances have been made to continue to default to the pipe if no selection is set (In other words, if you’re using one of these field types already, you don’t have to do anything as a result of the update unless you feel the need to change to a comma delimiter).
Other Updates
- Added $user_id and $row to wpmem_admin_profile_field and wpmem_user_profile_field filters – this will allow for expanded possible use of these filters.
- Updated email settings so that new from/name is only saved if the setting is changed (improves efficiency).
- Updated admin warning messages – with some of the recent admin updates, not all informational notice messages were being displayed.
- Updated User > Add New screen so that a user can be set as active when created by an admin.
- Fixes for PHP7.
- Fixes attribution setting to handle 3.x settings format.
- Fixes image field edit in the fields tab to include file type.
- Fixes issue with profile update when file/image field is required.
Important Notice Regarding Updating
This version makes a change to the setting for the plugin’s dialog messages. Similar to the change in 3.0 for the main options where the shift was made to a more extensible array for the settings, the same is now being done with the dialogs.
The production release of 3.1.1 contains a downgrade function. When the plugin is deactivated, it will downgrade the dialogs setting to the pre-3.1.1 state so that rollback to a previous version can take place.