Not Solved creating group for certain notifications
Not Solved
I am using this plugin, but modified to create the unread posts number in the tab. However the plugin author abandoned the he is no help. I modified the previous linked file accordingly....

var unreadPosts = {
    timeout:    false,
    interval:   10,
    enable:     false,
    fid:        0,
    hide:       false,
    updateCounter: function() {
        if (!unreadPosts.enable) {
        $.get( "xmlhttp.php?action=unreadPosts_getUnreads&fid" + unreadPosts.fid, function( data ) {
        var d = data.split('<!--')[2] //strip non-counter
        var d = d.split('-->')[1] //strip to only counter
        var d = d.slice(3, -2); //remove extra paren
        var title = document.title;
       // var title = "Python Forum";
        //if title.startsWtih('('){
        //    var title = title.split(')')[1] //remove extra num if there is one
        //var title = title.split(" ").splice(1,-2)
        if (d != "0"){
            var newTitle = '(' + d + ') ' + "Python Forum";
            document.title = newTitle;
            document.title = "Python Forum";
        if (unreadPosts.timeout) clearTimeout(unreadPosts.timeout);
        unreadPosts.timeout = setTimeout('unreadPosts.updateCounter()', unreadPosts.interval * 1000);

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:

        if (d != "0"){
            if (usergroup == tab_display_true){
                var newTitle = '(' + d + ') ' + "Python Forum";
                document.title = newTitle;
            document.title = "Python Forum";

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?

Messages In This Thread
creating group for certain notifications - by metulburr - 2019-06-19, 01:04 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)