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.

Show badges below the username

Hi Great plugin!

I wonder if is possible show the badge below the username in the discurssions instead at side of username.

Thanks!

Tagged:

Comments

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited June 2014

    well the function that renders them beside the name is this

    public function DiscussionController_AuthorInfo_Handler($Sender, $Args) {

    you can try changing that to this

    public function DiscussionController_AfterAuthorInfo_Handler($Sender, $Args) {

    or this for after the discussion

    public function DiscussionController_AfterDiscussionBody_Handler($Sender) {

    or this before the discussion

    public function DiscussionController_BeforeDiscussionRender_Handler($Sender) {

    or this

    public function DiscussionController_BeforeCommentDisplay_Handler($Sender) {

    this would put it before the meta info for comments

    public function DiscussionController_BeforeCommentMeta_Handler($Sender) {

    this would put it before the discussion info

    public function DiscussionController_BeforeDiscussionMeta_Handler($Sender) {

    this too could work

    public function DiscussionController_AfterDiscussionMeta_Handler($Sender){

    there are more I am sure, just a matter of testing which one works best for you then add some css to make it look better.

  • @vrijvlinder Thanks for the quick answer! But wen i change to public function DiscussionController_AfterDiscussionBody_Handler($Sender) { the badge desapear

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited June 2014

    try with this part that I did not add to all of them

    ($Sender, $Args) {

    the $Args are important in there

    public function DiscussionController_AfterDiscussionBody_Handler($Sender, $Args) {
    

    this is what the Args is

    $UserID = $Sender->EventArguments['Author']->UserID;

    it gets the author ID to be able to get the badges

  • Sorry now i saw, i said the wrong code, this code is not working:

    public function DiscussionController_AfterAuthorInfo_Handler($Sender, $Args) {

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    yes that was my guess sort about that, do any of them work to change where they show ?

  • This codes are not working (At least on my theme);

    (Dont show anything)
    public function DiscussionController_AfterAuthorInfo_Handler($Sender, $Args) {

    (This show before the page and repeat the badge)
    public function DiscussionController_BeforeDiscussionRender_Handler($Sender) {

    (Dont show anything)
    public function DiscussionController_BeforeCommentDisplay_Handler($Sender) {

    (Dont show anything)
    public function DiscussionController_BeforeCommentMeta_Handler($Sender) {

    (Dont show anything)
    public function DiscussionController_BeforeDiscussionMeta_Handler($Sender) {

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    ok then the other option is to use CSS to move them elsewhere. I would need to see it or test it on my set up to be able to write some css to have it do that.

    You can move them using absolute or relative positioning. This is not as clean as having it render where you want it.

  • @vrijvlinder‌ Ok, Thank you so much for your help! I was trying some codes here and i think the:

    public function DiscussionController_AfterDiscussionMeta_Handler($Sender){

    Works very good for me!

    Thanks again! Have a good night!

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    that's great !! you are very Welcome !

  • @vrijvlinder‌ do you know how to show the badges in the comments too, becouse i can only see in the 1st post

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    You need to add a second function in theory to add it in the comments too...try adding this after the first function

         public function DiscussionController_AfterCommentMeta_Handler($Sender, $Args) {
                // Get the user object from the controller, I am just guessing with this line
            $UserID = $Sender->EventArguments['Author']->UserID;
    
            $BadgeAwardModel = Yaga::BadgeAwardModel();
                $Badges = $BadgeAwardModel->GetByUser($UserID);
    
            foreach($Badges as $Badge) {
                echo Anchor(
                    Img(
                        Gdn_Upload::Url($Badge['Photo'])
                    ),
                    'badges/detail/' . $Badge['BadgeID'] . '/' . Gdn_Format::Url($Badge['Name']),
                    array('title' => $Badge['Name']),
                    array('class' => 'DiscussionHeaderBadge')
                );
            }
        }
    

    makes sure you count the } so you don't leave one out or add extra by mistake

  • edited June 2014

    @vrijvlinder‌ Thanks for the quick response! I forgot to mention one thing, instead of using the badge I'm using to show the rank as shown in this walkthrough. http://vanillaforums.org/discussion/27064/displaying-ranks-in-posts-user-profile#latest

    How do to show the rank in all posts?

    If you take my doubts away I will be very grateful!

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    I think for that I will need assistance from the yagi masters @hgtonight and @peregrine, I would think that you can make a badge with a word instead of an image that spells the rank you want. That would be the easy way to go. But I am sure there may be a way to add it as text instead of image.

    I know I posted a bunch of links for free icon and badge makers in the tutorial section. I will look it up and give you the link or you can go search for it using icons and badges as a search term. May be faster...in case you want to make some.

  • ok, thanks for the help!

Sign In or Register to comment.