Skip to:
Content
Pages
Categories
Search
Top
Bottom

Members-loop


  • s4ow7ime
    Participant

    @s4ow7ime

    Hello
    please help
    tell me how to add users to the list of profiles, field of the years Xprofile and given the suffix years / year.
    23 year
    30 years

    Tried using bp_member_profile_data( ‘field=the field name’ );
    Displays in the format 1951-01-16 00:00:00

Viewing 3 replies - 1 through 3 (of 3 total)

  • shanebp
    Moderator

    @shanebp

    So you want to change the display format?

    Get the value : $val = bp_get_member_profile_data( ‘field=the field name’ );

    Then format it however you want, for example:
    echo date('Y', strtotime($val) ) . ' years';

    https://www.google.com/#q=php+format+existing+date


    s4ow7ime
    Participant

    @s4ow7ime

    thanks


    s4ow7ime
    Participant

    @s4ow7ime

    tell me please where the problem might be there?
    The code works, all that to him, and the result is displayed, but then when nothing is displayed on the page.

    <?php
    function YearTextArg($year2) {
        $m2 = substr($year2,-1,1);
        $l2 = substr($year2,-2,2);
        return $year2. ' ' .((($m2==1)&&($l2!=11))?'a':((($m2==2)&&($l2!=12)||($m2==3)&&($l2!=13)||($m2==4)&&($l2!=14))?'s':'d'));
    }
    echo YearTextArg(date('Y')-1880);
    ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar