Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

In this Discussion

Vanilla 2.6 is here! It includes security fixes and requires PHP 7.0. We have therefore ALSO released Vanilla 2.5.2 with security patches if you are still on PHP 5.6 to give you additional time to upgrade.
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

Display user most active category in user profile

Hi. I would like to display user most active category in his user profile.
Is this possible ?


  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    It's certainly possible. But there is one catch I see here: category permissions. Imagine you have a forum where you have a category which is reserved for admins and mods. Or any other category which isn't public, a category which is only accessible for forum members. What should a guest see when he is looking at the profile of a user who is most active in a non public category?

    Most probably the second most used category, okay. But the problem is, that in such a case a) you would have to calculatate the information for each profile visit or b) cache more values.

    But further than that, I couldn't see a real problem here.

    Depending on where in the profile you like to see that information and how, you might me able to "re-use" an existing plugin to solve the problem on how to show something in the profile.

    Normally I advice to use a model to get information from tables. In this case I would advice to use a prepared SQL query, since it would be quite complicated.

    I would store the result (a sorted array of categories) in the UserMeta table and recalculate the information

    • after every discussion save
    • after every comment save and
    • on every profile visit where CountDiscussions + CountComments > 0 and no cached array is available

    I don't think this is a good beginner plugin, but if you have some programming experiences, it's surely do-able.

Sign In or Register to comment.