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.
The forum of the forums
4 posters

    Staff Online for phpbb3

    TheCrow
    TheCrow
    Manager
    Manager


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

    Solved Staff Online for phpbb3

    Post by TheCrow November 27th 2014, 2: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
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Staff Online for phpbb3

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

    Hello MrMind,

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


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

    Solved Re: Staff Online for phpbb3

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

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



    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!
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Staff Online for phpbb3

    Post by Ange Tuteur November 27th 2014, 5: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 {  }
    TheCrow
    TheCrow
    Manager
    Manager


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

    Solved Re: Staff Online for phpbb3

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

    Sorry this doesn't work.. Sad



    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!
    Mati
    Mati
    Active Poster


    Posts : 1932
    Reputation : 333
    Language : HTML, CSS & JavaScript
    Location : Forum Services

    Solved Re: Staff Online for phpbb3

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

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


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

    Solved Re: Staff Online for phpbb3

    Post by Ange Tuteur November 27th 2014, 9: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>
    TheCrow
    TheCrow
    Manager
    Manager


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

    Solved Re: Staff Online for phpbb3

    Post by TheCrow November 27th 2014, 9: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 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!
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Staff Online for phpbb3

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

    Try aligning them with this :
    Code:
    .myStaff { vertical-align:middle }
    TheCrow
    TheCrow
    Manager
    Manager


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

    Solved Re: Staff Online for phpbb3

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

    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..
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Staff Online for phpbb3

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

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


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

    Solved Re: Staff Online for phpbb3

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

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



    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!
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51555
    Reputation : 3524
    Language : English
    Location : United States

    Solved Re: Staff Online for phpbb3

    Post by SLGray November 27th 2014, 11:13 pm

    Topic solved and archived



    Staff Online for phpbb3 Slgray10

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

      Current date/time is November 14th 2024, 8:55 pm