I have this code that I am using on a site to check if the current user has a blog on the our wp network and as of now it is echoing the URL for both the main site and their blog. I would like to know, how can I modify the code so that it only echoes for the user's site and not the primary/main site.
<?php if(is_user_logged_in()) {
global $current_user;
$blogs = get_blogs_of_user( $current_user->id );
if($blogs) {
foreach ( $blogs as $blog ) {
echo '<li><a href="http://' . $blog->domain . $blog->path .'/upload-and-manage-documents/">My Documents</a></li>';
echo '<li><a href="http://' . $blog->domain . $blog->path .'upload-and-manage-documents/?ptype=settings&tab=gateways">Settings</a></li>';
}
}
} ?>
<?php endif; ?>
So as of now instead of 2 links, it is echoing 4. How can I fix this?
Any help is appreciated. Thanks.

get_user_blogs_by_role( 37, 'administrator' );returns all the sites the user is admin. – toscho♦ Dec 20 '12 at 1:03<?php if(is_user_logged_in()) { global $current_user; $blogs = get_user_blogs_by_role( 37, 'administrator' ); if($blogs) { foreach ( $blogs as $blog ) { echo '<li><a href="http://' . $blog->domain . $blog->path .'/upload-and-manage-documents/">My Documents</a></li>'; echo '<li><a href="http://' . $blog->domain . $blog->path .'upload-and-manage-documents/?ptype=settings&tab=gateways">Settings</a></li>'; } } } ?> <?php endif; ?>– mygm26 Dec 20 '12 at 5:48