Guest User

Untitled

a guest
Feb 15th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. $app = JFactory::getApplication();
  2. $message = "You must be logged in to view this content";
  3. $url = JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode('YOUR COMPONENT VIEW URL HERE')
  4. $app->redirect($url, $message);
  5.  
  6. <?php
  7. $user = JFactory::getUser();
  8. if($user->id=='' || $user->id==NULL){
  9. // Your message here.
  10. }else{
  11.  
  12. // Your code here
  13. }
  14. ?>
  15.  
  16. JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_users&view=login', JText::_("You must be logged in to view this content"));
  17.  
  18. $url = JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode('YOUR COMPONENT VIEW URL HERE')
  19. $this->setRedirect($url);
  20. return $this;
  21.  
  22. $app = JFactory::getApplication();
  23. $app->enqueueMessage("You must be logged in to view this content", "Notice");
Add Comment
Please, Sign In to add comment