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.
panel only visible to admins
hejhej.
is it possible to have the panel on the comments page only displayed when you are logged in as a admin?
is it possible to have the panel on the comments page only displayed when you are logged in as a admin?
0
This discussion has been closed.
Comments
create a new theme and put a conditional statement around the code of panel.php (some code is stolen from appg/init_vanilla.php)
// this code is not tested $DisplayPanel = false; if ( $Context->SelfUrl == "comments.php" ) { if ($Context->Session->UserID > 0) { $RequiredPermissions = array('PERMISSION_CHECK_FOR_UPDATES', 'PERMISSION_APPROVE_APPLICANTS', 'PERMISSION_MANAGE_REGISTRATION', 'PERMISSION_ADD_ROLES', 'PERMISSION_EDIT_ROLES', 'PERMISSION_REMOVE_ROLES', 'PERMISSION_ADD_CATEGORIES', 'PERMISSION_EDIT_CATEGORIES', 'PERMISSION_REMOVE_CATEGORIES', 'PERMISSION_SORT_CATEGORIES', 'PERMISSION_CHANGE_APPLICATION_SETTINGS', 'PERMISSION_MANAGE_EXTENSIONS', 'PERMISSION_MANAGE_LANGUAGE', 'PERMISSION_MANAGE_STYLES', 'PERMISSION_MANAGE_THEMES'); $RequiredPermissionsCount = count($RequiredPermissions); $i = 0; for ($i = 0; $i < $RequiredPermissionsCount; $i++) { if ($Context->Session->User->Permission($RequiredPermissions[$i])) { $DisplayPanel = true; break; } } } } if ( ! $Context->SelfUrl == "comments.php" OR $DisplayPanel ) { // old code in panel.php }
This should always display the panel on other pages than somments.php, and if we're in comments.php, display the panel only if we are authenticated and have a permission among those listed.
i get a php error because of the following lines
if ( $Context->SelfUrl == "comments.php" )
if ( ! $Context->SelfUrl == "comments.php" OR $DisplayPanel )
i tried
if (in_array($Context->SelfUrl, array("comments.php"))
but it didn't work. any idea?
Notice: Undefined variable: Context in /kunden/121606_86830/monstrs/forum/themes/monstrs/panel.php on line 4 Notice: Undefined variable: Context in /kunden/121606_86830/monstrs/forum/themes/monstrs/panel.php on line 33
Also, wouldn't this be easier?
// this code is not tested if ( ! $this->Context->SelfUrl == "comments.php" OR $this->Context->Session->User->RoleID > {whatever} ) { // old code in panel.php }