2012-07-24, 03:43 AM
Anyone Willing To Help With Plugin Creation?
I Have made the Following Code
Please Post Below On the Basis Of How I Would Make this Into a Plugin...
I Want it To Be Displayed On The Top Of Index.php / Portal.php
i have the Basis Code Of It But how do incorporate it?
Thanks In Advance Please Reply
I Have made the Following Code
<h1>Show My Ip Address</h1><hr> By <strong>Legitmods.com</strong><br><br> Your Ip Address is: <strong><?php echo $_SERVER['REMOTE_ADDR']; ?></strong><br>
I Want to Add this To A PluginPlease Post Below On the Basis Of How I Would Make this Into a Plugin...
I Want it To Be Displayed On The Top Of Index.php / Portal.php
i have the Basis Code Of It But how do incorporate it?
<?php
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("index_start", "");
$plugins->add_hook("portal_start", "");
function ()
{
return array(
"name" => "IP on Index",
"title" => "",
"description" => "Displays Users Ip On on the index page.",
"website" => "http://www.legitmods.com",
"author" => "legitmods.com",
"authorsite" => "http://www.legitmods.com",
"version" => "",
'guid' => '',
'compatibility' => '14*,16*'
);
}
function _activate()
{
global $db;
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("index", '#{\$forums}#', "{\}\n{\$forums}");
$poi_group = array(
"gid" => NULL,
"name" => "",
"title" => "",
"description" => "Displays users Ip on the index page.",
"disporder" => "",
"isdefault" => "no"
);
$db->insert_query("settinggroups", $poi_group);
$gid = $db->insert_id();
$poi_1 = array(
"sid" => "NULL",
"name" => "",
"title" => "ip to show on Indexpage",
"description" => "The PID of the ip to show.",
"optionscode" => "none",
"value" => "",
"disporder" => "",
"gid" => intval($gid)
);
$db->insert_query("settings", $poi_1);
$poi_2 = array(
"sid" => "NULL",
"name" => "",
"title" => "",
"description" => "Choose if you want the ip to be shown on indexpage.",
"optionscode" => "yesno",
"value" => "1",
"disporder" => "2",
"gid" => intval($gid),
);
$db->insert_query("settings", $poi_2);
$poi_3 = array(
"sid" => "NULL",
"name" => "",
"title" => "",
"description" => "Choose if you want the ip to be shown on portalpage.",
"optionscode" => "yesno",
"value" => "1",
"disporder" => "3",
"gid" => intval($gid),
);
$db->insert_query("settings", $poi_3);
}
function ip_on_index_deactivate()
{
global $db;
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("index", '#{\}(\n?)#', '', 0);
find_replace_templatesets("portal", '#{\}(\n?)#', '', 0);
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name=''");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name=''");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name=''");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name=''");
}
function ()
{
global $mybb, $db, $templates, $theme, $lang, $showip;
$current_page = my_strtolower(basename(THIS_SCRIPT));
if ($current_page == 'index.php' && $mybb->settings[''] == '1'|| $current_page == 'portal.php'&& $mybb->settings[''] == '1' )
(
Thanks In Advance Please Reply