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
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...
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&username={$lang->a}" style="padding: 5px;">{$lang->a}</a>
|
(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])?>
|
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:
<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>
|
Try replacing $GLOBALS['filters_set']['xt_uid'] with $GLOBALS['filters_set']['__xt_uid']
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.