XF 2.2 How to add number of Q&A upvotes as a category for Notable Members?

djbaxter

Well-known member
In the Notable Members tabs, we can already include a list for most posts/threads and most reactions.

I would like to add a "most upvoted" list for Question and Answer threads.

How would I do this?
 

Brogan

XenForo moderator
Staff member

XDinc

Well-known member
In the Notable Members tabs, we can already include a list for most posts/threads and most reactions.

I would like to add a "most upvoted" list for Question and Answer threads.

How would I do this?

@djbaxter
I can create a guide or add-on for you.

In xf_user Table,

1605212871593.png

Find vote_score

1605212834181.png

All you have to do is check the current structure of XF / Member Stats.

Like as,

PHP:
class YourClass
{
    public static function isVisible(\XF\Entity\MemberStat $memberStat): bool
    {
        return boolval(\XF::db()->fetchOne("
            SELECT user_id
            FROM xf_user
            WHERE vote_score > 0
            LIMIT 1
        "));
    }
}

Result,

1605212606285.png
 
Top