Trying to build a thread ignore system.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nerbert
    New Member
    • May 2008
    • 15
    • 3.6.x

    Trying to build a thread ignore system.

    Using vB 4.1.5 PS

    I had an add-on for vB3.7.3 for ignoring threads, forums and tags but with the new search system it no longer works, so I want to build up a new one from scratch. I'm not interested much in forums or tags, mostly threads and it only needs to work in New Posts or Daily Posts.

    So in my experimental version of search.php I hacked in a hook at the bottom of function set_newitem_forums($criteria) (line 1146) and tried the following plugin:

    PHP Code:
    if($vbulletin->userinfo['userid'] == 5)
    {
    //echo 'Testing plugin for ignore system.';
     
    ini_set('display_errors''1');

    $thread_string '7491,3161,7555';
    $forum_string '16,17';

    $threads explode(','$thread_string);
    $threads array_map('intval'$threads);

    $forums  explode(','$forum_string);
    $forums  array_map('intval'$forums);

    global 
    $vbphrase;
    $criteria->add_filter('forumid',  vB_Search_Core::OP_NEQ$forums);
    $criteria->add_filter('threadid'vB_Search_Core::OP_NEQ$threads);

    It works fine for ignoring forums (which I could already do) but the thread ignore doesn't work. Am I doing something wrong or is it somehow impossible to ignore posts by threadid?
  • IBxAnders
    Senior Member
    • Aug 2001
    • 1172
    • 4.0.x

    #2
    You do realize that you can block certain forums from appearing in search results by going to Forum Manager -> Edit forum settings -> Index posts in Search
    anders | vbulletin team | check out the new vbulletin facebook app
    Proudly vBulletin'ing since 2001
    Please be my friend!
    http://www.twitter.com/inetskunkworks
    vBulletin Performance Articles:
    Click here to read

    Comment

    • nerbert
      New Member
      • May 2008
      • 15
      • 3.6.x

      #3
      Originally posted by IBxAnders
      You do realize that you can block certain forums from appearing in search results by going to Forum Manager -> Edit forum settings -> Index posts in Search
      But that does it for everyone. I would want it so users can select which forums to ignore. Besides that I'm mostly interested in ignoring threads.

      I can't see why I can't exclude posts based on threadid, presumably if you can exclude them by forumid or userid, then the same should go for threadid.

      Comment

      • Andy
        Senior Member
        • Jan 2002
        • 5886
        • 4.1.x

        #4
        Originally posted by nerbert
        Am I doing something wrong or is it somehow impossible to ignore posts by threadid?
        The default code doesn't have a provision to ignore by threadid. You would have to hack that in.

        Comment

        • nerbert
          New Member
          • May 2008
          • 15
          • 3.6.x

          #5
          Originally posted by Andy
          The default code doesn't have a provision to ignore by threadid. You would have to hack that in.
          That's what the last line of the plug in is supposed to do. The one above it successfully ignores forums. I even tried hacking a full blown thread ignore function into vb/search/criteria.php:

          PHP Code:

              
          public function add_excludethread_filter($threadids)
              {
                  global 
          $vbphrase;

                  
          $this->add_filter('threadid'vB_Search_Core::OP_NEQ$threadids);
                  
          $this->add_display_strings('exclude_forum'vB_Search_Searchtools::getDisplayString('forum'$vbphrase['excluded_forums'], 'title''forumid'$forumidsvB_Search_Core::OP_NEQfalse));
              } 

          It's based on add_excludeforum_filter($forumids) on line 460. Still doesn't work. I suspect an alias for threadid in the query but damned if I can find away to see or output the query string.

          PHP used to be fun.

          Comment

          • Pandemikk
            Member
            • Apr 2009
            • 68
            • 3.7.x

            #6
            I think Andy means that the search criteria doesn't ignore threads. So you're trying to hack something into a query that doesn't exist.

            You'll have to modify the actual search criteria itself and add a "AND threadid NOT IN ($excluded_threadids)" at the end. You'll want to do some sanitizing and other obvious stuff as well.
            Rap Battles & Hip Hop Music - LyricalThreats

            Sure glad he's former staff. Didn't even bother to validate my license

            Comment

            • Paul M
              Former Lead Developer
              vB.Com & vB.Org
              • Sep 2004
              • 9886

              #7
              There seems to be a somewhat strange mapping in the searchcontroller.

              Code:
              	private static $field_map = array
              	(
              		'user' => 'userid',
              		'dateline' => 'dateline',
              		'groupid' => 'groupid',
              [COLOR="#FF0000"]		'threadid' => 'groupid',
              [/COLOR]		'contenttypeid' => 'contenttypeid',
              
              		'defaultdateline' => 'dateline',
              		'groupdateline' => 'dateline',
              
              		'defaultuser' => 'userid',
              		'groupuser'   => 'userid',
              
              		'rank'  => 'score',
              		'relevance'  => 'score'
              	);
              Just out of interest, can you change that to 'threadid' => 'threadid', and see if your plugin works.
              Baby, I was born this way

              Comment

              • Leinad_r
                Senior Member
                • Sep 2011
                • 235

                #8
                anybody knows if such a add-on exists for vb4?
                Not sent from my iPhone and not using any browser attaching any 3rd party advertisement to my posts

                Comment

                • Trevor Hannant
                  vBulletin Support
                  • Aug 2002
                  • 24325
                  • 5.7.X

                  #9
                  Have you tried searching at www.vbulletin.org?
                  Vote for:

                  - Admin Settable Paid Subscription Reminder Timeframe (vB6)
                  - Add Admin ability to auto-subscribe users to specific channel(s) (vB6)

                  Comment

                  widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                  Working...