Customizing the URLs of WordPress Login and Sign-up Pages?

You can use a htaccess file to rename the login and registration addresses to easier to remember versions: http://wpguy.com/articles/an-easy-to-remember-login-address/ Using what was in that link we can further extend the simple login address into a simple signup and a simple register address as follows: RewriteRule ^login$ /wp-login.php [L] RewriteRule ^signup$ /wp-signup.php [L] RewriteRule ^register$ /wp-register.php … Read more

Display user registration date

get_current_user_id() give you the user id of the logged in user. And that is: you. You have to get all users: <?php $users = get_users(); foreach( $users as $user ) { $udata = get_userdata( $user->ID ); $registered = $udata->user_registered; printf( ‘%s member since %s<br>’, $udata->data->display_name, date( “M Y”, strtotime( $registered ) ) ); }

How do I programmatically set default role for new users?

This allows plugins to easily hijack the default role while they’re active. // Hijack the option, the role will follow! add_filter(‘pre_option_default_role’, function($default_role){ // You can also add conditional tags here and return whatever return ‘subscriber’; // This is changed return $default_role; // This allows default }); I use it to make sure some plugins that … Read more

How can I un-reserve a pending username registration?

DB Access layer & deleting rows WordPress uses the wpdb class to manage access to the database layer using the global $wpdb. The class provides a method named delete() to delete rows from tables: $wpdb->delete( $table, $where, $where_format = null ); Multisite tables & activation keys WordPress has some MU specific tables, where one is … Read more

What is an easy way to display a front-end user registration form?

Jeff Starr wrote a great tutorial on front-end registration, login and password recovery taking the similar approach as suggested by onetrickpony. So take this as a follow up to his answer and as another resource that might help you get it done: http://digwp.com/2010/12/login-register-password-code/ Now you have two examples how to code this yourself and trust … Read more

Disable user registration password email

You can intercept this email before it is sent using the phpmailer_init hook. By default, this hook fires before any email is sent. In the function below, $phpmailer will be an instance of PHPMailer, and you can use its methods to remove the default recipient and manipulate the email before it is sent. add_action(‘phpmailer_init’, ‘wse199274_intercept_registration_email’); … Read more

users table – user_name vs. nicename

The nicename is (usually) just a sanitized version of the username. It’s suppose to be ‘nice’ in the sense that it is the ‘nicename’ that is used as a slug, for example: www.yoursite.com/author/my-nice-name/ will take you to the archive of the author with nicename ‘my-nice-name’. The documentation simply describes it as A string that contains … Read more

Adding fields to the “Add New User” screen in the dashboard

user_new_form is the hook that can do the magic here. function custom_user_profile_fields($user){ ?> <h3>Extra profile information</h3> <table class=”form-table”> <tr> <th><label for=”company”>Company Name</label></th> <td> <input type=”text” class=”regular-text” name=”company” value=”<?php echo esc_attr( get_the_author_meta( ‘company’, $user->ID ) ); ?>” id=”company” /><br /> <span class=”description”>Where are you?</span> </td> </tr> </table> <?php } add_action( ‘show_user_profile’, ‘custom_user_profile_fields’ ); add_action( ‘edit_user_profile’, ‘custom_user_profile_fields’ … Read more