Find Answers and Get Support › Forums › Gwangi – PRO Multi-Purpose Membership, Social Network & BuddyPress Community Theme › Popular Features › Members Directory › Age and City do not appear in the cards and in the profile
- This topic has 6 replies, 2 voices, and was last updated 6 years, 5 months ago by
Themosaurus.
-
AuthorPosts
-
AntonelloParticipant@antonellogulino
- 5 Topics
- 15 Posts
Hi Guys, congratulations for the excellent work ..
Unfortunately in my web, I still can not fix this thing:
Age of Member and City, do not appear in member cards and in profile.
How can I solve, can you help me?
Thank you
Antonello
in Attachment screenshotNovember 9, 2018 at 21:06 #3421@themosaurus- 1 Topics
- 1675 Posts
Hi @antonellogulino,
Thank you very much for the kind words! We really appreciate your comment! ?
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.
You can post the user name and password in your next reply and mark it private to keep this between us.Cheers,
November 9, 2018 at 22:28 #3428@themosaurus- 1 Topics
- 1675 Posts
Hi @antonellogulino,
Thank you for sharing the URL to your website with us. At first glance, the issue might be coming from the fact that your fields changed from the names that we gave them. Usually, BuddyPress seems to look for fields with the exact same names.
To fix this, simply add the following code snippet to your website:
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( 'Data di nascita' ); if ( ! empty( $birthdate_field_id ) ) : $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; $allowed_html = array( 'a' => array( 'href' => array(), 'rel' => array(), ), ); if ( ! empty( $age ) ) : ?> <div class="bp-member-xprofile-custom-field bp-member-birthdate"><?php echo wp_kses( $age, $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( 'Città', bp_get_member_user_id() ); $country = xprofile_get_field_data( 'Paese', 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;
It will override the functions that we’ve created to display this xProfile fields.
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:
We hope that it will solve your issue.
Regards,
November 12, 2018 at 17:57 #3466@themosaurus- 1 Topics
- 1675 Posts
You’re welcome. ?
Best regards,
November 12, 2018 at 19:27 #3477 -
AuthorPosts
The topic ‘Age and City do not appear in the cards and in the profile’ is closed to new replies.