Current time: 07-25-2014, 12:30 PM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mycode for Administrator only
10-15-2009, 01:18 PM
Post: #1
mycode for Administrator only
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?
Find all posts by this user
Quote this message in a reply
10-15-2009, 02:50 PM
Post: #2
RE: mycode for Administrator only
You could probably code a plugin to process the mycode only if the user is an admin

[Image: 1255110914.png]
Visit this user's website Find all posts by this user
Quote this message in a reply
10-15-2009, 03:16 PM
Post: #3
RE: mycode for Administrator only
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
Find all posts by this user
Quote this message in a reply
10-15-2009, 03:43 PM
Post: #4
RE: mycode for Administrator only
I also wonder about ;/
waiting for someone reply

Minimalistic Theme | Blue Theme
Auto Live Images Plugin - live statistics on your forum - user avatar, userbar, board signature.
Find all posts by this user
Quote this message in a reply
10-15-2009, 04:51 PM (This post was last modified: 10-15-2009 04:52 PM by doylecc.)
Post: #5
RE: mycode for Administrator only
You could make a plugin which checks who has made the post.

for example something like:

PHP Code:
<?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 == || $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.)

My plugins | AutoMedia 2.2
Visit this user's website Find all posts by this user
Quote this message in a reply
10-15-2009, 05:06 PM
Post: #6
RE: mycode for Administrator only
Looks good.

But if I want to use some installed MyCodes?

vBulletin/Wordpress/Magento/MyBB
Developer and Designer
Visit this user's website Find all posts by this user
Quote this message in a reply
10-15-2009, 05:33 PM
Post: #7
RE: mycode for Administrator only
doylecc thank you so much... Worked like a charm!!!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication