Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Role dependant content?
Is it possible to create a role-dependant content? Lets say I've created a page using Page Manager and want users with different roles see different content. Can it be done using PHP (Page Manager allows PHP)?
0
This discussion has been closed.
Comments
<p>Hello <?php echo $this->Context->Session->User->Name; ?> !</p>
What if statement should I use to determine a user's role?
<?php switch($this->Context->Session->User->RoleID) { case 4: // Administrator code case 3: // Member code case 2: // Banned code case 1: // Unauthenticated code }
<?php if ($this->Context->Session->UserID == 0) { $URL="http://path.to/forum/?Page=Guest"; header ("Location: $URL"); } ?>
This is what I use to re-direct non-members to a Page Manager page (called Guest) I want guests to see.
I hope it helps.
Later... Here it is in an if-else statement...
<?php if ($this->Context->Session->UserID > 0) { $URL="http://path.to/forum/?Page=Member"; header ("Location: $URL"); } else { $URL="http://path.to/forum/?Page=Guest"; header ("Location: $URL"); } ?>