Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9211131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:13:34+00:00 2026-06-18T01:13:34+00:00

I am working on a wordpress network and I am trying to figure out

  • 0

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 –

<?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 – link

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:13:35+00:00Added an answer on June 18, 2026 at 1:13 am

    Ok I was able to achieve what I want by using the following code –

    <?php 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 .'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>';
    }
      }
    }
    }
     ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working in wordpress, trying to figure out how to change the css color
I am working with wordpress images that the user chooses. They may or may
I am working in Wordpress trying to use an ajax request to fetch user
I'm working with wordpress and need to create a trigger that updates a table
I'm working on a Wordpress plugin. I need to pass plugin directories (that can
I'm working on a wordpress site, with a blog post that ends like: http://www.blog.com/?p=2
I'm working on a Wordpress blog. I'm embedding a stylesheet as follows: <link rel=stylesheet
I starting working with WordPress as a CMS, now that the V3 makes it
I'm pretty new to PHP, I'm working in WordPress but I don't think that
So I have been working with Wordpress 3.x and trying to build a custom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.