Add a member number to new user

To get the ID of the user that was created last, you could run the following query: SELECT id FROM wp_users ORDER BY user_registered DESC LIMIT 1 To do this within the context of your code, do this: global $wpdb; $last_user_id = $wpdb->get_results(“SELECT id FROM $wpdb->users ORDER BY user_registered DESC LIMIT 1”); That will give … Read more

What is the meta-box-order_post_hash used for?

I could only find the following core code references for the meta-box-order_ string: /wp-admin/includes/ajax-actions.php: update_user_option($user->ID, “meta-box-order_$page”, $order, true); and /wp-admin/includes/template.php: … get_user_option( “meta-box-order_$page” ) … that’s related to the ordering of meta-boxes. I doubt your $page value is post_hash, so my first guess is that this comes from a plugin/theme? If not then the user … Read more

update_user_meta adding new rows in db for same key

Try this: global $current_user; $user_id = $current_user->ID; // current user ID $meta = get_user_meta( $user_id, ‘title’, ‘Manager’ ); // subject meta if($meta != ”) // updates meta if exists update_user_meta($user_id, ‘title’, ‘Manager’); else // creates new meta if not exists add_user_meta($user_id, ‘title’, ‘Manager’);

Are the default entries for a user in wp_usermeta documented?

You may want to take a look at the code itself: https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/user.php#L1376 The above links to a documented list of the meta generated when WordPress generates a new user in the wp_create_user function. From these comments I pulled a quick list: user_pass, user_login, user_nicename, user_url, user_email, display_name, nickname, first_name, last_name, description, rich_editing, comment_shortcuts, admin_color, use_ssl, … Read more

How to Make admin Sidebar Menu always be Collapse by code

To make the admin sidebar menu always be collapsed, try adding the following code in the functions.php file of your child theme, or add it in your site using a plugin like Code Snippets, or Add Actions and Filters. global $user_ID; $user_fold = get_user_meta( $user_ID, ‘wp_user-settings’, true ); $exp_array = explode( “&”, $user_fold ); $search_array … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)