acornale (@acornale)

Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • @acornale

    Participant

    Yeah, I guess so? I just need to list every member of the site on a single page.

    @acornale

    Participant

    Nice – that worked! Thanks

    @acornale

    Participant

    Problem solved! Thought I’d write the solution here in case anyone has the same problem.

    In order to get the feeds coming through on the home page, the forum had to be public. However, I wanted the forum post content to be private and I wanted the user to be prompted to log in.

    The solution was simple…

    I created a custom content-single-topic.php template and added the following logic:

    <?php if ( is_user_logged_in() ) { ?>

    // display all the post content here

    <?php } else { ?>

    <p class=”message register”>This forum is accessible to approved users only</p>
    <p class=”message”>Please log in to continue.<br></p>
    <?php wp_login_form(); ?>

    <? } ?>

    —-

    I dont know what I didn’t think of this earlier. The logic is simple… all forums are public by default but you must be logged in to view the forum topic content. If you’re not logged in, it asks you to log in and then redirects you to the right topic page.

    @acornale

    Participant

    Correct. The forums are currently private. When I’m logged in, the feeds work fine but for non-logged in users, they see blank boxes.

    This is the code I’m using to display the latest 4 topics:

    <?php query_posts( array( ‘post_parent’ => ’89’, ‘post_type’ => ‘topic’, ‘posts_per_page’ => ‘4’, ‘order’ => ‘DESC’, ‘offset’ => ‘0’ ) );?>
    <?php if(have_posts()):while(have_posts()):the_post();?>

    <div class=”home-forum-single”>

    <span class=”entry-date”><?php echo get_the_date(); ?></span>
    <?php the_title();?>

    </div><!– end home forum single –>

    <?php endwhile;?>
    <?php endif;?>
    <?php wp_reset_query(); ?>

    There’s also a <?php the_permalink();?> wrapped around the title above but every time I enter it in the box, it converts it to a link so I’ve taken it out for now.

    Also, the “post_parent” in the query is the private forum.

Viewing 4 replies - 1 through 4 (of 4 total)