Aerosmith
Experienced
Posts: 26
Registered: 4-12-2002
Location: Earth
Member Is Offline
Mood: Semi-something
|
|
[Resolved] Prevent disply of admin actions
Full Board URL: url invalid - provide a real forum address
XMB Version: 1.9.11
How do I disable the display of things like this ?
Thread Split
10-21-18 at 01:24 AM
|
|
bfgadmin
Member
Posts: 52
Registered: 5-7-2020
Location: Pittsburgh, PA
Member Is Offline
Mood: Technical
|
|
These are pulled out of $table_logs from your forum's database and displayed in-line.
There are a few options for preventing it. One would be removing the UNION SELECT statement from this query in viewthread.php
Code: |
$sql = "SELECT p.*, m.* "
. "FROM "
. "( "
. " ( "
. " SELECT 'post' AS type, fid, tid, author, subject, dateline, pid, message, icon, usesig, useip, bbcodeoff, smileyoff "
. " FROM ".X_PREFIX."posts "
. " WHERE tid=$tid AND (dateline > $startdate OR dateline = $startdate AND pid >= $startpid)"
. " ORDER BY dateline ASC, pid ASC "
. " LIMIT $ppp "
. " ) "
. " UNION ALL "
. " ( "
. " SELECT 'modlog' AS type, fid, tid, username AS author, action AS subject, date AS dateline, '', '', '', '', '', '', '' "
. " FROM ".X_PREFIX."logs "
. " WHERE tid=$tid AND date >= $startdate AND date < $enddate "
. " ) "
. ") AS p "
. "LEFT JOIN ".X_PREFIX."members m ON m.username=p.author "
. "ORDER BY p.dateline ASC, p.type DESC, p.pid ASC ";
$querypost = $db->query($sql);
|
Don't go nuking your forum with this just yet. I have a test board setup to check code before rolling it out to our production site. I'll remove it on
there and see what it does.
Also, since it is pulled from $table_logs, clearing the log would presumably have the same effect. So would preventing the log from being written in
the first place, although you'd lose the ability to audit moderators and other administrators (who can clear logs anyhow...)
Give me a few, I'll come up with something.
|
|
bfgadmin
Member
Posts: 52
Registered: 5-7-2020
Location: Pittsburgh, PA
Member Is Offline
Mood: Technical
|
|
OK, so I can verify that using the Admin CP feature "Clear CP Logs" only clears administrative logs and not use of moderator
functions (topicadmin.php stuff).
As written earlier, you can either 1) modify the above query to prevent mod logs from being displayed in-line with posts, 2) modify the query that
writes the logs or 3) manually clear the entries from $table_logs.
Here's a simple way of doing option #1. There are certainly prettier ways to go about this, but here's a quick & dirty way to disable it. Change
the above query to this:
Code: |
$sql = "SELECT p.*, m.* "
. "FROM "
. "( "
. " ( "
. " SELECT 'post' AS type, fid, tid, author, subject, dateline, pid, message, icon, usesig, useip, bbcodeoff, smileyoff "
. " FROM ".X_PREFIX."posts "
. " WHERE tid=$tid AND (dateline > $startdate OR dateline = $startdate AND pid >= $startpid)"
. " ORDER BY dateline ASC, pid ASC "
. " LIMIT $ppp "
. " ) "
. " UNION ALL "
. " ( "
. " SELECT 'modlog' AS type, fid, tid, username AS author, action AS subject, date AS dateline, '', '', '', '', '', '', '' "
. " FROM ".X_PREFIX."logs "
. " WHERE tid=$tid AND date >= $startdate AND date < 1 "
. " ) "
. ") AS p "
. "LEFT JOIN ".X_PREFIX."members m ON m.username=p.author "
. "ORDER BY p.dateline ASC, p.type DESC, p.pid ASC ";
|
The "sabotage" happens in the UNION ALL's where clause: WHERE tid=$tid AND date >= $startdate AND date < 1
On my test forum, this prevented in-line view of mod log entries while still preserving the log itself for auditing purposes. You could also easily
re-enable it once you realize how useful the feature is.
|
|
miqrogroove
|
|
This will be turned off by default in 1.9.12.
|
|
|