geen postcount bij reply

Hulp nodig bij een modificaties of op zoek naar een MOD? Bekijk ons archief. Support wordt helaas niet meer verleend.
Forumregels

Sinds 1 januari 2009 wordt phpBB2 niet meer ondersteund.
Onderstaande informatie is verouderd en dient uitsluitend als archief.
phpBB2.0.x
Gesloten
barduck
Berichten: 63
Lid geworden op: 19 sep 2006, 07:09

geen postcount bij reply

Bericht door barduck » 15 nov 2006, 10:06

Hoe kan ik er voor zorgen dat, in de forumdelen waar de posts geteld worden, de postcount niet vehoogt wanneer men "antwoord", en dus enkel wie een topic start daar voor een puntje krijgt?

Gebruikersavatar
Ramon Fincken
Berichten: 2552
Lid geworden op: 27 nov 2005, 23:15
Locatie: Diemen
Contacteer:

Bericht door Ramon Fincken » 15 nov 2006, 15:37

dit zou moeten werken,
ik heb t getest, maar weet niet of ik alle scenario's heb gehad:
oftewel doe dit eerst op een test-board !



OPEN

Code: Selecteer alles

modcp.php
FIND

Code: Selecteer alles

         $sql = "SELECT poster_id, COUNT(post_id) AS posts
            FROM " . POSTS_TABLE . "
            WHERE topic_id IN ($topic_id_sql)
            GROUP BY poster_id";
REPLACE WITH

Code: Selecteer alles

         // Do not count replies
         // Ramon Fincken, Phpbbinstallers.com
         /*
         // Original code:

         $sql = "SELECT poster_id, COUNT(post_id) AS posts
            FROM " . POSTS_TABLE . "
            WHERE topic_id IN ($topic_id_sql)
            GROUP BY poster_id";

         */

         $sql = "SELECT topic_poster, COUNT(topic_id) AS posts
            FROM " . TOPICS_TABLE . "
            WHERE topic_id IN ($topic_id_sql)
            AND topic_poster > 0
            GROUP BY topic_poster";
         // Do not count replies
         // Ramon Fincken, Phpbbinstallers.com

OPEN

Code: Selecteer alles

includes/functions_post.php
FIND

Code: Selecteer alles

