• Resolved drnwd6

    (@drnwd6)


    Can Ultimate Member allow users to restrict which of their fields are shown in the directory? For example, some members are willing to share email, phone, mailing address with admins but not members. We need this functionality before choosing to purchase Ultimate Member

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Support yuriinalivaiko

    (@yuriinalivaiko)

    Hello @drnwd6

    You can manage the visibility of fields in the profile form. Use the field setting Privacy (select the Only visible to profile owner and specific roles option) and Select member roles (select the Administrator option) to make the field visible for the profile owner and administrators.

    See details in this doc: Fields Visibility

    Regards

    Plugin Support andrewshu

    (@andrewshu)

    Hi @drnwd6

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread if any other questions come up and we’d be happy to help. ??

    Regards

    Thread Starter drnwd6

    (@drnwd6)

    This functionality does not solve our need. Some members will want to hide certain fields while others will not want to hide those same fields. Just making a specific field fully hidden or visible does not provide flexibility needed for different members’ preferences.

    Thread Starter drnwd6

    (@drnwd6)

    So it seems the only solution is to double our fields so users can select if they want the private version as opposed to the public version.

    @drnwd6

    You can try this code snippet and create meta_keys for fields to hide in Members Directory like hide_user_email and make the field a checkbox with one value: yes

    Add these “Hide” user fields to any part of the Profile form and make them private to the User and Admin.

    add_filter( 'um_ajax_get_members_data', 'um_ajax_get_members_data_hidden_fields', 10, 3 );
    
    function um_ajax_get_members_data_hidden_fields( $data_array, $user_id, $directory_data ) {
    
        foreach( $data_array as $key => $value ) {
            if ( ! empty( $value )) {
                $hide = um_user( 'hide_' . $key );
                if ( ! empty( $hide ) && is_array( $hide )) {
                    if ( $hide[0] == 'yes' ) {
                        $data_array[$key] = '';
                    }
                }
            }
        }
        return $data_array;
    }

    Install by adding the code snippet to your active theme’s functions.php file
    or use the “Code Snippets” Plugin

    https://www.ads-software.com/plugins/code-snippets/

    • This reply was modified 4 months, 4 weeks ago by missveronica.
    • This reply was modified 4 months, 4 weeks ago by missveronica.
    Thread Starter drnwd6

    (@drnwd6)

    I added this code and I then added a field to Hide Email in the Directory. I then added a conditional rule to the Email field to hide it if the hide_user_email field is equal to value of yes. Is that what I was supposed to do?

    I have tested it and this does not hide the email in the directory.

    @drnwd6

    You don’t need any conditional fields with this code snippet solution.

    Your UM Forms Builder field setup like this Imgur example is all you need.

    The code snippet is looking at the value in the field hide_user_email
    while the Profile card data are collected during display of the Directory
    and if the hide_user_email is equal to yes (user clicked the checkbox)
    the code snippet will change the user_email to a blank field
    and UM will skip the display.

    • This reply was modified 4 months, 3 weeks ago by missveronica.
    Thread Starter drnwd6

    (@drnwd6)

    Thank you. I did all you said and the checkbox appears, but it is not resulting in the emails being hidden.

    I am realizing this may not be a problem with the code, though it may be a problem with cache because I am noticing something else. If a user submits a form (WPForm), they are redirected to a URL that thanks them for contacting us. But then they can no longer access the contact form, they are automatically redirected to the thank you page. This is a cache problem right?

    Since this is a ‘secret’ members only site, I imagine there needs to be some persistence of recognition of the person as they navigate the site but not this much persistence – what can I do to fix it? (I have LiteSpeed Cache plugin installed, if this is helpful)

    @drnwd6

    Deactivate the “LiteSpeed Cache” plugin.

    @drnwd6

    You can try this plugin “Directory Private Fields” now instead of the code snippet.

    https://github.com/MissVeronica/um-directory-private-fields

    Thread Starter drnwd6

    (@drnwd6)

    Thank you. So to clarify – I download, then upload/activate this plugin. Then I delete the code I had previously put in the .php file. And do the ‘hide_user_email’ fields I had put in before just stay in as you had described, but now they will work? Or do I make changes to those fields also? I’m not sure how, after activating the plugin, I get those options of hiding a field available and working.

    @drnwd6

    And do the ‘hide_user_email’ fields I had put in before just stay in as you had described, but now they will work?

    Remove these fields also.
    You define which fields User can make private in the plugin settings.

    User selects which fields to hide from the Account page

    Thread Starter drnwd6

    (@drnwd6)

    Ah, yes, I see it now in the Account area for a user! Thank you!

    It appeared as radio buttons in Swedish, so I do need to look into that. Maybe using the translator plugin, loco translate, that you included?

    This is really great, thank you!

    @drnwd6

    It appeared as radio buttons in Swedish

    Sorry my mistake, I have updated the template now.
    You can download the plugin again and update with WP as a new installation.

    @drnwd6

    Update of the plugin version 1.1.0 with an optional setting to include/exclude Administrators to see the Directory Private fields.
    Easy tool to verify the User settings.

    https://github.com/MissVeronica/um-directory-private-fields

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