[RC-2] Moderate Topics / Posts in Forum

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Locked
AceMan
Registered User
Posts: 337
Joined: Thu Nov 15, 2001 6:47 am
Contact:

[RC-2] Moderate Topics / Posts in Forum

Post by AceMan »

this mod is being updated & recoded for 2.0.4 with many new features.. please head here:

http://www.phpbb.com/phpBB/viewtopic.php?t=67909



Posted in Requests:
Posted: Fri Apr 19, 2002 11:04 am Post subject: Administrator approval of posts
andras wrote: I would like to be able to approve the post that are being posted on my board. How could this be possible? I am not an expert in programming, but i can follow instructions really well.

Thank you,


Andras



Here you go...

here's a link to get file:
Approve_Posts_MOD-RC2.htm
control-a, control-c, control-v

The idea:
The forum is put on 'lockdown' so to speak. Normal permissions apply, and once a thread has started, users must then wait until a moderator 'approves' of their post before it is visible to the general public. Also, once the topic has been accepted, posts each also require moderation. The topic is NOT visible though the forum view, posts in the approved topic are visible however. (this can be changed, up to whoever wants to use it, i'll make that change if needed)


**Update** Status RC2. After two fresh - bare installs on private boards, i'm confident in the install :).. Now to test on some live boards..

here's the mod:

Code: Select all


##################################################################### 
## Mod Title: Approve_Posts_Mod
## Mod Version: 2.0.0 RC-2 :: Saturday, April 20, 2002 02:00 EST
## Author: Mike Dawidowicz php@elitemaps.com
## Author URL: http://www.elitemaps.com
## Description: Approve all posts and topics in selected 
## forum prior to them becoming visible to general public.
## 
## Installation Level: moderate 
## Installation Time: 10 Minutes 
## Files To Edit: constants.php, viewforum.php, viewtopic.php, 
## posting.php, lang_main.php, admin_forums.php, viewforum_body.tpl
## viewtopic_body.tpl, forum_edit_body.tpl
## Included Files: (n/a)
##################################################################### 
## Author Note:
## Create a Database Table in your phpBB2 database to use this MOD
#####################################################################
## Before Adding This MOD To Your Forum, You Should Back Up
## All Files Related To This MOD 
##################################################################### 
# 
#-----[ CREATE TABLE - MySQL ]---------------------------------------
#

# MySQL 3.x, 4.x
#
# Table structure for table 'phpbb_approve_posts'
# ( Change phpbb_ to the proper table_prefix as used by your phpBB )
#
CREATE TABLE phpbb_approve_posts (
   approval_id mediumint(8) UNSIGNED NOT NULL auto_increment,
   forum_id smallint(5) UNSIGNED DEFAULT '0' NOT NULL,
   topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
   in_topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
   post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
   KEY approval_id (approval_id)
);

# 
#-----[ OPEN ]-------------------------------------------------------
#

/phpBB2/includes/constants.php

# 
#-----[ FIND ]-------------------------------------------------------
# line: 179

define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');

# 
#-----[ AFTER, ADD ]-------------------------------------------------
# line: 180

// Approve_Posts_Mod
define('APPROVE_POSTS', $table_prefix.'approve_posts');

# 
#-----[ OPEN ]-------------------------------------------------------
#

/phpBB2/viewforum.php

# 
#-----[ FIND ]------------------------------------------------------- 
# line: 444 - 451

//
// Okay, lets dump out the page ...
//
if( $total_topics )
{
	for($i = 0; $i < $total_topics; $i++)
	{
		$topic_id = $topic_rowset[$i]['topic_id'];

# 
#-----[ AFTER, ADD ]------------------------------------------------- 
# line: 452 - 504

	  //
	  // Begin Approve_Posts_Mod
	  //
	  $approve_posts_enabled = False;
	  $approve_posts_link = "";
	  $sql = "SELECT * FROM " . APPROVE_POSTS . " WHERE forum_id = $forum_id";
  	  if ( !($result = $db->sql_query($sql)) )
	  {
		 message_die(GENERAL_ERROR, 'Could not obtain forum approval information', '', __LINE__, __FILE__, $sql);
	  }
	  if ( $row = $db->sql_fetchrow($result) )
	  {	
			$sql = "SELECT * FROM " . APPROVE_POSTS . " WHERE topic_id = $topic_id";
			if ( !($result = $db->sql_query($sql)) )
			{
			   message_die(GENERAL_ERROR, 'Could not obtain topic approval information', '', __LINE__, __FILE__, $sql);
			}
			if ( $row = $db->sql_fetchrow($result) )
			{
				$approve_posts_enabled = $row['topic_id'];
				if ( $approve_posts_enabled != 0 )
				{
					$approve_posts_enabled = True;
				}
			}
	  }
	  if ( $is_auth['auth_mod'] )
	  {
		$approve_posts_enabled = False;
		if ( $row['topic_id'] == $topic_id )
		{
			$approve_posts_link = "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . "\">" . $lang['APPROVE_AWAITING'] . "</a>";
		}
		else
		{
			$sql = "SELECT * FROM " . APPROVE_POSTS . " WHERE in_topic_id = $topic_id";
			if ( !($result = $db->sql_query($sql)) )
			{
			   message_die(GENERAL_ERROR, 'Could not obtain post approval information', '', __LINE__, __FILE__, $sql);
			}
			if ( $row = $db->sql_fetchrow($result) )
			{
				if ( $row['in_topic_id'] == $topic_id )
				{
					$approve_posts_link = "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . "\">" . $lang['APPROVE_HAS_AWAITING'] . "</a>";
				}
			}
		}
	  }
	  if ( !$approve_posts_enabled ) {
	  //
	  // End Approve_Posts_Mod
	  //
# 
#-----[ FIND ]------------------------------------------------------- 
# approx line: 690 - 712

		$template->assign_block_vars('topicrow', array(
			'ROW_COLOR' => $row_color,
			'ROW_CLASS' => $row_class,
			'FORUM_ID' => $forum_id,
			'TOPIC_ID' => $topic_id,
			'TOPIC_FOLDER_IMG' => $folder_image, 
			'TOPIC_AUTHOR' => $topic_author, 
			'GOTO_PAGE' => $goto_page,
			'REPLIES' => $replies,
			'NEWEST_POST_IMG' => $newest_post_img, 
			'TOPIC_TITLE' => $topic_title,
			'TOPIC_TYPE' => $topic_type,
			'VIEWS' => $views,
			'FIRST_POST_TIME' => $first_post_time, 
			'LAST_POST_TIME' => $last_post_time, 
			'LAST_POST_AUTHOR' => $last_post_author, 
			'LAST_POST_IMG' => $last_post_url, 

			'L_TOPIC_FOLDER_ALT' => $folder_alt, 

			'U_VIEW_TOPIC' => $view_topic_url)
		);
	}
# 
#-----[ REPLACE WITH ]----------------------------------------------- 
# approx line: 690 - 714

		$template->assign_block_vars('topicrow', array(
			'ROW_COLOR' => $row_color,
			'ROW_CLASS' => $row_class,
			'FORUM_ID' => $forum_id,
			'TOPIC_ID' => $topic_id,
			'TOPIC_FOLDER_IMG' => $folder_image, 
			'TOPIC_AUTHOR' => $topic_author, 
			'GOTO_PAGE' => $goto_page,
			'REPLIES' => $replies,
			'NEWEST_POST_IMG' => $newest_post_img, 
			'TOPIC_TITLE' => $topic_title,
			'TOPIC_TYPE' => $topic_type,
			'VIEWS' => $views,
			'FIRST_POST_TIME' => $first_post_time, 
			'LAST_POST_TIME' => $last_post_time, 
			'LAST_POST_AUTHOR' => $last_post_author, 
			'LAST_POST_IMG' => $last_post_url, 

			'L_TOPIC_FOLDER_ALT' => $folder_alt, 

			'U_VIEW_TOPIC' => $view_topic_url,
			'APPROVE_POSTS_LINK' => $approve_posts_link)
		);
	}
  }// Approve_Posts_Mod: Only display this topic if it's been approved

# 
#-----[ OPEN ]------------------------------------------------------- 
#

/phpBB2/viewtopic.php

#
#-----[ FIND ]-------------------------------------------------------
# line: 645 - 649

//
// Does this topic contain a poll? 
//
if ( !empty($forum_row['topic_vote']) )
{

# 
#-----[ REPLACE WITH ]----------------------------------------------- 
# approx line: 645 - 692

//
// Begin Approve_Posts_Mod
//
$sql = "SELECT * FROM " . APPROVE_POSTS . " WHERE forum_id = $forum_id";
if ( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not obtain forum approval information', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{	
		$sql = "SELECT * FROM " . APPROVE_POSTS . " WHERE topic_id = $topic_id";
		if ( !($result = $db->sql_query($sql)) )
		{
		   message_die(GENERAL_ERROR, 'Could not obtain topic approval information', '', __LINE__, __FILE__, $sql);
		}
		if ( $row = $db->sql_fetchrow($result) )
		{
			if ( $row['topic_id'] != 0 )
			{
				$approve_posts_enabled = True;
			}
		}
}
if ( $is_auth['auth_mod'] )
{
	$approve_posts_enabled = False;
	if ( $row['topic_id'] == $topic_id )
	{
		$approve_posts_link = "<br><a href=\"" . append_sid("viewtopic.$phpEx?t=$topic_id" . "&approve_topic=$topic_id") . "\">" . $lang['APPROVE_POSTS_LINK'] . "</a>";
	}
	if ( $approve_topic == $topic_id )
	{
		$approve_posts_link = "";
		$sql = "DELETE FROM " . APPROVE_POSTS . " WHERE topic_id = $approve_topic";
		if ( !($result = $db->sql_query($sql)) )
		{
		   message_die(GENERAL_ERROR, 'Could not approve the selected topic', '', __LINE__, __FILE__, $sql);
		}
	}
}
//
// End Approve_Posts_Mod
//

//
// Does this topic contain a poll? 
//
if ( !empty($forum_row['topic_vote']) && !$approve_posts_enabled )
{

#
#-----[ FIND ]-------------------------------------------------------
# approx line: 836 - 839 

//
// Okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ...
//
for($i = 0; $i < $total_posts; $i++)
{

# 
#-----[ AFTER, ADD ]------------------------------------------------- 
# approx line: 842 - 896

	//
	// Begin Approve_Posts_Mod
	//
	$approve_posts_link = "";
	$sql =  "SELECT * FROM " . APPROVE_POSTS . " WHERE forum_id = $forum_id";
	if ( !($result = $db->sql_query($sql)) )
	{
	   message_die(GENERAL_ERROR, 'Could not obtain forum approval information', '', __LINE__, __FILE__, $sql);
	}
	if ( $row = $db->sql_fetchrow($result) )
	{	
			$sql = "SELECT * FROM " . APPROVE_POSTS . " WHERE post_id = '" .  $postrow[$i]['post_id'] . "'";
			if ( !($result = $db->sql_query($sql)) )
			{
			   message_die(GENERAL_ERROR, 'Could not obtain post approval information', '', __LINE__, __FILE__, $sql);
			}
			if ( $row = $db->sql_fetchrow($result) )
			{
				if ( $row['post_id'] != 0 )
				{
					$approve_posts_enabled = True;
				}
			}
	}
	if ( $is_auth['auth_mod'] )
	{
		$approve_posts_enabled = False;
		if ( $row['post_id'] )
		{
			if ( $approve_post == $postrow[$i]['post_id'] )
			{
				$approve_posts_link = "";
				$sql = "DELETE FROM " . APPROVE_POSTS . " WHERE post_id = $approve_post";
				if ( !($result = $db->sql_query($sql)) )
				{
				   message_die(GENERAL_ERROR, 'Could not approve the selected post', '', __LINE__, __FILE__, $sql);
				}
			}
			else 
			{	
				if ( $i==0 )
				{
					$approve_posts_link = "<br><a href=\"" . append_sid( "viewtopic.$phpEx?t=$topic_id&approve_post=" . $postrow[$i]['post_id'] . "&approve_topic=$topic_id") . "\">" . $lang['APPROVE_POSTS_LINK'] . "</a>";
				}
				else
				{
					$approve_posts_link = "<br><a href=\"" . append_sid("viewtopic.$phpEx?t=$topic_id&approve_post=" . $postrow[$i]['post_id']) . "\">" . $lang['APPROVE_POSTS_LINK'] . "</a>";
				}
			}
		}
	}
	if ( !$approve_posts_enabled ) {
	//
	// End Approve_Posts_Mod
	//
#
#-----[ FIND ]------------------------------------------------------- 
# approx line: 1294 - 1344


	$template->assign_block_vars('postrow', array(
		'ROW_COLOR' => '#' . $row_color,
		'ROW_CLASS' => $row_class,
		'POSTER_NAME' => $poster,
		'POSTER_RANK' => $poster_rank,
		'RANK_IMAGE' => $rank_image,
		'POSTER_JOINED' => $poster_joined,
		'POSTER_POSTS' => $poster_posts,
		'POSTER_FROM' => $poster_from,
		'POSTER_AVATAR' => $poster_avatar,
		'POST_DATE' => $post_date,
		'POST_SUBJECT' => $post_subject,
		'MESSAGE' => $message, 
		'SIGNATURE' => $user_sig, 
		'EDITED_MESSAGE' => $l_edited_by, 

		'MINI_POST_IMG' => $mini_post_img, 
		'PROFILE_IMG' => $profile_img, 
		'PROFILE' => $profile, 
		'SEARCH_IMG' => $search_img,
		'SEARCH' => $search,
		'PM_IMG' => $pm_img,
		'PM' => $pm,
		'EMAIL_IMG' => $email_img,
		'EMAIL' => $email,
		'WWW_IMG' => $www_img,
		'WWW' => $www,
		'ICQ_STATUS_IMG' => $icq_status_img,
		'ICQ_IMG' => $icq_img, 
		'ICQ' => $icq, 
		'AIM_IMG' => $aim_img,
		'AIM' => $aim,
		'MSN_IMG' => $msn_img,
		'MSN' => $msn,
		'YIM_IMG' => $yim_img,
		'YIM' => $yim,
		'EDIT_IMG' => $edit_img,
		'EDIT' => $edit,
		'QUOTE_IMG' => $quote_img,
		'QUOTE' => $quote,
		'IP_IMG' => $ip_img, 
		'IP' => $ip, 
		'DELETE_IMG' => $delpost_img, 
		'DELETE' => $delpost, 

		'L_MINI_POST_ALT' => $mini_post_alt, 

		'U_MINI_POST' => $mini_post_url,
		'U_POST_ID' => $postrow[$i]['post_id'])
	);
}

# 
#-----[ REPLACE WITH ]----------------------------------------------- 
# approx line: 1275 - 1381


	$template->assign_block_vars('postrow', array(
		'ROW_COLOR' => '#' . $row_color,
		'ROW_CLASS' => $row_class,
		'POSTER_NAME' => $poster,
		'POSTER_RANK' => $poster_rank,
		'RANK_IMAGE' => $rank_image,
		'POSTER_JOINED' => $poster_joined,
		'POSTER_POSTS' => $poster_posts,
		'POSTER_FROM' => $poster_from,
		'POSTER_AVATAR' => $poster_avatar,
		'POST_DATE' => $post_date,
		'POST_SUBJECT' => $post_subject,
		'MESSAGE' => $message, 
		'SIGNATURE' => $user_sig, 
		'EDITED_MESSAGE' => $l_edited_by, 

		'MINI_POST_IMG' => $mini_post_img, 
		'PROFILE_IMG' => $profile_img, 
		'PROFILE' => $profile, 
		'SEARCH_IMG' => $search_img,
		'SEARCH' => $search,
		'PM_IMG' => $pm_img,
		'PM' => $pm,
		'EMAIL_IMG' => $email_img,
		'EMAIL' => $email,
		'WWW_IMG' => $www_img,
		'WWW' => $www,
		'ICQ_STATUS_IMG' => $icq_status_img,
		'ICQ_IMG' => $icq_img, 
		'ICQ' => $icq, 
		'AIM_IMG' => $aim_img,
		'AIM' => $aim,
		'MSN_IMG' => $msn_img,
		'MSN' => $msn,
		'YIM_IMG' => $yim_img,
		'YIM' => $yim,
		'EDIT_IMG' => $edit_img,
		'EDIT' => $edit,
		'QUOTE_IMG' => $quote_img,
		'QUOTE' => $quote,
		'IP_IMG' => $ip_img, 
		'IP' => $ip, 
		'DELETE_IMG' => $delpost_img, 
		'DELETE' => $delpost, 

		'L_MINI_POST_ALT' => $mini_post_alt, 

		'U_MINI_POST' => $mini_post_url,
		'U_POST_ID' => $postrow[$i]['post_id'],
		'APPROVE_POSTS_LINK' => $approve_posts_link)
	);
  }
  else
  {
  	$template->assign_block_vars('postrow', array(
		'ROW_COLOR' => '#' . $row_color,
		'ROW_CLASS' => $row_class,
		'POSTER_NAME' => $poster,
		'POSTER_RANK' => $poster_rank,
		'RANK_IMAGE' => $rank_image,
		'POSTER_JOINED' => $poster_joined,
		'POSTER_POSTS' => $poster_posts,
		'POSTER_FROM' => $poster_from,
		'POSTER_AVATAR' => $poster_avatar,
		'POST_DATE' => $post_date,
		'POST_SUBJECT' => $post_subject,
		'MESSAGE' => $lang['APPROVE_POSTS_MSG'], 
		'SIGNATURE' => $user_sig, 
		'EDITED_MESSAGE' => $l_edited_by, 

		'MINI_POST_IMG' => $mini_post_img, 
		'PROFILE_IMG' => $profile_img, 
		'PROFILE' => $profile, 
		'SEARCH_IMG' => $search_img,
		'SEARCH' => $search,
		'PM_IMG' => $pm_img,
		'PM' => $pm,
		'EMAIL_IMG' => $email_img,
		'EMAIL' => $email,
		'WWW_IMG' => $www_img,
		'WWW' => $www,
		'ICQ_STATUS_IMG' => $icq_status_img,
		'ICQ_IMG' => $icq_img, 
		'ICQ' => $icq, 
		'AIM_IMG' => $aim_img,
		'AIM' => $aim,
		'MSN_IMG' => $msn_img,
		'MSN' => $msn,
		'YIM_IMG' => $yim_img,
		'YIM' => $yim,
		'EDIT_IMG' => $edit_img,
		'EDIT' => $edit,
		'QUOTE_IMG' => $quote_img,
		'QUOTE' => $quote,
		'IP_IMG' => $ip_img, 
		'IP' => $ip, 
		'DELETE_IMG' => $delpost_img, 
		'DELETE' => $delpost, 

		'L_MINI_POST_ALT' => $mini_post_alt, 

		'U_MINI_POST' => $mini_post_url,
		'U_POST_ID' => $postrow[$i]['post_id'],
		'APPROVE_POSTS_LINK' => $approve_posts_link)
	);
  }// Approve_Posts_Mod : Only display this topic if it's been approved
}

# 
#-----[ OPEN ]------------------------------------------------------- 
#

/phpBB2/posting.php

# 
#-----[ FIND ]-------------------------------------------------------
# line: 531 - 538


			if ( $error_msg == '' )
			{
				$topic_type = ( $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type;

				submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length);
				if ( $error_msg == '' )
				user_notification($mode, $post_data, $forum_id, $topic_id, $post_id, $notify_user);
			}
# 
#-----[ REPLACE WITH ]----------------------------------------------- 
# line: 531 - 571

			if ( $error_msg == '' )
			{
				$topic_type = ( $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type;

				submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length);
				if ( $error_msg == '' )
				user_notification($mode, $post_data, $forum_id, $topic_id, $post_id, $notify_user);
				
				//
				// Begin Approve_Posts_Mod
				//
				$sql = "SELECT * FROM " . APPROVE_POSTS . " WHERE forum_id = $forum_id";
				if ( !($result = $db->sql_query($sql)) )
				{
				   message_die(GENERAL_ERROR, 'Could not obtain forum approval information', '', __LINE__, __FILE__, $sql);
				}
				if ( $row = $db->sql_fetchrow($result) )
				{					
					if ( $row['forum_id'] != 0 )
					{
						$approve_posts_enabled = True;
					}
				}
				if ( $approve_posts_enabled )
				{
					if ( $mode == 'newtopic' )
					{
						$sql = "INSERT INTO " . APPROVE_POSTS . " (post_id, topic_id) VALUES ($post_id, $topic_id)";
					}
					else if ($mode == 'editpost' || $mode == 'reply')
					{
						$sql ="INSERT INTO " . APPROVE_POSTS . " (post_id, in_topic_id) VALUES ($post_id, $topic_id)";
					}
					if ( !($result = $db->sql_query($sql)) )
					{
					   message_die(GENERAL_ERROR, 'Could not insert post approval information', '', __LINE__, __FILE__, $sql);
					}
				}
				//
				// End Approve_Posts_Mod
				//
			}

# 
#-----[ OPEN ]------------------------------------------------------- 
#

/phpBB2/language/lang_english/lang_main.php

# 
#-----[ FIND ]------------------------------------------------------- 
# line: 988

//
// That's all Folks!
// ------------------------------------------------------------------

?>

# 
#-----[ BEFORE, ADD ]------------------------------------------------ 
# approx line: 987

//
// Approve_Posts_Mod
//
$lang['APPROVE_POSTS_LINK'] = "Approve this post";
$lang['APPROVE_POSTS_MSG'] = "<br><center><b>*** POST AWAITING MODERATOR APPROVAL ***</b></center><br>";
$lang['APPROVE_POSTS'] = "Moderator Approve of all Posts:";
$lang['APPROVE_AWAITING'] = "This topic is awaiting approval";
$lang['APPROVE_HAS_AWAITING'] = "This topic has posts awaiting approval";


# 
#-----[ OPEN ]------------------------------------------------------- 
#

/phpBB2/admin/admin_forums.php


# 
#-----[ FIND ]-------------------------------------------------------
# line: 269


				//
				// start forum prune stuff.
				//
				if( $row['prune_enable'] )
				{
					$prune_enabled = "checked=\"checked\"";
					$sql = "SELECT *
               			FROM " . PRUNE_TABLE . "
               			WHERE forum_id = $forum_id";
					if(!$pr_result = $db->sql_query($sql))
					{
						 message_die(GENERAL_ERROR, "Auto-Prune: Couldn't read auto_prune table.", __LINE__, __FILE__);
        			}

					$pr_row = $db->sql_fetchrow($pr_result);
				}
				else
				{
					$prune_enabled = '';
				}

# 
#-----[ BEFORE, ADD ]------------------------------------------------ 
# approx line: 269 - 286 


				//
				// Begin Approve_Posts_Mod
				//
				$sql = $sql = "SELECT * FROM " . APPROVE_POSTS . " WHERE forum_id = $forum_id";
				if ( !($result = $db->sql_query($sql)) )
				{
				   message_die(GENERAL_ERROR, 'Could not obtain forum approval information', '', __LINE__, __FILE__, $sql);
				}
				if ( $row = $db->sql_fetchrow($result) )
				{					
					if ( $row['forum_id'] != 0 )
					{
						$approve_posts_enabled = "checked";
					}
				}
				//
				// End Approve_Posts_Mod
				//

# 
#-----[ FIND ]------------------------------------------------------- 
# approx line: 333 - 358

			$template->assign_vars(array(
				'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"),
				'S_HIDDEN_FIELDS' => $s_hidden_fields,
				'S_SUBMIT_VALUE' => $buttonvalue, 
				'S_CAT_LIST' => $catlist,
				'S_STATUS_LIST' => $statuslist,
				'S_PRUNE_ENABLED' => $prune_enabled,

				'L_FORUM_TITLE' => $l_title, 
				'L_FORUM_EXPLAIN' => $lang['Forum_edit_delete_explain'], 
				'L_FORUM_SETTINGS' => $lang['Forum_settings'], 
				'L_FORUM_NAME' => $lang['Forum_name'], 
				'L_CATEGORY' => $lang['Category'], 
				'L_FORUM_DESCRIPTION' => $lang['Forum_desc'],
				'L_FORUM_STATUS' => $lang['Forum_status'],
				'L_AUTO_PRUNE' => $lang['Forum_pruning'],
				'L_ENABLED' => $lang['Enabled'],
				'L_PRUNE_DAYS' => $lang['prune_days'],
				'L_PRUNE_FREQ' => $lang['prune_freq'],
				'L_DAYS' => $lang['Days'],

				'PRUNE_DAYS' => ( isset($pr_row['prune_days']) ) ? $pr_row['prune_days'] : 7,
				'PRUNE_FREQ' => ( isset($pr_row['prune_freq']) ) ? $pr_row['prune_freq'] : 1,
				'FORUM_NAME' => $forumname,
				'DESCRIPTION' => $forumdesc)
			);

# 
#-----[ REPLACE WITH ]----------------------------------------------- 
# line: 333 - 361

			$template->assign_vars(array(
				'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"),
				'S_HIDDEN_FIELDS' => $s_hidden_fields,
				'S_SUBMIT_VALUE' => $buttonvalue, 
				'S_CAT_LIST' => $catlist,
				'S_STATUS_LIST' => $statuslist,
				'S_PRUNE_ENABLED' => $prune_enabled,

				'L_FORUM_TITLE' => $l_title, 
				'L_FORUM_EXPLAIN' => $lang['Forum_edit_delete_explain'], 
				'L_FORUM_SETTINGS' => $lang['Forum_settings'], 
				'L_FORUM_NAME' => $lang['Forum_name'], 
				'L_CATEGORY' => $lang['Category'], 
				'L_FORUM_DESCRIPTION' => $lang['Forum_desc'],
				'L_FORUM_STATUS' => $lang['Forum_status'],
				'L_AUTO_PRUNE' => $lang['Forum_pruning'],
				'L_ENABLED' => $lang['Enabled'],
				'L_PRUNE_DAYS' => $lang['prune_days'],
				'L_PRUNE_FREQ' => $lang['prune_freq'],
				'L_DAYS' => $lang['Days'],

				'PRUNE_DAYS' => ( isset($pr_row['prune_days']) ) ? $pr_row['prune_days'] : 7,
				'PRUNE_FREQ' => ( isset($pr_row['prune_freq']) ) ? $pr_row['prune_freq'] : 1,
				'FORUM_NAME' => $forumname,
				'DESCRIPTION' => $forumdesc,
				'L_APPROVE_POSTS' => $lang['APPROVE_POSTS'],
				'S_APPROVE_POSTS_ENABLED' => $approve_posts_enabled
				)
			);

# 
#-----[ FIND ]------------------------------------------------------- 
# approx line: 440 - 447


			// Modify a forum in the DB
			if( isset($HTTP_POST_VARS['prune_enable']))
			{
				if( $HTTP_POST_VARS['prune_enable'] != 1 )
				{
					$HTTP_POST_VARS['prune_enable'] = 0;
				}
			}

# 
#-----[ AFTER, ADD ]------------------------------------------------- 
# approx line: 448 - 477

			//
			// Begin Approve_Posts_Mod
			//
			if( isset($HTTP_POST_VARS['approve_posts_enable']))
			{
				$sql = "DELETE FROM " . APPROVE_POSTS . " WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't delete forum approval information", "", __LINE__, __FILE__, $sql);
				}
				if( $HTTP_POST_VARS['approve_posts_enable'] == 1 )
				{
					$sql = "INSERT INTO " . APPROVE_POSTS . " (forum_id) VALUES (" . intval($HTTP_POST_VARS[POST_FORUM_URL]) . ")";
					if( !$result = $db->sql_query($sql) )
					{
						message_die(GENERAL_ERROR, "Couldn't insert forum approval information", "", __LINE__, __FILE__, $sql);
					}
				}
			}
			else
			{
				$sql = "DELETE FROM " . APPROVE_POSTS . " WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't delete forum approval information", "", __LINE__, __FILE__, $sql);
				}
			}
			//
			// End Approve_Posts_Mod
			//

