HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Modifications for adding pictures to your WhosOnline

peregrineperegrine MVP
edited December 2012 in Feedback

If you don't understand the code don't attempt it, this is only for coders. But it works for me.
I leave it up to gary mardell if he want to modify the plugin with the following changes.

After you make the changes you will have to disable and enable the plugin.

add a css file called

WhosOnline/design/whosonline.css


.whoimage   {
    height: 20px !important;
    width:  20px !important;
    float: left;
    } 



make the following changes to your plugins/WhosOnline/default.php

97c97,98
< 
---

$Sender->AddCssFile('whosonline.css', 'plugins/WhosOnline');

158c159
<           ->Column('Timestamp', 'datetime')
---
          ->Column('Timestamp', 'datetime')
159a161
      ->Column('Photo','varchar(255)', NULL)
make the following changes to  plugins/WhosOnline/class.whosonlinemodule.php

18c18
< 
---
    $Photo = $Session->User->Photo;
22a23
          'Photo'=> $Session->User->Photo,
33c34
<           ->Select('u.UserID, u.Name, w.Timestamp, w.Invisible')
---
      ->Select('u.UserID, u.Name, u.Photo, w.Timestamp, w.Invisible')
44a46,69

function GetPhoto($User, $Options = array()) {
$Session = Gdn::Session();

  $Photo = $Session->User->Photo;
  if (!$Photo && function_exists('UserPhotoDefaultUrl'))
     $Photo = UserPhotoDefaultUrl($User);

  if ($Photo) {
     if (!preg_match('`^https?://`i', $Photo)) {
        $PhotoUrl = Gdn_Upload::Url(ChangeBasename($Photo, 'n%s'));
     } else {
        $PhotoUrl = $Photo;
     }
     $Href = Url(UserUrl($User));
     return '<a title="'.htmlspecialchars($User->Name).'" href="'.$Href.'"'.$LinkClass.'>'
        .Img($Session->User->PhotoUrl, array('alt' => htmlspecialchars($User->Name),'class' => 'ProfilePhotoSmall'))
        .'</a>';
  } else {
     return '';
  }

}

64c89,96
<                           <?php echo UserAnchor($User); ?>
---
                  <?php
                     if(!$User->Photo) {
                      echo UserAnchor($User); 
                      } else {
                      echo UserPhoto($User, array( 'ImageClass' => 'whoimage'));
                      }
                    ?>   

I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

«1

