A mod I am developing requires the user to set some options before they can use it. As such, once the mod is installed, I'd like all the users to be redirected to the 'OPTIONS' page of my mod on login (if they haven't already set the options). Can someone guide me on how to to do this?
On a side not, can you also point me to more documentation on $context. Thanks.
For $context, it is filled dynamically in each action, so the variable has different values in different places.
Bes bet is to use
echo '<pre>';
print_r($context);
echo '</pre>';
Somewhere in index.template.php.
For redirect, you can use redirectexit()
http://support.simplemachines.org/function_db/index.php?action=view_function;id=224
Redirect -
So I will need to modify the login function, check if mod-options have been set, and accordingly redirectexit to appropriate action, right?
$context -
Can we add our own data to $context; like, $context["firstrun"] = 0 ?
Redirect - yes. Not sure how what you really want to do, but something in Register.php --> Register2() function. After the registration is complete, there is already a redirect:
redirectexit('action=login2;sa=check;member=' . $memberID, $context['server']['needs_login_fix']);
Where you are automatically logged in after register.
Maybe what you really need is to change the login2() function to check where you come from and then... do things :P
As for $context, yes, you can.
To clarify -
After a mod is installed by the administrator, I need all the EXISTING users to set some options before they can start using it. So I want to redirect them on their next login to an "introduction / option page" so that they are informed about the mod and can then set its options if they want to use it. I think the login function should do ... will look into it and get back.
Thanks for your help.
What options need configuring, exactly? The fact you have users that might not want to be involved does suggest you don't *need* them to configure it immediately.
Sure, in some cases a user may not need to configure a mod to use it. But some cases where you are integrating SMF with an external web app does require the immediate attention of the user (at-least in the form of a notification).
As with everything this goes so much easier when context is given as opposed to being very generic.