# 
#-----[ OPEN ]------------------------------------------------------- 
#

/phpBB2/templates/subSilver/viewforum_body.tpl

# 
#-----[ FIND ]------------------------------------------------------- 
# line: 23 - 33

	<!-- BEGIN topicrow -->
	<tr> 
	  <td class="row1" align="center" valign="middle" width="20"><img src="{topicrow.TOPIC_FOLDER_IMG}" width="19" height="18" alt="{topicrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.L_TOPIC_FOLDER_ALT}" /></td>
	  <td class="row1" width="100%"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />
		{topicrow.GOTO_PAGE}</span></td>
	  <td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.REPLIES}</span></td>
	  <td class="row3" align="center" valign="middle"><span class="name">{topicrow.TOPIC_AUTHOR}</span></td>
	  <td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.VIEWS}</span></td>
	  <td class="row3Right" align="center" valign="middle" nowrap="nowrap"><span class="postdetails">{topicrow.LAST_POST_TIME}<br />{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_IMG}</span></td>
	</tr>
	<!-- END topicrow -->

# 
#-----[ REPLACE WITH ]----------------------------------------------- 
# line: 23 - 33

	<!-- BEGIN topicrow -->
	<tr> 
	  <td class="row1" align="center" valign="middle" width="20"><img src="{topicrow.TOPIC_FOLDER_IMG}" width="19" height="18" alt="{topicrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.L_TOPIC_FOLDER_ALT}" /></td>
	  <td class="row1" width="100%"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />
        {topicrow.GOTO_PAGE}{topicrow.APPROVE_POSTS_LINK}</span></td>
	  <td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.REPLIES}</span></td>
	  <td class="row3" align="center" valign="middle"><span class="name">{topicrow.TOPIC_AUTHOR}</span></td>
	  <td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.VIEWS}</span></td>
	  <td class="row3Right" align="center" valign="middle" nowrap><span class="postdetails">{topicrow.LAST_POST_TIME}<br />{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_IMG}</span></td>
	</tr>
	<!-- END topicrow -->

