A phantom user is someone who's opted out of the list and is hiding. If it's a small forum, you can easily do a user search and do a sort:Date; to narrow down who it might be.
For example, we can make a page (maybe with page manager extension) Who's OnLine.
This idea has become only because I assume, that with the big number of users calculation and printing of all users can become the reason of slow loading. I am not right?
The added load time for the panel should be negligable. The database queries are very light, and even with a lot of active users, you're still not looking at as much data as a very involved thread.
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?
Ok, so - me, not being a coder, I decided to take a stab at it. This is what I added to default.php:
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.
I also added this: 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 discussion
You don't want hat last block. It code redirects to the main page (sets browser location to index.php).
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 somebody is signed in, and they have the permission, then do the code between the { }
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
}
I tried both, but neither seemed to work as is. Should I be changing anything that you wrote?
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
}
I'm still very lost on this. I've read all the documentation, I've searched up and down in the forum, and I just can't see anything that would help me in my quest. Maybe I'm missing something in the Wiki, but is there something that shows you exactly how to set up permissions based on user-roles here in Vanilla?
Yah, everything appears to be working. However, when I uncheck it for a member, save it, it certainly saves, but it does not effect the user-experience of that role: they can still see Who's Online, regardless of whether or not they have permission to do so.
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 }