The MU forums have moved to WordPress.org

List MY blogs (2 posts)

  1. jackson100
    Member
    Posted 13 years ago #

    Hi guys,

    I used to have a working list of "My Blogs" in the sidebar which would show every user a list of his blogs. It worked fine before I upgraded to 2.8.4a, now the permalink works ok but the "blogname" does not. Can you please have a look at the code and see if Im getting the "blogname" in the correct way? Thanks a lot!

    global $current_user, $blog_id;
    if ( ! is_user_logged_in() ) {
    ?>

    <?php
    } else {
    $blogs = get_blogs_of_user($current_user->ID);
    $username = $current_user->user_login;
    $siteurl= get_settings('siteurl');
    ?>

    <?php
    if ( ! empty($blogs) ) foreach ( $blogs as $blog ) {
    $blog_id = $blog->userblog_id;
    $details = get_blog_details($blog_id);
    $blogname = htmlspecialchars( $details->blogname );
    echo get_blog_avatar($blog_id,'16','monsterid') . "domain . $blog->path . "'>" . $blogname . "
    ";
    }
    ?>

    <?php
    }

  2. jackson100
    Member
    Posted 13 years ago #

    got rid of the problem by implementing the following code:

    <?php
    $user_id = 1;
    $user_blogs = get_blogs_of_user( $user_id );
    echo 'User '.$user_id.'\'s blogs:

      ';
      foreach ($user_blogs AS $user_blog) {
      echo '
    • '.$user_blog->blogname.'
    • ';
      }
      echo '
    ';
    ?>

About this Topic

  • Started 13 years ago by jackson100
  • Latest reply from jackson100