• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Likes Review - Most Liked Posts

Has anyone edited this to take permissions into account, that would be willing to post the changes needed?

I'd LOVE to use this!
 
Very nice, thanks for the info!

Are you looking to add in the ability to strip bbcode in the results, as it's showing lots of those codes on that otherwise awesome page...

...and circles, we need more radius/circles! lol ;)
 
Very nice, thanks for the info!

Are you looking to add in the ability to strip bbcode in the results, as it's showing lots of those codes on that otherwise awesome page...

...and circles, we need more radius/circles! lol ;)
I have not found out yet how to exclude [bbcode]*[/bbcode] from the preview.
 
How would one modify this to show the users with the most likes, rather than the posts?
You would have to edit the LikeReview.php file, specifically this code which pulls the data from the DB:

Code:
public function getMostLikedPosts($limit)
    {
        $limitedSql = $this->limitQueryResults("
            SELECT content_id, COUNT(*) AS likes
            FROM xf_liked_content
            WHERE content_type = 'post'
            GROUP BY content_id
            ORDER BY likes DESC
        ", $limit);
        $postIds = $this->_getDb()->fetchCol($limitedSql);

        $postResults = $this->_getPostModel()->getPostsByIds($postIds, array
        (
            'join' => XenForo_Model_Post::FETCH_THREAD | XenForo_Model_Post::FETCH_USER
        ));

        $posts = array();
        foreach ($postResults AS $post)
        {
            $posts["$post[likes].$post[post_date]"] = $post;
        }
        krsort($posts);

        return $posts;
    }

Of course you would then need to edit all the output/displayed content to change it to a users based layout rather than posts.

It would probably be quicker to write a new add-on.
 
And if you want it as a sub-nav item, go into the same template but instead add

Code:
<li><a href="{xen:link likes-review}">Most 'Liked' Posts</a></li>

wherever you prefer. I chose to include it under the Forums tab:

Code:
                    <xen:hook name="navigation_tabs_forums">
                        <xen:if is="{$visitor.user_id}"><li><a href="{xen:link 'forums/-/mark-read', $forum, 'date={$serverTime}'}" class="OverlayTrigger">{xen:phrase mark_forums_read}</a></li></xen:if>
                        <xen:if is="{$canSearch}"><li><a href="{xen:link search, '', 'type=post'}">{xen:phrase search_forums}</a></li></xen:if>
                        <xen:if is="{$visitor.user_id}"><li><a href="{xen:link 'watched/threads'}">{xen:phrase watched_threads}</a></li></xen:if>
                        <li><a href="{xen:link 'find-new/threads'}">{xen:phrase whats_new}</a></li>
                                                <li><a href="{xen:link likes-review}">Most 'Liked' Posts</a></li>
                    </xen:hook>
Oh, yeah, I renamed it, too.
 
Top Bottom