The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Staff online widget always offline

4 posters

Go down

Solved Staff online widget always offline

Post by Bonetz June 13th 2013, 3:57 pm

I have a problem here in Staff Online Widget ..
I use a Online Staff widget as a slide out hover in left side ..
The problem is why is my status and the other staff always offline even though we are online?
I think the Problem is the java script that i use ..

Spoiler:

here is the code that I use ..
Code:
<script type="text/javascript">
 jQuery(function() {
 var x = document.getElementById('left').getElementsByTagName('table')[1];
 var y = document.getElementById('onlineStaff').getElementsByTagName('span');
 for (i=0; i<y.length; i++) {
 if (x.innerHTML.indexOf(y[i].innerHTML) > 0) y[i].innerHTML+=' <img src="'+'http://imageshack.us/a/img198/4198/onlinebg.png'+'">';
 else y[i].innerHTML+=' <img src="'+'http://imageshack.us/a/img812/4033/offlinezn.png'+'">'; } });
 </script>




This code was provided by P-Robs
Source of the Link : Click Here

I hope you help me about this one ..


Last edited by Bonetz on June 13th 2013, 6:05 pm; edited 1 time in total
Bonetz
Bonetz
New Member

Male Posts : 18
Reputation : 2
Language : C++ , Visual Basics , PHP , Java
Location : Cavite , Philippines

Back to top Go down

Solved Re: Staff online widget always offline

Post by E-Mark June 13th 2013, 4:07 pm

LG provided this code from what i know, and he said that he can't guarantee that this will work 100%, most of the forums i saw having this doesn't work either, i always saw it offline even if they're online. LOL. Razz
E-Mark
E-Mark
Active Poster

Male Posts : 1412
Reputation : 169
Language : English
Location : Bitcoin

http://coding-spot.darkbb.com/

Back to top Go down

Solved Re: Staff online widget always offline

Post by LGforum June 13th 2013, 5:15 pm

The code you're using is for a phpbb2 forum. Try this HTML widget:
Code:
<div id="onlinestaff">
    <span>Staff username 1</span>
    <span>staff username 2</span>
    <span>staff username 3</span>
</div>
<script>
jQuery(function() {
    var stafflist = document.getElementById('onlinestaff').getElementsByTagName('span');
    var online = jQuery('.module:last', document.getElementById('left'))[0].innerHTML;
    for(var i = 0, s; (s = stafflist[i++]); ) {
        if(online.indexOf('>' + s.innerHTML + '</') > 0) {
            s.innerHTML += ' <img src="'+'http://imageshack.us/a/img198/4198/onlinebg.png'+'">';
        }
        else {
            s.innerHTML += ' <img src="'+'http://imageshack.us/a/img812/4033/offlinezn.png'+'">';
        }
    }
});
</script>




That should work on your forum as long as you keep the 'Who is online' widget at the bottom of your sidebar.
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

Solved Re: Staff online widget always offline

Post by Bonetz June 13th 2013, 5:29 pm

LGforum wrote:The code you're using is for a phpbb2 forum. Try this HTML widget:
Code:
<div id="onlinestaff">
    <span>Staff username 1</span>
    <span>staff username 2</span>
    <span>staff username 3</span>
</div>
<script>
jQuery(function() {
    var stafflist = document.getElementById('onlinestaff').getElementsByTagName('span');
    var online = jQuery('.module:last', document.getElementById('left'))[0].innerHTML;
    for(var i = 0, s; (s = stafflist[i++]); ) {
        if(online.indexOf('>' + s.innerHTML + '</') > 0) {
            s.innerHTML += ' <img src="'+'http://imageshack.us/a/img198/4198/onlinebg.png'+'">';
        }
        else {
            s.innerHTML += ' <img src="'+'http://imageshack.us/a/img812/4033/offlinezn.png'+'">';
       }
    }
});
</script>





That should work on your forum as long as you keep the 'Who is online' widget at the bottom of your sidebar.

Sir its still not working
Bonetz
Bonetz
New Member

Male Posts : 18
Reputation : 2
Language : C++ , Visual Basics , PHP , Java
Location : Cavite , Philippines

Back to top Go down

Solved Re: Staff online widget always offline

Post by LGforum June 13th 2013, 5:36 pm

I edited my post above and it seems like you've coped the code before I made the edit. Try it again.
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

Solved Re: Staff online widget always offline

Post by Bonetz June 13th 2013, 5:43 pm

LGforum wrote:I edited my post above and it seems like you've coped the code before I made the edit. Try it again.


Sir the problem now is .. even though the staff is offline the status of his name in the staff online widget is always online..
Staff online - Staff online widget always offline QebVeKt
Bonetz
Bonetz
New Member

Male Posts : 18
Reputation : 2
Language : C++ , Visual Basics , PHP , Java
Location : Cavite , Philippines

Back to top Go down

Solved Re: Staff online widget always offline

Post by Bonetz June 13th 2013, 5:46 pm

Sir i think i got a typo error in your code .. give me 10 mins to fix it ..
Bonetz
Bonetz
New Member

Male Posts : 18
Reputation : 2
Language : C++ , Visual Basics , PHP , Java
Location : Cavite , Philippines

Back to top Go down

Solved Re: Staff online widget always offline

Post by LGforum June 13th 2013, 5:56 pm

Just visited your forum and seems to be working. The only staff member online is Bonetz.
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

Solved Re: Staff online widget always offline

Post by Bonetz June 13th 2013, 6:03 pm

Sir its working now thx for the code and for the help .. Solved~
Thanks again~
Bonetz
Bonetz
New Member

Male Posts : 18
Reputation : 2
Language : C++ , Visual Basics , PHP , Java
Location : Cavite , Philippines

Back to top Go down

Solved Re: Staff online widget always offline

Post by Sanket June 13th 2013, 6:08 pm

Topic Solved & Archived
Sanket
Sanket
ForumGuru

Male Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum