Announcement

Collapse
No announcement yet.

Trying to build a thread ignore system.

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

  • 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?

  • #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


    • #3
      Originally posted by IBxAnders View Post
      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


      • #4
        Originally posted by nerbert View Post
        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


        • #5
          Originally posted by Andy View Post
          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


          • #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


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

              Code:
              	private static $field_map = array
              	(
              		'user' => 'userid',
              		'dateline' => 'dateline',
              		'groupid' => 'groupid',
              		'threadid' => 'groupid',
              		'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


              • #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

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