Here is a script idea you can use to validate a stored value that you might have for users (such as a PIN) against their registration data. This example will assume that you only want to allow certain registrations for people who you already have data on (in this example, their name) and you want to validate that the user registering is that person. This example will use PIN assigned to the user’s data that we have and the script will validate the PIN provided at registration or will halt registration. Continue Reading →
Remove an unparsed wpmem_txt shortcode
The wpmem_txt shortcode is something that WP-Members puts in on the fly and its purpose is to prevent WordPress from putting line breaks (<p> and <br /> via the wpautop and wptexturize functions) into the form, thus throwing off the layout. This is one of those magic things that runs in the background that no one really knows about unless something breaks it.
Here is the problem: WordPress runs the shortcode parser on the content only once. By itself, that’s not a problem. However, if a plugin or theme developer includes a shortcode in their code and they do not use the function do_shortcode() on the $content variable before returning it, any shortcodes that are executed after theirs will be unparsed. For WP-Members, a bad practice like that will result in leaving wpmem_txt unparsed in your form.
So… how do you fix this? Continue Reading →
Working with Templates: Block a Category Archive Loop
In this example of integrating WP-Members features into WordPress Templates we will focus on the category template category.php.
With the default way of using WP-Members, your loop of a category would display titles and post excerpts, leading readers to the individual posts to either login or register. But suppose you want to limit all of that, including titles and excerpts on the category.
We will take the default (Twenty Twelve) category.php template and add a condition to it, and if the user is not logged it, we will direct the user to the login page (created with the WP-Members page=”login” shortcode), which will redirect the user back to the category page upon successful login. Continue Reading →
Simple registration invite code example
This is an example of adding a very simple invitation code to your registration process. In this example, we will add an invitation code field to the form and set up a function to validate that code. To keep it simple, the invitation code will be static (there will be only one code). Later I will be publishing a more advanced example where you can read user specific codes from a database table, validate, and also mark the code as claimed. Continue Reading →
Add a helpful dialog above the password reset form
Suppose you want to add a little text above the password reset form that will help the user know what to do – in this case, put in your username and email and you’ll receive an email with a new password. Here is an easy way to do that with the wpmem_login_form filter. Continue Reading →