[2.0.10] Highlight Topics User Posted In

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
13
76%
Very Good
3
18%
Good
1
6%
Fair
0
No votes
Poor
0
No votes
 
Total votes: 17

User avatar
smitjel
Registered User
Posts: 461
Joined: Sat Jun 11, 2005 11:40 pm
Location: Birmingham, AL

Post by smitjel » Sun Sep 25, 2005 6:22 am

Anyone tried this mod with an mssql setup? Works perfect on my test forum that's using MySQL but I'm getting an sql error when I use the same code on a mssql setup:
SQL Error : Line 2: Incorrect syntax near ','.

SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username, p3.poster_id AS my_reply_id FROM (phpbb_topics t, phpbb_users u, phpbb_posts p, phpbb_users u2 LEFT JOIN phpbb_posts p3 ON p3.topic_id = t.topic_id AND p3.poster_id = 6) WHERE t.topic_poster = u.user_id AND p.post_id = t.topic_last_post_id AND p.poster_id = u2.user_id AND ((t.topic_type = 2 AND t.forum_id = 14) OR (t.topic_type = 3)) GROUP BY p.post_id ORDER BY t.topic_type DESC, t.topic_last_post_id DESC
My Quick Reply MOD for phpBB2

User avatar
smitjel
Registered User
Posts: 461
Joined: Sat Jun 11, 2005 11:40 pm
Location: Birmingham, AL

Post by smitjel » Sat Oct 08, 2005 3:54 am

I hate to bump this but is anyone fluent with mssql that might could help me rewrite the sql for this mod? It doesn't seem to be compatible with mssql. I appreciate any help. I would LOVE to get this mod working on my setup!
My Quick Reply MOD for phpBB2

SailFan
Registered User
Posts: 84
Joined: Fri Mar 05, 2004 5:58 pm

Post by SailFan » Tue Nov 15, 2005 1:54 pm

I had this running in earlier versions, but have no luck with 2.0.18. Anyone else having trouble?

Should this MOD be taken off the table as it is not being supported?

poseid0n
Registered User
Posts: 18
Joined: Fri Oct 07, 2005 6:54 am

Post by poseid0n » Mon Nov 28, 2005 1:56 am

Is it possible to get a mod that allows you to change just the colour of specific topics. I have been searching for one for ages but no luck.

User avatar
JCLIFF
Registered User
Posts: 46
Joined: Mon Aug 15, 2005 4:52 pm
Location: Boston, MA
Contact:

Post by JCLIFF » Wed Dec 21, 2005 4:01 am

Question --> I've installed the mod (Parts 1 and 4), works great, but...

I've appeared to negate the [2.0.17] Topic Titles Begin With Capital Letter MOD which added "ucfirst" to viewforum.php. Can someone resolve this so I get both MODs to work properly?

I'm new, but learning, so as much as I figured this was a simple fix and attempted to deduce what the answer was, I'm at a loss...

What I had...
'TOPIC_TITLE' => ucfirst$topic_title,


After installing this mod, I've placed "ucfirst" in a few spots in this line, with no luck...
'TOPIC_TITLE' => ucfirst( ($topic_rowset[$i]['my_reply_id']) ? '<span style="color:#' . $theme['highlight_topic_color'] . '">' . $topic_title . '</span>' : $topic_title ),


In the meantime, I've installed Part 2. AWESOME! Thx.

User avatar
smitjel
Registered User
Posts: 461
Joined: Sat Jun 11, 2005 11:40 pm
Location: Birmingham, AL

Post by smitjel » Fri Feb 17, 2006 7:00 pm

Aside from the database incompatibilities of this mod, I can't figure out why some form of this mod has not been merged into the codebase of phpBB. I couldn't imagine using phpBB on a daily basis without this mod.

Is there some glaring reason that this functionality is not standard for phpBB?
My Quick Reply MOD for phpBB2

004
Registered User
Posts: 59
Joined: Thu Jan 27, 2005 3:23 pm

Post by 004 » Sun Apr 30, 2006 4:55 am

had this working fine for a long time..
currently updated my forum style and now instead of the proper icons, the topics that i've posted in say "No new posts" where the icon should be.
seems it needs to be installed on the new style, or perhaps just a few file alterations. has anyone had experience with this? can anyone help?
much thanks,
004

004
Registered User
Posts: 59
Joined: Thu Jan 27, 2005 3:23 pm

Post by 004 » Sun Apr 30, 2006 7:39 pm

