Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've secured a new client who requires user login functionality but I've never done this sort of thing before so need some advice or recommendations of what plugins to use or if I need custom functionality.

It will be a private quiz website where invited users will be asked to log in to a website so they can complete the quiz. The results of the quiz must be stored and must relate to that users login info. I don't want to use Wordpress's built in user accounts manager because I don't want quiz participants to be able to login to the CMS.

How would I manage this, are there any good plugins you'd recommend?

share|improve this question
1  
Plugin recommendations are off topic. See the faq. –  s_ha_dum Jan 11 '13 at 15:39
add comment

1 Answer

Use the existing system.

  1. Create yourself a new Role for your Quiz people, using add_role

  2. Make sure that Role has no capabilities, including 'Read'. Without 'Read', which is the only (default) capability "Subscribers" have, the user cannot get to the backend at all but can still login.

  3. Since these are invited users, presumably you will be created in them from the backend? Make sure they are set to the correct Role when you do.

  4. Use the login_redirect hook to always shuffle those users to the front end, or they will see scary "You can't be here" messages.

So...

// create the role
add_role('quiz_user', 'Quiz User', array());

// redirect users 
function quiz_user_redirect($redirect_to, $request_redirect_to, $user) {
    if (current_user_can('quiz_user')) $redirect_to = get_bloginfo('url'); // or other page
    return $redirect_to;
}
add_filter('login_redirect','change_login_redirect');

Very rough and untested and maybe not optimal. I just made it up. :)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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