ThemeShaper Forums » Thematic


Role based redirect

(1 post)
  • Started 8 years ago by joshuaiz
  • This topic is not resolved
  1. joshuaiz


    I have a site with client pages which are child pages of the main page 'Clients'. It's set up now so that only the admins can see the 'Clients' page which lists all the sub client pages. I'm using the Role Manager plugin and have created the role of 'clients' which is equivalent to Subscriber (level_0).

    When a client tries to access they are given a link to their client page but I want this to automatically redirect them to their client page instead.

    I've tried a few things (basically copy & paste) but none of them seem to be working. I'm using a modified page.php template for the 'Clients' page:

    ?php if ( current_user_can( 'level_10' ) || is_user_logged_in() && $username==$shorttitle ) { ?>

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div class="clientcontent" id="post-<?php the_ID(); ?>">

    <h1><?php the_title(); ?></h1>

    $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
    if ($children) { ?>
    <ul class="child-pages">
    <?php echo $children; ?>

    <?php } ?>

    //user is logged in so re-direct to their page
    header('Location:' . $username);

    } elseif ( is_user_logged_in()==false ) {
    //user not logged in so re-direct to login page


    It's this bit which doesn't seem to be working: header('Location:' . $username);

    Is there a simpler way to do this using template tags or wp_redirect based on user role?


    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.