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 →
Tips and Tricks
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 →
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 →
Email users when a new post is published
This tip is a request from a user. I like user requests – that makes it easier to deliver the kind of tutorials users are looking for instead of things I just come up with on my own.
This particular tip will address how you can automatically send an email to all users when a post is published or updated. Continue Reading →
Custom form field validation: numeric fields
WP-Members has its own built-in form field validation for things like usernames, email, and required fields. But what if you need to validate other elements, such as testing to see if an entered value is a number? Yes, the plugin framework allows for you to extend the form field validation to whatever you need.