Prevent Adminposts
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Prevent Adminposts
Firstly, you might want to check the actions ($mybb->input['action']) before putting your code in.
Otherwise it might be better to hook elsewhere, eg moderation_do_deletethread.

Yeah, inline mod won't work because it's not sent through input that way.
Take a look at getids in moderation.php

Here's some example code from moderation.php:

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
    // Delete Threads - Inline moderation
    case "multideletethreads":
        add_breadcrumb($lang->nav_multi_deletethreads);
        
        if(!empty($mybb->input['searchid']))
        {
            // From search page
            $threads = getids($mybb->input['searchid'], 'search');
            if(!is_moderator_by_tids($threads, 'candeleteposts'))
            {
                error_no_permission();
            }
        }
        else
        {
            $threads = getids($fid, 'forum');
            if(!is_moderator($fid, 'candeleteposts'))
            {
                error_no_permission();
            }
        }

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Some little handy functions for our inline moderation
function getids($id, $type)
{
    global $mybb;
    
    $newids = array();    
    $cookie = "inlinemod_".$type.$id;
    $cookie_ids = explode("|", $mybb->cookies[$cookie]);
    
    foreach($cookie_ids as $cookie_id)
    {
        if(empty($cookie_id))
        {
            continue;
        }
        
        if($cookie_id == 'ALL')
        {
            $newids += getallids($id, $type);
        }
        else
        {
            $newids[] = intval($cookie_id);
        }
    }
    
    return $newids;
}


My Blog
12-15-2010 08:16 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: