2009-11-08, 03:22 AM
(if you don't feel like reading all below, basically I am asking what I am doing wrong and is it even possible.)
So I noticed how useless the [change user] box was and thought about moving it. I don't really care that its there but figure it would be the perfect change to try and figure out the plugin system. So I fire up filezilla and open newthread.php and find
After a tiny bit of work I write my test plugin
As you may have figured out, it doesn't remove the [change user] box. No big deal to me but I am wondering how you would go about doing it. (Or is it even possible because it is before any run_hooks functions).
I would prefer you guys to explain what your code does (as I only care about this plugin in an educational sense).
Thanks for your time!
So I noticed how useless the [change user] box was and thought about moving it. I don't really care that its there but figure it would be the perfect change to try and figure out the plugin system. So I fire up filezilla and open newthread.php and find
// If we have a currently logged in user then fetch the change user box.
if($mybb->user['uid'] != 0)
{
eval("\$loginbox = \"".$templates->get("changeuserbox")."\";");
}
After a tiny bit of work I write my test plugin
<?php
// Disallow direct access to this file for security reasons
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("newthread_do_newthread_start
", "Sameuserer");
function Sameuser_info()
{
return array(
"name" => "Same user",
"description" => "Removes the usesless Change user under new topic",
"website" => "http://Fsdomain.com",
"author" => "Aaron Disibio",
"authorsite" => "http://Fsdomain.com",
"version" => "1.0",
"guid" => "",
"compatibility" => "*"
);
}
function Sameuserer($page)
{
str_replace("eval(\"\$loginbox = \"\".$templates->get(\"changeuserbox\").\"\";\");", "", $page);
}
?>
As you may have figured out, it doesn't remove the [change user] box. No big deal to me but I am wondering how you would go about doing it. (Or is it even possible because it is before any run_hooks functions).
I would prefer you guys to explain what your code does (as I only care about this plugin in an educational sense).
Thanks for your time!