Member Accept Invite

[insert_php]

switch($_GET[‘invitation’]){

case ‘accept’ :
acceptInvite();
break;

case ‘decline’ :
declineInvite();
break;

default :
echo ‘You do not have permission to view this page.’;

}
///// functions /////

function acceptInvite(){
global $current_user;
$user_roles = $current_user->roles;
$user_role = array_shift($user_roles);
if($user_role == “invitedusers”) {
$current_user->set_role(‘Editor’);
echo $user_role;
echo ‘Thank you for accepting the invitation
‘;
echo ‘With this new privilege, you will be able to access the advanced features on the website, and contain information about those privileges.

‘;
echo ‘Click Here to return to the website‘;
}
}
?>

roles;
$user_role = array_shift($user_roles);
if($user_role == “invitedusers”) {
$current_user->set_role(‘subscriber’);
echo ‘You have declined your invitation.
‘;
echo ‘Your permissions have not changed.

‘;
echo ‘Click Here to return to the website‘;
}
}

///// START /////

[/insert_php]