Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Filter Threads By Thread Prefix - MyBB 1.6 Only
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #11
RE: Filter Threads By Thread Prefix - MyBB 1.6 Only
Well, the one I posted works.... I will try yours too though Smile


[Image: leelink.gif]
MYBB1.6 & XThreads
11-16-2010 02:25 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #12
RE: Filter Threads By Thread Prefix - MyBB 1.6 Only
^ I think {$thread} refers to the thread being viewed in showthread (so it will use the prefix of the current thread) whereas {$similar_thread} refers to the thread in the table row.
Yours may not work if these two use different prefixes I think.

My Blog
11-16-2010 08:06 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #13
RE: Filter Threads By Thread Prefix - MyBB 1.6 Only
Hi - I think maybe I was not clear - so here is a pic. I have discovered another issue with this layout though (related to editing)

   

My goal was to show the similar threads - at the moment its calling on similarity of name (which is ok, I can think of things for that) - I think Rateu was looking at similarity of prefix, which is also a good idea. Maybe I could combine them......


[Image: leelink.gif]
MYBB1.6 & XThreads
11-16-2010 10:16 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #14
RE: Filter Threads By Thread Prefix - MyBB 1.6 Only
I'm a bit confused at what you're trying to say.

{$thread['prefix']} will take the prefix ID of the thread you're viewing
{$thread['threadprefix']} will display the prefix "name" of the thread you're viewing
{$similar_thread['prefix']} will take the prefix ID of the thread in the similar thread row
{$similar_thread['threadprefix']} will display the prefix "name" of the thread in the similar thread row

In the last code box you posted here, you're mixing the viewing thread's ID with the similar thread's name (so the link may be incorrect if the two are different).

My Blog
11-16-2010 11:33 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #15
RE: Filter Threads By Thread Prefix - MyBB 1.6 Only
(11-16-2010 11:33 AM)ZiNgA BuRgA Wrote:  I'm a bit confused at what you're trying to say.

{$thread['prefix']} will take the prefix ID of the thread you're viewing
{$thread['threadprefix']} will display the prefix "name" of the thread you're viewing
{$similar_thread['prefix']} will take the prefix ID of the thread in the similar thread row
{$similar_thread['threadprefix']} will display the prefix "name" of the thread in the similar thread row

In the last code box you posted here, you're mixing the viewing thread's ID with the similar thread's name (so the link may be incorrect if the two are different).

Hi Zinga - what I am trying to say - in response to the post from RateU

(11-16-2010 01:47 AM)RateU Wrote:  For the showthread_similarthreads_bit template, maybe you mean like this, Lee?

HTML Code
<a href="{$forumurl_q}filterxt_prefix={$similar_thread['prefix']}">{$similar_thread['threadprefix']}</a>


Is no, I did not mean to say something else - the snippet I posted worked - so does RateU's. Thats it. I have no idea if it is significant that they both work.

Code:
<td class="{$trow}"><a href="{$forumurl_q}filterxt_prefix={$thread['prefix']}">{$similar_thread['threadprefix']}</a>


What do I mean by worked? That the prefix shows up (as in pic) and if I click on that prefix while viewing the show thread it shows me all posts in that forum with that prefix.



[Image: leelink.gif]
MYBB1.6 & XThreads
11-16-2010 03:03 PM
Visit this user's website Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #16
RE: Filter Threads By Thread Prefix - MyBB 1.6 Only
Ok, I have been doing more testing on this - and now have a change of plan - what I am NOW trying to do is to get the threads with the same prefix OR with matching words of the currently viewed thread to show in the similar threads box.

Currently, the similar threads box is showing matches based on similar words in the title of the selected thread - what I am trying to do is get the threads with the same prefix as the selected thread to show. (It might be an idea to have a limit on it as well) - it makes no difference whether I use RateUs code or mine - it does not find the matching prefixes Frown

http://mybbhacks.zingaburga.com/attachment.php?aid=285


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 11-20-2010 01:36 AM by leefish.)
11-20-2010 01:32 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #17
RE: Filter Threads By Thread Prefix - MyBB 1.6 Only
You'll need to modify the query to do that.
Find in showthread.php:

Code:
WHERE t.fid='{$thread['fid']}' AND t.tid!='{$thread['tid']}' AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') >= '{$mybb->settings['similarityrating']}'

And stick a AND t.prefix=<something> type term in there.


My Blog
11-20-2010 07:40 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #18
RE: Filter Threads By Thread Prefix - MyBB 1.6 Only
Hi Zinga - if I make it an AND won't that mean that unless a thread has a prefix it won't show up?


....I shall go test....


[Image: leelink.gif]
MYBB1.6 & XThreads
11-20-2010 08:16 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #19
RE: Filter Threads By Thread Prefix - MyBB 1.6 Only
From memory, if a thread doesn't have a prefix, $thread['prefix'] should be 0, meaning the query will find all threads with no prefixes.

My Blog
11-20-2010 08:22 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #20
RE: Filter Threads By Thread Prefix - MyBB 1.6 Only
ok, I tried it - and no result - I think its because it is looking to do a match as the final piece of the query

PHP Code:
1
2
3
4
5
6
7
8
9
$query = $db->query("
				SELECT t.*, t.username AS threadusername, p.displaystyle AS threadprefix, u.username, MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') AS relevance
				FROM ".TABLE_PREFIX."threads t
				LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid = t.prefix)
				LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
				WHERE t.fid='{$thread['fid']}' AND t.tid!='{$thread['tid']}' AND t.visible='1' AND t.prefix='{$thread['prefix']}' AND t.closed NOT LIKE 'moved|%' AND MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') >= '{$mybb->settings['similarityrating']}'
				ORDER BY t.lastpost DESC
				LIMIT 0, {$mybb->settings['similarlimit']}
			");



I tried adding this

PHP Code:
1
2
3
4
5
6
7
8
9
$query = $db->query("
				SELECT t.*, t.username AS threadusername, p.displaystyle AS threadprefix, u.username, MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') AS relevance
				FROM ".TABLE_PREFIX."threads t
				LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid = t.prefix)
				LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
				WHERE t.fid='{$thread['fid']}' AND t.tid!='{$thread['tid']}' AND t.visible='1' AND t.prefix='{$thread['prefix']}' AND t.closed NOT LIKE 'moved|%' AND MATCH (t.prefix) AGAINST ('".$db->escape_string($thread['prefix'])."') OR MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') >= '{$mybb->settings['similarityrating']}'
				ORDER BY t.lastpost DESC
				LIMIT 0, {$mybb->settings['similarlimit']}
			");


and got this error message

Code:
MyBB has experienced an internal SQL error and cannot continue.
SQL Error:
1191 - Can't find FULLTEXT index matching the column list
Query:
SELECT t.*, t.username AS threadusername, p.displaystyle AS threadprefix, u.username, MATCH (t.subject) AGAINST ('SHOESballetenpointe meshes & uvmaps') AS relevance FROM mybb_threads t LEFT JOIN mybb_threadprefixes p ON (p.pid = t.prefix) LEFT JOIN mybb_users u ON (u.uid = t.uid) WHERE t.fid='46' AND t.tid!='1084' AND t.visible='1' AND t.prefix='2' AND t.closed NOT LIKE 'moved|%' AND MATCH (t.prefix) AGAINST ('2') OR MATCH (t.subject) AGAINST ('SHOESballetenpointe meshes & uvmaps') >= '4' ORDER BY t.lastpost DESC LIMIT 0, 10



[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 11-20-2010 09:33 AM by leefish.)
11-20-2010 09:17 AM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: