Invisible Replies Until Replied

Mods etc.

Moderator: Integra Moderator

Invisible Replies Until Replied

PostAuthor: tmotley » Fri Aug 03, 2007 4:35 am

Your phpBB Version: 2.0.22
phpBB Type: Integramod 141
MODs: No
Your knowledge: Basic Knowledge
Board URL: http://motleyville.com

PHP Version:
MySQL Version:


What was done before the problem appeared?
Nothing


What was done to try to solve the problem?
No problem



De.scription and Message

I'd like to have this modification on my board. I have students post 'Guided Discussions' and I'd like them to not be able to see previous student responses until they've posted their own.

Here is the mod file for the mod. How difficult?

Code: Select all
################################################################ MOD Title]http://opensource.org/licenses/gpl-license.php[/url] GNU General Public License v2################################################################ For security purposes, please check: [url=http://www.phpbb.com/mods/#]http://www.phpbb.com/mods/#[/url]# for the latest version of this MOD. Although MODs are checked## before being allowed in the MODs Database there is no guarantee## that there are no security problems within the MOD. No support## will be given for MODs not found within the MODs Database which## can be found at [url=http://www.phpbb.com/mods/#]http://www.phpbb.com/mods/#[/url]############################################################# ## Author Notes:####    The MOD is based on the request made by ScienceTeacher in this thread:##        http://www.phpbb.com/phpBB/viewtopic.php?t=396216####    Before installing his MOD you should make a backup of all files and the database################################################################## MOD History:####   2007-02-04 - Version 1.2.2##      - Topic review fixed##      - Pagination fixed####   2006-11-11 - Version 1.2.1##      - Typos...####   2006-10-19 - Version 1.2.0##      - Fixed post editing####   2006-09-16 - Version 1.1.1##      - Fixed function##      - Fixed so it supports editpost####   2006-09-14 - Version 1.1.0##      - Fixed after getting denied##      - Changed the way it saves user in db##      - Added function to verify user can see replies [ can_seereplies($user_id, $topic_id) ]####   2006-09-10 - Version 1.0.0##      - Fixed minor MOD template flaws##      - Submitted to database####   2006-09-09 - Version 0.5.2##      - Forgot explode() and one $is_auth##      - Cleaned code for queries in viewtopic.php and includes/topic_review.php####   2006-09-08 - Version 0.5.1##      - Fixed MOD code to do what it should do####   2006-09-08 - Version 0.5.0##      - Added auth setting for who can set Invisible replies (default moderator)##      - Fixed bug that allowed viewing (individual) replies by adding &start=x to the url##      - Beta release####   2006-09-05 - Version 0.4.0##      - Changed to per topic specification##      - Changed auth info to topic-side information##      - Deletion now supported (because of topic-side info)##      - Database tables changed####   2006-06-11 - Version 0.3.0##      - Rewrote comparing 0.1.1 and 0.2.0##      - Alpha-release####   2006-06-11 - Version 0.2.0##      - Deleted useless codechanges##      - Fixed wrong OPEN command##      - Fixed side-effects####   2006-06-08 - Version 0.1.1##      - No more changing simple auths##      - Replaced TINYINT by SMALLINT####   2006-06-07 - Version 0.1.0##      - look up changes in files##      - Pre-Alpha release################################################################## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD##############################################################  ##-----[ SQL ]------------------------------------------#ALTER TABLE `phpbb_auth_access` ADD `auth_invis_reply` TINYINT(2) DEFAULT '0' NOT NULL;ALTER TABLE `phpbb_forums` ADD `auth_invis_reply` TINYINT(2) DEFAULT '0' NOT NULL;ALTER TABLE `phpbb_topics` ADD `no_seereply` TINYINT(1) DEFAULT '0' NOT NULL;CREATE TABLE `phpbb_topics_replied` (topic_id mediumint(8) DEFAULT '0' NOT NULL, user_replied mediumint(8) DEFAULT '0' NOT NULL);  ##-----[ OPEN ]------------------------------------------#posting.php  ##-----[ FIND ]------------------------------------------#             $bbcode_uid = '';     ##-----[ AFTER, ADD ]------------------------------------------#             // Begin MOD: Invisible replies until replied             $no_seereply = ( $HTTP_POST_VARS['no_seereply'] == 1 || $HTTP_POST_VARS['no_seereply'] == 'on' ) ? 1 : 0;             // End MOD: Invisible replies until replied  ##-----[ FIND ]------------------------------------------#                 submit_post($mode  ##-----[ IN-LINE FIND ]------------------------------------------#);  ##-----[ IN-LINE BEFORE, ADD ]------------------------------------------#, $no_seereply  ##-----[ FIND ]------------------------------------------#     $template->assign_block_vars('switch_type_toggle', array());     ##-----[ BEFORE, ADD ]------------------------------------------#     // Begin MOD: Invisible replies until replied     if ( $is_auth['auth_invis_reply'] )     {         $template->assign_block_vars('switch_seereply_checkbox', array());     }     // End MOD: Invisible replies until replied  ##-----[ FIND ]------------------------------------------#     'L_DELETE_POST' => $lang['Delete_post'],     ##-----[ AFTER, ADD ]------------------------------------------#     'L_NO_SEEREPLY' => $lang['No_seereply'],  ##-----[ OPEN ]------------------------------------------#viewtopic.php  ##-----[ FIND ]------------------------------------------#$sql = "SELECT u.username, u.user_id,  ##-----[ BEFORE, ADD ]------------------------------------------#// Begin MOD: Invisible replies until repliedif ( ! can_seereplies($userdata['user_id'], $topic_id) ){     $start = 0;     $limit = 1;     $post_time_order = 'ASC';}else{     $limit = $board_config['posts_per_page'];}// End MOD: Invisible replies until replied  ##-----[ FIND ]------------------------------------------#     LIMIT $start, ".$board_config['posts_per_page'];  ##-----[ REPLACE WITH ]------------------------------------------#     LIMIT $start, $limit";  ##-----[ OPEN ]------------------------------------------#admin/admin_forumauth.php  ##-----[ FIND ]------------------------------------------#     0  => array(  ##-----[ IN-LINE FIND ]------------------------------------------#),  ##-----[ IN-LINE BEFORE, ADD ]------------------------------------------#, AUTH_MOD  ##-----[ FIND ]------------------------------------------#     1  => array(  ##-----[ IN-LINE FIND ]------------------------------------------#),  ##-----[ IN-LINE BEFORE, ADD ]------------------------------------------#, AUTH_MOD  ##-----[ FIND ]------------------------------------------#         2  => array(  ##-----[ IN-LINE FIND ]------------------------------------------#),  ##-----[ IN-LINE BEFORE, ADD ]------------------------------------------#, AUTH_MOD  ##-----[ FIND ]------------------------------------------#         3  => array(  ##-----[ IN-LINE FIND ]------------------------------------------#),  ##-----[ IN-LINE BEFORE, ADD ]------------------------------------------#, AUTH_MOD  ##-----[ FIND ]------------------------------------------#         4  => array(  ##-----[ IN-LINE FIND ]------------------------------------------#),  ##-----[ IN-LINE BEFORE, ADD ]------------------------------------------#, AUTH_MOD  ##-----[ FIND ]------------------------------------------#         5  => array(  ##-----[ IN-LINE FIND ]------------------------------------------#),  ##-----[ IN-LINE BEFORE, ADD ]------------------------------------------#, AUTH_MOD  ##-----[ FIND ]------------------------------------------#         6  => array(  ##-----[ IN-LINE FIND ]------------------------------------------#),  ##-----[ IN-LINE BEFORE, ADD ]------------------------------------------#, AUTH_MOD  ##-----[ FIND ]------------------------------------------#$forum_auth_fields = array(  ##-----[ IN-LINE FIND ]------------------------------------------#);  ##-----[ IN-LINE BEFORE, ADD ]------------------------------------------#, 'auth_invis_reply'  ##-----[ FIND ]------------------------------------------#     'auth_pollcreate' => $lang['Pollcreate']);  ##-----[ BEFORE, ADD ]------------------------------------------#     'auth_invis_reply' => $lang['Invis_reply'],  ##-----[ OPEN ]------------------------------------------#admin/admin_ug_auth.php  ##-----[ FIND ]------------------------------------------#$forum_auth_fields = array(  ##-----[ IN-LINE FIND ]------------------------------------------#);  ##-----[ IN-LINE BEFORE, ADD ]------------------------------------------#, 'auth_invis_reply'  ##-----[ FIND ]------------------------------------------#     'auth_pollcreate' => AUTH_POLLCREATE);  ##-----[ BEFORE, ADD ]------------------------------------------#     'auth_invis_reply' => AUTH_INVIS_REPLY,  ##-----[ FIND ]------------------------------------------#     'auth_pollcreate' => $lang['Pollcreate']);  ##-----[ BEFORE, ADD ]------------------------------------------#     'auth_invis_reply' => $lang['Invis_reply'],  ##-----[ OPEN ]------------------------------------------#includes/auth.php  ##-----[ FIND ]------------------------------------------#             $a_sql = 'a.auth_view, a.auth_read,  ##-----[ IN-LINE FIND ]------------------------------------------#a.auth_pollcreate  ##-----[ IN-LINE AFTER, ADD ]------------------------------------------#, a.auth_invis_reply  ##-----[ FIND ]------------------------------------------#             $auth_fields = array('auth_view', 'auth_read',  ##-----[ IN-LINE FIND ]------------------------------------------#'auth_pollcreate'  ##-----[ IN-LINE AFTER, ADD ]------------------------------------------#, 'auth_invis_reply'  ##-----[ FIND ]------------------------------------------#         case AUTH_DELETE:             $a_sql = 'a.auth_delete';             $auth_fields = array('auth_delete');             break;  ##-----[ AFTER, ADD ]------------------------------------------#         // Begin MOD: Invisible replies until replied         case AUTH_INVIS_REPLY:             $a_sql = 'a.auth_invis_reply';             $auth_fields = array('auth_invis_reply');         break;         // End MOD: Invisible replies until replied         ##-----[ OPEN ]------------------------------------------#includes/constants.php  ##-----[ FIND ]------------------------------------------#?>  ##-----[ BEFORE, ADD ]------------------------------------------#// Begin MOD: Invisible replies until replieddefine('AUTH_INVIS_REPLY', 150);define('TOPICS_REPLIED_TABLE', $table_prefix.'topics_replied');// End MOD: Invisible replies until replied  ##-----[ OPEN ]------------------------------------------#includes/functions.php  ##-----[ FIND ]------------------------------------------#?>  ##-----[ BEFORE, ADD ]------------------------------------------#// Begin MOD: Invisible replies until repliedfunction can_seereplies($user_id, $topic_id){     global $db;     global $userdata, $is_auth;         $sql = "SELECT topic_id, no_seereply         FROM " . TOPICS_TABLE . "         WHERE topic_id = $topic_id";                 if ( !($result = $db->sql_query($sql)) )     {         message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql);     }       $see_reply_row = $db->sql_fetchrow($result);         if ( $see_reply_row['no_seereply'] == 1 )     {         if ( !$userdata['session_logged_in'] )         {             return false;         }                 $sql = "SELECT t.topic_id, t.no_seereply, r.user_replied, r.topic_id             FROM " . TOPICS_TABLE . " t, " . TOPICS_REPLIED_TABLE . " r             WHERE t.topic_id = $topic_id                 AND r.topic_id = t.topic_id";         if ( !($result = $db->sql_query($sql)) )         {             message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql);         }             $see_reply = array();             while ( $row = $db->sql_fetchrow($result) )         {             $see_reply[] = $row;         }                 if ( ! count($see_reply) )         {             return false;         }             for ( $i = 0; $i <count>  ##-----[ BEFORE, ADD ]------------------------------------------#// Begin MOD: Invisible replies until replied$lang['No_seereply'] = 'Make replies invisible for user who haven't posted in this topic';$lang['Invis_reply'] = 'Invisible replies';// End MOD: Invisible replies until replied  ##-----[ OPEN ]------------------------------------------#templates/subSilver/posting_body.tpl  ##-----[ FIND ]------------------------------------------#           <END>  ##-----[ AFTER, ADD ]------------------------------------------#           </Begin>           <BEGIN>           <tr>             <td>               <input>             </td>             <td><span>{L_NO_SEEREPLY}</span></td>           </tr>           <END>           </End>    ##-----[ SAVE/CLOSE ALL FILES ]------------------------------------------## EoM
Last edited by tmotley on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
User avatar
tmotley
IntegraMODerators
IntegraMODerators
 
Posts: 524
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 3:56 am
Cash on hand: 0.00
Location: Missouri, USA

Return to IntegraMOD Modifications

Who is online

Registered users: Bing [Bot], Helter

cron