WP-Members 3.4.6

WP-Members 3.4.6 is currently available as a beta release. Should all go well with beta testing, I expect it to be released into production early next week (targeting Tuesday, November 29).

If you don’t know how to install a beta release for testing, read this FAQ.

Bug Fixes

  • Fixes a bug in the user profile update object that prevented non-admin users from updating any of the WP-Members custom fields in the dashboard profile view.
  • Fixes a bug in the registration/profile update logic that checks if the user object is a valid user. It is very rare that it wouldn’t be, and I have never received a bug report that anyone experienced this, but it is being fixed none-the-less.

Improvements

  • Adds author ID support for the [[wpmem_field]] shortcode. Previously, this shortcode would only display data for the current user ID or a user ID passed in the URL query string. This update allows you to specify [[wpmem field name_of_field id=”author”]] to use it to display custom field data for the current post author. (This was a feature request from a user, and I thought is was a great update to the plugin)
  • Updated the wpmem_{$form}_defaults filter hook to include the tag of the form being filtered (login|changepassword|resetpassword|forgotusername).
  • Added two new dialog strings for user account pending approval (acct_not_approved) and user account not valided (acct_not_validated).
  • Updates the rktgk_build_html_tag() utility function to include an “echo” parameter to automatically print the result to the screen.

New API functions

  • wpmem_get_user_by_meta() – retrieves a $user object by user meta value (WP’s get_user_by() only does this by username, email, and ID, so this new utility allows you to query a user by a custom meta value.
  • wpmem_add_membership_to_post() -programmatically adds a membership to a post. Can be used for bulk and on-the-fly post restriction.
  • wpmem_create_membership() – programmatically creates a membership. This can be used to create new memberships based on other actions (such as a value in a registration form).
  • wpmem_create_username_from_email() – can be used to create a username value from the user’s email address. Usernames are a required field in WP – even if you don’t use it in the form – it’s a mandatory value for the schema. I have seen too many users simply fill this with the email address which is not a good idea because usernames cannot be changed, thus leading to obvious problems. WooCommerce includes a function that does this, and if WC is installed, this function will default to that result. But if WC is not installed, this function will generate a value from the email user, and check it for uniqueness, adding a number if necessary until it finds a unique value.
  • wpmem_login_link(), wpmem_get_login_link(), wpmem_reg_link(), wpmem_get_reg_link() for getting and displaying links to these identified pages (based on the plugin’s settings).
  • rktgk_wp_parse_args() – similar to WP’s native wp_parse_args(), but fully recursive (which WP’s function is not) so it can handle multi-dimensional arrays.
  • rktgk_get_row() – functions like WP’s wpdb::get_row(), but incorporates wpdb::prepare() by default, saving a necessary (and critically important) sanitization step (that people tend to forget).