PDA

View Full Version : req: moderator edit reason hack


teksigns
09-22-2004, 11:33 PM
i need a hack that will show a extra field to moderators and administrators
when editing a post....

this field would allow them to enter a staff note as to the reason why the post was edited ....

the reason for editing would then appear at the bottom of the postbit and only
be visable to administrators and moderators .

anyone have any idea if something like this is around ?

Johnny
09-23-2004, 12:03 AM
did a quick search
https://vborg.vbsupport.ru/showthread.php?p=554006#post554006

:)

teksigns
09-23-2004, 12:08 AM
did a quick search
https://vborg.vbsupport.ru/showthread.php?p=554006#post554006

:)


that is only for closing a thread ....

i dont want to close a thread ....
and i dont want the reason to be thread based ....


i need the the reason to be post based and not to close the thread .....

Johnny
09-23-2004, 01:25 AM
omg, im sorry i miss read the post i thought u were asking for reason for closing.

the edit reason is already default in vb, you can just go to edit anyones post and right below the title of the post should have a field for edit reason and it should display in the postbit

teksigns
09-23-2004, 01:37 AM
omg, im sorry i miss read the post i thought u were asking for reason for closing.

the edit reason is already default in vb, you can just go to edit anyones post and right below the title of the post should have a field for edit reason and it should display in the postbit


i realize this , however if i use the default edit reason then it shows
the reason to everyone ....


i dont want the reason visable to anyone except moderator and administrators .

and i dont want to get rid of the edit reason for members eather ....

so therefor i need a seperate edit reason field for admin or a checkbox
beside the reason field to hide the reason from members.....

Johnny
09-23-2004, 02:47 AM
well im not really sure how to have multiple group ids under one condition but you can do this

in your postbit template search for this


<if condition="$post['edit_reason']">$vbphrase[reason]: $post[edit_reason]</if>


replace with

<if condition="$post[usergroupid]==7">$vbphrase[reason]: $post[edit_reason]</if>
<if condition="$post[usergroupid]==6">$vbphrase[reason]: $post[edit_reason]</if>
<if condition="$post[usergroupid]==5">$vbphrase[reason]: $post[edit_reason]</if>



i added 3conditionals for each group u have u can replase 7,6,5 with whatever group u have ur moderators in or whatever group u want the ability to see the edit reason.


6= administrators
7= moderators
5= super moderators

someone correct me if their is an alternative.

teksigns
09-23-2004, 03:17 AM
yes i realize i could do :

<if condition="(in_array($post[usergroupid], array (7,6,5)))">


but this would defeat the purpose of having the reson for editing
box for regular users..... i want to keep the one for them ......
not restrict it completly .....

what it needs is a check box next to the reason field that only appears
to admin and moderators that when checked hides the reason from all
others except mods and admin ......

guess it would check using something like this:

<if condition="$post['edit_reason'] AND !$post['reason_allow']">$vbphrase[reason]: $post[edit_reason]</if>

however using something like this would require a template edit or something
to get the checkbox working

and another field added to the post table called "reason_allow".

basicly if you checked the box to hide the reason message for a post
it would set the default bit in "reason_allow" from 0 to 1.

however i have no idea what part of the php files to edit to get the new database field
updated when a user checks the box......

teksigns
09-23-2004, 04:32 AM
ok i made a hack myself for this and it seems to work ok ....



run this query :

ALTER TABLE `editlog` ADD `reason_hide` INT(1) DEFAULT '0' NOT NULL;



///////////////////////////////////


in template "postbit"

find:

<if condition="$post['edit_reason']">$vbphrase[reason]: $post[edit_reason]</if>


replace with :


<if condition="(($post['edit_reason'] AND $post['reason_hide'] != 1) OR (($post['edit_reason']) AND (in_array($bbuserinfo[usergroupid], array (7,6,5)))))"><b>$vbphrase[reason]: $post[edit_reason]</b></if>



////////////////////////////////////

in template "editpost"

find :

<div><input type="text" class="bginput" name="reason" value="$newpost[reason]" size="50" maxlength="200" tabindex="1" title="$vbphrase[optional]" /><input type="hidden" name="reason_exists" value="$edit[reason_exists]" /></div>
</div>



add after :


<if condition="(in_array($bbuserinfo[usergroupid], array (7,6,5)))">
<div>Hide Reason From Everyone Except Moderators and Administrators ? <input type="checkbox" name="reason_hide" value="1"></div></if>

///////////////////////////////////


in file : "editpost.php"


find :

$edit['reason'] = htmlspecialchars_uni(fetch_censored_text(trim($_PO ST['reason'])));


add after:

$edit['reason_hide'] = intval($_POST['reason_hide']);

------------------------------------


find:

$DB_site->query("
REPLACE INTO " . TABLE_PREFIX . "editlog (postid, userid, username, dateline, reason)
VALUES ($postid, $bbuserinfo[userid], '" . addslashes($bbuserinfo['username']) . "', " . TIMENOW . ", '" . addslashes($edit['reason']) . "')
");



change to :



$DB_site->query("
REPLACE INTO " . TABLE_PREFIX . "editlog (postid, userid, username, dateline, reason, reason_hide)
VALUES ($postid, $bbuserinfo[userid], '" . addslashes($bbuserinfo['username']) . "', " . TIMENOW . ", '" . addslashes($edit['reason']) . "', '" . addslashes($edit['reason_hide']) . "')
");



/////////////////////////////////////


in "shothread.php"

find :


editlog.reason AS edit_reason,


replace all with :


editlog.reason AS edit_reason, editlog.reason_hide AS reason_hide,


/////////////////////////////////////




thats it !


now you can hide the reason from all except : moderators - supermods - and admins.


i hope this helps someone else.....