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

Recent

Welcome to TinyPortal. Please login or sign up.

April 30, 2024, 08:57:22 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,174
  • Total Topics: 21,220
  • Online today: 147
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 113
  • Total: 113

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: