2012-07-14, 06:17 AM
I'm trying to create a plugin which outputs a link on the member profile in the admin options table. I've got the following code so far:
It outputs my link, but not in the table, it outputs it above the forums (logo, header etc). Any help is appreciated.
<?php
$plugins->add_hook("member_profile_start", "reportuser");
function reportuser_info() {
return array(
"name" => "Report User",
"description" => "Adds a link to every users profile and gives the ability to report them as a spammer.",
"author" => "Shannon Rothe",
"version" => "1.0",
"website" => "http://jrpgclub.com/community",
"authorsite" => "http://jrpgclub.com/community",
"compatibility" => "*"
);
}
function reportuser_activate() {
global $db, $report_user;
$db->write_query("CREATE TABLE " . TABLE_PREFIX . "reportuser (
id INT AUTO_INCREMENT PRIMARY KEY,
ruid INT,
uid INT
)");
$template = array(
"title" => $db->escape_string('reportuser_link'),
"template" => "<li><a href=\"#\">Report this user</a></li>",
"sid" => -1,
"version" => 1608,
"dateline" => TIME_NOW
);
$db->insert_query("templates", $template);
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("member_profile_adminoptions", "#".preg_quote('{$lang->admin_ban_in_acp}</a></li>')."#i", "{\$lang->admin_ban_in_acp}</a></li>\n{\$report_user}");
}
function reportuser_deactivate() {
global $db;
$db->query("DROP TABLE " . TABLE_PREFIX . "reportuser");
$db->delete_query("templates", "title='reportuser_link'");
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("member_profile_adminoptions", '#'.preg_quote('{$report_user}').'#', '',0);
}
function reportuser() {
global $db, $memprofile, $templates;
eval("\$report_user = \"".$templates->get('reportuser_link')."\";");
output_page($report_user);
}
?>
It outputs my link, but not in the table, it outputs it above the forums (logo, header etc). Any help is appreciated.