How to redirect the user according to their user groups in Joomla

孤者浪人 提交于 2020-01-04 03:26:08

问题


I have created my website in Joomla. In my site I have created 3 user groups ('guest', 'unregistered', 'registered'), and I have created one blog kind of thing called abstract corner in article. The 'guest' and 'unregistered' user can just view the guidelines but they can't submit the abstracts. The 'registered' user can submit abstracts. I am using two images to display "abstract guidelines" and an "abstract submission" link. How can I redirect this user to particular article?

Please help me. I am new to Joomla .


回答1:


here is a 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";

     }


   }


来源:https://stackoverflow.com/questions/27873774/how-to-redirect-the-user-according-to-their-user-groups-in-joomla

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!