Find Answers and Get Support › Forums › Gwangi – PRO Multi-Purpose Membership, Social Network & BuddyPress Community Theme › Popular Features › Members Directory › Profile Field data displayed on members' cards on Directory page disappear
- This topic has 16 replies, 4 voices, and was last updated 6 years, 1 month ago by
Jason.
-
AuthorPosts
-
Des SomebodyParticipant@elsades
- 15 Topics
- 41 Posts
Following advice you have given in reply to queries from several members, I have created and activated a code snippet to display Gender, Age, country, etc, on the member cards in the Directory. This works fine when the Directory page first loads. But, if I then click on “Last Active” and select “Newest Registered” or “Alphabetical”, the newly-sorted Directory shows the member cards with the Gender, Age, Country, etc, missing – only the Name is played. However, if I the hit “Reload”, the Gender, Age, etc. re-appear.
How can I fix this problem?
Here is the the code snippet that I am using –
if ( ! function_exists( ‘gwangi_buddypress_member_location’ ) ) :
/**
* Print the HTML for the Age 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’ ) ) :
$age = xprofile_get_field_data( ‘Age’, bp_get_member_user_id() );
$gender = xprofile_get_field_data( ‘Gender’, bp_get_member_user_id() );
$country = xprofile_get_field_data( ‘Country’, bp_get_member_user_id() );
$seeking = xprofile_get_field_data( ‘Seeking’, bp_get_member_user_id() );
$for = xprofile_get_field_data( ‘For’, bp_get_member_user_id() );
$allowed_html = array(
‘a’ => array(
‘href’ => array(),
‘rel’ => array(),
),
);
if ( ! empty( $age ) && ! empty( $country ) && ! empty( $for )) : ?>
<div class=”bp-member-xprofile-custom-field bp-member-location”><p style=”text-align:left;”> <?php echo wp_kses( $gender, $allowed_html ); ?> <?php echo wp_kses( $age, $allowed_html ); ?> <br> <?php echo wp_kses( $country, $allowed_html ); ?> <br> <small> Seeks .. </small> <?php echo wp_kses( $seeking, $allowed_html ); ?> <br> <small> For .. </small> <?php echo wp_kses( $for, $allowed_html ); ?></p> </div>
<?php
endif;
endif;
}
endif;March 1, 2019 at 13:41 #5617@themosaurus- 1 Topics
- 1675 Posts
Hi @elsades,
We’ve tried to reproduce this issue on our development websites but it seems to work fine for us (please view attachment).
Our guesses are that:
– You might have a caching plugin activated, messing with the AJAX directory reload. In that case, please empty page caches and try again to see that’s resolving your issue.
– You might have another unknown or untested BuddyPress add-on changing the way the AJAX directory reload works. In that case, please deactivate all plugins except the plugins recommended with Gwangi and Code Snippets. Then, retry to filter your page to see if that issue is resolved.We’re curious to know what’s causing this issue on your website.
Thank you.
March 4, 2019 at 17:22 #5653Des SomebodyParticipant@elsades- 15 Topics
- 41 Posts
Thak you for your interest in this problem.
I don’t know how to “empty page caches”. Can you direct me?Cheers
March 5, 2019 at 01:09 #5659@themosaurus- 1 Topics
- 1675 Posts
Hi @elsades,
Do you have any caching plugin activated?
If you’re not sure, you can share with us a screenshot showing the list of activated plugins. You can post it in your next reply and mark it as private to keep this between us.
Cheers,
March 5, 2019 at 10:37 #5664DEMENTEParticipant@chilepower- 51 Topics
- 178 Posts
Permission and excuse my interference @themosaurus, but I would like to know how he managed @elsades to put these message icons and friendship request
March 5, 2019 at 12:21 #5667Des SomebodyParticipant@elsades- 15 Topics
- 41 Posts
I deactivated all plugins except for the ones present in the initial setup but the problem persisted. I also deactivated all code snippets (except the one which displays the extra profile fields on the members’ cards) but this did not fix the problem either. Could there be something wrong with the code snippet that I am using?
Cheers
March 6, 2019 at 07:17 #5668@themosaurus- 1 Topics
- 1675 Posts
Hi @chilepower,
Could make sure that the following BuddyPress components are activated please?
– Friend Connections
– Private MessagingYou can check the box related with these options by navigating to “Settings > BuddyPress > Components”.
Best,
March 6, 2019 at 17:49 #5673@themosaurus- 1 Topics
- 1675 Posts
Hi @elsades,
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 as private to keep this between us.Cheers,
March 6, 2019 at 17:50 #5674Des SomebodyParticipant@elsades- 15 Topics
- 41 Posts
This reply has been marked as private.March 8, 2019 at 05:15 #5685Des SomebodyParticipant@elsades- 15 Topics
- 41 Posts
This reply has been marked as private.March 10, 2019 at 10:32 #5704@themosaurus- 1 Topics
- 1675 Posts
Hi @elsades,
We’re not able to log into your website. Could make sure your login page is still online? It seems that something might be going wrong with the redirection set in place as your website is throwing “TOO MANY REDIRECT” error.
Cheers,
March 11, 2019 at 14:26 #5717Des SomebodyParticipant@elsades- 15 Topics
- 41 Posts
Sign-ins are now working.
Cheers
March 15, 2019 at 13:38 #5781@themosaurus- 1 Topics
- 1675 Posts
You’re welcome. ?
Best regards,
March 15, 2019 at 17:41 #5788March 18, 2019 at 10:49 #5801@themoceratops- 1 Topics
- 430 Posts
I took a look at your website and found the source of the issue.
In the snippet you created to display the custom fields, you checked the “Only run on site front-end” option which is why it didn’t work when sorting the members. That happens because when you sort the members they are reloaded via AJAX, which is not considered front-end. So I went ahead and checked “Run snippet everywhere” and it looks like the issue is now fixed.
Best regards,
March 18, 2019 at 14:16 #5803Des SomebodyParticipant@elsades- 15 Topics
- 41 Posts
Thanks for solving my problem and for giving a clear explanation of what I had done wrong.
By the way, I chose to set the “only run on site front end” option because of your general recommendation in your “adding-custom-php-without-changing-your-child-theme” article.
Cheers.
March 19, 2019 at 00:30 #5810 -
AuthorPosts
The topic ‘Profile Field data displayed on members' cards on Directory page disappear’ is closed to new replies.