# 
#-----[ OPEN ]------------------------------------------------------- 
#

/phpBB2/templates/subSilver/viewtopic_body.tpl

# 
#-----[ FIND ]------------------------------------------------------- 
# line: 27 - 61

	<!-- BEGIN postrow -->
	<tr> 
		<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS}<br />{postrow.POSTER_FROM}</span><br /></td>
		<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="100%"><a href="{postrow.U_MINI_POST}"><img src="{postrow.MINI_POST_IMG}" width="12" height="9" alt="{postrow.L_MINI_POST_ALT}" title="{postrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {postrow.POST_DATE}<span class="gen"> </span>   {L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td>
				<td valign="top" align="right" nowrap="nowrap">{postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}</td>
			</tr>
			<tr> 
				<td colspan="2"><hr /></td>
			</tr>
			<tr>
				<td colspan="2"><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>
			</tr>
		</table></td>
	</tr>
	<tr> 
		<td class="{postrow.ROW_CLASS}" width="150" align="left" valign="middle"><span class="nav"><a href="#top" class="nav">{L_BACK_TO_TOP}</a></span></td>
		<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="bottom" nowrap="nowrap"><table cellspacing="0" cellpadding="0" border="0" height="18" width="18">
			<tr> 
				<td valign="middle" nowrap="nowrap">{postrow.PROFILE_IMG} {postrow.PM_IMG} {postrow.EMAIL_IMG} {postrow.WWW_IMG} {postrow.AIM_IMG} {postrow.YIM_IMG} {postrow.MSN_IMG}<script language="JavaScript" type="text/javascript"><!-- 

	if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 )
		document.write(' {postrow.ICQ_IMG}');
	else
		document.write('</td><td>&</td><td valign="top" nowrap="nowrap"><div style="position:relative"><div style="position:absolute">{postrow.ICQ_IMG}</div><div style="position:absolute;left:3px;top:-1px">{postrow.ICQ_STATUS_IMG}</div></div>');
				
				//--></script><noscript>{postrow.ICQ_IMG}</noscript></td>
			</tr>
		</table></td>
	</tr>
	<tr> 
		<td class="spaceRow" colspan="2" height="1"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
	</tr>
	<!-- END postrow -->

