0

I am new to drupal So I want to redirect the user based on login Say, if there is an Anonymous user, he will be redirected to specific page, and if is an Authorized user along with login id and password, then he will be redirected to other specific page using script

  • In which condition, you want to redirect user? Like, you want to redirect user on form submit or viewing any page? – Jayendra Kainthola Jan 23 '14 at 5:49
0

Simply implement hook_preprocess_page() in template.php file and add your business logic: example

function MY_THEME_preprocess_page(&$variables) {
  if(CONDITION /* additional condition, e.g. $variables['is_front'] */) {
    if(user_is_anonymous()) {
      drupal_goto('node/13'); //change the url, with yours
    }
    else {
      drupal_goto('node/7'); //change the url, with yours
    }
  }
}

if you are implementing this hook for the first time then you need to flussh the cache.

0

Use Rules module and create redirect rules.

Project page says

The Rules module allows site administrators to define conditionally executed actions based on occurring events (known as reactive or ECA rules).

Example use cases

  • Build flexible content publishing workflows changes

  • Send customized mails to notify your users about important

  • Create custom redirections, system messages, breadcrumbs, ...
  • Build an eCommerce store using Drupal Commerce And many more...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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