WP-Members 2.9 introduced some new filter hooks to make customizing the various forms much easier. If you have set up a previous version of the plugin to allow password resets with just an email address, you probably already know that most form changes of this type required using the php function str_replace. Version 2.9 has new filter hooks that make this process much simpler. [Read more...]
I have received a lot of requests in the past for how to add a set of dropdown selections for date and store it as a single user meta value. This is a great example of using the new wpmem_register_form_rows filter hook, a new hook in 2.9, because we can use a single field in the WP-Members Fields tab for the date of birth to be stored as a single meta and use the filter to quickly change the placeholder field to a trio of dropdowns for date selection.
Note: this example requires a some php work, but like all of the examples here, I have tried to make it as “cut-and-paste ready” as I can. For many, this will work out of the box. For some, you may want to change the way the date is assembled and displayed (i.e. DD/MM/YYYY). I’ve tried to comment the code snippet as much as possible so you can follow what is going on. [Read more...]
Depending on how the plugin gets used, sometimes the <legend> tag for the form is not needed. For example, if you have created a login page with the page title “Login”, you do not really need the form to also carry the same text. Here are some generic utility snippets you can use to remove these various headings. [Read more...]
When I first developed the admin panels for the plugin, I added editable dialogs for most of the various error messages. Since then, some additional dialogs have been added for form validation (as well as the ability to add your own validation and messages). However, most of those were not included in the dialogs tab. This is mainly because it does take quite a bit of programming overhead and more system resources for adding this as a feature.
So what if you want to change one of these messages? For example, you would like to change the message “The username cannot include non-alphanumeric characters” to something more light hearted, such as “Like, no weird characters in the username, dude!” This code snippet collects a number of these default message strings and allows you to replace them with your own versions. [Read more...]
NOTE: if you are using version 2.9+, there is a new set of code snippets using some new filter hooks that make this process easier.
One of the requests I get most often is how can I change the plugin to have the password reset only require the user to give their email address. This especially comes up when people customize the process to use the person’s email address as their username, since a password reset form with “username” and “email” doesn’t make much sense in that situation.
Well, since version 2.8.5, there has been a filter hook in the password reset process that allows you to filter the arguments that are passed in order to reset the user’s password – wpmem_pwdreset_args. There are two stages to this demonstration, and thus two parts of the code snippet. First, we only need a form requesting the user’s email, so we will remove the “username” field from the form. Second is filtering the arguments of the password reset process so that the user’s password can be reset with only the email provided. [Read more...]