• Resolved stephanefromain

    (@stephanefromain)


    Hello,
    I am using a shortcode to display the member directory in the account page. [ultimatemember form_id=”6839″]

    The user can create several accounts with the same email.

    I want the user to see only the IDs created with his email in the directory.

    I added in snippets the code below but another account is displayed anyway.

    I saw that there is also
    <?php
    add_action(‘um_members_directory_display’, ‘my_members_directory_display’, 10, 1);
    function my_members_directory_display( $args ) {
    // your code here
    }
    ?>
    But I don’t know what code to put?

    CODE SNIPPETS
    /**
    * Prevent members from being able to see themselves in the member directory.
    * Add this code to the file functions.php in the active theme directory.
    */

    function um_pre_users_query_name( $directory ) {
    if ( is_user_logged_in() ) {
    $directory->where_clauses[] = ‘u.ID != ‘ . get_current_user_id();
    }
    }
    add_action( ‘um_pre_users_query’, ‘um_pre_users_query_notme’, 20 );

    function um_prepare_user_query_args_name( $query_args ) {
    if ( is_user_logged_in() ) {
    $query_args[‘exclude’] = get_current_user_id();
    }
    return $query_args;
    }
    add_filter( ‘um_prepare_user_query_args’, ‘um_prepare_user_query_args_notme’, 20 );

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘shortcode display directory based email’ is closed to new replies.