WP-Members 3.0.9 contains a number of small additions and a few fixes. It is primarily a feature release as the fixes are primarily improvements.
Custom Post Type Support
The main new feature is native support for Custom Post Types. CPT support did not work out well when first introduced in 3.0.0, which is why things were rolled back.
The issue with handling CPTs is that word “custom.” Not all CPTs will function like a standard WP post or page. Some have very specific uses and may or may not work well out-of-the-box with WP-Members. Functionality depends a lot on the specific CPT, what it does, and how it handles content. Please understand there are infinite possibilities here. This does not mean that you can’t block or restrict this content if it doesn’t work in the same way, but it may mean that it needs to be approached in a different way. (One good way is redirection, which is a simple-to-implement process with the Advanced Options extension.)
With that in mind, CPT support will be an option. For each Custom Post Type your install has, there will now be an option to enable it and add it to the WP-Members settings. There will be a section at the bottom of the main options tab for enabling any CPTs in you install (if there are no CPTs, then there will be no settings in this section). For any CPTs that you want the plugin to handle, check the box to enable them.
Once a CPT is added in this section, it will add settings for that CPT to the plugin’s options for blocking, excerpts, showing the login and registration form, and auto excerpt settings. Here is an example with our demo CPT “Books” added to the settings:
With the CPT Books enabled in the settings, now you can manage it’s settings in the same way as Posts and Pages.
Auto Excerpt Enhancements
As you may note from the previous section on CPTs, the Auto Excerpt feature has been updated to allow separate settings for all post types (posts, pages, and any managed CPTs). The setting was moved from the bottom of the “Other Settings” section and into the “Content” settings section.
You can now separately manage whether auto excerpt is enabled for each post type and also use different excerpt lengths as needed.
There is also a new filter hook for the auto excerpt that will allow you to filter defaults globally or by post. This filter will allow you to change certain defaults including:
- excerpt length – filters the length of the excerpt (number of words).
- strip tags – removes all HTML tags from the excerpt – defaults to false.
- close tags – this has always been there to close common HTML tags that may be found in the excerpt, but now the list can be filtered if you have additional tags the plugin may not be looking for.
- parse shortcodes – parses any shortcodes found in the excerpt – defaults to false.
- strip shortcodes – removes any shortcodes found in the excerpt – defaults to false.
- add ellipsis – adds an ellipsis (…) at the end of the excerpt – defaults to false.
- more link – you can filter the more link here, or with the WP filter the_content_more_link.
Note that most of these default to false. I do not generally like to just dump new things into the plugin that may affect a user’s installation. If any of the above are things that you want to use, you can enable them by filter. As these mature, they may become settings that are available in the admin panel, but those usually start out as filters.
Other Updates
Other updates include the following:
- New wpmem_member_links_args and wpmem_register_links_args filters. These will give more control over customizing what displays on the register form page and the user profile page when the user is logged in. The wpmem_member_links and wpmem_register_links filter will remain available, but the new filters will give you more control and an easier way to manipulate the content.
- A $link parameter was added to the wpmem_forgot_link_str and wpmem_reg_link_str filters. These are the filters that change the forgot password link and the register link in the main body form. Currently, it passes the complete HTML for the link, which wraps the text in HTML tag. The $link parameter has been added to make it easier to change the text without having to completely redo the string or resorting to juggling the string with PHP.
- New wpmem_sb_reg_link_str and wpmem_sb_forgot_link_str filters were added. These are the same as the above for the sidebar widget.
- Added [email] and [user-profile] shortcodes to the email processing. (user-profile replaces members-area although the later will still work.)
- Added “label_text” key to the wpmem_register_form_rows filter. This is a static value (you can’t change it) that may come in helpful if you are making changes to the form that involve changes to the label. The “label” key contains the text for the label surrounded by the HTML (default label tag), so if you just need the text the for label somewhere (like a placeholder) you would have to strip out the HTML. This new key gives you access to the raw text to be used where needed.
- Added forgot username retrieval link to the forgot password form.
- Added wpmem_username_link and wpmem_username_link_str filters for filtering the forgot username retrieval link (work the same as those mentioned above for forgot password and new registration).
General Fixes
- Fixed the handling of bulk actions on the Posts > All Posts screen so that if the list is filtered (such as viewing “Published” posts), the filtered view is maintained when the bulk action is used.
- Fixed handling of updates to user pages in the plugin’s main options tab. Some of you may have noticed that when you set or update the user pages, the initial screen view showed the post ID in the custom setting. Although everything works when you set or update these, the way that the $wpmem object was updated with the new settings didn’t carry things over to the initial screen for proper display. I’ve adjusted the way the object is updated so that the screen views correctly now.
- Added handling for empty post object in the is_blocked() function. Normally, it would be pretty rare for the post object to be empty when this function is used. However, I am adding some features to the next update of the Advanced Options extension that end up using this function in situations where there may be no post object. So to enable that without error, I’m adding this improvement to this function.
- Improved the email functions to eliminate calls to get_user_meta() for custom fields when possible. This will improve plugin operation when cache plugins using object and/or database cacheing are used.