How to redirect user according to their user groups in Joomla

I created my site in Joomla. On my site, I created 3 user groups ("guest", "unregistered", "registered") and I created one blog in the article called the abstract corner. The "guest" and "unregistered" user can simply view the recommendations, but they cannot submit abstracts. "Registered" user can submit abstracts. I am using two images to display the "abstract recommendations" and the "abstract view" link. How can I redirect this user to a specific article?

Please help me. I am new to Joomla.

+3


source to share


1 answer


here is the solution:



1.first you need to find out user group id

$user = JFactory::getUser();
$groups = $user->get('groups');

  foreach($groups as $group) {
 if ($group==3)//ex: group id is 3 for registered user 

 {

    echo"redirect page 1";

  }else{

   echo "redirect page 2";

     }


   }

      

+1


source







All Articles