Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Is there a way to display thanks count in dashboard

For example:

Comments

  • businessdadbusinessdad Stealth contributor MVP

    Sorry, broken image.

  • ShellShell New
    edited December 2012




    i mean if it's possible to display under Manage Users section in Dashboard.




  • I don't recommend changing core files in dashboard.

    But if you want to download the

    http://vanillaforums.org/addon/memberslistenh-plugin

    You can make these simple changes

    in plugins/MembersListEnh/views/memtable.php

     change around line 109 from 
     echo  '<th>' . Anchor(T('Username'),$MColUrl . '&ufield=' . 'Name' . '&sort=' . $NewSort ) .'</th>';
    
     to
     echo  '<th>' . Anchor(T('Username'),$MColUrl . '&ufield=' . 'Name' . '&sort=' . $NewSort ) .'</th>';
     echo  '<th>' . T('ThankCount').'</th>';
    
    
     change around line 175 to 176
     from
       echo '<td>' . UserAnchor($User). '</td>';  
      to 
        echo '<td>' . UserAnchor($User). '</td>';  
       echo '<td>' . $User->ReceivedThankCount . '</td>';
    

    Also- if there is a ?> in the bottom of plugins/MembersListEnh default.php - remove it.

    It will not be sortable via ThankCount, that feature I leave to you or someone else to do, unless you want to sponsor it and I might do it.

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

  • First of all, thank you for your help. Secondly, your plugin is amazing!

    Currently I don't need it sortable, but thank you.

  • Worked perfectly! Also, to sort it I just mimicked the code for the other icons. Thank you @peregrine!

  • Any idea how to do this with Karma? Same technique? I've been plugging different key words into the code you've provided for Thankful People with no success thus far.

  • peregrineperegrine MVP
    edited March 2013

    I don't use karmabank - but briefly looking and I could be wrong. You could start with a database retrieval either for all id's or a single user id and incorporate it the way role is added.

     ->Select('kb.*')
            ->From('KarmaBankBalance kb')
            ->Where('kb.UserID',$this->UserID)
            ->Get()
            ->FirstRow();
        }
    

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

  • Thank you again @peregrine! I will play around with this for awhile. Your guidance is much appreciated!

  • This is what my members table looks like, after I've successfully added the "Thanked Count" and unsuccessfully added the "Karma Balance":

    image

    The code for my Thanked Count (which works) and my Karma Balance attempt (which doesn't work) are here:

    if ($ShowThanks) echo '<th>' . Anchor(T('Thanked'),$MColUrl. '&ufield=' . 'ReceivedThankCount' . '&sort=' . $NewSort ).'</th>'; if ($ShowKarma) echo '<th>' . Anchor(T('Karma Balance'),$MColUrl. '&ufield=' . 'KarmaBankBalance' . '&sort=' . $NewSort ).'</th>';

    and

    if ($ShowThanks){ $Anchor = '/profile/receivedthanks/'. $User->UserID .'/'.$User->Name; echo '<td>' . Anchor($User->ReceivedThankCount,$Anchor) . '</td>'; } if ($ShowKarma){ $Anchor = '/profile/karmabank/'. $User->UserID .'/'.$User->Name; echo '<td>' . Anchor($User->KarmaBankBalance,$Anchor) . '</td>'; }

    Briefly looking at this, is there something wrong with the retrieval method I'm trying for Karma?

  • peregrineperegrine MVP
    edited March 2013

    Look in user table.

    You will see there is a field ---->ReceivedThankCount

    now - look in user table for field ---> KarmaBankBalance
    it is not there. why? because the karmabalance is stored in the karmabankbalance table under the balance column. That is the choice of the person who wrote the plugin and probably a good idea not to add a column to the "vanilla" user table, as the others have.

    so, in essence you have to get the balances from the

    KarmaBankBalance ....

    so you need to join it in class.memberslistenhmodel.php

    like this:

    class MembersListEnhModel extends VanillaModel{
    
        public function GetMembersListEnh($Limit=5, $Offset=0, $SortOrder, $UserField){
    
         $MembersListEnhModel = new Gdn_Model('User');
            $Sender->UserData = $MembersListEnhModel->SQL
            ->Select('*')
            ->From('User u')
            ->Join('KarmaBankBalance kb', 'u.UserID = kb.UserID')
            ->OrderBy("u.$UserField",$SortOrder)
            ->Where('Deleted',false)
            ->Limit($Limit, $Offset)
            ->Get();
           RoleModel::SetUserRoles($Sender->UserData->Result());
           return $Sender->UserData;
        }  
    

    then you need to echo the karma balance field in memtable,php

    echo '<td>' . $User->Balance . '</td>';

    comprende?

    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 worked perfectly!

    Thank you so much, I can't express through words alone how grateful I am for your support, as this is what I've felt like through much of this forum designing process:

    I hope to one day get to the point where I can answer more questions than I ask, but until then, you are the best.

  • @kirkpa31

    glad it worked out for you...

    I also added this. It may or may not prove useful.

    http://vanillaforums.org/addon/karmaleaderboard-plugin

    easy to modify for thankful people.

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

Sign In or Register to comment.