How can I call a specific file (via php) by referencing the logged-in username?

Try to do this: <?php global $current_user;?> <?php if(is_user_logged_in()) :?> <?php get_currentuserinfo();?> <?php if(is_array( $current_user->roles ) && in_array( ‘map_user’, $current_user->roles ) ) : ?> <div id=”mapContent”> <?php require(“/mapping/”.$current_user->user_login.”.html/”); ?> </div> <?php endif; ?> <?php endif; ?> Source codex.wordpress.org

Completely remove ability to create users?

Okay, so the code above does work, but not for super admins, you must explicitly remove permissions from super admins, like this: // restrict super admin capabilites add_filter(‘map_meta_cap’, ‘restrict_super_admins’, 10, 4); function restrict_super_admins($caps, $cap, $user_id, $args){ $super = array( ‘add_users’, ‘create_users’, ); if( in_array($cap, $super) ) { $caps[] = ‘do_not_allow’; } return $caps; }

Get Authors Role

As an alternative to “current_user_can” WordPress provides “user_can” which will take a User object or ID as a parameter. Combining your top code and the bottom code with the new function it would look like this: $author_user = $wp_query->get_queried_object(); // the queried object in ‘author.php’ should be an author user if (user_can($author_user, ‘buyer’)) { get_template_part( … Read more

How to auto strip hyperlinks & images in wordpress post

Here is one idea to strip link- and image tags from the post content (before you save it) by using the edit_post_content filter and the wp_kses function: add_filter( ‘edit_post_content’, ‘my_edit_post_content’, 10, 1 ); function my_edit_post_content( $content ) { if (!current_user_can(‘manage_options’)) { // only strip for non-admins global $allowedposttags; $mytags = $allowedposttags; unset($mytags[‘a’]); // don’t allow … Read more

How to list users like an archive page 10 users on page and have navigations

First of all, you would use WP_User_Query instead of WP_User class to find the list of users. I wrote up a snippet to demonstrate this. I haven’t tested it, so you might want to rewrite the whole thing. For reference, checkout this blog post http://mattvarone.com/wordpress/list-users-with-wp_user_query/ and the codex http://codex.wordpress.org/Class_Reference/WP_User_Query#Pagination_Parameters $per_page = 10; $offset = isset($_GET[‘offset’]) … Read more

User Meta stuff

You have a few PHP issues preventing output- it appears your foreach is commented out with //. you do foreach( $our_children as $children ), but then you use $our_children instead of $children inside the foreach. $children->Age is for accessing an object’s property, but what you have here is an array, so it should be $children[‘Age’] … Read more

Get logged in username in wordpress url

I think this will do what you are looking for. add_action(“template_redirect”, ‘template_redirect’); function template_redirect() { global $wp; if(is_user_logged_in() && !isset($_GET[‘user’])){ $current_user= get_userdata(get_current_user_id()); wp_redirect(add_query_arg(array(‘user’=>$current_user->user_login),home_url($wp->request))); die(); } }