![]() |
creating group for certain notifications - Printable Version +- MyBB Community Forums (https://community.mybb.com) +-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html) +--- Forum: General Support (https://community.mybb.com/forum-176.html) +--- Thread: creating group for certain notifications (/thread-223526.html) |
creating group for certain notifications - metulburr - 2019-06-19 I am using this plugin, but modified to create the unread posts number in the tab. However the plugin author abandoned the plugin....so he is no help. I modified the previous linked file accordingly....
Right in the if condition that changes the document.title or leaves it as "Python Forum" I would like to add another clause that if the user is in a certain user group ( a secondary user group that wants to see this notification in the tab) then they see the number, otherwise they do not. so pseudo code like:
But i dont know how to define "usergroup" or "tab_display_true" group within the javascript file? In PHP to get the UID of hte user you would do similar to I am assuming instead of uid there is one for usergroup? But still even if there is, how to you apply it to a javascript file?
RE: creating group for certain notifications - Mipher - 2019-06-19 That's a server-side work. You need to edit this function: inc/plugins/unreadPosts.php#L261 Mainly, you need to return two data: the count template (as the plugin already does) and your cleaned unread posts count (without the manipulation of a template) with your usergroup check. Then in the js file you just need to read the variable (check if is set/greater than 0) and do your document.title manipulation. It is better if you return the data in json since you need to pass multiple data.
RE: creating group for certain notifications - metulburr - 2019-06-19 thanks a lot! When i get time later on i will try to apply this and see where i sit. |