WPMU - How to get blog link of current user?

admin

Administrator
Staff member
I am working on a wordpress network and I am trying to figure out how to create a if/else link that will take the current user from the main site to a specific page on their blog. For example in theory this is what I am trying to achieve -

Code:
<?php global $wp_roles;
foreach ( $wp_roles->role_names as $role => $name ) :
if (current_user_can( $role ) && $role == 'HAS A BLOG') { ?>

<a href="<?php URL TO USERS BLOG ?>/SPECIFIC-PAGE/">A Page on your blog</a>

<?php } else {   ?>

<a href="HOME">MAIN SITE</a>

I found some info on something similar but I could not get it to work for me at all - <a href="https://wordpress.stackexchange.com...ite-primary-blog-url-or-path-for-current-user">link</a>

How can I go about getting this to work? Any help would be appreciated. Thanks.