What is the recommended way to approach the follow issue? I have to create two pages. On one page I will have a small form where users will be able to register themselves (with or without photo). On the other page, I will show all the users' info entered on the previous form. For the admin section, I just need to have all the registered users listed and to be able to delete them.

I don't want to touch the default's WP user registration stuff, because it is already being used and I cannot mix up the things.

Is it possible to use some kind of custom post types? Any plugin or idea?

  • Any reason why you couldn't use the WP user tables but create a special role to separate these registered users from everyone else? Commented Feb 25, 2012 at 12:52
  • Any example in how to do that?
    – Daniel
    Commented Feb 25, 2012 at 14:02

2 Answers 2


The following code creates a new role. In fact is simply clones the subscriber role, so if you are not using that role currently, you may as well just use that.

The following function need only be run once (it run's when a user is 'admin side')

//Creates a custom role called 'my_new_role'.
//Run this once then feel free to comment out the next line:
add_action('admin_init', 'my_custom_role');
function my_custom_role(){
    global $wp_roles;

    $subscriber = $wp_roles->get_role('subscriber');

    //Adding a 'new_role' with subscriber caps
    $wp_roles->add_role('my_new_role', 'My New Role', $subscriber->capabilities);
    //Optional add/remove caps, like the capability to access the dashboard

See the codex for more information on capabilities.

Wherever your are processing the form you'll want to create a new user and assign them the role 'my_new_role'. To do this use the wp_insert_user. As a brief example:

wp_insert_user( array (
    'user_login' => 'JoeBloggs',
    'user_pass' => 'a_password_43463', 
    'first_name' => 'Joseph',
    'last_name' => 'Bloggs',
    'role'=>'my_new_role') ) ;

Prior to the above you should have performed all the nonce-checks, data validation and any other checks.

You may wish to redirect these new users to a different page (not the dashboard) when they log-in. To do this use the login_redirect filter.

add_filter('login_redirect', 'dashboard_redirect');
function dashboard_redirect($url) {
    global $current_user;

    if (current_user_can('my_new_role')) {
             //current user is 'my_new_role', take them somewhere else...
             $url = home_url(); 
        return $url;
  • Good piece of code, I will play with it around. Just one question. How do I list in the backend all users that were assigned to 'my_new_role'?
    – Daniel
    Commented Feb 25, 2012 at 20:35
  • That's a good question - could you ask it? It would probably be helpful to others. Commented Feb 25, 2012 at 20:54

I would face it this way:

Database extension for wordpress allow you to manage very easily the content, you just need to create the form(s) and then you can retrieve and modify the information as you wish. For the other page, since the extension shows you the path to the database, you just need to make some queries and you are done.

  • I thought about that, but this approach doesn't allow me to manage the registered users.
    – Daniel
    Commented Feb 25, 2012 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.