Alphabetical Filtering
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #1
Alphabetical Filtering
I am working on a forum set up and the owner would like to have the option to filter subjects alphabetically in addition to the filter by prefix I already have set up for him.

The current install has XThreads v1.53 and I already have a basic set of templates set for this forum.

Ideally, I would like to be able to offer an alphabet bar (like in the mybb member list) so that when the user clicks on say P s/he gets all the subjects starting with P.

I did consider setting up an XThreads Custom Field that would extract the FIRST letter of the post subject and then setting up a filter for it. I am not sure how to do that though.

Please can you advise how I can go about getting that first letter in a value so I can filter on it?

Thank you.

Link to forum: http://www.classifiedbilliards.com/mybb/...http://www.classifiedbilliards.com/mybb/forumdisplay.p


[Image: leelink.gif]
MYBB1.6 & XThreads
07-11-2012 10:24 PM
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: #2
RE: Alphabetical Filtering
Partial match filtering was an idea I had, but I don't think I'll implement it.
A thread field may work with XThreads v1.60's input formatter option (and you don't have existing threads, and don't expect to move threads into the forum), but it is ugly...

My Blog
(This post was last modified: 07-11-2012 10:45 PM by ZiNgA BuRgA.)
07-11-2012 10:43 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #3
RE: Alphabetical Filtering
Yes, I was a bit afraid of that. I had a similar situation where I needed the thread user id to be a custom field (rather than using the XT_filter url option as the two formats don't seem to chain together nicely) and I got round it by adding an XThreads field with a default value of {$thread['uid']}. That did work, so I was wondering if there was a conditional function that would get JUST the first letter, and then a filter to try and match it?

Like in the memberlist it has this line:

Code:
<a href="memberlist.php?username_match=begins&amp;username={$lang->a}" style="padding: 5px;">{$lang->a}</a>



[Image: leelink.gif]
MYBB1.6 & XThreads
07-11-2012 11:17 PM
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: #4
RE: Alphabetical Filtering
(07-11-2012 11:17 PM)leefish Wrote:  rather than using the XT_filter url option as the two formats don't seem to chain together nicely
It _should_ work... >_>

(07-11-2012 11:17 PM)leefish Wrote:  I got round it by adding an XThreads field with a default value of {$thread['uid']}. That did work
It won't if you do stuff like move threads into the forum, have existing threads etc.

(07-11-2012 11:17 PM)leefish Wrote:  I was wondering if there was a conditional function that would get JUST the first letter

Code:
<?=strtolower($mybb->input['subject'][0])?>


My Blog
(This post was last modified: 07-12-2012 08:41 PM by ZiNgA BuRgA.)
07-12-2012 08:40 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #5
RE: Alphabetical Filtering
Hello again, back with a filtering question. I said that the xt_filters and the tf_filters did not chain together nicely, and I now have an example to show what I mean.

In this forum >>  http://www.leefish.nl/mybb/forumdisplay....http://www.leefish.nl/mybb/forumdisplay.php?filtertf_prefix=Sims2&filtertf_pfcat=Buy&filterxt_uid=501&fid=22&sortby=starter&order=desc

I have filtered by game:sims2, category:buy and uid501:XanderGC. As you can see, the filter has worked perfectly, but in the uploader box the name of the selected uploader (xt_uid) is not showing, though it does show the selected value in the game and category. It would be very cool if I could get the username that has been selected to show as it does for the other two options but I cannot figure it out. Help appreciated.

Here is my html (used in the forumdisplay_threadlist)

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<div>
	
<form action="forumdisplay.php" method="get">
				<label>Game</label><select name="filtertf_prefix">
<option value="">All</option>
<option value="Sims2"{$GLOBALS['filters_set']['prefix']['selected']['Sims2']}>Sims2</option>
<option value="Sims3"{$GLOBALS['filters_set']['prefix']['selected']['Sims3']}>Sims3</option>
 </select>

				<label>Category</label><select name="filtertf_pfcat">
					<option value="">All</option>
<option value="Buy"{$GLOBALS['filters_set']['pfcat']['selected']['Buy']}>Buy</option>
<option value="Build"{$GLOBALS['filters_set']['pfcat']['selected']['Build']}>Build</option>
<option value="Bodyshop"{$GLOBALS['filters_set']['pfcat']['selected']['Bodyshop']}>Bodyshop</option>
<option value="CAS"{$GLOBALS['filters_set']['pfcat']['selected']['CAS']}>CAS</option>
<option value="Community Lot"{$GLOBALS['filters_set']['pfcat']['selected']['Community Lot']}>Community Lot</option>
<option value="Food"{$GLOBALS['filters_set']['pfcat']['selected']['Food']}>Food</option>
<option value="Mods and Hacks"{$GLOBALS['filters_set']['pfcat']['selected']['Mods and Hacks']}>Mods and Hacks</option>
					
				</select>

				<label>Uploader</label><select name="filterxt_uid">
					<option value="">All</option>
<option value="334"{$GLOBALS['filters_set']['xt_uid']['selected']['Michelle']}>Michelle</option>
<option value="501"{$GLOBALS['filters_set']['xt_uid']['selected']['501']}>XanderGC</option>
				 </select>

</if>

<label style="margin: 5px;width: 80px;"><input type="submit" class="button" value="Apply Filters" /></label>
				<input type="hidden" name="fid" value="{$fid}" />
				<input type="hidden" name="sortby" value="{$sortby}" />
				<input type="hidden" name="order" value="{$sortordernow}" />
				<input type="hidden" name="datecut" value="{$datecut}" />

<span style="{$filters_set['__all']['visiblecss']}"><a href="forumdisplay.php?fid={$fid}"><span class="sigbutton">Clear filter</a></span>
		</form>



</div>



[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 09-11-2012 01:04 AM by leefish.)
09-10-2012 03:41 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: #6
RE: Alphabetical Filtering
Try replacing $GLOBALS['filters_set']['xt_uid'] with $GLOBALS['filters_set']['__xt_uid']

My Blog
09-10-2012 11:05 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #7
RE: Alphabetical Filtering
Thank you - it works. I read the docs and I saw the stripe but when I tried it I failed because I had ['_xt_uid'] - only ONE underscore in front. Read fail on my part, thanks for helping me out.


[Image: leelink.gif]
MYBB1.6 & XThreads
09-10-2012 11:16 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: