MyBB Community Forums

Full Version: stuck at assign a function for specific usergroup
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i was actually developing a Aio monthly post counter plugin which should count monthly posts of the specified group's user(there postcounts should be shown in their profile fields,postbits[only  those selected group's users only*])
till now i came to this function:

there i tried with admin's postcount.
but don't know how to add like
if $user is in == specified usergroup then {
function postcount () for him
and i tried to show the posts (using {$posts}) in the template but failed :/
anyone can help ?
I think that you need to do a left join query not a simple query. It must select the userid and the group id of the author
ok i fixed the usergroup stuff but the variable is not shown on templates,
i tried echo and it worked(echo inside function) but not working in template.

here is my full plugin:

currently what it does:
  1. counts user's all visible posts of specific usergroup(i successfully implemented that) from 1st of this month onwards, we can also exclude forums whose posts we don't wants to be get counted.
  2. it creates postcount_postbit, postcount_profile templates in global template & pasts {$postcount_postbit} to postbit,postbit_classic templates & {$postcount_profile} to member_profile template.

what i wants to do but failing:
  1. the {$postcount_postbit} and {$postcount_profile} are not being displaced on postbit as well as in member profile.. and when i tried only {$postscount} by manually adding on postbit and member profile but only in members profile page it displayed, in postbit,its still not displayed..
  2. When i add {$postscount} manually on member profile then if my(the user who is watching anyone's profile) $postscount are displayed in every members profile :/ which is i guess because i haven't stored the data in database.. but in data base where i should add my each users $postcount so it can be easily showed/updated like {$postscount} ? which hooks would be involved in this ?
Where is code to load templates?
I wants to load it in the postbit & in each users profile page..
You need to load it in the plugin