Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [user-meta]

User meta data consists of key-value pairs pertaining to the according user ID.

0
votes
0answers
3 views

Custom sortable columns not clickable [duplicate]

I have attached several custom columns to the WP users which are displayed in the admin Users list. I have made the columns sortable in that I've set up the ordebry and order GET params to filter by ...
0
votes
1answer
12 views

Get all user meta_keys and then group users by matching values

One of the plugins I am using generates user meta from our AD. One of the keys is the user's Manager. As many users will have the same manager, I want to be able to group all users. I was trying to ...
1
vote
0answers
12 views

Get users primary blog URL in MultiSite

I'm trying to get the primary blog URL of a user. What I have works to grab the details, but if there is more than one blog it just returns them all :( $user_id = get_current_user_id(); $user_blogs = ...
0
votes
1answer
21 views

Delete all user's meta without knowing all the 'key'

Trying to delete users from the frontend - which I currently have working. Previously, I was manually deleting the metadata when it was completed. I was looking to see if it was possible to delete ...
1
vote
1answer
14 views

Custom SQL query on wp_users with the addition of wp_usermeta

I am trying to query a list of user id's in WordPress using SQL IN() with the addition of them having a meta_value value of "Yes" on the meta_key "is_registered" in the wp_usermeta table but I can't ...
1
vote
0answers
20 views

How can I save unique user data on my site? [on hold]

I am trying to find a way to allow registered users on my site create lists of data and save them. I'm having trouble finding a way to save the list they create to the database of my site. I am ...
0
votes
1answer
26 views

Get user by meta data key and velue

I have create custom user meta, but it was array how i can call only one of them by key like I want to get only course_id = 22 list. Here this my user meta array [certifications] => Array ...
0
votes
1answer
24 views

Send admin new order email to logged in user as well

