Support only during business hours : Monday to friday, from 8:30 am – 5:30 pm CEST

Due to the decrease in our staff due to vacations, our response time may be longer.

Be sure we're doing our best to manage your topic as soon as possible.

city and age do not appear in profiles

This topic is resolved
Viewing 21 posts - 1 through 21 (of 21 total)
  • Author
    Posts
  • DEMENTE
    Participant
    • 51 Topics
    • 178 Posts
    @chilepower

    Age of Member and City, do not appear in member cards and in profile.
    How can I solve, can you help me?

    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    Hi @chilepower,

    The “City”, “Country” and “Age” field displayed on our demo are only available if you use our generated fields.

    As described in our setup guide (https://doc.themosaurus.com/finishing-buddypress-setup/), you can generate the default fields by a single click. Only these are the ones that are displayed on member lists and member profile.

    If these are not showing on your member directory, the values might be simply have been left empty. However, if these fields are not showing in the admin, it seems that you might have skipped some steps from the setup guide. It’s best to complete every step before going to next otherwise some imports will be broken, like your homepage and directory search forms, for instance.

    To solve this, you need to go first to your BuddyPress settings and finish its setup:

    Finishing BuddyPress Setup


    This step will help you to generate all the missing profile fields.

    Your next step will be re-save your homepage and directory search forms.
    We use BP Profile Search (https://wordpress.org/plugins/bp-profile-search/) to showcase the profile search feature on our demos.
    You can edit the homepage search form by visiting “Users > Profile Search” in your dashboard, where you will find every existing profile search forms.
    Just edit your forms and click “Save” without changing anything.

    Finally, you can test by adding some values to these fields for your test members.

    It should solve your issue. ?

    Best,

    DEMENTE
    Participant
    • 51 Topics
    • 178 Posts
    @chilepower

    I already did that when I bought your article all that,The theme should work with our fields or with yours and not only with yours

    pd:I do not get response notifications from this forum

    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    Hi @chilepower,

    Thank you for your great feedback. That’s actually a feature that we’re planning to add in the coming updates as multiple buyers have requested this in some way…

    In the meantime, you could solve this by adding the following code snippet to your website:

    if ( ! function_exists( 'gwangi_buddypress_member_location' ) ) :
    	/**
    	 * Print the HTML for the City and Country XProfile Field in the BP Member Directory.
    	 *
    	 * @since 1.0.0
    	 */
    	function gwangi_buddypress_member_location() {
    		if ( function_exists( 'xprofile_get_field_data' ) ) :
    			$city         = xprofile_get_field_data( 'City',    bp_get_member_user_id() );
    			$country      = xprofile_get_field_data( 'Country', bp_get_member_user_id() );
    			$allowed_html = array(
    				'a' => array(
    					'href' => array(),
    					'rel'  => array(),
    				),
    			);
    			if ( ! empty( $city ) && ! empty( $country ) ) : ?>
    				<div class="bp-member-xprofile-custom-field bp-member-location"><?php echo wp_kses( $city, $allowed_html ); ?>, <?php echo wp_kses( $country, $allowed_html ); ?></div>
    			<?php
    			endif;
    		endif;
    	}
    endif;

    Simply change City using the exact name of your field in xprofile_get_field_data( 'City', bp_get_member_user_id() ) and also change the Country in xprofile_get_field_data( 'Country', bp_get_member_user_id() ).

    To add this code snippet to your site, we recommend that you use a the Code Snippets plugin (https://wordpress.org/plugins/code-snippets/). If you have never activated this plugin, please read the following post:

    Adding Custom PHP Without Changing Your Child Theme

    Best,

    DEMENTE
    Participant
    • 51 Topics
    • 178 Posts
    @chilepower

    thanks and What about the age?

    DEMENTE
    Participant
    • 51 Topics
    • 178 Posts
    @chilepower

    I have 2 more questions

    – ready thank you very much worked and is it possible to integrate sex too?

    – but it does not appear in the widget of authors, why? http://prntscr.com/mkbi9f

    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    Hi @chilepower,

    1) Could you share with us the exact name for the following fields?
    – City
    – Country
    – Age
    – Sex
    We will tune the snippet to make it work for you.

    2) Regarding the author avatar widget, it’s best if you wait for the update as it’s far more complicated and it cannot be solved with a single snippet.

    Thank you.

    DEMENTE
    Participant
    • 51 Topics
    • 178 Posts
    @chilepower

    1)fields

    – I only use “ciudad” I do not use “country”, because my website is only for cities

    – age is edad

    – Sex is sexo,

    2) I’ll wait then thanks

    DEMENTE
    Participant
    • 51 Topics
    • 178 Posts
    @chilepower

    I’m sorry, I was wrong city is ciudad de residencia

    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    Hi @chilepower,

    Could you add this snippet to the following please? Let’s see if that solve your issue.

    if ( ! function_exists( 'gwangi_buddypress_member_birthdate' ) ) :
        /**
         * Print the HTML for the Birthdate XProfile Field in the BP Member Directory.
         *
         * @since 1.0.0
         */
        function gwangi_buddypress_member_birthdate() {
            if ( function_exists( 'xprofile_get_field_data' ) ) :
    
                $birthdate_field_id = xprofile_get_field_id_from_name( 'Edad' );
    
                if ( ! empty( $birthdate_field_id ) ) :
                    // Get age using birthdate field value.
                    $birthdate                = xprofile_get_field_data( $birthdate_field_id, bp_get_member_user_id() );
                    $birthdate_field_settings = BP_XProfile_Field_Type_Datebox::get_field_settings( $birthdate_field_id );
    
                    if ( 'elapsed' !== $birthdate_field_settings['date_format'] ) :
                        $birthdate_datetime = DateTime::createFromFormat( $birthdate_field_settings['date_format'], $birthdate );
                        if ( ! empty( $birthdate_datetime ) ) :
                            $age = $birthdate_datetime->diff( new DateTime( 'now' ) )->y;
                        endif;
                    endif;
    
                    // Get sex field value.
                    $sex = xprofile_get_field_data( 'Sexo', bp_get_member_user_id() );
    
                    $allowed_html = array(
                        'a' => array(
                            'href' => array(),
                            'rel'  => array(),
                        ),
                    );
    
                    // Display age field value.
                    if ( ! empty( $age ) ) : ?>
                        <div class="bp-member-xprofile-custom-field bp-member-birthdate"><?php echo wp_kses( $age, $allowed_html ); ?></div>
                    <?php
                    endif;
    
                    // Display sex field value.
                    if ( ! empty( $sex ) ) : ?>
                        <div class="bp-member-xprofile-custom-field bp-member-sex"><?php echo wp_kses( $sex, $allowed_html ); ?></div>
                    <?php
                    endif;
                endif;
            endif;
        }
    endif;

    Could also make sure that your “Edad” field is storing the birthdate and not the age as plain text? Otherwise, you can change the field name in the following code bit:
    $birthdate_field_id = xprofile_get_field_id_from_name( 'Edad' );

    Best,

    DEMENTE
    Participant
    • 51 Topics
    • 178 Posts
    @chilepower

    now I do not appear anything is deleted the city and age, the first code that you gave me worked perfect but the latter does not work,I just want it to 🙁 appear:

    – age
    – sex
    – city
    – and if sexual tendency is possible

    DEMENTE
    Participant
    • 51 Topics
    • 178 Posts
    @chilepower

    I’m using the first code that gave me and age and city appears but I want to also appear sex and sexual orientation http://prntscr.com/mknebs

    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    Hi @chilepower,

    Did you erase the previous code snippet? You actually need to add both, one after the other. This way, “Edad”, “Sexo” and “Ciudad de Residencia” will be displayed on your member cards and profiles.

    Yes, we can also sexual tendency if you wish to. How do spell this in Spanish or what is the name of your profile field?

    Thank you.

    DEMENTE
    Participant
    • 51 Topics
    • 178 Posts
    @chilepower

    tendencia sexual

    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    OK, thank you.

    Please try the following:

    if ( ! function_exists( 'gwangi_buddypress_member_birthdate' ) ) :
        /**
         * Print the HTML for the Birthdate XProfile Field in the BP Member Directory.
         *
         * @since 1.0.0
         */
        function gwangi_buddypress_member_birthdate() {
            if ( function_exists( 'xprofile_get_field_data' ) ) :
    
                $birthdate_field_id = xprofile_get_field_id_from_name( 'Edad' );
    
                if ( ! empty( $birthdate_field_id ) ) :
                    // Get age using birthdate field value.
                    $birthdate                = xprofile_get_field_data( $birthdate_field_id, bp_get_member_user_id() );
                    $birthdate_field_settings = BP_XProfile_Field_Type_Datebox::get_field_settings( $birthdate_field_id );
    
                    if ( 'elapsed' !== $birthdate_field_settings['date_format'] ) :
                        $birthdate_datetime = DateTime::createFromFormat( $birthdate_field_settings['date_format'], $birthdate );
                        if ( ! empty( $birthdate_datetime ) ) :
                            $age = $birthdate_datetime->diff( new DateTime( 'now' ) )->y;
                        endif;
                    endif;
    
                    // Get sex field value.
                    $sex = xprofile_get_field_data( 'Sexo', bp_get_member_user_id() );
    
                    $allowed_html = array(
                        'a' => array(
                            'href' => array(),
                            'rel'  => array(),
                        ),
                    );
    
                    // Display age field value.
                    if ( ! empty( $age ) ) : ?>
                        <div class="bp-member-xprofile-custom-field bp-member-birthdate"><?php echo wp_kses( $age, $allowed_html ); ?></div>
                    <?php
                    endif;
    
                    // Display sex field value.
                    if ( ! empty( $sex ) ) : ?>
                        <div class="bp-member-xprofile-custom-field bp-member-sex"><?php echo wp_kses( $sex, $allowed_html ); ?></div>
                    <?php
                    endif;
                endif;
            endif;
        }
    endif;
    
    if ( ! function_exists( 'gwangi_buddypress_member_location' ) ) :
        /**
         * Print the HTML for the City and Country XProfile Field in the BP Member Directory.
         *
         * @since 1.0.0
         */
        function gwangi_buddypress_member_location() {
            if ( function_exists( 'xprofile_get_field_data' ) ) :
                $city         = xprofile_get_field_data( 'Ciudad de residencia', bp_get_member_user_id() );
                $tendency     = xprofile_get_field_data( 'Tendencia sexual',     bp_get_member_user_id() );
                
                $allowed_html = array(
                    'a' => array(
                        'href' => array(),
                        'rel'  => array(),
                    ),
                );
                
                // Display city field value.
                if ( ! empty( $city ) ) : ?>
                    <div class="bp-member-xprofile-custom-field bp-member-location"><?php echo wp_kses( $city, $allowed_html ); ?></div>
                <?php
                endif;
    
                // Display tendency field value.
                if ( ! empty( $tendency ) ) : ?>
                    <div class="bp-member-xprofile-custom-field bp-member-tendency"><?php echo wp_kses( $tendency, $allowed_html ); ?></div>
                <?php
                endif;
            endif;
        }
    endif;

    It’s more complete and contains the four fields to display. Please sure that spelling and case are OK.

    Could confirm it works properly now?

    Thank you.

    DEMENTE
    Participant
    • 51 Topics
    • 178 Posts
    @chilepower

    no, it does not work it only shows the city and the sexual tendency http://prntscr.com/mll90d 🙁

    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    Hi @chilepower,

    We’re sorry for the inconvenience. This method of trial and error is taking too much and we’re sure that you wish to move forward with your setup.

    So, could you please create a new website user for us? If possible with administrator capabilities so we can make a quick check of your settings and test directly to fine tune the given snippet.

    You can post the user name and password in your next reply and mark it as private to keep this between us.

    Cheers,

    DEMENTE
    Participant
    • 51 Topics
    • 178 Posts
    @chilepower
    This reply has been marked as private.
    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    Hi @chilepower,

    It looks OK now. Could you confirm please?

    Thank you.

    DEMENTE
    Participant
    • 51 Topics
    • 178 Posts
    @chilepower

    if it looks very good. thank you very much for your help and time

    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    You’re welcome. ?

    Best,

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

The topic ‘city and age do not appear in profiles’ is closed to new replies.

Troubleshooting Demo Imports

You're trying to setup your theme but you're experiencing errors when importing the demo content? Or you've just followed the setup guide but your website doesn't look exactly like our demo? These are common issues for which you can find easy and quick fixes.

Happy With our Support So Far?

Feel free to review our theme on Themeforest! It helps us making our products more known to new potential customers, which allow us more time to improve the quality and develop new features. #SharingIsCaring ❤️

Discover MatchPress

Skip • Like • Super-Like

Add powerful matching features like Member likes, skips, super likes, conditional private messaging and much more.

Setup Your Cera or Gwangi powered Community Website and Turn it into an iOS and Android App

15% discount for Cera users

To unleash the full power of your Cera or Gwangi theme, we have partnered with the Zipline team. Your community website can now be fully setup and turned into your very own custom app for iOS and Android.

Whether you've newly acquired the theme or already got your site up and running, Zipline got you covered. And we got you an incredible discount.

Holiday, Weather & Festive effects
to pimp your WordPress Site