-
Author
-
July 18, 2016 at 04:32 #129420hotloverspassionParticipant
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.July 19, 2016 at 00:29 #129534LauraModeratorHi,
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 solutionLaura 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 🙂
July 20, 2016 at 02:22 #129627LauraModeratorHello, 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 solutionLaura 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 🙂
April 26, 2017 at 19:17 #159679PrabanjaniParticipantHi,
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.
April 27, 2017 at 23:48 #159793LauraModeratorHello, 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 solutionLaura 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 🙂
April 28, 2017 at 09:09 #159823PrabanjaniParticipantIt 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 issueThanks in advance.
May 1, 2017 at 03:55 #160035LauraModeratorGlad its resolved 🙂
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura 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 🙂
-
AuthorPosts
You must be logged in to reply to this topic.