I need to be able to send the admin email for a new order also to the e-mail address linked to the current logged in user. This is required as 1 account is for different people (people who give a ...
1
vote
1answer
64 views

Modifying Author Link to add Author Meta in URL

I have a plugin which adds a custom role called the trip_vendor. I am trying to edit or modify the profile url of this role. Currently, it is example.com/operator/username but I want to change it to ...
0
votes
1answer
12 views

how to save multiple checkbox in usermeta and get it?

I want to create a new part as multiple checkbox in user profile page that user can check their services. But the issue is i do not know how to display the checked options after saving as checked ...
0
votes
2answers
18 views

How can I add a simple custom field to my plugin?

I have a custom plugin that I'm trying to edit. I didn't develop the plugin. I just need to add a textarea to it and save the contents. I have the field added, but I can't get it to save. This simply ...
1
vote
1answer
10 views

Showing all users who match 2 meta fields with current user

PHP novice here... so thanks for your patience and generous answers in advance. I'm trying to show a list of all users who match two fields with the current user, but it's not working so I would ...
0
votes
1answer
57 views

Where do I implement this display of User Meta Data, and how to put it in a table?

So I have the code below that should pull the user metadata of the currently logged-in user. <?php $current_user = wp_get_current_user(); echo 'Username: ' . $current_user->user_login . '<...
0
votes
0answers
59 views

wp_get_current_user Not working

I am using the wp_get_current_user() function inside a hook which fires before email is sent from contactform7 . The function works but the main problem is that the function doesnt return the current ...
0
votes
1answer
26 views

Updating WooCommerce product field when product author updates profile field

This is a continuation/variation on this issue: Adding existing user custom field value to a woocommerce product While this solution worked, ideally, it would be great if when the product author ...
0
votes
0answers
24 views

wordpressPCL user meta

I'm using the wordpressPCL library to create new users. I need to insert Meta fields as well, how should I structure this field? private static async Task InserUser() { ...
0
votes
1answer
25 views

Existing user_meta fields not updated

Why am I not allowed to update existing user-meta fields when hooking on to edit_user_profile_update hook? I use this code add_action( 'edit_user_profile_update', 'xpl_registration_save' ); function ...
0
votes
0answers
23 views

meta_query orderby sort multiple keys

I'm trying to read the birthdays of the users in my database through custom fields that have been added. Displaying the current months is easy but I am trying to capture the current month(remainder) ...
0
votes
0answers
12 views

link user to post, when its submitted via online form

Users can submit Events via a Custom Post Type (Form is made with the qform Plugin) - If the user does not have an account, an account is created during submitting the form. If he is logged-in already,...
0
votes
2answers
41 views

Add user custom fields and make editable on frontend

We are looking for a way to add Advanced Custom Fields data to a user / subscriber after they have purchased a product (Woocommerce). The subscriber should be able to edit these fields on the frontend ...
1
vote
1answer
20 views

wp_get_current_user in custom file returns 0

I need to access logged-in user data in a custom PHP file that I call in a WP page through an include. The include file is: require($_SERVER['DOCUMENT_ROOT'].'/wp-config.php'); require($_SERVER['...
0
votes
0answers
28 views

How to update user meta from php file?

I need to update user meta from php file on my server. Maybe I need some additional permissions? <?php require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php'); $user_id = 1; $new_value = 'http://...
0
votes
0answers
16 views

WP author meta disappeared

My WP site has stopped displaying user meta data. For example, the biographical info has disappeared from both the front- and back-end. I've found it is still present in the underlying database: any ...
1
vote
2answers
46 views

I'm trying to update user meta but is always 1, What I doing wrong? [closed]

<?php function consultation_user_profile_fields($user){ if ( user_can( $user->ID, "subscriber" ) ) { ?> <h3>Consultation</h3> <?php $query = new WP_Query( array(...
0
votes
0answers
8 views

How users can add custom post type to their own bucket?

I would like any users connected have the possibility to add post to their own category. They can choose the name of this category. Default is bucket. Example : There a 3 posts. Each user can add ...
0
votes
1answer
14 views

How to exclude posts for current user

How can I hide posts that are in an array of ids in the usermeta for the current user in the main query. I can use post__not_in in meta_query but I do not know which option to use for only a specific ...
0
votes
0answers
34 views

simple click counter for current_user

I am trying to create click counter with Ajax for login users. I have multiple subscriber in the blog and need to count there clicks. HTML: <a id="countable" href="#">Click Counter</a> &...
1
vote
1answer
46 views

Adding current user's ID to the end of PDF hyperlinks in post content

How can I add extra parameters after a hyperlink, for tracking purposes? For example, let's say I inserted media into a post - http://mysite/wp-content/uploads/2018/12/My_PDF_File.pdf. How can I make ...
0
votes
0answers
21 views

How to do a sql like query on serialized data of user meta data

As long I don't need to do a query with the data of all users, storing data like the zip code or city in the meta data as an serialized object works fine. But now I have to do a lot of different ...
0
votes
1answer
23 views

Update an additional user meta field with a string

I have created a WordPress website. In the user section I have created an additional attribute called "Token" meta field. Every time a new user is created or a user logs in and is validated, I would ...
0
votes
1answer
32 views

How would I be able to use a font awesome icon as a user's avatar?

Would it be possible to use/allocate a font awesome icon as a user's avatar?
0
votes
1answer
20 views

Auto copy value from specific user meta field to another field

I'm looking for synchronizing specific user meta field with another one. ex: Coping user phone number to woocommerce billing phone. So the admin can only edit one field and the other updates ...
0
votes
1answer
57 views

author.php not showing content if Author has no Posts

I am making a custom Genesis theme, and have a custom author.php file that pulls in various custom fields (Using Advanced Custom Fields), and author meta information to the page from the author ...
0
votes
2answers
20 views

Getting different user data depending on where I use variable

I'm looping through all users with $allusers = get_users($args); foreach ( $allusers as $user ): And then I have an email user button (firstname and lastname are ...
0
votes
1answer
79 views

Display custom image field in user profile

I am trying to display user info from acf so far the normal text, radio and select and date fields display if I use the following: <?php $current_user = wp_get_current_user(); echo $current_user-&...
0
votes
1answer
149 views

Update a user meta key based on WooCommerce product purchase

I have a WooCommerce shop. I have a custom user meta key for user expiration that I need to update based on the result of all users who have purchased a specific product. Unfortunately, I have not ...
1
vote
1answer
17 views

Adding number to date not working [closed]

I am adding number stored in custom user meta data to current date. Here is my code $addeddays = get_user_meta($this->order->user_id, 'xxx', true); $timeBase = date('j.n.Y'); echo date('j.n.Y', ...
0
votes
0answers
12 views

Is it possible to remove a conditional value from WordPress custom metabox

Here I have attached the screenshot from MySQL for easy understanding. In this meta value a: denotes total no of users liked the post. User denotes user with id user-id My question : Is it possible ...
0
votes
0answers
19 views

Post Meta deletion ajax not working

I am trying to remove function in the backend of post like plugin. In the post like plugin they are storing values in the following manner that is User Id , Post id and comment (or) Post . ...
0
votes
0answers
6 views

WooCommerce: how to store the e-mail being used for purchase in PayPal as billing email?

When sending users to complete payment inside PayPal (default PayPal Standard is in use in my shop), how can I grab the PayPal e-mail account used by the user to pay, instead of the e-mail user used ...
1
vote
1answer
55 views

Adding custom class to get_avatar() image doesn't work

Instead of outputting <img alt="" src="#" srcset="#" class="avatar avatar-60 photo" height="60" width="60"> I want to add custom class which looks like <img alt="" src="#" srcset="#" class=...
0
votes
1answer
46 views

get_the_author_meta i want to write in a loop

I'm working on WordPress I'm trying to write foreach to the get_the_author_meta here href and <i class="fa fa-facebook"></i> coming dynamically how should i write in a loop this is my code ...
0
votes
1answer
33 views

How to set a user meta key value based on another user meta key value

Each of the 7,000+ users on my site has around 25 keys in the usermeta table. I won't list them all, but two of the keys are "access_code" and "association". There are several dozen unique access ...
0
votes
0answers
34 views

'per_page' option isn't saving to the database on custom admin list page

Hoping this makes sense and one of you folks can see what I'm missing. I've got a custom table for a plugin that I'm designing for WordPress. I want to display the information from the table on the ...
0
votes
1answer
42 views

using custom meta user data to run queries in WordPress

I have added custom user meta data to the WordPress user profile below is the code I used to add this data. This part of the code seems to be working fine and I do not have a problem with it. <?...
0
votes
1answer
32 views

How to get value from radio buttons meta box, and return different contents?

I have a multiple checkbox type question (using Ultimate member) storing values as user meta. The question basically asks the user what he wants, and according to what he wants, I would like my ...
0
votes
1answer
55 views

Increment user meta data by 1 each time a page is visited

Can't for the life of me figure out why this isn't working, I've tried like below with $val, I've tried sticking the get_user_meta into the meta_value, I've tried just adding +1 in the meta_value but ...
0
votes
1answer
14 views

Read array in php?

I'm trying to add some custom user meta on the registeration. For example, I have field to set a fruit : function some_fruits($fruit= false) { $fruits= array(); $fruits['1'] = 'Apple'; $...
0
votes
1answer
24 views

If logged in user views his profile page

I did some search but could not find the exact answer. My goal is the display "edit link" on profile pages but it will only visible to that user. For example, John logged in and views the page site....
0
votes
0answers
17 views

Add another role to a user when they click a button?

On my site, there are roles "user, authors, etc.". Default role for user is "User" which I want to keep it for all users. How to add another role to a user when they click a button? I tried with my ...