Guest User

Untitled

a guest
Aug 14th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2. function redirectToLogin($msg = 'You must login first')
  3. {
  4. global $mainframe;
  5. $currentUser =& JFactory::getUser();
  6.  
  7. //If user is not logged-in
  8. if($currentUser->get('guest'))
  9. {
  10. $uri = JFactory::getURI();
  11. $return = $uri->toString();
  12.  
  13. $url = 'index.php?option=com_user&view=login';
  14. $url .= '&return='.base64_encode($return);
  15.  
  16. $mainframe->redirect($url, JText::_($msg));
  17. exit();
  18. }
  19. }
  20. ?>
Add Comment
Please, Sign In to add comment