Find Answers and Get Support › Forums › Gwangi – PRO Multi-Purpose Membership, Social Network & BuddyPress Community Theme › Popular Features › Member Profile › UI breaking bug discovered + in need of code snippet
- This topic has 9 replies, 2 voices, and was last updated 6 years, 4 months ago by
Themosaurus.
-
AuthorPosts
-
AndersParticipant@anders
- 8 Topics
- 13 Posts
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.
December 10, 2018 at 05:17 #4140@themosaurus- 1 Topics
- 1675 Posts
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,
December 10, 2018 at 12:01 #4145@themosaurus- 1 Topics
- 1675 Posts
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
December 11, 2018 at 18:11 #4157@themosaurus- 1 Topics
- 1675 Posts
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:
Best regards
December 12, 2018 at 11:04 #4170AndersParticipant@anders- 8 Topics
- 13 Posts
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 ‘(‘December 13, 2018 at 01:36 #4183@themosaurus- 1 Topics
- 1675 Posts
This reply has been marked as private.December 13, 2018 at 11:39 #4187AndersParticipant@anders- 8 Topics
- 13 Posts
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!
December 17, 2018 at 01:09 #4202@themosaurus- 1 Topics
- 1675 Posts
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,
December 17, 2018 at 12:43 #4205 -
AuthorPosts
The topic ‘UI breaking bug discovered + in need of code snippet’ is closed to new replies.