vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   req: moderator edit reason hack (https://vborg.vbsupport.ru/showthread.php?t=69751)

teksigns 09-22-2004 11:33 PM

req: moderator edit reason hack
 
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/showthrea...006#post554006

:)

teksigns 09-23-2004 12:08 AM

Quote:

Originally Posted by Johnny


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

Quote:

Originally Posted by Johnny
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

PHP Code:

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

replace with
PHP Code:

<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 :

Code:

<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:

Code:

<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 :

Code:

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


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


in template "postbit"

find:

Code:

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

replace with :


Code:

<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 :

Code:

<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 :


Code:

<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 :

Code:

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

add after:

Code:

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


find:

Code:

                        $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 :



Code:

                        $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 :


Code:

editlog.reason AS edit_reason,

replace all with :


Code:

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.....


All times are GMT. The time now is 03:11 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02637 seconds
  • Memory Usage 1,755KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (13)bbcode_code_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete