XF 2.2 Adding into the NewsFeed

mjda

Well-known member
I made an add-on that lets members "Bump" their threads without posting. I'd like to get that added into the "Latest activity" news feed, but I can't figure out how to do it. I'd simply like it to say "User1 bumped the thread My Thread Title.".

I should note that I don't have an entity here, so there is no content type, other than thread.

Any help would be greatly appreciated.
 

Jeremy P

XenForo developer
Staff member
You'd likely want to call \XF\Repository\NewsFeed::publish and create a corresponding template.
 

mjda

Well-known member
Thanks again, @Jeremy P! Got it figured out and working perfectly!

For those who are looking at how to do this, here is the code I added:

Code:
$newsFeedRepo = $this->repository('XF:NewsFeed');
$newsFeedRepo->publish('thread', $thread->thread_id, 'bump', $visitor->user_id, $visitor->username);

Then I added a template called news_feed_thread_bump, which is pretty much a duplicate of news_feed_thread_insert. Along with that I added a new phrase news_feed_thread_bump which, again, was just a duplicate of news_feed_thread_insert.
 
Top