Announcement

Collapse
No announcement yet.

How to get a click on the prefix to filter instead of search

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Glenn Vergara
    commented on 's reply
    You're welcome. I corrected the code in my original post.

  • fcherub
    commented on 's reply
    Wonderful ! Thank you

  • Glenn Vergara
    replied
    I checked and I missed the closing "]"


    Code:
    $filterRadio = $('.filter-options-list [name="filter_prefix"][value="' + prefix + '"]');

    Leave a comment:


  • fcherub
    replied
    Hi Glenn,
    It does work in IE, Chrome, Opera, but not in Firefox (I haven't made any changes to about:config)

    Leave a comment:


  • fcherub
    commented on 's reply
    Thank you!
    I will try it out as soon as I can, will let you know how it goes.
    Federico

  • Glenn Vergara
    replied
    Here's a good solution that leverages the existing Filter dropdown that will not refresh the page.

    Create a template hook at footer_before_body_end hook location with this code:

    Code:
    <script>
    $(function() {
        if ($('.js-topic-prefix').length) {        
            $('.topic-list-container').on('click', '.js-topic-prefix', function(e) {
                var qs = vBulletin.parseQueryString(this.href),
                    searchJSON,
                    prefix,
                    $filterRadio;
    
                try {
                    searchJSON = JSON.parse(qs.searchJSON);
                }
                catch(e) {}
                if (searchJSON) {
                    prefix = searchJSON.prefix[0];
                    $filterRadio = $('.filter-options-list [name="filter_prefix"][value="' + prefix + '"]');
                    if ($filterRadio.length) {
                        $filterRadio.trigger('click');
                        e.preventDefault();
                    }
                }
            });        
        }
    });
    </script>
    If you don't know how to create a template hook, go to one of my mods in my signature. The instructions are similar.
    Last edited by Glenn Vergara; Sun 3rd May '15, 7:53pm.

    Leave a comment:


  • fcherub
    replied
    My workaround: as can be seen here http://www.colocforum.net/forum/offr...location/paris

    An ad widget with links to the filtered content. I will need to style it a bit better and to comment out the prefix link in the display_Topics_item template

    Leave a comment:


  • fcherub
    replied
    Ok, thanks.

    I've seen other software behaving as I described - best not to say which one, I guess!

    An alternative would be (already asked at vb.org, about 3 weeks ago http://www.vbulletin.org/forum/showthread.php?t=318054):

    1. I create a prefix set for each forum
    2. I accept that clicking on a prefix executes a search
    3. I create a module to show on search results pages containing a long list of conditions: if this prefixid, then show this text, so that users would understand what just happened.

    If anyone has an idea of how I would write such a condition, that would also help
    Last edited by fcherub; Wed 22nd Apr '15, 2:14am.

    Leave a comment:


  • Mark.B
    replied
    There isn't necessarily anything you can replace it with. Such a "thing" would need to have been coded in the back end of the software.
    Prefixes were designed to execute a search, there is no other functionality built into the software.

    You're best off asking this on www.vbulletin.org.

    The support team can only assist with using the default software as built. We are not developers or coders.

    I'm not closing the thread, however vbulletin.org is the correct place for such discussions - you are far more likely to find someone who can help there.

    Leave a comment:


  • fcherub
    replied
    Well, so far I can see that I need to replace
    Code:
     href="{vb:url 'search'}?searchJSON={vb:urlencode {vb:raw searchStr}}"
    in the display_Topics_item template with something, but what?

    If you can please leave this topic open, or move it to the questions or suggestions forum, I will post here if I can figure something out, thanks

    Leave a comment:


  • fcherub
    commented on 's reply
    Hello Mark,
    yes, I'm a member at vb.org, been using vbulletin since 3.0.3

  • Mark.B
    replied
    This requires customized code (i.e., 'hacks', plugins, queries, or template modifications). We can't offer official support for customizations, modifications, or for forums running modified code. We do however have a customization site and forums with people that may be willing to help you with this. You may be looking at paying a third party programmer to achieve what you're looking for.

    Please visit http://www.vbulletin.org/forum/ and ask for help there in the appropriate forum. You will need to register on those forums and enter your forum email address on the following form in order to get full access:

    http://www.vbulletin.com/members/mem...t_priority.php

    Leave a comment:


  • fcherub
    started a topic How to get a click on the prefix to filter instead of search

    How to get a click on the prefix to filter instead of search

    Hi,

    I would like to accomplish this because it would save an enormous amount of time for me...

    If clicking on the prefix applied a filter, I could have a single set of prefixes sitewide, in my case "offer" and "demand".

    With the current system, clicking on the prefix does a search in all forums using that prefix set, confusing users, so I would have to create an offer / demand prefix set for each forum.

    It can also be confusing to users because clicking on the prefix opens a search result page which does not have the prefix as a title, it just says Search Results.

    Oftentimes, users will click the post prefix expecting the post to open. This is another reason why the filtering option is best in my opinion. The user will remain on the same page, the filter will appear, and it is clear to them what just happened.

    version: 5.1.6
    Last edited by fcherub; Wed 22nd Apr '15, 1:37am.

Related Topics

Collapse

  • zel
    Click on the prefix
    by zel
    I've a forum that use a lot of prefixes.
    When I'm in a channel and I click on a prefix, vB5 searches that prefix on all the channels.
    I think that it should filter the topics and not search...
    Wed 9th Oct '13, 6:31am
Working...
X