Articles of user meta

How to add country drop down menu to the user profile?

I’ve added this code snippet to my functions.php function my_new_contactmethods( $contactmethods ) { $contactmethods[‘country’] = ‘country’; return $contactmethods; } add_filter(‘user_contactmethods’,’my_new_contactmethods’,10,1); It works perfactly as I wanted. It show an extra field to fill up user country on user backend profile. But it just a text field. Actually I want to show this field as a […]

Add user data to table when user is created?

I am trying to figure out how to add user information and specific meta data to a separate table through PHP. I would prefer to do this when a user posted to the wp_users and wp_usermeta table. I am using the WooCommerce Auction plugin and the Salient theme. Also if I made a PHP file […]

Authors details such as social media links, emails etc → Is this Meta or something else?

The author section of my first WordPress theme is currently hard coded in HTML. See the live website here. This One. These social media Icons and the link associated with them are not provided in the backend author dashboard by default and they need to be coded. Can someone guide me how to? Is this […]

how to get list of all users and their metadata

How do I get a list of all users with role = ‘Customers’ including all the metadata per user, means wp_users + wp_usermeta. Query below does not generate the wanted results. $query = “SELECT * FROM wp_users INNER JOIN wp_usermeta ON wp_users.ID = wp_usermeta.user_id ORDER BY ID DESC’); “; $data = $wpdb->get_results($query,ARRAY_A); But that list […]

update_user_meta() not working

i’m having a trouble with WordPress, with the function update_user_meta() I’m trying to update or add a new custom meta value for the user, who already have the custom meta working on the edit profile. But when i do the function update_user_meta() outside the edit-profile.php, just didn’t work for me. I have a page like […]

Which is more efficient? Using usermeta, or creating a new MySQL table?

I’m building a bookmarking feature, allowing users to place a marker inside a blog post. The data will then be saved in the database, and retrieved upon opening that blog post. The same concept can be applied for a lot of things in WordPress, like post ratings, post favoriting, etc. So far I’ve been creating […]

Showing user ID on user main page from screen options

On the user main page in the screen options, you have some choices for displaying user information e.g.. e-mail, role, posts etc.. Is there a way to be able to display the user’s unique ID?

Show individual author rank from query of cumulative post view count for all authors

I originally was going to post a question on how I would go about ranking a list of authors by the amount of post views from all of their posts combined. But I luckily found a solution here: List users with the most total posts view This is the code I’m using from that page, […]

Possible bug: update_user_meta is updating two unique meta entries

On a CPT page I am checking to see if the user is logged in; if they are, I’m checking to see if they have a meta entry which is ‘session-‘ + the current page’s stub. If they do, I increment the value by one. I thought this was all working fine, but I’ve just […]

Distinguish profile user and admin user IDs / get ID of user being edited

On the user-profile page of my site I want to allow admin role users to be able to edit specific user-meta fields of subscriber role users. How can I distinguish between the two user IDs. The current logged in user is the admin user get_current_user(); // returns the admin role user id but I need […]