How to Get User Profile Info on a Category Page

Add a metabox to the category edit screen with a user dropdown. Save the user ID as meta data. In your category template use the meta user ID as argument for get_user_by(): // First find the ID, put it into $user_id then: $author = get_user_by( ‘id’, $user_id ); See this post for an example how … Read more

remove_action with profile_personal_options

Sometimes you need to get a little creative when customizing the WordPress admin area. It’s often possible to do it without CSS, but it isn’t always straightforward: understanding what’s happening on the source files and digging through the many functions called in the ifs and elses is a must. Here’s something slightly hacky I came … Read more

Remove /author/ from the author profile url

Essentially, you can’t do that because you’ve overlapped the “page” and “author” sections in the namespace. See, with your setup, then given a URL like http://example.com/whatever, WordPress has no way to distinguish whether “whatever” is an author or a Page. To do this, you’d need to add a lot more code to add extra querying … Read more

Display site admin profile fields in header.php

Ok I figured a way to do it. If anyone else is interested, here’s the code. It first gets the user id of the admin of the blog, and then it uses the id to pull the meta from the profile fields. For one field — <?php $thisblog = $current_blog->blog_id; $user_id_from_email = get_user_id_from_string( get_blog_option($thisblog, ‘admin_email’)); … Read more

Make user profile field required

What I did create form with fields and validate them: added this line of code to add the user knowledge that it is required fields <span class=”description”><?php _e(‘(required)’); ?></span> added this to form like this: add_action( ‘show_user_profile’, ‘extra_user_profile_fields’ ); add_action( ‘edit_user_profile’, ‘extra_user_profile_fields’ ); function extra_user_profile_fields( $user ) { ?> <table class=”form-table”> <tr> <th><label for=”address”><?php _e(“address”,’shabatkeeper’); … Read more

How to detect when a user changes their name?

The hook you’re looking for is insert_user_meta. add_filter( ‘insert_user_meta’, function( $meta, $user, $update ) { if( true !== $update ) return $meta; $old_meta = get_user_meta( $user->ID ); if( $old_meta[ ‘first_name’ ] !== $meta[ ‘first_name’ ] ) { //* Do something } return $meta; }, 10, 3 );

How can I default to all WordPress roles when parameter is not included in shortcode?

Try this: function profile_counts($atts) { $atts = shortcode_atts( array( ‘metakey’ => ”, ‘metavalue’ => ”, ‘userrole’ => ”, ), $atts ); $user_ids = get_users( array( ‘meta_key’ => $atts[‘metakey’], ‘meta_value’ => $atts[‘metavalue’], ‘role__in’ => wp_parse_list( $atts[‘userrole’] ), ‘fields’ => ‘ID’, // retrieve just the IDs ‘count_total’ => false, // no need for FOUND_ROWS() ) ); return … Read more

Can I create front-end editable user profile pages with WordPress? How do I do it?

Rarely do I answer question with simply a plugin recommendation – and I’d never recommend a commercial one – but since there’s a really good plugin for the task of front end profiles/login and such out there, I cannot let it go unmentioned: Check out Theme-My-Login by Jeff Farthing. There ain’t no better solution. It’s … Read more