Resource icon

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

No permission to download

Jake Bunce

Well-known 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.

It will prevent any new feed entries being made for a thread.

You need to edit this file to specify the thread_id you want to omit:

library/OmitFromRecentActivity/NewsFeedModel.php

Rich (BB code):
<?php

class OmitFromRecentActivity_NewsFeedModel extends XFCP_OmitFromRecentActivity_NewsFeedModel
{
	public function publish($userId, $username, $contentType, $contentId, $action, array $extraData = null)
	{
		if ($contentType == 'post')
		{
			$postModel =...

Read more about this resource...
 
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/

Okay I also found out putting the news bot on invisible and making it so no one can view their activity feed does work for most regular members but does not work for users who can bypass user privacy. Because of that, news bot posts will show up for them in recent activity.
 
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/

Here is code for you:

Rich (BB 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).
 
How do I include more than one forum? Do I just enter a comma and then the other forum ID?
 
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);
    }
}
 
Top Bottom