1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Logout + redirect + message not possible

Discussion in 'Community' started by tritongr, Nov 10, 2019.

  1. tritongr

    tritongr New Member

    Level: Community
    In a form's onAfterProcess PHP I have this code:

    1. $app = JFactory::getApplication();
    2. $app->logout();
    3. $app->redirect("/success", "Successful save");
    4. return true;
    Works partially. User redirected to /success page and logged out, but no message appear.

    Following I swap lines 2 and 3,
    1. $app = JFactory::getApplication();
    2. $app->redirect("/success", "Successful save");
    3. $app->logout();
    4. return true;
    Works partially. User redirected to /success page and message appear but no logout executed

    Is it possible to achieve all 3? Redirect, message and logout?
     
  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    This is Joomla, not Fabrik.
    You can add messages with
    $app->enqueueMessage("your text");
     
  3. tritongr

    tritongr New Member

    Level: Community
    Thanks troester for the reply,

    but I try the following code without success on displaying the message "All good".
    Logout + redirect goes ok.
    $app = JFactory::getApplication();
    $app->enqueueMessage("All good");
    $app->logout();
    $app->enqueueMessage("All good");
    $app->redirect("/success", "Successful save");
    $app->enqueueMessage("All good");
    return true;

    The reason I need PHP for sending the message to the redirect page, is that I have to include some form field values (using placeholders etc).
     
  4. tritongr

    tritongr New Member

    Level: Community
    In fact after form submission I would like to logout the user and redirect to a page displaying some of the choices has made.
    Something like this: "You successfully submit the following choices ..."
     

Share This Page