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.

How to show Points with Author Meta?

2

Comments

  • @peregrine said:
    now you can upload it if you want.
    @vrijvlinder said:
    And Don't forget to make an icon for it or I will!!

    Done: http://vanillaforums.org/addon/myyagapoints-plugin

  • r0obertr0obert
    edited May 2014

    Thanks @vrijvlinder!

    I need to actually learn some real coding now...

    ...now that I'm part of the team haha

  • How can I add text next to the number of points eg. "10 Points" ?

  • peregrineperegrine MVP
    edited May 2014

    try this

    echo Wrap($Author->Points . " Points",'span', array('class' => 'Points Count'));

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

  • Try this

    echo Wrap(T('Points'),$Author->Points,'span', array('class' => 'Points Count'));

  • the only time it would be point - would be 1 Point

    you could put a test to determine pseudocode if $Author->Points == 1 then echo " Point" insead

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

  • That easy huh, I wonder how many more cool things I can learn. :) Thanks @peregrine!

  • peregrineperegrine MVP
    edited May 2014

    yes a T (good idea V) would be better if you are going to upload and make it translateable.

    if ($Author->Points == 1) {
      echo Wrap($Author->Points .  " " . T("Point") ,'span', array('class' => 'Points Count'));
      }else {
      echo Wrap($Author->Points .  " " . T("Points") ,'span', array('class' => 'Points Count'));
      }
    

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

  • You are lucky, some people can't cut and paste successfully ...

  • r0obertr0obert
    edited May 2014

    What's does the "T" do?

    @peregrine said:
    yes a T (good idea V) would be better if you are going to upload and make it translateable.

    if ($Author->Points == 1) {
      echo Wrap($Author->Points .  " " . T("Point") ,'span', array('class' => 'Points Count'));
      }else {
      echo Wrap($Author->Points .  " " . T("Points") ,'span', array('class' => 'Points Count'));
      }
    

    Working perfectly, thanks guys!

  • edited May 2014

    It mean translatable string. Anything that has a T for translate can be changed with a language locale to another language. So if I use a spanish locale for example, that word would be translated after I add the $Definition in the file for the locale if it is not there already.

  • r0obertr0obert
    edited May 2014

    I used position: absolute and left/top to position the element under the user avatar (bootstrap theme). Is there a better way to do this? @vrijvlinder you are the expert in css right?

    @vrijvlinder said:
    It mean translatable string. Anything that has a T for translate can be changed with a language locale to another language. So if I use a spanish locale for example, that word would be translated after I add the $Definition in the file for the locale if it is not there already.

    Awesome, the translatable string might come in handy!

  • I would need to see it to help you with that.

  • You could try changing the span class to AuthorInfo instead of Points Count and see if it lines up proper on it's own

  • It's working fine with both classes, I just needed it to work with PhotoWrap class. I was only wondering if there is a better way to position elements, besides position absolute and left/top etc.

  • edited May 2014

    Don't use Photowrap class because that is only for the user image user link

    AuthorInfo is for the span that contains it. Then you can add css example. So it targets the right element

    .Item .AuthorInfo img{
    padding-right:2px;
    height:20px;
    width:20px
    }
    

    you can also do it like this

    echo Wrap($Author->Points . " " . T("Points") ,'span', array('class' => 'Points Count'));

    the css

         .Item .AuthorInfo .PointsCount{
            padding-right:2px;
            height:20px;
            width:20px
            margin:0;
            vertical-align:text-bottom;
            }
    
  • How about making it into a hyperlink that goes to say /profile/name page? I'm also not sure where to add/edit the html property title="Points description on hover". How would this be done?

  • peregrineperegrine MVP
    edited May 2014

    array('class' => 'Points Count', 'title'=> 'Points description on hover'));

    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 May 2014

    or

    this should work with translations.
    echo Wrap($Author->Points . " " . T("Point") ,'span',array('class' => 'Points Count', 'title' => sprintf(T('Points description on hover'))));

    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.