Comments

  • Tried this. got a 'bonk' error message.

  • peregrineperegrine MVP
    edited March 2013

    @MarkWienands said:
    Tried this. got a 'bonk' error message.

    and then you turned on your "deverror" and it produced what ...

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    and then you turned on your "deverror" and it produced what ...

    So happy you are back !!

  • peregrineperegrine MVP
    edited March 2013

    easy as 1-2-3

    0 - disable your who's online in dashboard.

    three steps to pictures in who's online.

    1 - download default.txt and rename it to default.php
    and place new one here plugins/WhosOnline/default.php

    2 - download class.whosonlinemodule.txt and rename it to class.whosonlinemodule.php
    and place it here plugins/WhosOnline/class.whosonlinemodule.php

    3 - download whosonline.txt and rename it to whosonline.css
    and place it here plugins/WhosOnline/design/whosonline.css

    4 - re-enable your whos online plugin in dashboard.

    if you don't disable, make changes, and enable - you will not be doing the procedure correctly.


    anybody with an ability to correctly replace files want to provide feedback as to whether the changes work for you. I know they work for me. But it will give some veracity to the changes if someone else can say yea or nay.

    disregard below if you are not saving backups of the original plugin (especially since you can always download it)

    But, if you are saving backups, I suggest if you are saving backups of the old who's online files, rename them as follows

    for the old files - this my renaming convention - it saves alot of headaches.
    (precede old file with an x- and change extension form php to ph so it doesn't inadvertantly get executed.

    default.php to x-default.ph

    class.whosonlinemodule.php to x- class.whosonlinemodule.ph

    sometime vanilla reads other php files in directories and gets confused.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • +1 to anyone who actually provides some feedback.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • hgtonighthgtonight ∞ · New Moderator

    I can verify that it does indeed show avatars instead of names. The css looks broken on the default theme however.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • peregrineperegrine MVP
    edited March 2013

    thanks for the feedback @hgtonight

    I added a new one below if you want to test it or if someone else does.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • thanks for the feedback @hgtonight

    can you try this. (I modified default.php and class.whosonlinemodule.php and removed the whosonline.css I added.)

    now 1 step less then before :).

    easy as 1-2-3

    0 - disable your who's online in dashboard.

    three steps to pictures in who's online.

    1 - download default.txt and rename it to default.php and place new one here plugins/WhosOnline/default.php

    2 - download class.whosonlinemodule.txt and rename it to class.whosonlinemodule.php and place it here plugins/WhosOnline/class.whosonlinemodule.php

    3 - re-enable your whos online plugin in dashboard.

    if you don't disable, make changes, and enable - you will not be doing the procedure correctly.

    anybody with an ability to correctly replace files want to provide feedback as to whether the changes work for you. I know they work for me. But it will give some veracity to the changes if someone else can say yea or nay.

    disregard below if you are not saving backups of the original plugin (especially since you can always download it)

    But, if you are saving backups, I suggest if you are saving backups of the old who's online files, rename them as follows

    for the old files - this my renaming convention - it saves alot of headaches. (precede old file with an x- and change extension form php to ph so it doesn't inadvertantly get executed.

    default.php to x-default.ph

    class.whosonlinemodule.php to x- class.whosonlinemodule.ph

    sometime vanilla reads other php files in directories and gets confused.

    It tests out with pics and vanillicons and the default theme in vanilla 2.0.18.4 and displays well as far as I can tell.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited March 2013

    also works with vanilla 2.1 default theme and probably other ones as well.

    to align the times to the right you can add this to your custom.css of your theme

     div.WhosOnline  .PanelInfo li {
         text-align: right;
       }
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • 2.0.18.4 test with embed theme in wordpress.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • @peregrine i found 1 bug this night testing some question, when i conect my test user in PC "Full Site" Who's online" show correct members, but when i conect in "mobile site" dont show members ON in this site. When i switch "Mobile site" to "Full site" members are show.

    So..People conecting via mobile is not showing in addon.

    I Explain in spanish now :)))

    Basicamente, me he dado cuenta que la gente que conecta por el movil al foro no se muestran en el addon, a no ser que pasen de la version mobile a la version full site. Que entoces si lo muestran. Lo he visto hoy al hacer yo unas pruebas con 2 usuarios a la vez. Uno desde el pc y otro desde el movil, donde el de pc se veia como si estuviese conectado solo, hasta que el usuario que tenia en el Movil, le di a full site y ya tambien lo mostraba como conectado.

    un saludo!

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited March 2013

    I think the plugin is not mobile friendly , the mobile has pretty much nothing but the bare essentials . you can check this by looking in the plugin info, about.php

  • peregrineperegrine MVP
    edited March 2013

    @Konquet

    i found 1 bug this night testing some question, when i conect my test user in PC "Full Site" >Who's online" show correct members, but when i conect in "mobile site" dont show members >ON in this site. When i switch "Mobile site" to "Full site" members are show.

    So..People conecting via mobile is not showing in addon.

    I think that is the behaviour of who's online before I made changes. you can search for mobile friendly on the forum on how to make plugins mobile friendly. an easy change.

    @vrijvlinder said:
    I think the plugin is not mobile friendly , the mobile has pretty much nothing but the bare essentials . you can check this by looking in the plugin info, about.php

    Yes, all I did was add photos not change permissions or anything about other behavior of the plugin. And I was looking for feedback on whether the changes work for photos, not more modifications :).

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited March 2013

    @litouch

    use the above instructions in this link
    http://vanillaforums.org/discussion/comment/177186/#Comment_177186

    and to display without times but with photos - try this alternate:

    and instead of the class.whosonlinemodule.txt in the comment #177186 above, use the
    alt-class.whosonlinemodule.txt (below) and rename it to plugins/WhosOnline/class.whosonlinemodule.php

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • without times - screenshot.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • phreakphreak Vanilla*APP (White Label) & Vanilla*Skins Shop MVP

    Thanx a lot @peregrine, works great here.

    • VanillaAPP | iOS & Android App for Vanilla - White label app for Vanilla Forums OS
    • VanillaSkins | Plugins, Themes, Graphics and Custom Development for Vanilla
  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited March 2013

    I think the reason it is not mobile friendly is because the panel asset is not there to support it since that is it's Target ? I mean apart from the 'Mobilefriendly'=FALSE;

    Even if you use mobile Friendly true, it won't show because the panel is not there to contain it ...One would have to add the asset panel to the tpl to render the panel in a mobile theme I think. Possibly putting it after the content in module sorting order and floating it left. I kind of would like having the panel in the mobile it is about the width of the mobile already .

    You could possibly even use css in the mobile theme to move it from the none existent panel to below or above the content with some crafty css !

  • @vrijvlinder said:
    I think the reason it is not mobile friendly is because the panel asset is not there to support it since that is it's Target ? I mean apart from the 'Mobilefriendly'=FALSE;

    exactly.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • @peregrine, it's working, but the css seems not very nice... there is no space between the line and thumbnails, a little strange... it would be better if adding some space, I think.

    @vrijvlinder, I tried to remove that line, "->Column('Timestamp', 'datetime')", no luck.

  • 422422 Developer MVP

    margin-top:5px;

    There was an error rendering this rich post.

Sign In or Register to comment.