TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,913
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 332
  • Total: 332

redirectexit in center block -> login status at target messed up

Started by Jyggafey, September 09, 2007, 01:42:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jyggafey

hi, i got a center block that redirects to a custom action under certain circumstances (user is logged in and a custom profile field is not set when visiting the forum index).
Im using redirectexit($scripturl.'/index.php?action=myaction'); to redirect.
When i visit my action by directly accessing the url it works like a charm, however when the user is redirected by the center block code the user is not logged in anymore when reaching my action page.
Heres my center block code:
global $user_profile, $modSettings, $user_info;
//is the user logged in?
if ($context['user']['is_logged'])
{
  $memID = $context['user']['id'];
  loadMemberData($memID);
  //if the field is not set
  if (!isset($user_profile[$memID]['options']['myfield']))
  {
    //redirect to qauth set page
    redirectexit('http://xxx.yy/forum/index.php?action=myaction');
  }
  else
  {
    //field is already set
  }
}
else
{
  //is guest (not logged in) or field disabled
}

IchBin

when using redirectexit I don't think you need the full URL if you're using an action. Not sure if that will make a difference to your problem, but all you need is the action name.

redirectexit('myaction');

Jyggafey

Looks like its working with redirectexit('action=myaction')  :)
just the action name redirected to '...index.php?actionname'

IchBin

I remembered reading about redirectexit at the function db at SMF. I guess I just didn't remember the proper string parameter lol. :) Glad you got it fixed though. :up:

This website is proudly hosted on Crocweb Cloud Website Hosting.