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 Problem

4 posters

Page 1 of 2 1, 2  Next

Go down

Solved Staff Online Widget Problem

Post by Unlosing November 21st 2015, 8:47 pm

Hello, i used coding for the Staff Online Widget. When I am logged in to my account it says I am online under Staff Online. But when i go on a different computer with a different account it says "no staff online" even when I am logged in with my admin account. It is probably the coding that i used for the widget, can you guys give me proper coding for staff online widget.


Last edited by Unlosing on November 22nd 2015, 12:47 am; edited 2 times in total
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Ace November 21st 2015, 9:06 pm

Hello,

You must add the other accounts to the script. Please, add this script into a widget:

Code:
<script type="text/javascript">
  myStaff = ['/u1'];
  staff_cache_time = 4*60*1000; // mm*ss*ms;
  </script>
<div id="theStaff">
</div>
 
<div id="theContent" style="display:none">
</div><script type="text/javascript">
  if (localStorage.staffOn && localStorage.staffEx > +new Date - staff_cache_time) jQuery('#theStaff').html(localStorage.staffOn);
  else loadStaff();
  function loadStaff() {
    jQuery('#theContent').load('/viewonline #main-content a, a.gen', function() {
      for (i=0; i<myStaff.length; i++) jQuery('#theContent a').filter(function() { return jQuery(this).attr('href') === myStaff[i] }).appendTo('#theStaff').wrap('<div class="myStaff">');
      if (!jQuery('#theStaff .myStaff').length) jQuery('#theStaff').html('No staff online');
      jQuery('.myStaff a').each(function() {
        var href = jQuery(this).attr('href');
        jQuery(this).before('<span class="monAva"></span>').prev().load(href + ' #profile-advanced-right .module:first div img:first,.forumline td.row1.gensmall:first > img, .frm-set.profile-view.left dd img,dl.left-box.details:first dd img, .row1 b .gen:first img, .real_avatar img', function() {
          if (window.localStorage) {
            localStorage.staffOn = jQuery('#theStaff').html();
            localStorage.staffEx = +new Date;
          }
        });
      });
    });
  }
  </script>

Locate this line:

myStaff = ['/u1'];

Replace by the users that you want (example):

myStaff = ['/u1', '/u2', '/u5'];

Then, just add a CSS code for it:

Code:
/******STAFF ONLINE**********/
.monAva img {
  height: 40px;
  width: 40px;
  margin-right: 5px;
  background: none repeat scroll 0 0 #FFF;
  border: 1px solid #d5d1c8;
  box-shadow: 0 2px 2px rgba(0,0,0,0.1);
  padding: 1px;
}
.monAva img:hover {
  border: 1px solid black;
}
.myStaff a {
  display:inline-block;
  vertical-align:top;
  margin-top:.75em;
}
/******* STAFF ONLINE********/

See you.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 9:34 pm

What is the staff_cache_time, does it matter if I change that?
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 9:36 pm

And where do I add the CSS code
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Ace November 21st 2015, 9:44 pm

Hello,

Sorry, didn't give you the CSS path Facepalm . Go to your Admin CP>> Display >> Pictures and Colors >> Colors >> CSS Stylesheet.

Staff Cache Time line is to set the interval to refresh the cache (which is a short time memory). You don't have to worry about that. Smile

See you.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 9:50 pm

