Hello,

I want to redirect the user depeding on their role, if no destination is specified (if they log in from front page)... if they have already entered a URL and logged after, they should preserve destination....how do I have to insert this condition into my php snippet*
I tried to check whether 'destination' isset, but this did not work...

Best regards

Adriana

* this works, but I want to add preserving destination if a specific was chosen before login...

global $user;   
if (in_array('SchuelerIn_MNG',$user->roles)||in_array('SchuelerIn_KS',$user->roles))  { return 'fuer_schuelerinnen';   }   
elseif (in_array('Lehrperson',$user->roles))  {     return 'fuer_lehrkraefte';   }   
else {     return 'destination';   }

Comments

mithy’s picture

You have to understand that the destination param is always set in the login block, on the front page it is a destination to front page. I would add a condition for the current page, e.g. using the $_GET['q] param.

Hope this helps.