1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Omit thread from recent activity (code example) 1.x

Allows you to omit a thread from recent activity. Useful for spammy threads.

  1. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Jake Bunce submitted a new resource:

    Omit thread from recent activity (code example) (version 1.x) - Allows you to omit a thread from recent activity. Useful for spammy threads.

    Read more about this resource...
     
  2. Rodrigo Farcas

    Rodrigo Farcas Active Member

    Does it work with an array of thread id's?

    Is this a plugin?
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  4. DRE

    DRE Well-Known Member

    Can you please create a version that will let you omit an entire subforum and the threads included inside?

    This is for registered feeds.

    http://xenforo.com/community/threads/news-reader.28610/

     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Here is code for you:

    Code:
    <?php
    
    class OmitFromRecentActivity_NewsFeedModel extends XFCP_OmitFromRecentActivity_NewsFeedModel
    {
    	public function publish($userId, $username, $contentType, $contentId, $action, array $extraData = null)
    	{
    		if ($contentType == 'post')
    		{
    			$postModel = XenForo_Model::create('XenForo_Model_Post');
    			$post = $postModel->getPostById($contentId, array(
    				'join' => XenForo_Model_Post::FETCH_THREAD
    			));
    
    			if ($post['node_id'] == 18)
    			{
    				return;
    			}
    		}
    		else if ($contentType == 'thread')
    		{
    			$threadModel = XenForo_Model::create('XenForo_Model_Thread');
    			$thread = $threadModel->getThreadById($contentId);
    
    			if ($thread['node_id'] == 18)
    			{
    				return;
    			}
    		}
    
    		parent::publish($userId, $username, $contentType, $contentId, $action, $extraData);
    	}
    }
    
    The node_id is specified twice, one for each content type (posts and threads).
     
    The8thLegion likes this.
  6. DRE

    DRE Well-Known Member

    Thank you very much Jake! I'mma try this when I get home.
     
  7. DRE

    DRE Well-Known Member

    Works great!!!
     
  8. DRE

    DRE Well-Known Member

    How do I include more than one forum? Do I just enter a comma and then the other forum ID?
     
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Code:
    			if (in_array($post['node_id'], array(81,90,154)))
    			{
    				return;
    			}
    
    In your case one section is $post['node_id'], the other is $thread['node_id'].
     
    The8thLegion likes this.
  10. DRE

    DRE Well-Known Member

    You da man!
     
  11. Solidus

    Solidus Well-Known Member

    It's not working for me. I have my thread ID in, but it still shows in recent activity page. "The chat thread"

    PHP:
    <?php

    class OmitFromRecentActivity_NewsFeedModel extends XFCP_OmitFromRecentActivity_NewsFeedModel
    {
        public function 
    publish($userId$username$contentType$contentId$action, array $extraData null)
        {
            if (
    $contentType == 'post')
            {
                
    $postModel XenForo_Model::create('XenForo_Model_Post');
                
    $post $postModel->getPostById($contentId);

                if (
    $post['thread_id'] == 45049)
                {
                    return;
                }
            }

            
    parent::publish($userId$username$contentType$contentId$action$extraData);
        }
    }
     
  12. Solidus

    Solidus Well-Known Member

    Oh, it works now. Took a few minutes to take effect.
     
  13. zastavra

    zastavra Formally Stevez

    Is it possible to modify the add-on in order to omit certain users or user groups?
     

Share This Page