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.
Who's Online
This discussion has been closed.
Comments
With that said, it *is* possible to make it a seperate page. But I don't have the spare cycles to do it.
I want to specify who can see the "Who's Online" section. Basically, I only want admins to see it, and for it to not exist to anyone else. Any suggestions of how to setup permissions for this?
Under
$Context->Dictionary["MenuOptions"] = "Menu Options"; $Context->Dictionary["HideWhosOnline"] = "Hide the \"Who's Online\" panel"; $Context->Dictionary["Phantom"] = "Hide my username from the \"Who's Online\" panel";
I added:$Context->Dictionary['PERMISSION_SEE_WHOS_ONLINE'] = "See \"Who's Online\" panel";
Then, to set up the actual permission, I added:
// Default permissions $Context->Configuration['PERMISSION_SEE_WHOS_ONLINE'] = '0';
This put a new option in my role/permission menu. I gave the admin the ability to see it and left the normal member-role unchecked.
When I logged in through a member-based account, I could still see it.
So, I obviously can put the option in the role menu, however, its not actually creating that specific permission. How do I do that?
I borrowed my additional coding from the new Attachments default.php, but I'm not at the level of understanding where I can see what I am missing.
if ($Context->Session->UserID == 0 || ( $AccountUser->UserID != $Context->Session->UserID && !$Context->Session->User->Permission("PERMISSION_SEE_WHOS_ONLINE") )) { header('location:'.GetUrl($Configuration, 'index.php')); die(); }
per this discussionStill not working. Any thoughts?
Give this a try:
if ( $Context->Session->UserID > 0 && $Context->Session->User->Permission('PERMISSION_SEE_WHOS_ONLINE') ) { // extension code that adds list to the panel goes here }
The code literally means
If that doesn't work, rather than add your own permission, (Your code looks good to me, but I am not yet that familiar with permissions) you can piggy back this in on another existing permission:
if ( $Context->Session->UserID > 0 && $Context->Session->User->Permission('PERMISSION_EDIT_COMMENTS') ) { // code goes here }
But, regardless, this is how my code currently looks, and no matter if the permission is checked or unchecked, I can still see the Users Online area.
$Context->Dictionary["MenuOptions"] = "Menu Options"; $Context->Dictionary["HideWhosOnline"] = "Hide the \"Who's Online\" panel"; $Context->Dictionary["Phantom"] = "Hide my username from the \"Who's Online\" panel"; $Context->Dictionary['PERMISSION_SEE_WHOS_ONLINE'] = "See \"Who's Online\" panel"; // Default permissions $Context->Configuration['PERMISSION_SEE_WHOS_ONLINE'] = '0'; if ( $Context->Session->UserID > 0 && $Context->Session->User->Permission('PERMISSION_SEE_WHOS_ONLINE') ) { // extension code that adds list to the panel goes here }