# 
#-----[ REPLACE WITH ]----------------------------------------------- 
# line: 27 - 61

	<!-- BEGIN postrow -->
	<tr> 
		<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS}<br />{postrow.POSTER_FROM}</span><br /></td>
		<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="100%"><a href="{postrow.U_MINI_POST}"><img src="{postrow.MINI_POST_IMG}" width="12" height="9" alt="{postrow.L_MINI_POST_ALT}" title="{postrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {postrow.POST_DATE}<span class="gen"> </span>   {L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td>
				<td valign="top" align="right" nowrap="nowrap">{postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}</td>
			</tr>
			<tr> 
				<td colspan="2"><hr /></td>
			</tr>
			<tr>
				<td colspan="2"><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}{postrow.APPROVE_POSTS_LINK}</span></td>
			</tr>
		</table></td>
	</tr>
	<tr> 
		<td class="{postrow.ROW_CLASS}" width="150" align="left" valign="middle"><span class="nav"><a href="#top" class="nav">{L_BACK_TO_TOP}</a></span></td>
		<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="bottom" nowrap="nowrap"><table cellspacing="0" cellpadding="0" border="0" height="18" width="18">
			<tr> 
				<td valign="middle" nowrap="nowrap">{postrow.PROFILE_IMG} {postrow.PM_IMG} {postrow.EMAIL_IMG} {postrow.WWW_IMG} {postrow.AIM_IMG} {postrow.YIM_IMG} {postrow.MSN_IMG}<script language="JavaScript" type="text/javascript"><!-- 

	if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 )
		document.write(' {postrow.ICQ_IMG}');
	else
		document.write('</td><td>&</td><td valign="top" nowrap="nowrap"><div style="position:relative"><div style="position:absolute">{postrow.ICQ_IMG}</div><div style="position:absolute;left:3px;top:-1px">{postrow.ICQ_STATUS_IMG}</div></div>');
				
				//--></script><noscript>{postrow.ICQ_IMG}</noscript></td>
			</tr>
		</table></td>
	</tr>
	<tr> 
		<td class="spaceRow" colspan="2" height="1"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
	</tr>
	<!-- END postrow -->

