MyBB Community Forums

Full Version: Plugin Insert Code in the End of Footer?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am almost done with my first plugin.

But I need some help here:

How can I put this code into the end of the footer template:
<?php
if ($mybb->user['uid'] != 0)
{

if ($mybb->user['toscheck'] != 100 && THIS_SCRIPT != "misc.php?page=tos")
{

echo "{$tospopup}";

}
}
?>

Thanks in advanced.
You will have to add it to the footer template.

Heres a snippet from one of my plugins
include MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("footer","/(".preg_quote("{\$auto_dst_detection}").")/i", "{\$hidesectionfooter}\n$1");

If the code you posted is all of your plugin then you've got alot to do.

Take a look at some other mybb plugins and see how they do what they do Toungue
Use find_replace function (try to understand what bleepy posted).
(2011-11-08, 07:09 PM)BleepyEvans Wrote: [ -> ]You will have to add it to the footer template.

Heres a snippet from one of my plugins
include MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("footer","/(".preg_quote("{\$auto_dst_detection}").")/i", "{\$hidesectionfooter}\n$1");

If the code you posted is all of your plugin then you've got alot to do.

Take a look at some other mybb plugins and see how they do what they do Toungue

So after what I understand I this is how it works?
include MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("footer","/(".preg_quote("{\$auto_dst_detection}").")/i", "{\$hidesectionfooter}\n$1");

So in:
include MYBB_ROOT."/inc/adminfunctions_templates.php";
It does so the plugin can access to the admin functions of the template?

And in:
find_replace_templatesets("footer"
It tells that the function should find and replace only in the footer template. Right?

But:
,"/(".preg_quote("{\$auto_dst_detection}").")/i", "{\$hidesectionfooter}\n$1");
But what does this mean?
Bump.

Does anyone knows.
find, {$auto_dst_detection} and add {$hidesectionfooter} before it on its own line

It varys depending on what you want it to do.
(2011-11-08, 08:31 PM)Dead Soul™ Wrote: [ -> ]But:
,"/(".preg_quote("{\$auto_dst_detection}").")/i", "{\$hidesectionfooter}\n$1");
But what does this mean?
Bump.

Does anyone knows.
It means it finds a variable called or specified ( here, we have specified {$auto_dst_detection} ) and ads your plugin variable just next or before (as specified) to it in the mentioned template (here, footer template).