Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

Integration with YAGA?

This discussion is related to the Members List Enhanced addon.

Thanks for the plugin!

I noticed Peregrine's reactions were included in this plugin. Now that YAGA has been updated to 2.2, what's the odds of
getting those reactions integrated?

Comments

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    The easiest way is to simply add the modules for the leaderboards from yaga to the page for members list .

  • hgtonighthgtonight ∞ · New Moderator

    What kind of integration?

    You want to see how many of each reaction a user has? Or just their total points?

    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.

  • PFAFFPFAFF
    edited March 2016

    Number of each reaction was what I was thinking (similar to how Peregrine's worked). But, total points / rank would be cool too.

  • PFAFFPFAFF
    edited March 2016

    ^ not sure why my comment is bold... Figured it out. Forum doesn't like pound sign in comment.

  • hgtonighthgtonight ∞ · New Moderator

    Total points and rank are both stored in the user model, so they would be "free" to display.

    Getting reaction totals for a list of users would require iterating over the list and performing a query for each one currently. I don't think it would scale well. You could definitely do it with some custom SQL.

    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.

  • Can you guys give me a hint as to where I need to be looking in Members List & YAGA in order to make this happen? Still very much a novice with PHP (learning though!).

  • hgtonighthgtonight ∞ · New Moderator

    You can access the points from the user object directly ($User->Points in the view file). The rank ID is also stored in the user object, but you will probably want to load the rank names once and then just reference in the loop.

    $ranks = Yaga::RankModel()->Get();
    $rankNames = array();
    foreach($ranks as $rank) {
        $rankNames[$rank->RankID] = $rank->Name;
    }
    

    Now you can output the user's rank like this:

    echo $rankNames[$User->RankID];
    

    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.

    PFAFF
  • Awesome! This gives me a starting point. Thanks, @hgtonight.

  • PFAFFPFAFF
    edited March 2016

    @hgtonight, I've got it outputting correctly! Thanks for the tip!

    I tied it in with $ShowPhoto so unfortunately, when I click on the header to sort it sorts by name. What is tying it to sort?

    Link: http://www.nerdlouisville.org/discussion/#/plugin/MembersListEnh

  • PFAFFPFAFF
    edited March 2016

    Here's the relevant code:

    if ($ShowPhoto) echo '<th>' . Anchor(T('Photo'),$MColUrl . '&ufield=' . 'Name' . '&sort=' . $NewSort ) .'</th>'; echo '<th>' . Anchor(T('Username'),$MColUrl . '&ufield=' . 'Name' . '&sort=' . $NewSort ) .'</th>'; echo '<th>' . Anchor(T('Rank'),$MColUrl . '&ufield=' . 'Rank' . '&sort=' . $NewSort ) .'</th>'; echo '<th>' . Anchor(T('Points'),$MColUrl . '&ufield=' . 'Points' . '&sort=' . $NewSort ) .'</th>';

    if ($ShowPhoto) echo '<td>' .UserPhoto($User,array('LinkClass'=>'ProfilePhotoCategory','ImageClass'=>'ProfilePhotoMedium')) . '</td>'; echo '<td>' . UserAnchor($User). '</td>'; echo '<td>' . $rankNames[$User->RankID] . '</td>'; echo '<td>' . $User->Points . '</td>';

  • hgtonighthgtonight ∞ · New Moderator
    edited March 2016

    @PFAFF That paged is restricted. I tried creating an account but it didn't send the email. It also wouldn't let me log in with facebook (which I generally hate doing anyway).

    EDIT - I got in, but your system isn't loading 3rd party js libraries correctly.

    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.

  • PFAFFPFAFF
    edited March 2016

    @hgtonight said:
    @PFAFF That paged is restricted. I tried creating an account but it didn't send the email. It also wouldn't let me log in with facebook (which I generally hate doing anyway).

    Weird.

    Try logging in with hgtonight and "*******" as your password.

    I'm showing both of your registrations, but not sure why it wouldn't let you login or it didn't send email (need to look into that).

  • hgtonighthgtonight ∞ · New Moderator

    I got in, thanks. Feel free to delete my facebook connection.

    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.

  • @hgtonight said:
    I got in, thanks. Feel free to delete my facebook connection.

    Will do.

  • hgtonighthgtonight ∞ · New Moderator

    It defaults to sorting on the Name field because the points and rankid fields are not in the white list. You will need to add them to the switch case block starting on line 52.

    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.

    PFAFF
  • @hgtonight said:
    It defaults to sorting on the Name field because the points and rankid fields are not in the white list. You will need to add them to the switch case block starting on line 52.

    That worked! Very much appreciated!

    hgtonightvrijvlinder
  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    great, please post what you did so I can update the plugin including this. I inherited this plugin as well as others by peregrine so I have no idea . I just wanted to preserve his work for other people. But I have no idea nor time tofigure it out.

    If you want to help others, please post code that I can add to the plugin to improve it. Otherwise, anyone else wanting the same thing from this plugin , MUST HIT YOU UP FOR THE CODE TO DO IT.

    PFAFF
  • @vrijvlinder said:
    great, please post what you did so I can update the plugin including this. I inherited this plugin as well as others by peregrine so I have no idea . I just wanted to preserve his work for other people. But I have no idea nor time tofigure it out.

    If you want to help others, please post code that I can add to the plugin to improve it. Otherwise, anyone else wanting the same thing from this plugin , MUST HIT YOU UP FOR THE CODE TO DO IT.

    @vrijvlinder, the main reason I didn't add the code is because I kind of hacked it on. I didn't add the option to enable or disable in the settings.

    I'll post it when I get a chance (in a hurry right now), but not sure if it's wise to add to official plugin without also adding those settings.

    What do you think?

  • Here we go. The file you want to be working in is in Views and is memtable.php.

    **Again, this only adds the stuff. It doesn't add the options to turn it off or on. **

    Add this:

    case 'points': $UserField = 'Points'; break; case 'rankid': $UserField = 'RankID'; break;

    After:

    case 'name': $UserField = 'Name'; break;

    Then, add this:

    $ranks = Yaga::RankModel()->Get(); $rankNames = array(); foreach($ranks as $rank) { $rankNames[$rank->RankID] = $rank->Name; }

    Before this:

    $ShowPhoto = Gdn::Config("Plugins.MembersListEnh.ShowPhoto");

    Then, add this:

    echo '<th>' . Anchor(T('Rank'),$MColUrl . '&ufield=' . 'RankID' . '&sort=' . $NewSort ) .'</th>'; echo '<th>' . Anchor(T('Points'),$MColUrl . '&ufield=' . 'Points' . '&sort=' . $NewSort ) .'</th>';

    After this:

    echo '<th>' . Anchor(T('Username'),$MColUrl . '&ufield=' . 'Name' . '&sort=' . $NewSort ) .'</th>';

    Then, add this:

    echo '<td>' . $rankNames[$User->RankID] . '</td>';
    echo  '<td>' . $User->Points . '</td>';
    

    After this:

    echo '<td>' . UserAnchor($User). '</td>';

    whu606hgtonight
Sign In or Register to comment.