This topic has 17 replies, 4 voices, and was last updated 11 years by Anchora.

  • Author
  • #6399
     Anchora
    Participant

    Hi!

    I noticed, that there is displayed the same age for every member in the members-loop.
    Though, on the profile-pages the ages are displayed correctly.

    Thought that could be an issue with xprofile (show age instead of birthday), but thats not so.

    Any ideas?

    Thanks!

    #6455
     SQadmin
    Keymaster

    Hi,
    Maybe is related to some custom code added or plugin used. In our demo it looks good

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

    Indeed a problem with Xprofile!
    Newest version 1.5.7.9…

    Would there be a way then to show the age in profile, without xprofile?

    (in the first try, i only disabled “show age instead of birthday”, instead of disabling the plugin)

    #6535
     SQadmin
    Keymaster

    In our theme we used default buddypress xprofile date field. Just set it under Sweetdate – Buddypress – Age field

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

    This is what I had before.
    But on profilepages, there’s shown the birthdate then, instead of the age!

    #6609
     SQadmin
    Keymaster

    You can add this code to show the age in the profile:

    COPY CODE
    
    /* Birthday to age in profile page */
    bp_get_the_profile_field_value();
    add_filter('bp_get_the_profile_field_value', 'kleo_age_field',10,3);
    function kleo_age_field($value, $type, $id)  {
    	$age_field = sq_option('bp_age_field');
    	if ($age_field == $id) {
    		$value = xprofile_get_field_data($id);
    		$diff = time() - strtotime($value);
    		$age = floor($diff / (365*60*60*24));
    		$value = sprintf( _n( '%s year', '%s years', $age, 'buddypress' ), $age );
    	}
    	return $value;
    }
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #6619
     Anchora
    Participant

    Yes, therewith the age is shown – but on every profile ONLY the admins age!
    It is the same result as with xprofile.

    I’ve totally disabled total-cache for that + cleared cache/-cookies in browser.

    #6695
     SQadmin
    Keymaster

    I have updated the code. Try it now

    Regards,
    Abe

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

    That did it!

    Thanks, Abe!

    #8551
     cougarmen
    Participant

    i have the same problem.

    on profile header it shows the birthday date instead of age. i’d like to put the code you gave but i don’t know the file name and its location.

    Please could you help me

    Thanks

    #8552
     Anchora
    Participant

    put it into functions.php of your sweetdate-child!

    #8553
     cougarmen
    Participant

    ok great thanks a lot it worked for me.

    But i still have a problem : age appears correctly but the field name is still “date of birth” instead of “age” how do i replace it ?

    #8555
     Anchora
    Participant

    check your sweetdate settings in admin-dashboard

    #8556
     cougarmen
    Participant

    if you mean to set age label to “age” i already made it but still not working

    #8557
     Anchora
    Participant

    did you also do it in the members/profile-fields section of wp?

    #8558
     cougarmen
    Participant

    Ok i changed it, it’s not a perfect solution but will be ok for now.

    Thanks

    #8578
     airsidworld
    Participant

    HI,
    Code is working well.
    Just an styling issue: the age is show in black which is not the same color of other answered fields according to the color define in sweetdate => styling options (in my case in green).
    Would you have a quick css code for it ?

    #8589
     Anchora
    Participant

    dl.dl-horizontal dd { color: white; }
    or with !important maybe..

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

The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?