WordPress.org

Ready to get started?Download WordPress

Forums

Get user site url (6 posts)

  1. Geofeedz
    Member
    Posted 3 years ago #

    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.

  2. 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.

  3. Geofeedz
    Member
    Posted 3 years ago #

    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.

  4. which theme?

  5. Geofeedz
    Member
    Posted 3 years ago #

    classipress 3.0

  6. mobragauk
    Member
    Posted 3 years ago #

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

    foreach ($user_blogs as $user_blog) {

Topic Closed

This topic has been closed to new replies.

About this Topic