Search Users base on meta_value & meta_key

Your query is wrong that’s way noting is returned because there is no row in the database that holds more then one meta_key. What you can do instead is create a Sub Query to get all user id’s of users who live in London as a Sub Query and the use that to filter users … Read more

current post with current author

A compacted version that does not load the globals yet calls upon them directly. if( is_user_logged_in() and // Force user validation… STUFF !empty($GLOBALS[‘post’]) and // Check if a $post exists in globals !empty($GLOBALS[‘current_user’]) and // Check if current_user exists in globals ($GLOBALS[‘current_user’]->ID == $GLOBALS[‘post’]->post_author) // Match User IDs ){ // This is your Author speaking, … Read more

Multiple Unique Author Profiles

You could register a user_meta field (probably a dropdown) and use that to select templates. You will still need to use if statements to differentiate the templates, but you’re going to need that regardless of the route you take. If you use get_template_part() you can split out the actual html and such of it and … Read more

Hide one admin from another admin

add_action(‘pre_user_query’,’yoursite_pre_user_query’); function yoursite_pre_user_query($user_search) { global $current_user; $username = $current_user->user_login; if ($username == ‘<USERNAME OF OTHER ADMIN>’) { global $wpdb; $user_search->query_where = str_replace(‘WHERE 1=1’, “WHERE 1=1 AND {$wpdb->users}.user_login != ‘<YOUR USERNAME>'”,$user_search->query_where); } } Replace text with the actual usernames of the users involved. You can also modify this to hide one admin from all other users … Read more

How to use WordPress for class notes?

My recommendation would be to add a separate site (usually pretty easy to do … just follow the typical installation instructions). Then, you can export your current content into an XML file and import it into the new site. A Better Option Create a new site on WordPress.com and import your content there. This has … Read more

Is there a way to make custom fields only editable by administrators?

<input type=”text” name=”facility” id=”facility” value=”<?php echo esc_attr( get_the_author_meta( ‘facility’, $user->ID ) ); ?>” <?php if (!is_admin()) { echo ‘disabled=”disabled”‘; } class=”regular-text” /><br /> <span class=”description”><?php _e(“Please enter the facility name.”); ?></span> Add this third line to all your inputs that you don’t want the non-admins to edit.