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

How to avoid one code multiple times instead do that through some function? Shortcode, but I think shortcode is not used in main theme’s core files?

You can use PHP’s includes like this: include dirname(__FILE__).’/components/authorSocials.php’; but you should remember about providing the data to your component. Since the idea is that you will you use it in different places, not always the default values will be available and will be the right ones, so you should add some more code to … Read more

How to make url variable?

Assuming the user’s mobile number is saved in wp_usermeta with meta_key being mobile_number, then adding this to a template will show the current user’s mobile number: <?php echo get_user_meta( get_current_user_id(), ‘mobile_number’, true ); ?>

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