WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Ttrying To Pull Info From User Meta Fails (3 posts)

  1. kirkward
    Member
    Posted 1 year ago #

    I have two websites. I used one to develop a custom post template that would display site admin profile information, including custom fields I have added to the profile page.

    I have transferred the fully developed template to the live site and was preparing to deploy, when I discovered that the PHP code did not work on the live site.

    Both sites are WP 3.4.2 Multisite Networks. The only difference is that the development network only has the one main site, no subdomains. The live network has multiple subdomains, and the template was tested on one of the subdomains when it was discovered that the code did not work in the new environment.

    Here is a sample of the code I am using to display meta information from the site admin user profile:

    <?php
    $user_id_from_email = get_user_id_from_string( get_blog_option($thisblog, 'admin_email'));
    $details = get_userdata($user_id_from_email);
    if ($details->first_name) echo $details->first_name;
    ?>

    The following code is pulling and displaying correctly, but I do not know how to use the differences to get the user information.

    <?php $current_site = get_current_site(); echo $current_site->id; ?>
    <?php echo get_bloginfo ( 'admin_email' ); ?>

    Both of those last two display the proper information.

    Any help would be appreciated!

    If you can help me, I promise to eat a turkey leg in your honor at Thanksgiving!

  2. vtxyzzy
    Member
    Posted 1 year ago #

    If I understand correctly what you want, I think you can get the admin info like this:

    <?php
    global $current_blog;
    $thisblog = $current_blog->blog_id;
    $user_id_from_email = get_user_id_from_string( get_blog_option($thisblog, 'admin_email'));
    $details = get_userdata($user_id_from_email);
    if ($details->first_name) echo $details->first_name;
    ?>
  3. kirkward
    Member
    Posted 1 year ago #

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic