The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Staff online widget always offline

Go down

Solved Staff online widget always offline

Post by Bonetz on Thu 13 Jun - 15:57:12

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 Thu 13 Jun - 18:05:40; edited 1 time in total
avatar
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 on Thu 13 Jun - 16:07:45

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
avatar
E-Mark
Active Poster

Male Posts : 1389
Reputation : 164
Language : English, Tagalog
Location : Republic of the Philippines

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

Back to top Go down

Solved Re: Staff online widget always offline

Post by LGforum on Thu 13 Jun - 17:15:15

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.
avatar
LGforum
Hyperactive

Male Posts : 2263
Reputation : 260
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Solved Re: Staff online widget always offline

Post by Bonetz on Thu 13 Jun - 17:29:35

@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
avatar
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 on Thu 13 Jun - 17:36:43

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

Male Posts : 2263
Reputation : 260
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Solved Re: Staff online widget always offline

Post by Bonetz on Thu 13 Jun - 17:43:46

@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..
avatar
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 on Thu 13 Jun - 17:46:39

Sir i think i got a typo error in your code .. give me 10 mins to fix it ..
avatar
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 on Thu 13 Jun - 17:56:21

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

Male Posts : 2263
Reputation : 260
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Solved Re: Staff online widget always offline

Post by Bonetz on Thu 13 Jun - 18:03:25

Sir its working now thx for the code and for the help .. Solved~
Thanks again~
avatar
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 on Thu 13 Jun - 18:08:27

Topic Solved & Archived
avatar
Sanket
ForumGuru

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

http://webartzforum.com

Back to top Go down

Back to top


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