1

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

1 Answer 1

6

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;
?>
1
  • Unfortunately. This still results in echoing the Super Admin's first name.
    – chris_s
    Commented Jan 24, 2012 at 1:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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