Ok, but for the ['/u1', '/u2], would i put it like ['/Unlosing', '/Test'] or would i do it without the /
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 10:09 pm

It's not working, it isn't displaying staff online for me
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Ace November 21st 2015, 10:10 pm

Ok, but for the ['/u1', '/u2], would i put it like ['/Unlosing', '/Test'] or would i do it without the /

Hi there,

Nope. For example:

https://help.forumotion.com/u102716 << This is your Profile in FM.

This number is what you're looking for.

The same thing with my profile:

/u80693

That's why the script isn't working for you. Smile

Just replace /Unlosing to the numbers and it should work. Always use the /.

Regards.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 10:15 pm

Wait, how do I find what /u number I am on my own forum
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Ace November 21st 2015, 10:18 pm

Unlosing wrote:Wait, how do I find what /u number I am on my own forum

It follows the same principle. Just click on the member's name (like in a post). When you're inside the profile, you'll see the user number in your URL.

If you'd like, please, provide me with the names of the staff members that you want to add to the widget and your forum URL and I will make the script for you. Smile

See you.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 10:21 pm

It works on my account, but when i am on a different pc logged on to another account, but logged on with my staff account on this pc, it says "no staff online" for my friend even when I am online
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Ace November 21st 2015, 10:30 pm

Unlosing wrote:It works on my account, but when i am on a different pc logged on to another account, but logged on with my staff account on this pc, it says "no staff online" for my friend even when I am online

Ok, can you send me the script that you're using and your forum URL?

Regards.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 10:33 pm

<script type="text/javascript">
myStaff = ['/u1', '/u3'];
staff_cache_time = 4*60*1000; // mm*ss*ms;
</script>
<div id="theStaff">
</div>

<div style="display:none" id="theContent">
</div><script type="text/javascript">
if (localStorage.staffOn && localStorage.staffEx > +new Date - staff_cache_time) jQuery('#theStaff').html(localStorage.staffOn);
else loadStaff();
function loadStaff() {
jQuery('#theContent').load('/viewonline #main-content a, a.gen', function() {
for (i=0; i<myStaff.length; i++) jQuery('#theContent a').filter(function() { return jQuery(this).attr('href') === myStaff[i] }).appendTo('#theStaff').wrap('<div class="myStaff">');
if (!jQuery('#theStaff .myStaff').length) jQuery('#theStaff').html('No staff online');
jQuery('.myStaff a').each(function() {
var href = jQuery(this).attr('href');
jQuery(this).before('<span class="monAva"></span>').prev().load(href + ' #profile-advanced-right .module:first div img:first,.forumline td.row1.gensmall:first > img, .frm-set.profile-view.left dd img,dl.left-box.details:first dd img, .row1 b .gen:first img, .real_avatar img', function() {
if (window.localStorage) {
localStorage.staffOn = jQuery('#theStaff').html();
localStorage.staffEx = +new Date;
}
});
});
});
}
</script>

http://gamebusters.forumotion.com/
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Ace November 21st 2015, 10:48 pm

Hi,

Use this code:

Code:
<script type="text/javascript">
  myStaff = ['/u1', '/u3'];
  staff_cache_time = 4*60*1000; // mm*ss*ms;
  </script>
<div id="theStaff">
</div>
 
<div style="display:none" id="theContent">
</div><script type="text/javascript">
  if (localStorage.staffOn && localStorage.staffEx > +new Date - staff_cache_time) jQuery('#theStaff').html(localStorage.staffOn);
  else loadStaff();
  function loadStaff() {
    jQuery('#theContent').load('/viewonline #main-content a, a.gen', function() {
      for (i=0; i<myStaff.length; i++) jQuery('#theContent a').filter(function() { return jQuery(this).attr('href') === myStaff[i] }).appendTo('#theStaff').wrap('<div class="myStaff">');
      if (!jQuery('#theStaff .myStaff').length) jQuery('#theStaff').html('No staff online');
      jQuery('.myStaff a').each(function() {
        var href = jQuery(this).attr('href');
        jQuery(this).before('<span class="monAva"></span>').prev().load(href + ' #profile-advanced-right .module:first div img:first,.forumline td.row1.gensmall:first > img, .frm-set.profile-view.left dd img,dl.left-box.details:first dd img, .row1 b .gen:first img, .real_avatar img', function() {
          if (window.localStorage) {
            localStorage.staffOn = jQuery('#theStaff').html();
            localStorage.staffEx = +new Date;
          }
        });
      });
    });
  }
  </script>

Ask your friend to clear his browser data (cache and cookies). It'll automatically update after a few minutes.

See you.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 10:59 pm

Does he have to use the built in "clear cache and cookies" on the website, can he use the one for his browser
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Ace November 21st 2015, 11:03 pm

Hello,

I'd recommend a general cache cleaning. But I guess that the forum link should work fine as well (since there aren't external scripts in this particular code).

See you.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 11:05 pm

It still isn't working for him, is it working for you? If so, please take a screenshot and send it to me
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Ace November 21st 2015, 11:16 pm

Hi,

Since your statistics are not shown to guests, I'm not sure if you're online or not. :/

But I got this print from my test forum:

Staff Online Widget Problem IB3K4a2

Test123 is also the u3. And Admin, of course, is the u1. So, since our codes are identical, the problem is the refresh. It took a while to Test123 to appear after he logged in.

Please, refresh your page continuously so the widget can detect that you're online.

Regards.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 11:18 pm

No no, on the right side should be something called Staff Online:
Check that.
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Ace November 21st 2015, 11:20 pm

Unlosing wrote:No no, on the right side should be something called Staff Online:
Check that.

Could you go to your Admin CP >> User & Groups >> Special Rights.

Mark everything that it's possible to Guests.

Regards
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 11:22 pm

Just make an account for test purposes, I can delete you right after if you want me to
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Ace November 21st 2015, 11:30 pm

Unlosing wrote:Just make an account for test purposes, I can delete you right after if you want me to

I have created an account. The problem is that some scripts run using Guest's rights (like the bots on your forum). Therefore, it is impacting how this script works. I have set all these special rights to Administrators at my test forum and the script stopped working. Smile
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 11:32 pm

Well, the script is working on my account, but not on my friends account
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 11:33 pm

It will be easier to chat on my website, post under "Website Bugs" and I will respond
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Ace November 21st 2015, 11:36 pm

Unlosing wrote:Well, the script is working on my account, but not on my friends account

Yes, but did you set up the special rights to Guests? Do it, ask your friend to clear (again) cookies and cache and wait a few minutes. Smile

Regards.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 11:41 pm

But some of these things I don't want on my forum, that's why I disabled them for the average user. What exactly do I need to make available to guests
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Ace November 21st 2015, 11:51 pm

Hi,

I've been testing. So, you'll need:

View the profile (Guests)
Users status display (Guests)

Regards.
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Unlosing November 21st 2015, 11:52 pm

Okay, see if it works now, if so, send me a screenshot
Unlosing
Unlosing
Forumember

Posts : 56
Reputation : 1
Language : English

http://gamebusters.forumotion.com

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Beyonder November 21st 2015, 11:53 pm

Ace is vastly knowledgeable good job.
Beyonder
Beyonder
Forumember

Male Posts : 721
Reputation : 29
Language : English
Location : Beyond Realm

http://fictionalomniverse.forumotion.com/

Back to top Go down

Solved Re: Staff Online Widget Problem

Post by Ace November 22nd 2015, 12:13 am

Hagoromo Otsutsuki wrote:Ace is vastly knowledgeable good job.

Thank you, I truly appreciate it. Smile

Unlosing, it's still not working for me either. However, visit this forum: http://testeaces.forumeiros.com/ It's my test forum. You can see - even as a guest - that the widget is working. (of course that, depending when you access it won't show nobody) Razz

Could you please create a 2nd admin account, log into it from another browser (let you Admin account logged in) and see if the first account is shown?

Regards!
Ace
Ace
Forumember

Posts : 250
Reputation : 49
Language : Portuguese & English

http://ajuda.forumeiros.com/u39577

Back to top Go down

Page 1 of 2 1, 2  Next

Back to top

- Similar topics

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