• Resolved dan87manc

    (@dan87manc)


    Hi

    I’m trying to use the Members Directory Page to search for members via their User ID.

    I am using a shortcode to show the user ID on users’ profiles, but the search doesn’t pick up on this.

    Could someone help me solve this one? If it isn’t possible, my workaround is to set users’ User ID as their nickname, which the search can find. But then I’ll need to work out how to automatically set a User ID as a nickname when signing up, if anyone could help with that one.

    Thanks very much
    Daniel

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @dan87manc

    Searching users with the user ID on the members’ directory is not available at this time. If you want to set the user id as a nickname upon user registration, you can try following Code Snippets:

    add_action( 'um_user_register', function( $user_id, $args ){
     $user_nickname = $user_id;
     update_user_meta( $user_id, 'nickname', $user_nickname );
    },20,2 );
    • This reply was modified 2 weeks ago by Aswin Giri.
    Thread Starter dan87manc

    (@dan87manc)

    Hey @aswingiri

    Thanks a lot for the reply.

    Unfortunately that isn’t changing the nickname, I put it in functions.php if that’s correct?

    Thanks for your help

    [ Please do not bump. ]

    • This reply was modified 2 weeks ago by Yui.
    • This reply was modified 1 week, 4 days ago by Jan Dembowski.
    missveronica

    (@missveronicatv)

    @dan87manc

    You can try to use this code snippet,
    install into your child-theme’s functions.php file
    or use the “Code Snippets” Plugin.

    https://wordpress.org/plugins/code-snippets/

    add_filter( 'um_before_update_profile', 'um_before_update_profile_nickname', 10, 2 );
    
    function um_before_update_profile_nickname( $changes, $argsID ) {
    
        $changes['nickname'] = $argsID;
        return $changes;
    }
    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @dan87manc

    This thread has been inactive for a while, so we will go ahead and mark it Resolved. …Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. 🙂

    Regards,

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