//
// Update post stats and details
//
function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_id, &$user_id)
{
   global $db,$HTTP_POST_VARS;

   $sign = ($mode == 'delete') ? '- 1' : '+ 1';
   $forum_update_sql = "forum_posts = forum_posts $sign";
   $topic_update_sql = '';
AFTER, ADD

Code: Selecteer alles

   // Do not count replies
   // Ramon Fincken, Phpbbinstallers.com
   if($mode == 'reply') return;
   if($mode == 'delete' && strlen($post_data['first_post']) < 1) return;
   // Do not count replies
   // Ramon Fincken, Phpbbinstallers.com
Freelance webdevelopment, including phpbb2 scripting!

Website founder van: phpBBinstallers.net phpBBantispam.com
Mods: zie op http://www.phpbb.com Blog in wording: RamonFincken.com

barduck
Berichten: 63
Lid geworden op: 19 sep 2006, 07:09

Bericht door barduck » 15 nov 2006, 20:13

djeezes man, hoe doe jij dat toch zo vlug?

Gebruikersavatar
Ramon Fincken
Berichten: 2552
Lid geworden op: 27 nov 2005, 23:15
Locatie: Diemen
Contacteer:

Bericht door Ramon Fincken » 17 nov 2006, 00:25

barduck schreef:djeezes man, hoe doe jij dat toch zo vlug?
Had een vrije dag..

Maargoed mocht je een bug tegenkomen bij testen laat het even weten
Freelance webdevelopment, including phpbb2 scripting!

Website founder van: phpBBinstallers.net phpBBantispam.com
Mods: zie op http://www.phpbb.com Blog in wording: RamonFincken.com

barduck
Berichten: 63
Lid geworden op: 19 sep 2006, 07:09

Bericht door barduck » 25 nov 2006, 16:44

ik denk dat ik een bug heb maar ik ben niet zeker of het hier iets mee te maken heeft. Wanneer ik of een andere admin of mod een topic willen verwijderen krijgen we deze boodschap te lezen:
Could not update user post count information

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3

SELECT topic_poster, COUNT(topic_id) AS posts FROM phpbb_HQBPtopics WHERE topic_id IN (1330) AND topic_poster > 0 GROUP BY topic_poster

Line : 334
File : modcp.php
Ik weet dus niet of het iets met deze mod te maken heeft, ik weet wel dat de prune mod er ook tussen staat en het er dus alsvolgt uit ziet:

Code: Selecteer alles

switch( $mode )
{
	case 'delete':
    case 'prune':	
		if (!$is_auth['auth_delete'])
		{
			if ( !($is_auth['auth_tmod'] && $topic_id != '' && $topic_row['topic_poster'] == $userdata['user_id']) )
			{		
			message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_auth_delete'], $is_auth['auth_delete_type']));
			}			
		}

		$page_title = $lang['Mod_CP'];
		include($phpbb_root_path . 'includes/page_header.'.$phpEx);

		if ( $confirm )
		{
  			if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) )
			{
				message_die(GENERAL_MESSAGE, $lang['None_selected']);
			}

			include($phpbb_root_path . 'includes/functions_search.'.$phpEx);

			$topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id);

			$topic_id_sql = '';
			for($i = 0; $i < count($topics); $i++)
			{
				$topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . intval($topics[$i]);
			}

			$sql = "SELECT topic_id 
				FROM " . TOPICS_TABLE . "
				WHERE topic_id IN ($topic_id_sql)
					AND forum_id = $forum_id";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not get topic id information', '', __LINE__, __FILE__, $sql);
			}
			
			$topic_id_sql = '';
			while ($row = $db->sql_fetchrow($result))
			{
				$topic_id_sql .= (($topic_id_sql != '') ? ', ' : '') . intval($row['topic_id']);
			}
			$db->sql_freeresult($result);

			if ( $topic_id_sql == '')
			{
				message_die(GENERAL_MESSAGE, $lang['None_selected']);
			}

			if ($mode != 'prune')
			{
         // Do not count replies 
         // Ramon Fincken, Phpbbinstallers.com 
         /* 
         // Original code: 

         $sql = "SELECT poster_id, COUNT(post_id) AS posts 
            FROM " . POSTS_TABLE . " 
            WHERE topic_id IN ($topic_id_sql) 
            GROUP BY poster_id"; 

         */ 

         $sql = "SELECT topic_poster, COUNT(topic_id) AS posts 
            FROM " . TOPICS_TABLE . " 
            WHERE topic_id IN ($topic_id_sql) 
            AND topic_poster > 0 
            GROUP BY topic_poster"; 
         // Do not count replies 
         // Ramon Fincken, Phpbbinstallers.com 
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not get poster id information', '', __LINE__, __FILE__, $sql);
			}

			$count_sql = array();
			while ( $row = $db->sql_fetchrow($result) )
			{
				$count_sql[] = "UPDATE " . USERS_TABLE . " 
					SET user_posts = user_posts - " . $row['posts'] . " 
					WHERE user_id = " . $row['poster_id'];
			}
			$db->sql_freeresult($result);

			if ( sizeof($count_sql) )
			{
				for($i = 0; $i < sizeof($count_sql); $i++)
				{
					if ( !$db->sql_query($count_sql[$i]) )
					{
						message_die(GENERAL_ERROR, 'Could not update user post count information', '', __LINE__, __FILE__, $sql);
					}
				}
			}

}

			$sql = "SELECT post_id 
				FROM " . POSTS_TABLE . " 
				WHERE topic_id IN ($topic_id_sql)";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not get post id information', '', __LINE__, __FILE__, $sql);
			}

			$post_id_sql = '';
			while ( $row = $db->sql_fetchrow($result) )
			{
				$post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . intval($row['post_id']);
			}
			$db->sql_freeresult($result);

			$sql = "SELECT vote_id 
				FROM " . VOTE_DESC_TABLE . " 
				WHERE topic_id IN ($topic_id_sql)";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not get vote id information', '', __LINE__, __FILE__, $sql);
			}

			$vote_id_sql = '';
			while ( $row = $db->sql_fetchrow($result) )
			{
				$vote_id_sql .= ( ( $vote_id_sql != '' ) ? ', ' : '' ) . $row['vote_id'];
			}
			$db->sql_freeresult($result);

			//
			// Got all required info so go ahead and start deleting everything
			//
			$sql = "DELETE FROM " . THANKS_TABLE . "
					WHERE topic_id IN ($topic_id_sql)";
			if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
			{
							message_die(GENERAL_ERROR, 'Error in deleting Thanks post Information', '', __LINE__, __FILE__, $sql);
			}

			$sql = "DELETE FROM " . INTERESTEDS_TABLE . "
					WHERE topic_id IN ($topic_id_sql)";
			if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
			{
							message_die(GENERAL_ERROR, 'Error in deleting Interesteds post Information', '', __LINE__, __FILE__, $sql);
			}
						
			$sql = "DELETE 
				FROM " . TOPICS_TABLE . " 
				WHERE topic_id IN ($topic_id_sql) 
					OR topic_moved_id IN ($topic_id_sql)";
			if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
			{
				message_die(GENERAL_ERROR, 'Could not delete topics', '', __LINE__, __FILE__, $sql);
			}

			if ( $post_id_sql != '' )
			{
				$sql = "DELETE 
					FROM " . POSTS_TABLE . " 
					WHERE post_id IN ($post_id_sql)";
				if ( !$db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, 'Could not delete posts', '', __LINE__, __FILE__, $sql);
				}

				$sql = "DELETE 
					FROM " . POSTS_TEXT_TABLE . " 
					WHERE post_id IN ($post_id_sql)";
				if ( !$db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, 'Could not delete posts text', '', __LINE__, __FILE__, $sql);
				}

				remove_search_post($post_id_sql);
				delete_attachment(explode(', ', $post_id_sql));				
			}

			if ( $vote_id_sql != '' )
			{
				$sql = "DELETE 
					FROM " . VOTE_DESC_TABLE . " 
					WHERE vote_id IN ($vote_id_sql)";
				if ( !$db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, 'Could not delete vote descriptions', '', __LINE__, __FILE__, $sql);
				}

				$sql = "DELETE 
					FROM " . VOTE_RESULTS_TABLE . " 
					WHERE vote_id IN ($vote_id_sql)";
				if ( !$db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, 'Could not delete vote results', '', __LINE__, __FILE__, $sql);
				}

				$sql = "DELETE 
					FROM " . VOTE_USERS_TABLE . " 
					WHERE vote_id IN ($vote_id_sql)";
				if ( !$db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, 'Could not delete vote users', '', __LINE__, __FILE__, $sql);
				}
			}

			$sql = "DELETE 
				FROM " . TOPICS_WATCH_TABLE . " 
				WHERE topic_id IN ($topic_id_sql)";
			if ( !$db->sql_query($sql, END_TRANSACTION) )
			{
				message_die(GENERAL_ERROR, 'Could not delete watched post list', '', __LINE__, __FILE__, $sql);
			}

			sync('forum', $forum_id);

			if ( !empty($topic_id) )
			{
				$redirect_page = "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&sid=" . $userdata['session_id'];
				$l_redirect = sprintf($lang['Click_return_forum'], '<a href="' . $redirect_page . '">', '</a>');
			}
			else
			{
				$redirect_page = "modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id&sid=" . $userdata['session_id'];
				$l_redirect = sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>');
			}

			$template->assign_vars(array(
				'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">')
			);

			message_die(GENERAL_MESSAGE, $lang['Topics_Removed'] . '<br /><br />' . $l_redirect);
		}
		else
		{
			// Not confirmed, show confirmation message
			if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) )
			{
				message_die(GENERAL_MESSAGE, $lang['None_selected']);
			}

			$hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';

			if ( isset($HTTP_POST_VARS['topic_id_list']) )
			{
				$topics = $HTTP_POST_VARS['topic_id_list'];
				for($i = 0; $i < count($topics); $i++)
				{
					$hidden_fields .= '<input type="hidden" name="topic_id_list[]" value="' . intval($topics[$i]) . '" />';
				}
			}
			else
			{
				$hidden_fields .= '<input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" />';
			}

			//
			// Set template files
			//
			$template->set_filenames(array(
				'confirm' => 'confirm_body.tpl')
			);

			$template->assign_vars(array(
				'MESSAGE_TITLE' => $lang['Confirm'],
				'MESSAGE_TEXT' => ($mode == 'prune') ? $lang['Confirm_prune_topic'] :$lang['Confirm_delete_topic'],

				'L_YES' => $lang['Yes'],
				'L_NO' => $lang['No'],

				'S_CONFIRM_ACTION' => append_sid("modcp.$phpEx"),
				'S_HIDDEN_FIELDS' => $hidden_fields)
			);

			$template->pparse('confirm');

			include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
		}
		break;
