This topic has 9 replies, 3 voices, and was last updated 7 years by Laura.

  • Author
  • #129420
     hotloverspassion
    Participant

    Hi guys,

    I’m not sure, whether you’ll be able to help me with the following issue, but I will give it a shot 🙂

    I have seen similar issue discussed already in this forum but I cannot find the related post any more.

    In members directory, I have done some changes to the text below members photos. I have followed a code from Radu, played with the code and changed it to my needs, which seems to work great, except one thing. If the age field is left blank by the user ( not filled in ), the output comes out as 46. How can I modify the code to show only filled in fields and if field is empty, leave it blank?

    Please see images:

    Image 1 – ages are displayed correctly as both age fields are filled in by user

    Image 2 – first age is displayed correctly, but because it is a single person ( not couple ), second “partner’s age” wasn’t filled in therefore number 46 should not display

    Image 3 – both numbers 46 should not be displayed as the user didn’t fill his age field – therefore there should not be any number showing

     

    Here is the code from my child theme functions.php:

    function additional_remove_filter () {

    remove_action(‘bp_members_meta’, ‘render_bp_meta’);

    }

     

    add_action(‘after_setup_theme’,’additional_remove_filter’);

     

    add_action(‘bp_members_meta’,’custom_profile_fields_in_directory’);

    function custom_profile_fields_in_directory() {

    $output = ”;

    $diff = time() – strtotime(bp_get_member_profile_data( ‘field=Age’ ));

    $age = floor($diff / (365*60*60*24));

    $diff = time() – strtotime(bp_get_member_profile_data( “field=Partner’s age” ));

    $partnersage = floor($diff / (365*60*60*24));

    $output .= ‘<span class=”c_username”>’.bp_get_member_user_nicename() . ‘</span>’;

    $output .= ‘<span class=”profile_title”>’.bp_get_member_profile_data( ‘field=Profile title’ ) . ‘</span>’;

    $output .= bp_get_member_profile_data( ‘field=I am a’ ).’     ‘;

    $output .= ‘<span class=”c_age”>’.$age .'</span>’;

    $output .= ‘&’;

    $output .= ‘<span class=”c_partnersage”>’.$partnersage .'</span>’;

    echo $output;

    }

     

    Thank you very much! And thank you for all amazing support you provide to all of us, it’s just brilliant!!!!!!

    Attachments:
    You must be logged in to view attached files.
    #129534
     Laura
    Moderator

    Hi,

    What you need requires significant amount of time to create a functionality like that and our purpose here is to help you with any theme problem that you may encounter or with small customizations.
    For anything that theme doesn’t have or you need something different you should hire a programmer/web developer to achieve what you need.

    If you want a quote from our developers team, contact our colleague cornel@seventhqueen.com about your request.

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #129540
     hotloverspassion
    Participant

    That’s fine, I was just asking 🙂

    #129627
     Laura
    Moderator

    Hello, i know 🙂 its the usual message when the issue is a custom request

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #159679
     Prabanjani
    Participant

    Hi,
    I like to add additional profile fields below the profile pic of members. Now we have age/groom.
    I like to add additional fields like height, location. I searched for the solution
    code:
    /members page fields
    add_action(‘after_setup_theme’,’kleo_my_member_data’);
    function kleo_my_member_data()
    {
    global $kleo_config;
    //this is the details field, right now it take the “About me” field content
    $kleo_config[‘bp_members_details_field’] = ‘About me’;
    //this display the fields under the name, eq: 36 / Woman / Divorced / Berlin. Modify with the names of the fields you want to appear there
    $kleo_config[‘bp_members_loop_meta’] = array(
    ‘I am a’,
    ‘Marital status’,
    ‘City’
    );

    }

    This is not working for me. Actually I want eg: 23 / bride / 4’11” / Chennai and I dont want the field names.

    #159793
     Laura
    Moderator

    Hello, just change the fields at I am a, Marital Status and City to the fields you want to show, the age should appear automatically 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #159822
     Prabanjani
    Participant

    Thank you, I’ll try.

    #159823
     Prabanjani
    Participant

    It is not working:(
    I used function.php in sweetdate-child theme
    I think the above coding is for Kleo-child
    Help me in rectifing this issue

    Thanks in advance.

    #159825
     Prabanjani
    Participant

    🙂 It is working

    Thanks

    #160035
     Laura
    Moderator

    Glad its resolved 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?