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

djbaxter

in memoriam 1947-2022
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?
 
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.webp

Find vote_score

1605212834181.webp

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.webp
 
Back
Top Bottom