How to call php with a shortcode?

Hi there.

I have a multisite installation. I'm looking to add a list of my user's created websites to their membership details page. This code is already available on wp-signup when they go to create a new blog:

$blogs = get_blogs_of_user($current_user->ID);
if ( !empty($blogs) ) { ?>

<p><?php _e( 'Sites you are already a member of:' ) ?></p>

    <?php foreach ( $blogs as $blog ) {
    $home_url = get_home_url( $blog->userblog_id );
    echo '
  • ' . $home_url . '
  • ';
    } ?>

<?php } ?>

Is there away I can get this php to show in the middle of their membership details page using a shortcode? Or is there some other solution that I'm overlooking?