Tag Info

Hot answers tagged

4

When a POST is set to private, non-logged in users will receive a 404 message. If you dump the global variable $wp_query, var_dump($wp_query); ..you will notice that no post_status is present in the parameters returned therefore using the slug (or name parameter of query_vars array for example) we can get the post status of the POST that is trying to be ...


4

Yes, you can set up a separate, private blog that requires members to log in. You can do this with a plug-in called Members Only - it's freely available from the WordPress plug-in repository. Anyone who visits the site who's not logged in will be directed automatically to the login screen. After users log in, they can browse the site normally. Edit ...


3

You should be using a filter outside of your template for this: add_filter( 'template_include', 'wpa62226_template_include', 1, 1 ); function wpa62226_template_include( $template ){ if( is_page( 'some-page' ) ) : global $wp_query; $wp_query->set_404(); status_header( 404 ); $template = locate_template( '404.php' ); ...


3

Authenticator, a plugin on github https://github.com/bueltge/Authenticator uses HTTP Auth by default to get the functionality equivalent to Members Only. It also has the ability to create a token to work the same way Feed Keys work.


2

There is a plugin for that: Automatic Updates For Private And Commercial Plugins. To prevent upgrade checks against the WordPress.org data base in your plugin use the function Mark Jaquith has written.


2

from the plugin; uses action 'post_submitbox_misc_actions' and some query to catch the user Publish form: http://wordpress.org/extend/plugins/private-post-by-default/ function default_post_visibility(){ global $post; if ( 'publish' == $post->post_status ) { $visibility = 'public'; $visibility_trans = __('Public'); } elseif ( !empty( ...


2

The easiest php solution would be to make a download script. It checks if the user has the right permissions and serves the file to the webclient. Or my preference setup a folder outside your web root and put the files there. Set the file permissions with no anonymous access and let the webserver read them and output them in a php file like this. The below ...


2

You could redirect anything that's not a page or admin to home via the parse_query action: function wpa_parse_query( $query ){ if( !is_admin() && !$query->is_page ) wp_redirect( home_url() ); } add_action( 'parse_query', 'wpa_parse_query' ); If it's not an admin screen or a query for a page, it'll redirect. You can see all of the types of ...


1

Here is an example; add_action( 'template_redirect', array( 'someClass', 'init' )); class someClass { protected static $content = 'oh yeah, private!'; public static function init() { $class = __CLASS__; new $class; } private function __construct() { add_filter('the_content', array(&$this, ...


1

Have actually been doing some ACL research recently and came across Role Scoper which has seemed to fit my needs quite nicely for the project. I'm providing that link with an additional note that these "all-in-one" solutions can be a bit dodgy, so make sure you test thoroughly. Since you're looking for BuddyPress integration, they also have a sister product, ...


1

I am new to BuddyPress so I don't know which functions and variables to use here. Read the codex - for example: http://codex.buddypress.org/developer-docs/the-bp-global/ You could create a function in your theme- functions.php or in bp-custom.php and call it from template files and pass it parameters like allowed_users, etc. Or you code hard-code ...


1

I'm working on a separate, second blog for logged-in users, and I'm using is a number of plugins: Login With Ajax, TDO Mini Forms (providing forms for logged-in users to post drafts with, that the admin then can moderate, or have them post straight away), and Role Scoper (to restrict access to that blog's categories). I've also defined a taxonomy for tags to ...


1

BuddyPress is good for this as well. You can create public, private or hidden groups and control who can invite others. http://wordpress.org/extend/plugins/buddypress/ You have the option to have forums in each of the groups as well.


1

You can easily create private forums with the Simple:Press forum plugin. http://simple-press.com/ It can do a LOT more than just that, and for that reason might be overkill (not sure what other requirements you have), but if you are looking for a very flexible and powerful forum system, then I can recommend Simple:Press.


1

I've been working on this a little bit, and this solution adds a new set of options to the "Privacy" settings page. function oxide_setup_options() { register_setting('oxide-privacy', 'blog_open'); $blog_open = get_option('blog_open'); if ( empty( $blog_open ) ) { add_option('blog_open', '0'); } } add_action('admin_init', ...


1

Use this : http://wordpress.org/extend/plugins/password-protected/ A very simple way to quickly password protect your WordPress site with a single password. Integrates seamlessly into your WordPress privacy settings. How can I change the WordPress logo to a different image? Install and configure the Login Logo plugin by Mark Jaquith. This ...


1

Template Tags for the rescue Only logged in users: is_user_logged_in() Only logged in users that have a certain capability assigned to their role current_user_can($capability) Only logged in users that have a specific role assigned current_user_has_role($role) Only logged in users that have a specific capability assigned (to their role) on a specific ...


1

Solution pulled out of the comments: This bug has already been in the Trac for a long time, but isn't fixed! There is a workaround though. Use the Plugin PressPermit or hack the core as explained here: https://core.trac.wordpress.org/attachment/ticket/20114/20114.diff


1

You could perhaps: 1) Create the category for your Private posts, e.g. "Private" 2) Exclude the "Private" category from your main Loop 3) Output the "Private" category using a custom template file, e.g. category-private.php 4) Wrap the Loop in category-private.php in an if ( is_user_logged_in() ) conditional (This assumes, of course, that you are the ...


1

List Category Posts plugin uses get_posts to actually get the posts and its default post_status is publish and that is way you won't get any private posts. To "Fix" it you can edit the file named include/CatList.php of the plugin and add $lcp_query .= '&post_status=private'; before line 51 before $this->lcp_categories_posts = ...


1

Are you doing this inside The Loop? I'd try something like this myself: if ($post->post_status == "private" && !is_user_logged_in()) { echo "You must be logged in to view this page."; } else if( $post->post_status == "private" && is_user_logged_in() ) { // Page code goes here }


1

You would be better suited by allowing members to sign up on your site, then giving each uses level permissions to read different posts. A plugin like Members might work for this. But, if you really want to do what you asked, you're going to have to do some javascript hacking or completely remove the publish meta box and roll your own. There's not a ton ...


1

Search engines SHOULD respect the industry standard robots.txt file which you could use to block access to a post type. Such as blocking access to anything under example.com/deals. You could also go above and beyond and check the $_SERVER['HTTP_USER_AGENT'] for bots. Something like: $bot_list = array("Teoma", "alexa", "froogle", "Gigabot", "inktomi", ...


1

The first thing you need to do is disable direct access to the directories the files are stored in by uploading blank index.html files to wp-content/uploads/ and all of its subdirectories. That way no one can go browsing around your upload directories finding that media manually. In order to keep search engines from crawling your protected pages and users ...


1

I found the simplest way - just use Simply Exclude Wordpress plugin. It has the option to exclude each post (or tag, for that matter) from front page, archive, search or feed. It works flawlessly. You can still view the posts by using direct links.


1

Without a plugin something like this should work //functions.php function get_user_role() { global $current_user; $user_roles = $current_user->roles; $user_role = array_shift($user_roles); return $user_role; } //page template $role = get_user_role(); if($role == "subscriber"){ //cool you can see this ...


1

if you are worried about spams you should use a anti-spam plugin (Akismet comes by default you should configure it). For the session enabling and usage you wordpress session enabler (but i highly dough that it would be of much help). You can also use Registered Users Only, Members Only or registered users only 2 to force your users to login before the can ...


1

If your on a company intranet it might be easier/more secure to just whitelist a few IP's and deny access to everything else, you can do that with apache config or .htaccess. Otherwise you will have to get people to login and then you can use a plugin like "Members Only", there are several of these for private blogs.


1

Sound like a nice idea, but when i need a per user customized private section i usually code it based on page template files and create a few pages with these template files fo example, say i have a download page which will show each user the files he can download so my page template would first check if the user is logged in (if not Unauthorized redirect) ...



Only top voted, non community-wiki answers of a minimum length are eligible