Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need some help with this plugin.
#1
Reply
#2
Hmm, this plugin shall hide the who's online page to guests, right?

First let me tell you that you can reach that easily going to your Admin CP:
Users & Groups -> Groups -> Edit group guests:
Miscellaneous -> Can view who's online?

If you want to do that manually, you should do something like that:

You are not allowed to see php code.
This is the hook just before the script shows the page.

Now, your current code will only show an additional error message to guests but lateron will still print the online users.

I'd use one of these methods:
You are not allowed to see php code.Explanation: We do need $mybb to check if the current mybb user who wants to see the who's online page is logged in. if he isn't we will not have a uid (userid):
You are not allowed to see php code.If we have a guest we'll show the error message (I took it from you) and lateron we'll do something very important:
You are not allowed to see php code.Exit means the script will stop here, so it'll not display any online users or do any other thing.
You could also use the following construct after the You are not allowed to see php code. but that's not recommended for integrated sites as the online.php - index.php would always show this error, forever and ever. But it's nice for other situations, I do use it at the galleries addon for example to exclude guests from editing or adding images:
You are not allowed to see php code.This will show a friendly redirect page to the guest telling him that he has no permission to see the site.
Not recommended for your plugin as it would always redirect to index.php.
You could do the redirect to the registration site though.

I hope that I understood your question and that you can understand my text.
If you have any questions please feel free to ask.

Thank you.

Best regards
Lennart Sauter
Forum Admin
Reply
#3
Thank you very much for your answer. Unfortunately I am not so good with php. Can you please make a plug in out of it. And yes I know that it can be don't with permissions but doing it like that will hide it completely from guests. I want to show it to them but instead of the online list I want them to see my message.
If you can make a plug-in that does just that then I will show my appreciation immediately by taking one subscription. I want this very bad because a forum that is my rival has it and it bugs me that I can not have it. Thank you
Reply
#4
Allright, now I do understand what you would like to have Smile

It's late overhere, almost midnight.

I will post your plugin here tomorrow.

Good night
Lennart Sauter
Forum Admin
Reply
#5
Thank you very much Lennart.
Reply
Register (for free) to hide the ads.
#6
No problem.

I looked into the MyBB code now and found out the following:
If the usergroup has no right to view the who's online list MyBB will not even show the template.

That was the mainreason why your plugin didn't work.

I updated the plugin now, see the attached file.
It should work fine, however at the moment it doesn't do the template edit if you activate the plugin (no idea why... but no time to look into it).

Install the plugin like that:
Upload the attached hideonline.php to your inc/plugins folder and activate in Admin CP. After that go to themes & templates -> templates -> edit your template set -> index templates -> index_boardstats.
Find {$whosonline} and after it add {$hideonline}.
Should work fine now and guests should see something like that:
   

Kind regards
Lennart Sauter

PS: If that was not what you wanted or if I can do anything else for you let me know. You don't have to give me any copyright as I didn't change much, it's 90% your code Wink


Attached Files
.php   hideonline.php (Size: 1.47 KB / Downloads: 5)
Forum Admin
Reply
#7
I will test this out as soon as I have access at my laptop which I have loaned it to my sis for her homework and will post back the results. Thank you very much.
Reply
#8
Allright, tell me if it worked then Smile

My sister uses her own laptop for homework - I do need my computer for business Big Grin
Forum Admin
Reply
#9
Very good work Lennart..!
It worked great
Thankyou
Reply
#10
Sorry for the delay. It did not worked for me. All it did was show the message below the users online. I do not know how to make a screenshot but I would have showed you.
Reply
Register (for free) to hide the ads.


Forum Jump:


Users browsing this thread: 1 Guest(s)