# 
#-----[ OPEN ]------------------------------------------------------- 
#

/phpBB2/templates/subSilver/admin/forum_edit_body.tpl

# 
#-----[ FIND ]------------------------------------------------------- 
# approx line: 23-26

	<tr> 
	  <td class="row1">{L_FORUM_STATUS}</td>
	  <td class="row2"><select name="forumstatus">{S_STATUS_LIST}</select></td>
	</tr>
# 
#-----[ AFTER, ADD ]------------------------------------------------- 
# approx line: 27-30

	<tr> 
	  <td class="row1">{L_APPROVE_POSTS}</td>
	  <td class="row2">{L_ENABLED}<input type="checkbox" name="approve_posts_enable" value="1" {S_APPROVE_POSTS_ENABLED}/></td>
	</tr>
# 
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------------- 
# 
# EoM 


i've tested it a bit on a local forums install.. if anyone want's to give it a go, lemme know ;)
Last edited by AceMan on Sun Feb 02, 2003 11:56 am, edited 7 times in total.
chinch
Registered User
Posts: 169
Joined: Mon Mar 11, 2002 7:34 pm

Post by chinch »

i'll install this ASAP.

if you have a TXT file to download it helps some of us using windoze :)
AceMan
Registered User
Posts: 337
Joined: Thu Nov 15, 2001 6:47 am
Contact:

