Page 1 of 3

[MODDB] Invisible replies until replied

Posted: Thu Jun 08, 2006 5:05 am
by Lord Le Brand
MOD Title: Invisible replies until replied
MOD Description: This MOD makes replies invisible to a user until the user makes a reply in topics which have set 'Replies invisible'. Who can set replies invisible, is set per forum with the permissions page in the Admin Control Panel.
MOD Version: 1.2.2

MOD Download: http://mods.lordlebrand.ugboards.com/in ... _1.2.2.mod (use this while the official file isn't working)
Release topic: http://www.phpbb.com/community/viewtopic.php?t=560377

Demo board: n/a

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:

Code: Select all

##   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
##      - Fixed reply seeing auths
##
##   2006-09-16 - Version 1.1.1
##      - Fixed function
##      - Fixed so it supports editpost
##
##   2006-09-10 - 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

Posted: Thu Jun 08, 2006 6:42 pm
by Lord Le Brand
[update to 0.1.1]

Posted: Thu Jun 08, 2006 7:18 pm
by Ramon Fincken
will test this one..

I miss the code to remove topics/posts from the $userdata['auth_seereplies'] when a topic/post is deleted.

Will this mod allow a reply >> delete / edit >> reply again ?

Rfn

Posted: Thu Jun 08, 2006 7:32 pm
by Lord Le Brand
That's a good idea!
I'll work on this

Posted: Sun Jun 11, 2006 9:15 am
by Lord Le Brand
[Update to 0.2.0] , Useless codechanges deleted, Fixed wrong OPEN command, Fixed a few side-effects

Posted: Mon Jul 03, 2006 3:00 am
by Kster
Parse error: parse error, unexpected T_IS_EQUAL in /home/forums/public_html/forum/viewtopic.php on line 1498

got this error...

Posted: Mon Jul 03, 2006 8:44 am
by deny
I hope that you gonna to integrate this with attachment mod also.Invisible attach and text until someone reply.

Posted: Mon Jul 03, 2006 4:08 pm
by Kster
deny does yours work?
i've installed tons of mods but this is the only 1 that i can't seem to install properly

Posted: Tue Jul 04, 2006 1:55 pm
by deny
Kster wrote: deny does yours work?
i've installed tons of mods but this is the only 1 that i can't seem to install properly


I'm gonna to try this mod only if author confirm that it works with attachment mods.

error in viewtopic.php

Posted: Tue Aug 01, 2006 7:57 pm
by go.ozeni
I love the MOD that you set up, however I am having a problem with the viewtopic.php file.

After I add this new code:

Code: Select all

// Begin MOD: Invisible replies until replied
	$join_sql_table = (!$post_id) ? '' : ", " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2 ";
	$join_sql = (!$post_id) ? "t.topic_id = $topic_id" : "p.post_id = $post_id AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_id <= $post_id";
	$count_sql = (!$post_id) ? '' : ", COUNT(p2.post_id) AS prev_posts";
	
	$order_sql = (!$post_id) ? '' : "GROUP BY p.post_id, t.topic_id, f.forum_id, f.auth_seereply, u.auth_seereplies ORDER BY p.post_id ASC";
	
	$sql = "SELECT t.topic_id, f.forum_id, f.auth_seereply, u.auth_seereplies" . $count_sql . "
		FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . FORUMS_TABLE . " f" . $join_sql_table . "
		WHERE $join_sql
			AND f.forum_id = t.forum_id
			$order_sql";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql);
	}
	
	if ( !($forum_topic_data = $db->sql_fetchrow($result)) )
	{
		message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
	}

	if ( intval($forum_topic_data['auth_seereply']) == 0 )
	{
		message_die(GENERAL_ERROR, 'No Seereply set');
	}
	
	if ( $forum_topic_data['auth_seereply']) == 150 )
	{
		if ( !$userdata['auth_seereplies'] && $userdata['user_level'] != ADMIN )
		{
			$i = $total_posts;
		}
		else
		{
			$see_replies = explode(",",$userdata['auth_seereplies']);
	
			if ( ( !$userdata['session_logged_in'] || !in_array($topic_id, $see_replies ) ) && $userdata['user_level'] != ADMIN )
			{
				// Cannot see replies
	
				$i = $total_posts;
			}
		}
	}
	// End MOD: Invisible replies until replied	
and then when I go to look at any topics in my forums, I get this error:

Code: Select all

Parse error: syntax error, unexpected T_IS_EQUAL in /mywebsite/public_html/phpBB2/viewtopic.php on line 1009
I have tried and retried pasting it in and have also put it inside and outside the "}"

Has anyone else had this issue.

Posted: Tue Aug 01, 2006 9:24 pm
by ScienceTeacher
Thank you for filling the request!!! I tried out the MOD on your demo site and it works exactly as I hoped. After installation, there is a major problem with viewtopic.php. In fact, I am unable to view any topics on the board.

Posted: Wed Aug 02, 2006 7:20 pm
by ScienceTeacher
I went back to your 0.1.1 version. Viewing other forums after installation yields an Information box that states, "no seereply set." Playing around with the permissions allows configurations that allow you to view all topics or set to "Posted" on Reply Visibility which allows you to see only the first post (this is exactly what I need!).
The problem lies when a reply is made (or even starting a new topic), waiting to view your message or selecting "view my message," an information box states, "No posts exist for this topic" This happens when a reply is made no matter the permissions, always. Viewing the topic can happen, but you have to go back to the forum index, choose the forum, and select the topic.

Posted: Sat Sep 02, 2006 6:34 pm
by Lord Le Brand
Very very sorry for the late reply

I have fixed the MOD, now it should work

@deny:
This MOD makes replies invisible for a user until he/she replies: the first post is visible with all attachements, all other posts are completely invisible.

Anyway:

[Update to 0.3.0]
[Release as Alpha]

Thanks Lord

Posted: Sat Sep 02, 2006 8:56 pm
by ScienceTeacher
Great! School starts on Tuesday. I am swamped momentarily but will try it out as soon as I can. Thought you fell off the face of the Earth.

You rock!

great mod

Posted: Sun Sep 03, 2006 2:58 am
by swimjap
Thank you for fixing the mod. I am a good friend and colleague of the science teacher you have been working with. I just finished downloading the mod and works great. I was curious however. I was wondering if there is anyway you can make it so that the invisible reply can be switched on and off by topics instead of turning off the whole forum? Thanks.