I am trying to use the following code to 1st check if a user has a certain member level, then if they have a blog on the wp network. If they pass both those checks then a link is echoed, if they dont pass the first if check then another link is echoed. Also though, I am trying to check if they pass the first if but fail the second one then a different link is echoed. Here's the code I have now -

```
    <?php
if(pmpro_hasMembershipLevel(array(2,4))) { 
    if(current_user_can( 'edit_posts' )) {
        global $current_user;
        $blogs = get_blogs_of_user( $current_user->id );
        if($blogs) {
            foreach ( $blogs as $blog ) {
                if($blog->userblog_id != 1) { 
                    echo '<li><a href="http://' . $blog->domain . $blog->path .'wp-admin/">My Site</a></li>';
                } else {
                    echo '<li><a href="/register-site/">Register your Site</a></li>';  
                }
            }
        }
    } 
} else {  
    echo '<li><a href="/membership-levels/">UPGRADE</a></li>';
}
?>

```

The code above echoes the register link when its suppose to but when the user has a blog, the register link shouldnt show but now it shows next to my site link. Any ideas?

***EDIT***

1. Free user sees a UPGRADE link
2. Premium Users without site see a REGISTER Link ( the membership array of 2,4 are the levels they have to be either one of )
3. Premium members with a site will see the MY SITE link.

***EDIT***

I was able to use the print\_r and on the page where it's suppose to echo the register link -- Array ( [1] => stdClass Object ( [userblog\_id] => 1 [blogname] => mysite.com [domain] => mysite.com [path] => / [site\_id] => 1 [siteurl] => <https://mysite.com> [archived] => 0 [spam] => 0 [deleted] => 0 ) )