Prevent Adminposts
TriTop Offline
Member
***
Posts: 53
Joined: Apr 2008
Post: #1
Prevent Adminposts
Hey Comm!
Try to write a plugin that stop edit adminposts by moderators. At this hook:

PHP Code:
$plugins->add_hook('editpost_delete', 'adminposteditlock');

everything works fine. Unresolved problems with the inline moderation tool.
The variable $mybb->input['pid'] is not working. Test with:

PHP Code:
$tid = intval($mybb->input['tid']);
$query = $db->simple_select("posts", "*", "tid='$tid'");
$post = $db->fetch_array($query, "pid");

backfired.

Here is the complete codeblock:

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$plugins->add_hook('moderation_start', 'adminposteditlock_moderation');

function adminposteditlock_moderation()
{
global $db, $mybb;

$pid = intval($mybb->input['pid']);
$query = $db->simple_select("posts", "*", "pid='$pid'");
$post = $db->fetch_array($query);
$uid = $post['uid'];
$user = get_user($uid);
$group = usergroup_permissions($user['usergroup']);
if($mybb->usergroup['cancp'] != 1 && $group['cancp'] == 1)
{
error("This post was made by an Admin. Editing or deletion is not allowed.", "ERROR!");
}
}


oh well.....still learning. Any suggestions are welcome.

12-15-2010 04:47 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Prevent Adminposts - TriTop - 12-15-2010 04:47 AM
RE: Prevent Adminposts - ZiNgA BuRgA - 12-15-2010, 08:16 AM
RE: Prevent Adminposts - TriTop - 12-16-2010, 01:59 AM

 Standard Tools
Forum Jump: