WordPress.org

Ready to get started?Download WordPress

Forums

executing php in index to define landing page for group id's (1 post)

  1. LCubed
    Member
    Posted 3 years ago #

    WordPress site using page content only, and the pages are accessible only via login.

    Users are categorised into groups via plugin "WpNamedUsers"
    Unique site pages are defined for each group, thie parameter is set using the same plug in.

    When a user lands on the site they encounter the login page.
    The user logs in here. This login provides access the pages available to their group.

    Once the user has entered their login details correctly they are redirected to logged in landing page. Currently we cannot define which page the user is redirected to.
    The logged in landing page for each user is defined within the “index.php” file.

    We need to write the php that sets the parameters for loading a specific page for each group.

    Currently the line of code loading the logged in landing page is:

    <?php while ( have_posts() ) : the_post(); ?>
     <div class="clear">&nbsp;</div>
     <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">

    I need to write and <if>, <elseif>, <else> statement to define the following:
    • If login is successful and “wp_named_users_groups” is “groupa” the landing page is “/~leisure/destinations-groupa/”
    • If login is successful and “wp_named_users_groups” is “groupb” the landing page is “/~leisure/destinations-groupb/”

    I have tried a few variations of this to now avail:

    <?php if $group_id='groupa';  ?>
      <div <?php post_class(); ?> id="post-40">
      <?php elseif $group_id='groupb'; ?>
      <div <?php post_class(); ?> id="post-161">

    Hopefully someone can help me with my beginners php knowledge.

Topic Closed

This topic has been closed to new replies.

About this Topic