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 for phpbb3

4 posters

Go down

Solved Staff Online for phpbb3

Post by TheCrow November 27th 2014, 4:29 pm

Hello,

I am currently testing a code for phpbb3. I am using this code in the widget for the Staff Online widget but it seems that the avatars are not displaying. Could i get some help on that?

Code:
    <script type="text/javascript">
    myStaff = ['/u1', '/u2'];
    staff_cache_time = 4*60*1000; // mm*ss*ms;
    </script>   
<div id="theStaff">
</div>
   
<div style="display:none" id="theContent">
</div>
    <noscript><div style="color:red;font-size:9px">Functionality of this widget is not possible, as JavaScript is disabled or unsupported.</div></noscript>    <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');
        if (window.localStorage) {
          localStorage.staffOn = jQuery('#theStaff').html();
          localStorage.staffEx = +new Date;
        }
      })
    }
    </script>

Version: Phpbb3


Thanks
TheCrow
TheCrow
Manager
Manager

Male Posts : 6921
Reputation : 795
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Staff Online for phpbb3

Post by Ange Tuteur November 27th 2014, 4:53 pm

Hello MrMind,

From what I'm looking at there's nothing in there that displays the avatar, it only returns a name.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Staff Online for phpbb3

Post by TheCrow November 27th 2014, 5:45 pm

How can i make it return the avatar of the name also?


staff posts - Staff Online for phpbb3 Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6921
Reputation : 795
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Staff Online for phpbb3

Post by Ange Tuteur November 27th 2014, 7:42 pm

See if this works :
Code:
    <script type="text/javascript">
    myStaff = ['/u1', '/u2'];
    staff_cache_time = 4*60*1000; // mm*ss*ms;
    </script> 
<div id="theStaff">
</div>
 
<div style="display:none" id="theContent">
</div>
    <noscript><div style="color:red;font-size:9px">Functionality of this widget is not possible, as JavaScript is disabled or unsupported.</div></noscript>    <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');
        $('.myStaff a').each(function() {
          var href = $(this).attr('href');
          $(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>

You can style the images with this CSS :
Code:
.monAva img {  }
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Staff Online for phpbb3

Post by TheCrow November 27th 2014, 10:46 pm

Sorry this doesn't work.. Sad


staff posts - Staff Online for phpbb3 Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6921
Reputation : 795
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Staff Online for phpbb3

Post by Mati November 27th 2014, 11:17 pm

Change those dollars $ singes with the word jQuery in code code given by Ange Tuteur, and it should work.
Mati
Mati
Hyperactive

Posts : 2020
Reputation : 330
Language : HTML, CSS & JavaScript
Location : Forum Services

https://forumservice.forumotion.com/

Back to top Go down

Solved Re: Staff Online for phpbb3

Post by Ange Tuteur November 27th 2014, 11:55 pm

Oh yes, I forgot. I don't manage script in widgets much Mr. Green

Try now
Code:
   <script type="text/javascript">
    myStaff = ['/u1', '/u2'];
    staff_cache_time = 4*60*1000; // mm*ss*ms;
    </script>
<div id="theStaff">
</div>
 
<div style="display:none" id="theContent">
</div>
    <noscript><div style="color:red;font-size:9px">Functionality of this widget is not possible, as JavaScript is disabled or unsupported.</div></noscript>    <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>
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Staff Online for phpbb3

Post by TheCrow November 27th 2014, 11:57 pm

That works like a charm! One little problem! How can i move the names of the staff and align them in the middle?


staff posts - Staff Online for phpbb3 Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6921
Reputation : 795
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Staff Online for phpbb3

Post by Ange Tuteur November 27th 2014, 11:59 pm

Try aligning them with this :
Code:
.myStaff { vertical-align:middle }
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Staff Online for phpbb3

Post by TheCrow November 28th 2014, 12:09 am

uhm i don't know if that made something because the avatars disappear all of a sudden.. Sad

My bad! The avatars appeared! But the code didn't do anything..
TheCrow
TheCrow
Manager
Manager

Male Posts : 6921
Reputation : 795
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Staff Online for phpbb3

Post by Ange Tuteur November 28th 2014, 12:42 am

Try this :
Code:
.myStaff a {
  display:inline-block;
  vertical-align:top;
  margin-top:.75em;
}
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Staff Online for phpbb3

Post by TheCrow November 28th 2014, 12:49 am

Yes that fixed it! Thank you both! Topic Solved!


staff posts - Staff Online for phpbb3 Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6921
Reputation : 795
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Staff Online for phpbb3

Post by SLGray November 28th 2014, 1:13 am

Topic solved and archived


staff posts - Staff Online for phpbb3 Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51519
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

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