Access/Permissions error when user confirms e-mail

强颜欢笑 提交于 2019-12-25 02:23:00

问题


I have a "Join Now" menu option on the unregistered user front end. When a new user selects that menu option, they're presented the registration form. On completion they get a notice that a confirmation e-mail has been sent to them.

All standard stuff.

So... the user goes to their e-mail inbox, finds the confirmation e-mail and clicks the link. They're brought back to the site and they are still under the "Join Now" menu option...

https://www.example.com/index.php/join-now?view=login

So... the complete the login form, as expected. And there's the rub.

The 'Join Now' menu option is tied to the unregistered user permissions level and once they log in, it is no longer an active menu option. So, every time a new user logs in, they get an error message at the top of the page in the "drawer" box.

Error
You are not authorised to view this resource.

How do I fix that so that when they log in they get redirected back to the 'Home' menu and we don't get this error message? For the life of me I can't seem to figure that out, and I know it should be simple.


回答1:


You can put this inside your template:

$app = JFactory::getApplication();
$user = JFactory::getUser(); 
//redirect user if logged in
if ($user->id > 0) $app->redirect('index.php/menuwhereyouwanthimtogo');


来源:https://stackoverflow.com/questions/20912897/access-permissions-error-when-user-confirms-e-mail

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