Post by AceMan »

i'm not sure what they're setting up for downloads..

but here's a link *temporary*
Approve_Posts_MOD-RC1.txt
chinch
Registered User
Posts: 169
Joined: Mon Mar 11, 2002 7:34 pm

Post by chinch »

installed... testing now...

all forums are locked

i'm in admin area - forum management. when clicking on a forum to EDIT i get this error

Could not obtain forum approval information

how do you setup the existing forum to require approval or not?

:)
Last edited by chinch on Sat Apr 20, 2002 5:08 am, edited 1 time in total.
AceMan
Registered User
Posts: 337
Joined: Thu Nov 15, 2001 6:47 am
Contact:

Post by AceMan »

cool, how goes it?.. got a link?
chinch
Registered User
Posts: 169
Joined: Mon Mar 11, 2002 7:34 pm

Post by chinch »

AceMan
Registered User
Posts: 337
Joined: Thu Nov 15, 2001 6:47 am
Contact:

Post by AceMan »

did you create the database tables?

to make a forum 'moderated by approval' goto admin panel, and click forum management, and click edit on the forum u want to admin.


Could not obtain forum approval information
also popping up on viewforum.php..

it's not able to get to database as u can see here:

Code: Select all

			$sql = "SELECT * FROM " . APPROVE_POSTS . " WHERE forum_id = $forum_id";
			if ( !($result = $db->sql_query($sql)) )
			{
			   message_die(GENERAL_ERROR, 'Could not obtain forum approval information', '', __LINE__, __FILE__, $sql);
			}

