Tag Info

Hot answers tagged

5

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 ...


5

Transients are persistent storage mechanism. That means that by saving transient with certain key you will be able able to retrieve same transient with that same key (if it had not expired and cache have not been flushed since). "Public" does not really apply to them, since they are internal code concept and only thing that accesses them is your code, not ...


5

Transients are just database keys that expire. It's like telling WordPress you want it to remember a certain piece of information, but for a limited time. In general, transients are accessible to PHP through any request. But since they're server-side, transients are only exposed to front-end users if you as the developer expose them. A Solution Given ...


4

The problem with the code in your question is it always intercepts. You completely lose the ability to not publish, no drafts possible. Why this leads to untrashable post is something I didn't inspect further. Anyway this isn't what one wants. I'm glad the javascript solution is working for you, but personally I have two problems with it, first, you can ...


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

I'm hereby answering my own question, because i found a solution, but I'm really interested in your opinions towards it. Or maybe you have a much better solution, if so, I really would like to here about it. Research result My research results were: 1. get the files outside of the document root, www folder; 2. disallow any direct access to the ...


3

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 ...


3

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.


3

If you can, use apache basic authentication, much easier than trying to do this with a WP plugin, especially if you only have 2 users for the site.


3

See WordPress › Absolute Privacy « WordPress Plugins. Full login control and blocking of RSS.


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.


3

No that's impossible. When WordPress calls a method it has to be public public. You could write a public method that is called on the hook which calls a private method inside. Not sure if that makes sense though …


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

The problem is that changing the post visibility to private invokes a status change, in a way private is not only a visibility but also a publishing status. Or to quote the Wordpress Codex, section »Content Visibility - Private Content«. Once you change the visibility to private, the post or page status changes to "Privately Published" as shown. ...


3

This is challenging, because showing something would require page not to be private. It is more common to leave page public, but make it produce conditional output depending on if user is logged (is_user_logged_in()) in or other criteria.


2

You're after post_password_required(): <?php if ( ! ( $post->post_password && post_password_required() ) ) get_sidebar() ?>


2

Have you checked your timezone settings under Settings -> General? One of the things that can cause this is if the schedule date is in the past according to the configured timezone but not according to your time.


2

I used this as a solution for hiding draft pages. You can hide the (draft page) menu items with the li.draft class. add_filter('nav_menu_css_class' , 'nav_menu_add_post_status_class' , 10 , 2); function nav_menu_add_post_status_class($classes, $item){ $post_status = get_post_status($item->object_id); $classes[] = $post_status; return ...


2

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', ...


2

The easiest solution is to add a specific class to the menu items that you want to hide. And then hide them through CSS. ^ click to enlarge ^ The CSS classes are not visible by default, you have to enable it in the Screen Options upper tab. If your theme does not print the relevant classes in the <body> tag, this will do: add_filter( ...


2

I did something like this a while ago. I think I've put a template file 'bbpress.php' in my theme folder. In the header I put the following code for access control: if ( !is_user_logged_in() ) { wp_die('You don’t have access to this page.'); }


2

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 ...


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

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 ...


2

Joost de Valk's WordPress SEO plugin is capable of disabling most, if not all, archives you mention:


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 ...


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

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

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

There's a query_posts parameter where you normally use published, but can use private too.



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