get_user_meta and umeta_id

You can fix this in 1 of 2 ways: change the call to add_user_meta() to update_user_meta() when your 1st conditional evals to true. As explained in update_user_meta(), “If the meta field for the user does not exist, it will be added.” pass true as the $unique (4th) param to add_user_meta(). As explained in add_user_meta(), the … Read more

update_user_meta inside a popup/modal

From what I can tell, it sounds like you need to be using AJAX to update that user meta. Also you might need to retrieve the “content” with AJAX as well, so as to get the updated information if the popup modal is called again. There is a lot of documentation on AJAX in wordpress, … Read more

Partial searches for wp_usermeta

<?php // ALWAYS sanitize user input! $poblacion = sanitize_text_field( $_GET[‘poblacion’] ); $trabajo = sanitize_text_field( $_GET[‘trabajo’] ); $usuarios = get_users( array( ‘role’ => ’empresa-BBDD’, ‘order_by’ => ‘nicename’, ‘order’ => ‘ASC’, ‘meta_query’ => array( // search for user meta data ‘relation’ => ‘AND’, array( ‘key’ => ‘poblacion’, ‘value’ => $poblacion, ‘compare’ => ‘LIKE’ // partial comparison ), … Read more

How can get all users by current user meta (array)?

This a:1:{i:0;s:1:”3″;} is the serialized version of an array in PHP. You can unserialize it by using the function unserialize like below- $data = unserialize(‘a:1:{i:0;s:1:”3″;}’); So after unserialize inside $data you’ll get an array like below- Array ( [0] => 3 ) This array will contain the user ID which is blocked by the user … Read more

In admin manage users page, how can I stop users with certain privileges from editing users with other privileges?

It sounds like you want to remove the following permissions from the ‘liaison’ role: create_users delete_users edit_users promote_users remove_users Keep “list_users” so they can see the list, but not edit anything. The easiest way to remove these permissions is to use a Role Editor plugin. Several are available; you’ll select the ‘liaison’ role, and then … Read more