This is an extension of the ideas presented in the tutorial Restrict Post or Page Access to a Specific User with the twist that this version makes some minor changes to incorporate an HTML multi-select for selecting multiple users for access to a post.
Continue Reading →Add a meta box in the post editor for blocking custom post types
Users who configure to block custom post types will notice that you don’t get the meta box that WP-Members shows for blocking (or unblocking) posts and pages. While you can still use custom fields directly for custom post blocking/unblocking at the individual post level, it’s nice to have the meta box. So I’ve put together a code snippet for you to use to implement this on your custom post type editors.
Blocking Custom Post Types
Note: As of WP-Members 3.0, you can add custom post types to the plugin’s main blocking options. See the options documentation section on Custom Post Types.
This is a new method of blocking custom post types. There are two main differences over the method described here and the original method.
First, this method is a little more scalable. If you have multiple custom post types and want to set a blocking value for each, you only need to add to the settings array. Second, this method allows you to override the blocking value on an individual custom post type post than you have set for the custom post type as a group. This operates the same as regular posts and pages. It also takes advantage of the new extra settings that WP-Members version 3.0 offers.
(If you want to add a meta box for blocking/unblocking individual custom post type posts, there is an additional code snippet you can add here.) Continue Reading →
WP-Members 2.9.7 native registration error patch
The 2.9.7 release of the plugin was intended to include a fix for the native registration to work with localized (translated) sites. Unfortunately, there was a flaw in the line that fixes this. The flaw causes a breakdown of the native (back-end wp-login.php) registration process.
I have patched this in the main plugin download package. Since I caught this early and the majority of users do not use this backend registration, there aren’t that many users effected.
But if you are one of users effected by this, you have two options. First, as I just mentioned, the download package is fixed so you can re-download the plugin. You really only need to replace /wp-members-core.php (and /admin/user-export.php for one other patch).
Or, you can apply the fix yourself. If editing in WP, go to Plugins > Editor and select WP-Members from the plugin dropdown. Open the file /wp-members-core.php.
Near the end of the file, the second from the last function is wpmem_wp_reg_finalize. Line 920 is the first line of this function and you will see:
$native_reg = ( isset( $_POST['wp-submit'] ) && $_POST['wp-submit'] == esc_attr_e( 'Register' ) ) ? true : false;
The esc_attr_e is the problem. This echos the output and we don’t want that. This should be changed to esc_attr( __( ‘Register’ ) ) like this:
$native_reg = ( isset( $_POST['wp-submit'] ) && $_POST['wp-submit'] == esc_attr( __( 'Register' ) ) ) ? true : false;
WP-Members 2.9.7 export users error patch
The export users process in the initial release of WP-Members 2.9.7 can cause an error if debugging is turned on or PHP messages are set to display warnings. Continue Reading →