hrm.... looking back over my stuff... does my post include:
define 'APPROVE_POSTS' ???

i may have forgot constants.php :) hang 1 sec
nah.. it's there :)



i'm gonna throw up a fresh install on my localhost for the heck of it and install it all over again ;)
chinch
Registered User
Posts: 169
Joined: Mon Mar 11, 2002 7:34 pm

Post by chinch »

thanks.

i have  "phpbb_approve_posts"  database table as per the instructions

it shows 0 records
AceMan
Registered User
Posts: 337
Joined: Thu Nov 15, 2001 6:47 am
Contact:

Post by AceMan »

perfect, go into admin interface now, and click on edit forum for the forum you want to set this up on.. and click Enable for Moderator Approve All Topics & Posts:


what's your table prefix on the rest of your tables?... sorry if I didn't make that obvious..

phpbb_approve_posts ... your table should have same prefix as all the other phpbb_ tables......

so edit it accordingly.



I'm going to prepare a better text file, I think there's winblowz carraige returns in there that's messing things up, hang a few ... sorry... grab your backups :)
chinch
Registered User
Posts: 169
Joined: Mon Mar 11, 2002 7:34 pm

Post by chinch »

all tables are the same prefix "phpbb_"

from admin... management... EDIT i get this

General Error
Could not obtain forum approval information

