New answers tagged user-meta
1
It was actually much easier than I originally thought - just doing a WP_User_Query for a meta value (meta arrays are supported as well, like for the other query classes).
public function on_deactivate()
{
$meta_key = 'tools_page_tsi_per_page';
$query = new WP_User_Query( array( 'meta_key' => $meta_key ) );
if ( empty( $query->results ) )
...
1
It sounds like you are trying to use those location values for something they were not intended for, so you need to convert the values somehow.
You can rename your .gifs to match the location value then you could do...
if( !empty($korea) ) {
echo '<img src="http://www.mydomain.com/flags/'.$korea.'.gif" border=0>';
}
Please note the change I ...
0
Are you looking for this?
function convertInterestCategory() {
$interest_categories = array(
'interest_disaster',
'interest_animals',
'interest_women',
'interest_seniors',
'interest_hunger_health',
'interest_education',
'interest_environment',
'interest_arts_culture',
...
0
You need to pass get_user_meta a third parameter to prevent it from returning an array. That is where the mistake is, not with the add/update functions.
$invoice_meta = get_user_meta( $_GET['id'], 'invoices', true);
You will need to clean up any data already in the database or the existing nested arrays will still cause trouble.
3
The obvious advantage of user meta is that you can use the WordPress API to record and retrieve these extra columns, without writing extra PHP classes or SQL queries. The wp_usermeta table is pretty well indexed, in fact, it uses one row per field (rather than one column if you use a custom table), and you don't have to worry about performance. Using the ...
1
Welcome to WPSE. You can use wp_insert_user, you don't need to hook onto anything.
Assuming here they fill out a form with a name, username, email and password field, and you capture it however you want.
$name_array = explode(' ',$_POST['name']);
$user = array(
'user_login' => $_POST['username'],
'user_pass' => $_POST['password'],
...
0
The job was done by creating one new table. And storing the Category ID and the User Meta value each and every time the category is created.
Now, just list the category with the Created By value in the frontend.
Answer pulled from an OP comment.
1
Don't use update_usermeta, it is deprecated, update_user_meta is the one to use.
You get the previously saved value out with get_user_meta.
<input type='text' name='group[]' id='group[]' class="regular-text"
value="<?php echo esc_attr( get_user_meta( $user->ID, 'group', true ) ); ?>" />
1
This should do what you want:
global $wpdb;
$wpdb->query("
DELETE FROM $wpdb->usermeta
WHERE meta_id NOT IN (
SELECT MIN(meta_id)
FROM $wpdb->usermeta
GROUP BY user_id, meta_key, meta_value
)"
);
Maybe you should first back up your table, though.
0
Theoretically, this could be achieved by saving a user's password elsewhere, when he or she updates it.
Note that this sort of thing is hardly ever recommendable.
In almost all cases, there is a better architectural approach that renders having to be able to show plain-text passwords unnecessary.
That being said, if you absolutely must do it, this is how ...
3
User passwords are stored in the database as what is called a hash. hashes are not reversible even if you know the hash and the mechanism used to create it. The only way to "decrypt" a hash is to take a password, hash it, compare it against the target hash, and try again... over and over until you get a match. If you think about that, you aren't really ...
1
User levels are deprecated, not obsolete. Deprecated features should still be expected to work but should not be used in new code. The point of deprecation is to provide code authors time to update software and thus avoid breakages when the deprecated feature are finally removed.
Leave this alone.
Besides which, it is a very insignificant "problem" you are ...
1
You do not specify a plugin you are using. But if a user login with a OAuth (used by the mosts social plattforms), then he cannot be logged in in WordPress.
Why?
A user needs a username and password to login. OAuth (and other methods) do not provide a password. They only answers with Yes, this user is authorized or No, not authorized.
The social login ...
Top 50 recent answers are included