enig idee, want ik zoek me gek?


(lijn 334 is dus deze:

Code: Selecteer alles

						message_die(GENERAL_ERROR, 'Could not update user post count information', '', __LINE__, __FILE__, $sql);
)

Gebruikersavatar
Ramon Fincken
Berichten: 2552
Lid geworden op: 27 nov 2005, 23:15
Locatie: Diemen
Contacteer:

Bericht door Ramon Fincken » 25 nov 2006, 19:13

ik zal er eens naar kijken, wat gebeurde er precies ( oftewel waar klikte je op voordat je de error zag ? )

Rfn
Freelance webdevelopment, including phpbb2 scripting!

Website founder van: phpBBinstallers.net phpBBantispam.com
Mods: zie op http://www.phpbb.com Blog in wording: RamonFincken.com

barduck
Berichten: 63
Lid geworden op: 19 sep 2006, 07:09

Bericht door barduck » 25 nov 2006, 19:17

post verwijderen (zo'n x'ke). Er wordt dan mooi gevraagd of ik zeker ben het topic te willen verwijderen en als ik ja klik krijg ik die error. Zou het eventueel een hulp zijn het volledige bestand hier te zetten of in een pm te sturen?

barduck
Berichten: 63
Lid geworden op: 19 sep 2006, 07:09

Bericht door barduck » 28 nov 2006, 16:25

al een ideetje?

Gesloten