Profile Field data displayed on members' cards on Directory page disappear

Home Forums Gwangi – Dating & Matchmaking Community Theme Popular Features Members Directory Profile Field data displayed on members' cards on Directory page disappear

This topic contains 16 replies, has 4 voices, and was last updated by  Jason 4 days, 2 hours ago.

Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #5617

    Des Somebody
    Participant
    • 29 Posts
    @elsades

    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;

    #5653

    Themosaurus
    Keymaster
    • 1665 Posts
    @themosaurus

    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.

    #5659

    Des Somebody
    Participant
    • 29 Posts
    @elsades

    Thak you for your interest in this problem.
    I don’t know how to “empty page caches”. Can you direct me?

    Cheers

    #5664

    Themosaurus
    Keymaster
    • 1665 Posts
    @themosaurus

    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,

    #5667

    DEMENTE
    Participant
    • 62 Posts
    @chilepower

    Permission and excuse my interference @themosaurus, but I would like to know how he managed @elsades to put these message icons and friendship request

    #5668

    Des Somebody
    Participant
    • 29 Posts
    @elsades

    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

    #5673

    Themosaurus
    Keymaster
    • 1665 Posts
    @themosaurus

    Hi @chilepower,

    Could make sure that the following BuddyPress components are activated please?
    – Friend Connections
    – Private Messaging

    You can check the box related with these options by navigating to “Settings > BuddyPress > Components”.

    Best,

    #5674

    Themosaurus
    Keymaster
    • 1665 Posts
    @themosaurus

    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,

    #5685

    Des Somebody
    Participant
    • 29 Posts
    @elsades
    This reply has been marked as private.
    #5704

    Des Somebody
    Participant
    • 29 Posts
    @elsades
    This reply has been marked as private.
    #5717

    Themosaurus
    Keymaster
    • 1665 Posts
    @themosaurus

    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,

    #5781

    Des Somebody
    Participant
    • 29 Posts
    @elsades

    Sign-ins are now working.

    Cheers

    #5788

    Themosaurus
    Keymaster
    • 1665 Posts
    @themosaurus

    You’re welcome. 🙂

    Best regards,

    #5801

    Jason
    Participant
    • 25 Posts
    @themoceratops

    Hi @elsades,

    I closed your other topic and reopened this one since the problem has indeed not been fixed. Sorry about that.

    I will be looking at the issue and come back to you when I find out more.

    Best regards,

    #5803

    Jason
    Participant
    • 25 Posts
    @themoceratops

    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,

    #5810

    Des Somebody
    Participant
    • 29 Posts
    @elsades

    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.

    #5815

    Jason
    Participant
    • 25 Posts
    @themoceratops

    Glad I could help you @elsades 🙂

    Thank you for noticing us of that line in the article, I have made a small change to hopefully make it less confusing.

    Best regards,

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

The topic ‘Profile Field data displayed on members' cards on Directory page disappear’ is closed to new replies.