Advertisement
pcwriter

Link to 1st blog by user

Feb 5th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. /*Echoes the first blog created by the user. If no blog yet, no button will show */
  2. $current_user = wp_get_current_user();
  3. $userID = $current_user->ID;
  4. $user_blogs = get_blogs_of_user( $userID );
  5.                         foreach ( $user_blogs as $user_blog ) {
  6.                             if (( $user_blog->userblog_id != 1 ) && ( !isset( $usersite ) )) {
  7.                                 $usersite = $user_blog->userblog_id;
  8.                                 echo '<a class="button bp-menu-button" href="' . esc_url( "${user_blog->path}/wp-admin" ) . '">Go to your dashboard</a>';
  9.                             }
  10.                         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement