wp_insert_user always tries the same user name

Before doing anything, make sure that the user account doesn’t already exist. This is really easy to do with the username_exists function. if( null == username_exists( $username ) ) { echo “user not exist”; } use the above code and see what happen then do as below $user_id = wp_create_user ( $email_address, $password, $email_address ); … Read more

Redirect /member/ to /member/user

You could hook into template_redirect action hook and redirect the users. I assume that you want to redirect the currently logged in user. add_action( ‘template_redirect’, ‘wpse314345_redirect_users’ ); function wpse314345_redirect_users( $template ){ // Check if the user is logged in if( is_user_logged_in() ) { // Get the current user $user = wp_get_current_user(); // Redirect the user … Read more

Disabling user capability to edit_posts or delete_posts in the front-end

By using this functionality we can able to remove the delete option of the page or post. function wp_restrict_page_deletion( $caps, $cap, $user_id, $args ) { $post_id = $args[0]; if ( $cap === ‘delete_post’ && $post_id === your post id* ) { $caps[] = ‘do_not_allow’; } return $caps; } add_filter( ‘map_meta_cap’, ‘wp_restrict_page_deletion’, 10, 4 ); I … Read more

Create relationships between users or user roles

For functionality like this I think you’ll have to go with premium plugins or code it yourself. If you want to go with custom code Pods might be able to help you out with creating relationships between doctors and patients: https://wordpress.org/plugins/pods/

Display recent members

You should try using the get_users function. https://codex.wordpress.org/Function_Reference/get_users Example: get_users(‘orderby=meta_value&meta_key=user_registered’);