Introducing Quests: Tailored gamification & bridging in-person events with your community Mike Gitkos Yesterday at 12:39 PM1 day
Posted May 9, 20187 yr I'd like to be able to differentiate where a post is submitted by checking the forum it was posted in. I feel like adding Forum ID to the Post object would be a good addition. May as well add Topic ID to it as well.
May 9, 20187 yr You can already access the topic by using $comment->item() and the Item class has a method called container() which would return you then the forum object
May 9, 20187 yr The post response returns the topic id , so you could use a second REST request to the topic endpoint which will return the topic and also forum details
May 9, 20187 yr In the post return, you'll get the item ID. You can do an additional call to "/forums/topics/{id}", where you'll get info about the forum too. Or if this is for your own site, you can create a hook that overloads \IPS\Content\Comment::apiOutput(), and add the forum ID to what it returns. public function apiOutput( \IPS\Member $authorizedMember = NULL ) { $parentReturn = parent::apiOutput( $authorizedMember ); $parentReturn['forum'] = $this->item()->container()->apiOutput( $authorizedMember ); return $parentReturn; } Untested.
May 9, 20187 yr Author Oh right, I didn't realise the item_id was the topic ID. This should be fine, though I don't really want to be making multiple API requests but I'll take what I can get! Thanks :)
Archived
This topic is now archived and is closed to further replies.