|
Need some help with this plugin.
|
|
06-22-2009, 08:40 AM
Post: #1
|
|||
|
|||
|
Need some help with this plugin.
If you can help me with creating this plug-in I will show my appreciation by becoming a subscriber here.
Need some help with creating a plug in. After reading all the tuts on the subject, here and at mybb I am half way there. I need some help to finish it up. The plug in I am trying to make is this tut by babjusi here. http://community.mybboard.net/thread-50878.html He said that he doe not have the time to do it himself and I am free to make it into a plug in. Here is what I have until now. Code: if(!defined("IN_MYBB")) { die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined."); } $plugins->add_hook("XXXXX", "hideonline"); function hideonline_info() { return array( "name" => "Hide online", "description" => "It will hide the online list from guests", "website" => "http://community.mybboard.net/", "version" => "1.0", "author" => "babjusi and that_guy", "authorsite" => "http://community.mybboard.net", "compatibility" => "14*", 'guid' => ' ' ); } function hideonline_activate() { global $db ; require MYBB_ROOT."/inc/adminfunctions_templates.php"; find_replace_templatesets("index_whosonline", '#'.preg_quote('<tr> <td class="tcat">').'#', '{$var}<tr> <td class="tcat">'); } function hideonline_info_deactivate() { global $db, $templates; include MYBB_ROOT."/inc/adminfunctions_templates.php"; find_replace_templatesets("index_whosonline", '#'.preg_quote('{$var}').'#', '', 0); } function hideonline() { global $mybb, $templates, $index_whosonline, $var, $settings, $lang; if($mybb->user["usergroup"]== 1){ $var = '<tr> <td class="tcat"><span class="smalltext"><strong>Users on line disabled</strong></span></td> </tr> <tr> <td class="trow1"><span class="smalltext">Sorry guest but you are not authorised to view the online list.</span></td> </tr>'; This is all I have. I have read and read the tuts but there are some things that I did not understand. I really hope that I get it as this way I refresh what I learn in php. 1. What is the name of the hook that I should define here Code: $plugins->add_hook("XXXXX", "hideonline"); 2. What about the global variables, are they ok in all functions or I have left something out? 3. What about the find and replace template sets, are they ok? Code: find_replace_templatesets("index_whosonline", '#'.preg_quote('<tr> <td class="tcat">').'#', '{$var}<tr> <td class="tcat">'); And this Code: find_replace_templatesets("index_whosonline", '#'.preg_quote('{$var}').'#', '', 0); And my last question is about the last function. Is this the way to format it? I would really be grateful for some help. |
|||
|
06-23-2009, 04:15 AM
(This post was last modified: 06-23-2009 04:16 AM by Lennart.)
Post: #2
|
|||
|
|||
|
RE: Need some help with this plugin.
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: PHP Code: You cannot view this code until you login or registerThis 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: PHP Code: You cannot view this code until you login or registerPHP Code: You cannot view this code until you login or registerPHP Code: You cannot view this code until you login or registerYou could also use the following construct after the PHP Code: You cannot view this code until you login or registerPHP Code: You cannot view this code until you login or registerNot 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
|
|||
|
06-23-2009, 06:55 AM
Post: #3
|
|||
|
|||
|
RE: Need some help with this plugin.
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 |
|||
|
06-23-2009, 07:10 AM
Post: #4
|
|||
|
|||
|
RE: Need some help with this plugin.
Allright, now I do understand what you would like to have
![]() It's late overhere, almost midnight. I will post your plugin here tomorrow. Good night Lennart Sauter Forum Admin
|
|||
|
Today, 00:00 AM
|
||
|
||
|
Advertisement
|
|
06-23-2009, 09:12 AM
Post: #5
|
|||
|
|||
|
RE: Need some help with this plugin.
Thank you very much Lennart.
|
|||
|
06-24-2009, 06:07 AM
Post: #6
|
|||
|
|||
|
RE: Need some help with this plugin.
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: hide online message.jpg (Size: 133.75 KB / Downloads: 5)
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
Forum Admin
|
|||
|
06-25-2009, 12:46 AM
Post: #7
|
|||
|
|||
|
RE: Need some help with this plugin.
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.
|
|||
|
06-25-2009, 12:47 AM
Post: #8
|
|||
|
|||
|
RE: Need some help with this plugin.
Allright, tell me if it worked then
![]() My sister uses her own laptop for homework - I do need my computer for business
Forum Admin
|
|||
|
06-25-2009, 02:18 AM
Post: #9
|
|||
|
|||
|
RE: Need some help with this plugin.
Very good work Lennart..!
It worked great Thankyou Learn About Mesothelioma Disease![]() Proud To Be A Muslim - Islam Is My Soul - I Love Islam |
|||
|
06-30-2009, 03:31 AM
Post: #10
|
|||
|
|||
|
RE: Need some help with this plugin.
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.
|
|||
|
« Next Oldest | Next Newest »
|

Startpage
Subscribe
Search
Member List
Help






![[Image: external.png]](http://www.mybbaddons.com/board/images/external/external.png)