TinyPortal
Development => Resources => Topic started by: Jyggafey on September 09, 2007, 01:42:13 PM
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
}
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');
Looks like its working with redirectexit('action=myaction') :)
just the action name redirected to '...index.php?actionname'
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: