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?
-
I know practically zero php but I managed to do this for myself by modifying the wp_list_pages function. I have copy-pasted the text as is below. I hope it helps!
This post describes how you can modify the wp_list_pages() function of WordPress so that it lists normally hidden pages if the user is logged in (You can hide pages from the administrator panel, or more easily using the excellent Pagemash plugin). Thus you can restrict access to certain pages on your site unless the user is logged in. What is also great about this method is that since we modify the wp_list_pages function it also hides these restricted pages in the navigation bar/ pages widget of your site (Assuming they generate the list using wp_list_pages, which is usually the case). The wp_list_pages function is in the file post-template.php which can be found in the wp-include folder of your WordPress installation. Rename the current file as post-template-old.php or something similar in case something goes wrong.
Now all you have to do is open the file and look for the following block of code:
// Allow plugins to filter an array of excluded pages
$r[‘exclude’] = implode(’,’, apply_filters(’wp_list_pages_excludes’, explode(’,’, $r[‘exclude’])));What this code is doing is basically setting the exclude variable with a list of the page IDs of the pages listed as hidden in the administrator section of WordPress. What we want to do is modify this so that these pages are excluded (i.e. hidden) only if the viewer is someone who isn’t logged in. If the person is logged in then we would like for all the hidden pages to be displayed. To do this replace this block of code with the following:
if (is_user_logged_in()) {
$r[‘exclude’] = ”;
}
else {
$r[‘exclude’] = implode(’,’, apply_filters(’wp_list_pages_excludes’, explode(’,’, $r[‘exclude’])));
}All we are doing is using the is_user_logged_in function to either set none of the pages to be excluded (for the case that the person is logged in) or we exclude the pages marked as ‘hidden’ from the sight of regular visitors. So to use this method to make pages only visible to logged in visitors you will want to hide all these pages. I would also recommend setting them as ‘private’ to prevent someone from guessing the page ID and accessing the restricted pages. I would highly recommend complementing this method with use of the Sidebar login widget. This widget creates a nice login panel in your sidebar. Once the user logs in, your newly reloaded page will automatically update the navigation bar and the page widget in your sidebar to list the previously restricted pages.
The main drawback here is that now you cannot have other pages that are hidden from logged in visitors. However it shouldn’t be too hard to modify the if->else statements above to tailor it to your requirements. My knowledge of PHP is absolutely zero and I only figured this out because it required a very simple piece of code. Also, this technique obviously won’t work with blog posts. However it shouldn’t be too hard to make similar if->else statements in your PHP files so that some posts/post categories remain hidden from users who aren’t logged in.
If there are any php-gurus out there who read this, please do chip in with some ideas on how you can extend this to do more complex stuff. I would be especially interested in how one might go about using a similar method to hide posts and categories from regular site visitors.
Edit – Turns out there is a plug-in for doing similar stuff called page-restrict. While it does restrict page access to logged in users it doesn’t seem to hide these restricted pages from the view of visitors who are not logged in. Personally I’m not a big fan of letting users know what the title of the restricted pages are, and also having them know that I am intentionally excluding them from some content on my site. Also for restricting access to posts try WP Sentry or Role Scoper plugins
I found this post in another thread. Has anyone tried MemberWing?
There is:
Free WordPress Membership Plugin – MemberWing:* Supports 4 levels of membership (Bronze, Silver, Gold, Platinum). You may use just one if you dont need 4.
* SEO optimized – you may add free teasers to every premium article to allow search engine indexing and ranking and to “spice up” your visitors.
* Supports latest version of WordPress
* And it’s freeIt doesn’t include automated payment system yet, but team is working on it right now. By the time you read it – it may already be in place.
—
GlebIt doesn’t appear to integrate to a payment system but does appear to manage members and content.
@talia: Sorry I didn’t manage to reply in the end. The internet connection wasn’t particularly fab whilst I was abroad. I haven’t been actively ‘WP’ing recently so am a little out of the loop.
The developers of Memberwing seem to be from Mensk:
https://www.mensk.com/webmaster-toolbox/wordpress/wordpress-membership-plugin-memberwing-and-its-free/No problems mosey. Hope you had a good holiday
Right now my challenge is a problem with scheduling posts in advance so I backburnered the membership problem! I’ve not heard of Mensk.
Thanks talia, it was good to go away!
I’ve had a look at the post you made in a thread and have made a response there.
The link to Mensk is in case anyone is interested in the development team ??
Thanks for your help on the other thread.
Looking in admin mode wasn’t causing the scheduled posts to show before the due date, but after logging out I had to post some public posts to test what other people see when they look at the website and found that ticking the private post box is causing errors in future dated posts.
Now for the solution…
mosey – i found out your good i hope you could fix my problem, i want to have members login page coul you please give me the exact plugins for this and guide me all the way thru… hoping your reply more power!
I used the code for “Template Name: Members Only” and it works great. I’m using the Defusion theme and it works with that. I want the page to be visible from the pull down menu just not visible until logged in which this does. However it is not formatted the same as the other pages.
The left and right borders don’t align like the other pages. On the non members only theme pages, the side bar begins at the top. On the members only theme pages, the side bar begins at the bottom of the page. The content of the page pushes the side bar down.
Any clues to modify this so the width of members only pages are the same as non members pages?I’ve tried adding this from the defusion theme’s style.css
<h2><?php the_title(); ?></h2>
<div class=”contenttext”>
<?php the_content(); ?>
#content-left {
float: left;
#width: 600px;
width: 700px;
}#content-right {
float: right;
#width: 320px;
width: 220px;
}
It doesn’t work.Very helpful thread! I tried wp-sentry which enables to remove private: from the titles ??
thanks very very much Mosey
- The topic ‘Members only sections’ is closed to new replies.