Hello everyone:
I have logintoboggan running and the redirects page to take users to the following page after login to choose their roles. At the moment it is a system of checks to either add or remove a certain role, but I'd like to make it so they only show up to add a role if they arent that role and only display to remove it if they aren't. Basically, I want a conditionals statement to display the form elements only if the users id and role id match that.
Here is the working model without conditionals, it just looks terrible if someone tries to add a role as a fan by accident if they are one and they get a database duplicate error, I want it to only show relevant choices... I got the idea from here: http://drupal.org/node/28379#comment-128757
<?php
global $user;
if ($_POST["AddFan"] == "Upgrade")
{
$userid = $user->uid;
db_query("INSERT INTO {users_roles} (rid, uid) VALUES ('%d','%d')", 4, $userid);
}
if ($_POST["AddBand"] == "Upgrade")
{
$userid = $user->uid;
db_query("INSERT INTO {users_roles} (rid, uid) VALUES ('%d','%d')", 5, $userid);
}
if ($_POST["AddBiz"] == "Upgrade")
{
$userid = $user->uid;
db_query("INSERT INTO {users_roles} (rid, uid) VALUES ('%d','%d')", 6, $userid);
}
if ($_POST["RemoveFan"] == "Downgrade")
{
$userid = $user->uid;