:(

User avatar
Remix_88
Registered User
Posts: 46
Joined: Wed Apr 23, 2003 12:52 pm
Location: Hampshire, UK

Post by Remix_88 » Fri May 12, 2006 2:10 pm

drathbun wrote: If you want an indication of whether a user has posted in a topic or not all you want is a flag. You don't even want to return the post row information at all, just a notification that it exists or not.

Also, left joins (outer joins) can be a real performance killer. Especially on a large or active board. Have you considered doing something like this?

Code: Select all

Get topics for page (already done, selected into topic_rowset)
Collapse topic_id values into a comma separated list (implode topic_rowset)
Check for user posts in those topics
In other words after getting a list of topics for the page you could run a second query that checks and sets a flag for the logged in user. An advantage is that you could check to see if the user is logged in before running this extra query, and eliminate the outer join if you don't actually need it. Assuming that you have a set of topic ID values in a string $topic_list then this is what would work:

Code: Select all

if ($userdata['session_logged_in'])
{
$sql = 'SELECT p.topic_id, sign(post_id)
FROM ' . POSTS_TABLE . ' p
where p.topic_id in ' . $topic_list . '
and p.poster_id = ' . $userdata['user_id'];

blah blah execute and test sql here
The results of that query would be an array of topic_id values with a flag of 1 where the user has responded. Now in the topic loop you simply check to see

Code: Select all

if ($topic_posted['topic_id'] == 1) {replace image as appropriate}
Doing it this way means that 1. There's no check run if the user isn't logged in, and 2. You eliminate an outer join which should help performance.


The following code does exactly what drathbun illustrated.

Code: Select all

	// check if user replied to the topics
	$user_topics = array();
	if ($userdata['user_id'] != ANONYMOUS)
	{
		// get all the topic ids to display
		$topic_ids = array();
		for ($i = 0; $i < count($topic_rowset); $i++)
		{
			$topic_item_type	= substr($topic_rowset[$i]['topic_id'], 0, 1);
			$topic_id			= intval(substr($topic_rowset[$i]['topic_id'], 1));
			if ( $topic_item_type == POST_TOPIC_URL )
			{
				$topic_ids[] = $topic_id;
			}
		}
		// check if the user replied to
		if (!empty($topic_ids))
		{
			// check the posts
			$s_topic_ids = implode(', ', $topic_ids);
			$sql = "SELECT DISTINCT topic_id FROM " . POSTS_TABLE . " 
					WHERE topic_id IN ($s_topic_ids)
						AND poster_id = " . $userdata['user_id'];
			if ( !($result = $db->sql_query($sql)) )
			{
			   message_die(GENERAL_ERROR, 'Could not obtain post information', '', __LINE__, __FILE__, $sql);
			}
			while ($row = $db->sql_fetchrow($result))
			{
				$user_topics[POST_TOPIC_URL . $row['topic_id']] = true;
			}
		}
	}
Regards, Remix_88.

jesus_army
Registered User
Posts: 19
Joined: Thu Mar 09, 2006 2:38 pm
Contact:

Works with 2.0.20

Post by jesus_army » Fri Jun 02, 2006 10:52 am

I didn't get that bit of code to work, but here is my version:

Code: Select all

  // check if user replied to the topics 
   $user_topics = array(); 
   if ($userdata['user_id'] != ANONYMOUS) 
   { 
      // get all the topic ids to display 
      $topic_ids = array(); 
      for ($i = 0; $i < count($topic_rowset); $i++) 
      { 
      	$topic_id = ( $topic_rowset[$i]['topic_status'] == TOPIC_MOVED ) ? $topic_rowset[$i]['topic_moved_id']  : intval($topic_rowset[$i]['topic_id']); 
        $topic_ids[] = $topic_id; 
      } 
      // check if the user replied to 
      if (!empty($topic_ids)) 
      { 
         // check the posts 
         $s_topic_ids = implode(', ', $topic_ids); 
         $sql = "SELECT DISTINCT topic_id FROM " . POSTS_TABLE . " 
               WHERE topic_id IN ($s_topic_ids) 
                  AND poster_id = " . $userdata['user_id']; 
         if ( !($result = $db->sql_query($sql)) ) 
         { 
            message_die(GENERAL_ERROR, 'Could not obtain post information', '', __LINE__, __FILE__, $sql); 
         } 
         while ($row = $db->sql_fetchrow($result)) 
         { 
            $user_topics[ $row['topic_id'] ] = true; 
         } 
      } 
   }
with a test of the form:

Code: Select all

		if( $topic_rowset[$i]['topic_status'] == TOPIC_MOVED )
		{
			$topic_type = $lang['Topic_Moved'] . ' ';
			$topic_id = $topic_rowset[$i]['topic_moved_id'];
			$folder_image = ($user_topics[$topic_id]) ? $images['folder_moved_own'] : $images['folder_moved'] ;
			$folder_alt = $lang['Topics_Moved'];
			$newest_post_img = '';
		}
		else
		{
			if( $topic_rowset[$i]['topic_type'] == POST_ANNOUNCE )
			{
				$folder = ($user_topics[$topic_id]) ? $images['folder_announce_own'] : $images['folder_announce'] ;
				$folder_new = ($user_topics[$topic_id]) ? $images['folder_announce_new_own'] : $images['folder_announce_new'] ;
			}
			else if( $topic_rowset[$i]['topic_type'] == POST_STICKY )
			{
				$folder = ($user_topics[$topic_id]) ? $images['folder_sticky_own'] : $images['folder_sticky'] ;
				$folder_new = ($user_topics[$topic_id]) ? $images['folder_sticky_new_own'] : $images['folder_sticky_new'] ;
			}
			else if( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED )
			{
				$folder = ($user_topics[$topic_id]) ? $images['folder_locked_own'] : $images['folder_locked'] ;
				$folder_new = ($user_topics[$topic_id]) ? $images['folder_locked_new_own'] : $images['folder_locked_new'] ;
			}
			else
			{
				if($replies >= $board_config['hot_threshold'])
				{
					$folder = ($user_topics[$topic_id]) ? $images['folder_hot_own'] : $images['folder_hot'] ;
					$folder_new = ( ($user_topics[$topic_id]) ? $images['folder_hot_new_own'] : $images['folder_hot_new'] );
				}
				else
				{
					$folder = ($user_topics[$topic_id]) ? $images['folder_own'] : $images['folder'] ;
					$folder_new = ($user_topics[$topic_id]) ? $images['folder_new_own'] : $images['folder_new'] ;
				}
			}

I know there's a bit of work to do to get that into a proper mod. Sorry!
John C Campbell

User avatar
Cheakamus
Registered User
Posts: 69
Joined: Sat Jan 05, 2002 7:30 pm
Location: Reno, NV USA

Post by Cheakamus » Fri Jul 21, 2006 11:15 pm

Whoa... tried this on my forum with almost 2 million posts and it was not happy. MySQL timed out and took down the rest of the board until it finished.

If the "two queries" version is available and might work better on a large BBS please let me know.

Thanks!

Jay
"No one ever went broke underestimating the taste of the American public." - H.L. Mencken

004
Registered User
Posts: 59
Joined: Thu Jan 27, 2005 3:23 pm

Post by 004 » Sun Jul 23, 2006 2:31 am

edit: got it :-)

MitchSchaft
Registered User
Posts: 292
Joined: Fri Jun 06, 2003 10:22 pm
Location: exiled

Post by MitchSchaft » Fri Jul 28, 2006 1:37 am

FYI, installed through EasyMOD (option 3) and works greeat on v 2.0.21. This is without the above mods.

MitchSchaft
Registered User
Posts: 292
Joined: Fri Jun 06, 2003 10:22 pm
Location: exiled

Post by MitchSchaft » Fri Jul 28, 2006 1:46 am

Update: Just uninstalled option 3 and installed option 2. Both work like a charm. I'm sticking with #2!

Also, my board is HEAVILY modded. www.rig-talk.com

angeljhouse
Registered User
Posts: 86
Joined: Wed Jul 26, 2006 5:59 am

Post by angeljhouse » Thu Aug 03, 2006 9:53 am

I have not installed this mod yet as i want to know that...can i set that only admin can add image before topics and change the specific topic color....and disallow anyother user to use this mod's functions??

Can i choose some topic posted by admin will be changed to other colour and some will not be changed to other colour? (that is when admin post notice, admin can change colour themself...but when posting general topics...it can be using default color??)

it must be red in colour or can choose other colour??

except the text colour can be changed, can the text cell (text cell background) change to other colour??

thanks for all your help!

Post Reply

Return to “[2.0.x] MOD Database Cleanup”

Who is online

Users browsing this forum: No registered users and 6 guests