Support » Plugins » Members only sections

  • Looking for a flawless or semi flawless plugin that will enable a members only sections of a wordpress site?
    Looking for something that will turn it into a pay per view site.. Any one know of such a plugin?

Viewing 15 replies - 16 through 30 (of 130 total)
  • @mach2racer: I’m not sure how much I would be able to help (since I just poke around WordPress rather than work under the hood) but I’ve sent a message through the contact form on your website.

    Hey same

    Yep, it worked like a charm, thanks!

    See it here:

    Here’s the code I put in the page; mind you, the style hooks will be different on your page template, more than likely. [CODE EDITED at 9:02 PM]

    Template Name: Members Only
    <?php get_header(); ?>
    <div id="container">
    <div id="content">
    <?php if (is_user_logged_in()) { ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <h3 class="page-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    <div class="post">
    		<?php the_content(); ?>
    [deleted first .post closing division]
    <?php endwhile; ?>
    <?php endif; ?>
    <? } else { ?>
    <h3>Sorry But You Must Be Logged in to View This Page</h3>
    <div class="post">
    		We're sorry, but this area is only for registered, logged in users. If you are a registered user, please use the link below to login to the site.  If you have not yet registered, please use the link below to register to become a member of this site and view content not available to the general public.  If you have any questions, please contact us.
    <? } ?>
    </div> <!-- /post -->
    </div><!-- /content -->
    </div><!-- /container -->
    <?php get_sidebar(); ?>

    I have a question… and I’ll tell you right up front, I become easily lost in the PHP forest, so if the answer to this is already obvious, just give me a slap and I’ll go dig out a text book. This really appeals to me because I hate password protected pages, but is it possible to easily modify the ” <?php if (is_user_logged_in()) { ?> ” statement to limit viewing to a particular user or group of users?

    Thanks jonimueller! 🙂 I think the code you’ve posted will be really useful for lots of people! Will the testbed site stay up for umm… forever? :p

    @claytonjames (and everyone else) : I just found a site/page by Ben at RedWingStudio which talks about user-only/protected pages. And he actually addresses the issue of limiting viewing to a particular group of users in the comments, by using another plugin called Role Manager.

    Is anyone willing to try it out perhaps and share the results here? 🙂

    Actually, Mosey posted the essential code. I just took that and fleshed it out a bit; but without him, I’d have been clueless!

    As far as my test site is concerned, since I own and have renewed it for 10 years, it’ll be up for awhile. I put all my test stuff there. I’ll install role manager and play with the RedWingStudio script tomorrow.

    Now the question is how do you go and build a registration, area? I am sure you can use cform? Or is that too much?

    Is anyone willing to try it out perhaps and share the results here? 🙂

    I think I might. I already use role manager, so I will read the article and see if it is something I can get a handle on. Thank you!

    Way to take one for the team

    Thanks in advance, jonimueller and ClaytonJames!

    @jonimueller: It’s the fleshing out that makes it make more sense! Otherwise it would be difficult to figure out where each part goes. I was just wondering if it was going to be online (for people searching say several months on from now) otherwise I guess could always include a screenshot instead of having a live site? Thanks 🙂

    Sorry for being away so long, but jonimueller’s code is basically what you need.

    Where it says “Sorry, need to be logged in” I added a login box using this

    <form class="ddfm" name='loginform' id='loginform' action='/wp-login.php' method='post'>
    	<p class="fieldwrap"><label for="log">Username</label><input class="fmtext" type="text" name="log" id="log" value="" tabindex='1' /></p>
    	<p class="fieldwrap"><label for="pwd">Password</label><input class="fmtext" type='password' name='pwd' id='pwd' value='' tabindex='2' /></p>
    	<input name='rememberme' type='hidden' id='rememberme' value='false' />
    	<div class="submit">
    		<input type='submit' name='submit' id='submit' value='Login &raquo;' tabindex='3' />
    		<?php //use a hidden field to return them to the page they came from ?>
    		<input type="hidden" name="redirect_to" value="<?php echo $_SERVER["REQUEST_URI"]; ?>" />

    I actually can’t remember why I have the form named after the dragon design form mailer, maybe I was just lazy and used some code. I don’t think you need ddfm for that.
    But underneath this I added a “If you want to request a login, send me an email” with a ddfm mail form under it using <?php global $ddfm; echo $ddfm{3}->generate_data(); ?>

    This only works when you set your WordPress installation to “users cannot register”. Otherwise they just register and get immediate access. You control the site by adding users when you want them added.

    Thanks I saved that bad boy.

    mosey- Great link, thank you!
    joni- You make it look so easy!

    The info in this comment thread worked for me.

    Steps I took:

    A) Installed Role Manager plugin. (I already had it in use).

    B) Created a new capability exactly per the instructions, and assigned it to a specific account.

    C) Downloaded the template:

    D) Modified the template to fit my theme, uploaded it to my theme folder, created a new page and applied the template. The page was then only available to the account I gave the new capability to. I then created a sub-page for my new page, and applied the same “hidden” template. Successful test. Page and subpage are only viewable by the account with capabilities.I then created a sub-page on an unprotected (normal) page and applied the template. The unprotected page remained viewable while the new subpage required a log in. Another Successful test.

    There is a login form in the template by default, but I could not get it to work for me. I already use a re-direct on login, so maybe there was some conflict. I did not pursue it because it wasn’t important to me. (I know, I’m a selfish bastard sometimes). Now here’s a big one… Is there a way to take this one step further and hide the page links until an authorized user logs in, rather than displaying them with a “restricted” notice?

    Thanks for evaluating the solution suggested by RedwingStudio, claytonjames! 🙂 Am really glad to read that it does work!

    Unfortunately I’m not sure about the login box either, but with regards to the page links, do you mean not displaying links in the navigation bar to visitors (rather than registered users)?

    If this is the case, the most straightforward way I can think of would be to exclude the page ids from the usual navigation, and then perhaps use the function again somewhere else on the page but this time include the ‘if user logged in’ condition before <?php wp_list_pages(); ?>?

    I’m 100% certain there are better ways of doing this, so any suggestions would be great! ^^

    I thought that if I tried putting the page exclusions in wp_list_pages in my header, and then tried overriding the exclusions for authorized users by adding wp_list_pages() to…

    <?php if (is_user_logged_in()) {
    if ( current_user_can('view_my_hidden_posts') ) {?>

    …in my members page template, I may be able to do just that, but I got so lost in the “endif’s” “edwhile’s” and “else’s” that I almost gave myself a seizure trying to figure it out.

    Could you imagine? Being found dead in my chair, foaming at the mouth, eyes crossed, and one crooked, crimson finger from where I tried using the blood that ran from my ears just before my head exploded to scrawl one last line of incorrectly constructed PHP code into the top of my desk? I need to hit the PHP text books for a while I guess. I do love a good puzzle. With my luck, as soon as I find a non-plugin solution, will get around to updating the Post-Levels plugin. That used to solve the whole problem quite nicely. Thanks again!


Viewing 15 replies - 16 through 30 (of 130 total)
  • The topic ‘Members only sections’ is closed to new replies.