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

Ready to contribute?

Amazing! Sign our contributors' agreement and then join us on GitHub.

Vanilla 2.3 fully supports PHP 7. Get it now!
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

Get Karmabank Url in Discussion user meta

This discussion is related to the Karma Bank addon.
SevMCSevMC

Thanks for this excellent plugin! :)

I was modifying the default.php in order to add the author's Karmabank Url to the KarmaBalance displayed in the dicussion meta, but If I add something like $UserID or $Author it doesn't work (Sorry, Im pretty bad with php XD).

Do you know how can I do that? :)

I got stuck here:

protected function ShowBalance(&$Sender) {
    $Balance = ArrayValue($Sender->EventArguments['Author']->UserID, $Sender->Data('KarmaBalances'));
    echo '<a href="profile/karmabank/'.AUTHORID.'/'.AUTHORNAME.'"><span title="Loudness" class="udb">'.sprintf(T("%01.2f Karma"),$Balance).'</span></a>';
}
Tagged:

Best Answer

  • peregrineperegrine MVP
    edited May 2012 Answer ✓

    I assume the logic is correct and you want to replace these two items...

    AUTHORID.'/'.AUTHORNAME

    try this...

    $AId = $Sender->EventArguments['Author']->UserID  // would be authorid
    $AName =$Sender->EventArguments['Author']->Name;  // would be authorname
    
    echo '<a href="profile/karmabank/'. $AId . '/'. $AName .'"><span title="Loudness" class="udb">'.sprintf(T("%01.2f Karma"),$Balance).'</span></a>';
    

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

Answers

  • peregrineperegrine MVP
    edited May 2012 Answer ✓

    I assume the logic is correct and you want to replace these two items...

    AUTHORID.'/'.AUTHORNAME

    try this...

    $AId = $Sender->EventArguments['Author']->UserID  // would be authorid
    $AName =$Sender->EventArguments['Author']->Name;  // would be authorname
    
    echo '<a href="profile/karmabank/'. $AId . '/'. $AName .'"><span title="Loudness" class="udb">'.sprintf(T("%01.2f Karma"),$Balance).'</span></a>';
    

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

  • SevMCSevMC
    edited May 2012

    Thank You very much :)

    there was only one small mistake, you missed an ; on the $AId = $Sender ;)

    $AId = $Sender->EventArguments['Author']->UserID; // would be authorid
    
  • I will probably put this in the next version.

    grep is your friend.

    candymanSevMC
  • SevMC said:
    Thank You very much :)

    there was only one small mistake, you missed an ; on the $AId = $Sender ;)

    $AId = $Sender->EventArguments['Author']->UserID; // would be authorid

    On> SevMC said:

    Thank You very much :)

    there was only one small mistake, you missed an ; on the $AId = $Sender ;)

    $AId = $Sender->EventArguments['Author']->UserID; // would be authorid

    Only one mistake - thats not bad for not testing 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.

  • Yes, is working perfectly at my site: www.makeitsound.org, thanks @peregrine :)

    x00 said:
    I will probably put this in the next version.

    Nice, It will be very usefull :D

Sign In or Register to comment.