06-22-2009, 08:40 AM
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.
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.



