Is there any way to create or use any mycode only by an administrator?
If for example make an IFrame mycode, is very dangerous if anyone can use it.
So I want only the administrator to use it.
Any help?
You could probably code a plugin to process the mycode only if the user is an admin
this way the user dont see the output of the plugin...
I want the user to see the final output, but only the administrator can use it.
For example in another bb (simple machines) there is a tag [html] which can be used only by the admin.
Everything inside that tag is parsed like html.
All the users see the output but only the admin can use it.
If a user use the [html] tag then it renders simple as [html] text
I also wonder about ;/
waiting for someone reply
You could make a plugin which checks who has made the post.
for example something like:
<?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("parse_message", "iframe_run");
function iframe_info()
{
return array(
"name" => "iframe",
"description" => "iframe MyCode for certain users only",
"website" => "",
"author" => "",
"authorsite" => "",
"version" => "1.0",
"guid" => "",
"compatibility" => "14*"
);
}
function iframe_run($message)
{
global $mybb, $post;
$uid = intval($post['uid']);
if ($uid == X || $uid == Y)
{
$message = preg_replace("#\[iframe\](.*?)\[/iframe\]#i", '<iframe src="$1" width="98%" height="400" name="$1">iframe</iframe>', $message);
}
else
{
$message = preg_replace("#\[iframe\](.*?)\[/iframe\]#i", '<a href="$1" alt="" target="_blank">$1</a>', $message);
}
return $message;
}
?>
Just replace X and Y for $uid with the user id's of your admins (or any other user you want to allow it.)
Looks good.
But if I want to use some installed MyCodes?
doylecc thank you so much... Worked like a charm!!!