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.

UI breaking bug discovered + in need of code snippet

This topic is resolved
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • Anders
    Participant
    • 8 Topics
    • 13 Posts
    @anders

    I have noticed a very UI breaking bug when navigating between the user pages (messages, notifications etc.). The whole profile turns white; the header image disappears, and occasionally the profile picture as well. The given name of the user is also placed at the very top of the page, meaning users have to scroll down a bit to get to their content – UX breaking as well.

    According to a web developer helping me with my project, the fault lies with the Grimlock plugin.

    Please see the attached image. I can give you access to the website if you need to take a closer look.

    This request may not be in the right location, but I thought I could save us a thread. I need a code snippet for Birthdate, City and Country so they will be displayed on the profile cards in the member’s directory – I don’t use BP in English.

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

    Hi @anders,

    Could you please provide us with you website’s url and create an admin user for us? That will allow us to determine where the issue is located and also help us build the snippet you need. You can send us these details in a private reply by checking the “Set as private reply” checkbox under the reply text area.

    However, please note that it is preferred that you create a separate topic for each request as it makes it easier for other members to find what they are looking for if they have a similar issue.

    Best regards,

    Anders
    Participant
    • 8 Topics
    • 13 Posts
    @anders
    This reply has been marked as private.
    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    Hi @anders,

    After checking your website, we noticed that you are using an older version of the theme. Can you please make sure to update your Gwangi theme, the Gwangi Youth child theme and all the required plugins to the latest version ?

    After you have correctly updated Gwangi and Grimlock, the problem should be fixed. If you are still seeing the issue after updating, please try to clear your browser cacher and purge your server cache and check if you are still seeing the issue.

    To update your theme, you can download and install the Envato Market plugin (https://envato.com/market-plugin/) on your WordPress site.

    Once the plugin is installed and activated, go to “Envato Market” in your admin menu and follow the instructions under “Activate Envato API Connection”.

    When this is done, you will see your purchased themes under the “Themes” tab and you should be able to update your Gwangi theme from there by clicking the “Update available” button.

    Finally, it seems like we are unable to access your admin panel. Can you please make sure to give us admin access so we can have the necessary information to build the code snippet you need?

    Regards

    Anders
    Participant
    • 8 Topics
    • 13 Posts
    @anders
    This reply has been marked as private.
    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    Hi @anders,

    Thank you, it’s working now.

    After checking, I notice the Birthdate, City and Country fields are already displayed in the members directory. But I’m guessing you would probably like to translate the field names in Norwegian and still have them displayed. So here is a code snippet that should help you in case you need it:

    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( 'Birthdate' );
    
    			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( '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;

    In this code snippet, you just have to change 'Birthdate', 'City' and 'Country' to the translated field names to keep them displayed in the members directory.

    If you need to find out how to add a PHP code snippet to your site, we recommend that you visit this article of our documentation:

    Adding Custom PHP Without Changing Your Child Theme

    Best regards

    Anders
    Participant
    • 8 Topics
    • 13 Posts
    @anders

    I appreciate you taking the time to make such an intricate code snippet for me!

    However, your code returns a fatal error:
    syntax error, unexpected ‘&’

    Removing the ‘&’ produces another error:
    syntax error, unexpected ‘gwangi_buddypress_member_birth’ (T_STRING), expecting ‘(‘

    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus
    This reply has been marked as private.
    Anders
    Participant
    • 8 Topics
    • 13 Posts
    @anders

    Thank you, I managed to sort it out. Don’t know why I got the error but oh well…

    If I in the future want to translate the profile fields into several languages, will an array work? E.g.:
    $birthdate_field_id = xprofile_get_field_id_from_name( ‘Birthdate’, ‘Fødselsdato’, ‘Geboortedatum’ );

    … or will I have to implement translations in a different manner!

    Many thanks!

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

    You’re welcome. ?

    Unfortunately, passing an array as parameter for the xprofile_get_field_id_from_name function will probably not work as it is expecting the $field_name parameter (http://hookr.io/functions/xprofile_get_field_id_from_name/).

    Please note that this issue is related with the translation of BuddyPress, not with the use of your theme. As theme authors, the installation, setting or debugging of third party plugins isn’t part of the support we will provide.

    To go further, we invite you to ask for more help from the plugin authors and post your request on their support forums:
    https://buddypress.org/support/

    We remain available for all support requests related with the use of your theme.

    Regards,

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

The topic ‘UI breaking bug discovered + in need of code snippet’ 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