1
votes

Is there any way or how to start off to make a default log in form on drupal 7 applicable for normal users only? Administrators cannot log in in that log in form (I'll make a custom log in form for administrators, but that wasn't the issue here)

It was like,

http://mysite.com/user/

You see a log in form, ONLY normal users can log-in in that form. Is there any way to do this any hints or clues where to start off first?

I've been here

https://drupal.org/node/1894620

Studied this

https://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook_node_access/7

It doesn't seem right, or I just don't manage to applied it well. I'm lost. Any help would be appreciated though.

1

1 Answers

0
votes

I think the only solution is to copy the whole User-Login form (within its all submit- and validation-functions) in your own custom module.

You can start by looking up the form-array from the login-form.....

function mymodule_form_alter(&$form, $form_state, $form_id)
{
  if ($form_id == 'user_login')
  {
    // The login form here...
    print_r($form);
  }
}

.... and copying this into a new hook_form(), implemented by your module.

Now you can alter the submit and validation of the form in the copy. In the new validation function you can check for the correct User-Role.