WordPress.org

Support

Support » Multisite » Get user site url

Get user site url

  • PLEASE! PLEASE HELP ME!
    I have been at this for 2 days without sleep and have tried everything I know.
    I am using multisite and I need to get the users siteurl in the comment template. I have been through the wpmu functions and this function is the closet I’ve gotten

    <?php
    $user_id = 1;
    $user_blogs = get_blogs_of_user( $user_id );
    echo 'User '.$user_id.'\'s blogs:<ul>';
    foreach ($user_blogs AS $user_blog) {
        echo '<li>'.$user_blog->blogname.'</li>';
    }
    echo '</ul>';
    ?>

    but i get this error
    Warning: Invalid argument supplied for foreach() in /home/jinijco/public_html/wp-content/themes/digizaar/comments.php on line 86

    This is my last effort before I give up on this.
    Any help is much appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Andrea Rennick

    @andrea_r

    Customer Care at Copyblogger Media and Studiopress

    You don’t have to do anything specific for that.

    If the user is logged in and leaves a comment, the standard comments code in a template will automatically show their name linked to their primary blog in the network.

    No special coding by you is needed.

    hey, Andrea. Thanks for taking the time to help me.
    My comment template does not do that.
    I have been trying to figure it out for a while now.

    Andrea Rennick

    @andrea_r

    Customer Care at Copyblogger Media and Studiopress

    which theme?

    classipress 3.0

    mobragauk

    @mobragauk

    It looks like the capitalisation of “AS” is not right. Try this instead:

    foreach ($user_blogs as $user_blog) {

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Get user site url’ is closed to new replies.
Skip to toolbar