Skip to:
Content
Pages
Categories
Search
Top
Bottom

“Only Me” Extended Profile Field Visible To All Users


  • warrencat
    Participant

    @warrencat

    In the extended profile fields, I’ve created a field that automatically pulls in data using the process described further below. This field is required and is located in the Base (Primary) group of profile fields.

    The issue I’ve run into is that I’ve configured the field to be visible to “Only Me” and have selected the option to Enforce field visibility, but when I look at the public-facing profile page, this field is still visible to any other logged in user, regardless of role. (I have confirmed this by logging in with a subscriber level account and viewing the profile page.)

    The profile fields data import process:

    I am using the NADI plugin (https://active-directory-wp.com/) to automatically create and sync users and user data from company Active Directory database. This plugin has an add-on tool that will subsequently sync selected data from the user WordPress profile over to the BuddyPress profile.

    Troubleshooting steps I’ve already completed:

    1. I’ve deactivated all plugins other than BuddyPress; the “Only Me” profile is still visible on the public-facing user profile page for any logged in user. It doesn’t appear to be caused by a plugin conflict.
    2. I’ve changed to a default WordPress bundled theme; again, the “Only Me” profile is still visible on the public-facing user profile page for any logged in user. It doesn’t appear to be caused by a theme conflict.

    WP Version: 5.2
    BP Version: 4.3.0
    NADI Plugin Version: 2.1.9 (Up to date)
    NADI Add-on Version: 1.0.4 (Up to date)

    I hope I’ve provided enough information. I’m struggling to determine why this profile field that should only be visible to the person who is logged in and no else is visible to every user. I also hope someone here might have a suggestion or recommendation for what I might try next.

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)

  • shanebp
    Moderator

    @shanebp

    Do you have this issue for profile fields that you did create or populate with the NADI plugin?
    If not, use a database tool like phpmyadmin and check the visibility settings for that field id – those settings are in the _bp_xprofile_meta table.


    warrencat
    Participant

    @warrencat

    Thank you for the suggestion. Here is what I did, as well as the results.

    All of the current extended profile fields were data being synced using the NADI add-on. I created a new text field to test with in the Base (Primary) field group and configured it the same: Required, “Only Me” visibility and Enforce field visibility selected. I edited an existing user profile, added some text to this new field and saved the profile.

    I viewed the profile as an admin and could see both fields – the original and the new test field – that should be hidden. All good there. I switched to a subscriber account and reloaded the profile and both the original and new test fields no longer displayed.

    This leads me to think there is an issue with the process of adding data to the extended BuddyPress profile fields using a sync process that somehow ignores the Field Visibility element, but that is corrected when the profile is manually updated.

    Regarding PHPMyAdmin, this site is installed on an internal company server and, as such, I don’t have PHPMyAdmin or any similar tool at my disposal to be able to easily look in on the database tables, unfortunately. But knowing which table has this data in it will be helpful as I work with my IT support on any further analysis/diagnosis.


    warrencat
    Participant

    @warrencat

    A follow-up question: Would it be possible for the Add-on plugin to take into account field visibility and include the appropriate data during the sync process?

    If so, I could work with the plugin developer to see if that is something they may be able to fix on their end, but I don’t want to ask them if it isn’t possible.


    shanebp
    Moderator

    @shanebp

    > Would it be possible …

    Yes, of course. Tell them about the _meta table. There are a few rows re visibility for each field. Have them dump out your test field so they can see the required keys and adjust accordingly.


    warrencat
    Participant

    @warrencat

    Thank you again. I’ll plan to post a follow-up after communicating with the NADI plugin development team.


    warrencat
    Participant

    @warrencat

    I finally have a follow up on this issue.

    I’ve been in touch with the NADI Plugin Developer about the “Only Me” fields being visible to anyone viewing a user’s profile page. After explaining the issue and providing some of our user data to them, this was their reply:

    The source of this issue resides in buddypress/bp-xprofile/bp-xprofile-functions.php :: bp_xprofile_get_fields_by_visibility_levels(): If the user or administrator has not explicitly saved a profile, the wp_usermeta attribute “bp_xprofile_visibility_levels” is empty. This is the case after a NADI import of a new or already existing user happens.

    With the attribute ‘bp_xprofile_visibility_levels‘ being empty, the default visibility an administrator has configured won’t get applied.

    These are my argument why BuddyPress should apply the attached fix:

    1. From a developer point of view, it is not intuitive that the default visibility settings are not applied if the user’s profile has not been previously saved.
    2. From an administrator’s point of view, the current solution allocates unnecessary hard disk space. My integration database contains 10.000 user, which is a realistic user base size for the NADI plug-in. Alone for the unnecessary default visibility settings around 4 Mbyte have to be allocated. To be fair, NADI also uses duplicate data to work with BuddyPress.

    From my point of view as a NADI developer:

    1. Importing 10.000 users already takes a long time. Explicitly calling BuddyPress’ save methods would result in additional SQL queries which I would like to avoid
    2. bp_xprofile_get_fields_by_visibility_levels is not a hook, so I can’t apply the patch in our plug-in

    They are recommending this issue be addressed in the core BuddyPress files, specifically in the bp-xprofile-functions.php file. They provided me with a file containing proposed code changes, though this modified file with an attempt to fix did not specifically for me in my environment. I’m not sure how to provide it to you for your consideration/review since there is no attachment facility on this forum.


    warrencat
    Participant

    @warrencat

    Sorry, @shanebp, I forgot to tag you in my earlier reply.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Skip to toolbar