Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

So I am currently running a multisite install where the super admin creates all new sites. One of the templates we're using has a blog page for a loan officer. I am extending the user profile so the new user can input critical data that needs to be displayed on their page. There is only one user per site, in addition to the Super Admin that is automatically added when a site is created. What I have come to find, is that you need to specify the user ID if you want to use the function

the_author_meta();

outside of the loop. Here's my problem. I can't put an ID in the template, because each new loan officer will use this same theme template. So how can I make these fields dynamic? Below is an image of the profile section for the LO to help visually. Another example is that Andy Johnson will be the user of the blog with a role of author. The next site we create will be for Jack Smith. And his blog will need to reflect the relevant information that is put in his profile page.

EDIT: I tried using get_current_user() as well but with no luck of fetching a specific user. It just pulls the Super Admin. I keep finding snippets that say they should work, but everything seems to output the Super Admin.

EDIT: It seems as though getting the $user_id from the global post results in the Super Admin as well. Does anyway know if I should be using the WP_Users_Query?

http://codex.wordpress.org/Class_Reference/WP_User_Query

http://www.diigo.com/item/image/27x2l/02oy

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

Not sure how this would differ with multi-site, but this is how you'd do this outside the loop normally:

<?php
# get post data
$temp_post = get_post($post_id);

# grab the author meta
$user_id = $temp_post->post_author;

# grab the field you're looking for
$first_name = get_the_author_meta('first_name',$user_id);

# display field
echo $first_name;
?>
share|improve this answer
    
Unfortunately. This still results in echoing the Super Admin's first name. –  chris_s Jan 24 '12 at 1:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.