Development

Easier Access of Private Posts in Wordpress

Newest version: 1.3

Goal

This project tries to make private posts more accessible within wordpress. Since day one, private posts within wordpress are only shown in page-by-page browsing, and nowhere else, even for authors themselves after logging in. This causes navigation of private posts much more difficult than it should be.

Limitation of private posts also occurs in admin interface — one can’t locate private posts easily by selecting categories and tags. In particular, if certain category or tag is used by private posts only, the link to posts is removed (because public post count is zero) and users are denied access to their own posts!

This project tries to remedy such situation.

What it does

  • Show private post link in monthly archive widget.
  • Show private post link in calendar widget. (patch must be applied)
  • Fix post count in category page in admin interface, to reflect counts of private posts.
  • Fix post count in tag page in admin interface, to reflect counts of private posts.
  • Attempt to reveal categories which contain only private posts in sidebar widget.

Right now what it does is to show links of private posts in archive list and calendar without any configuration. While normal website surfers won’t see any private post at all, private post authors can see their own entries after logging in blog site. For privacy reason, they won’t be able to read private posts from other authors on the same site, just confined to their own.

Currently it consists of a plugin and a patch against WordPress core. If patch is not applied, the plugin still works partially; monthly archive widget still shows links of private posts. But NOT in calendar.

Download and Install

Please refer to project page on Google Code for download link and install instruction.

License

This plugin is released under BSD license.

Special notes

As noted before, if patch is not applied, the plugin still works partially except in calendar widget; no private post shows up in calendar.

Request of adding plugin hook is done in Wordpress Trac. But from the milestone, the change would not be done until mid 2009. Enough is enough. I won’t continue waiting indefinitely for the patch to be delayed even more.

18 Responses

  1. Jim Turner says:

    Thank you very much for this information! The archive listing now behaves exactly like I want it to.

    Thanks again,
    Jim T.

  2. Jessica says:

    Does this still work with the newest version of WP? Unix patching still needed?

    • Abel says:

      Yes, it should still work. Unix patch is still needed, the fix is left as unreviewed and not applied to WordPress source, please refer to the Trac link above for detail.

  3. Kaustubh says:

    Hi,

    Nice plugin but want to know, how it can be possible to show the private post links to all, and once someone clicks on that it asks to login or register?

    Please suggest.

    Thanks in advance.

    • Abel says:

      @Kaustubh:

      I’m not entirely sure what are you expecting for. Do you mean:

      • Everybody knows private posts do exist, but the content is hidden by default
      • If users browse the site as guest and click on any private post link, then they are redirected to login / register page
      • Once they login successfully, they can read ALL private posts by everybody?
  4. Kaustubh says:

    Thanks for comments but so far what i realized that posts or pages marked private goes invisible unless you log in.

    Example I just made this post Private http://www.guitarmonk.com/2009/10/01/subscription-panel-features/ under this category http://www.guitarmonk.com/category/subscriptions/ … can you see it?

    Here’s the Before & After status http://www.guitarmonk.com/fireshot_capture.png

    Hope it helps to make me understand.

    Regards

    • Abel says:

      That’s true. Private posts are, by definition, only viewable by the author, and not anybody else (except admin). What you want is more similar to protected posts instead. However current implementation of protected post is very crude and naive: it is only protected by a single password, thus one just need to know the password in order to view protected posts, there is no need to create any account.

      In any case, this plugin probably doesn’t fit your need. One approach to solve your problem is to use plugin to change private post behavior so that people know its existence, and grant extra rights to registered user so that they can read others’ private posts. Alternatively you may try your luck to ask in WordPress forum and see if anybody has already come up with similar plugin.

  5. Marc says:

    Hi,

    one problem left:

    If a cat includes private posts only it doesn’t show up.

    There needs to be a minimum of one public post inside a cat but I don’t want to add a public post in this cat. Any ideas?

    regards,
    Marc

    • Abel says:

      @Marc:

      Can you tell me in which part is the category not showing up?

      If what you mean is the category list, then yes, that’s the default behavior of WP. WP calculates the count of public posts from a category, and stores the number directly into database. If you are using default widgetized sidebar, you may need to modify 1 or 2 lines of code inside WP.

      • Marc says:

        Yes, i meant category list.

        I wasn’t able to change the count to public and/or private posts and displaying the cat by auth.

        I don’t want to display a cat to logged out user if it doesn’t include public posts, so I would need two counts or something similar.

        So how to display a cat if a user is logged in and the cat includes zero public posts ^^

        • Abel says:

          Sorry for late reply.

          WP can’t do what you want by default. Under default configuration, WP simply hides any category with zero public posts. Probably you need to write your own category list (using wp_list_categories() function with hide_empty parameter), and also adjusting the post count to include private posts too.

          Alternatively, you can modify the WP_Widget_Categories class inside wp-includes/default-widget.php to add the hide_empty argument, but that means modifying the WP core each time after update, which is quite cumbersome.

  6. Marc says:

    P.S.
    I’m using this plugin in combination with the following plugin to give special groups access to private posts:
    http://justintadlock.com/archives/2009/09/17/members-wordpress-plugin

  7. Ed says:

    I have tried to get your plugin to work but am having no success. I have created a private post , as the admin, and it does not appear in monthly archive widget. Can you direct me to a site that has this plug in working ? Or provide more detail instructions.

    I have uploaded plugin, enabled it, and created private post, but cannot see info in my monthly archive widget…

    • Abel says:

      It only works if you have logged in as the author of private post. Is it true that monthly archive widget fails to show anything even after login?

  8. Ed says:

    thanks for ntotifying me by email

  9. Marc says:

    Bug found:
    If you use quick edit in article list it returns in the cat box the following error message:
    Warning: Attempt to assign property of non-object in /www/htdocs/***/wordpress/wp-content/plugins/wp-priv-post-access/wp-priv-post-access.php on line 61

    • Abel says:

      Yes, this is a known problem caused by incompatibility with recent versions of WordPress. I have had a version that seemingly fixed the problem, just that it has no sufficient testing, thus not posted online. I’ll perform more testing tomorrow and upload new version if everything is ok. Sorry for the late reply.

    • Abel says:

      Marc, can you try the newest version (1.3) and see if the problem still persists? It seems to me that the error has gone since some later version of WP 2.8.x.

1 Incoming Link

  1. [...] 如果想在登录以后在归档和日历中看到自己的私人日志,可以安装wp-show-priv-post插件,其中包含补丁程序。 已阅次数:3次 本文分类:WordPress 本文标签:WordPress 本文评级: 1 个投票,平均级别:10/10。  Loading … Trackback: http://www.funbsd.net/wordpress/wordpress-tips-advance.html/trackback [...]

Leave a Reply

E-mail is not disclosed nor shared. Required fields are marked *