i'm sort of stuck there... can't edit any forums.
chinch
Registered User
Posts: 169
Joined: Mon Mar 11, 2002 7:34 pm

Post by chinch »

shoot... apologies here...8O

i had not uploaded "constants.php" properly...

it's working now... testing ASAP :)
AceMan
Registered User
Posts: 337
Joined: Thu Nov 15, 2001 6:47 am
Contact:

Post by AceMan »

but here's a new link to get file:
**SEE POST 1 FOR UPDATED LINK**
AceMan
Registered User
Posts: 337
Joined: Thu Nov 15, 2001 6:47 am
Contact:

Post by AceMan »

chinch, that work out for you?... i never saw any 'moderated' posts on your forum..

so i dunno.. i also never got a mail w/ my activate link lo
chinch
Registered User
Posts: 169
Joined: Mon Mar 11, 2002 7:34 pm

Post by chinch »

i have it running :) i setup a new forum for "approval" and i'll do some more testing over the weekend. Thanks!
AceMan
Registered User
Posts: 337
Joined: Thu Nov 15, 2001 6:47 am
Contact:

Post by AceMan »

do you like that i have the ***POST AWAITING MODERATOR APPROVAL*** message?..

or should I just not show the post at all to non-admins?
Locked

Return to “[2.0.x] MODs in Development”