Jaxel
Well-known member
So I've made a custom like handler... you can see it here: (must be logged in to like)
http://www.8wayrun.com/media/soul-edge-blade-introduction-edge-of-soul.776/
It works great at liking, it adds likes, subtracts likes, and works through ajax without any issues. The likes also appear properly on my "account/likes" page.
However, I have run into a few issues that I have no idea how to fix:
http://www.8wayrun.com/media/soul-edge-blade-introduction-edge-of-soul.776/
It works great at liking, it adds likes, subtracts likes, and works through ajax without any issues. The likes also appear properly on my "account/likes" page.
However, I have run into a few issues that I have no idea how to fix:
- Likes do not appear on "recent-activity"
http://www.8wayrun.com/recent-activity/
- Likes do not appear on "news feeds"
- When someone likes a media, the alert system says I have an alert (red marker), however when I go the alert tab, it says I have no new alerts. The like alert also does not appear in my "latest alerts" page.
Code:
<?php
class EWRmedio_LikeHandler_Media extends XenForo_LikeHandler_Abstract
{
public function incrementLikeCounter($contentId, array $latestLikes, $adjustAmount = 1)
{
$dw = XenForo_DataWriter::create('EWRmedio_DataWriter_Media');
$dw->setExistingData($contentId);
$dw->set('media_likes', $dw->get('media_likes') + $adjustAmount);
$dw->set('media_like_users', $latestLikes);
$dw->save();
}
public function getContentData(array $contentIds, array $viewingUser)
{
$mediaModel = XenForo_Model::create('EWRmedio_Model_Media');
$medias = $mediaModel->getMediasByIDs($contentIds);
return $medias;
}
public function getListTemplateName()
{
return 'news_feed_item_media_like';
}
}