MyBB Community Forums
stuck at assign a function for specific usergroup - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: stuck at assign a function for specific usergroup (/thread-199871.html)



stuck at assign a function for specific usergroup - HMR - 2016-09-04

Hello,
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:
http://pastebin.com/aAkBsvyV


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 ?


RE: stuck at assign a function for specific usergroup - chack1172 - 2016-09-04

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


RE: stuck at assign a function for specific usergroup - HMR - 2016-09-05

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:
http://pastebin.com/zgrRgZk2

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 ?



RE: stuck at assign a function for specific usergroup - chack1172 - 2016-09-06

Where is code to load templates?


RE: stuck at assign a function for specific usergroup - HMR - 2016-09-06

I wants to load it in the postbit & in each users profile page..


RE: stuck at assign a function for specific usergroup - chack1172 - 2016-09-06

You need to load it in the plugin