September 22 2011

WordPress Hide Private Link

Some people (including me) may want to preserve some of his privacy in his blog.

This could easily be done for the posts, that is, you can either hide the entire post by carefully selecting its visibility option, or even hide part of it with the help of some of the plugins (Wp-private being just one of it).

However, WordPress (seemingly from V2.7 to at least V3.0) behaves abnormally when you try to keep your links (in the link widget) private. It turns out that the private links are invisible even to the administrators.

Solutions were proposed (plural form is used despite that I found only one on the web), but are mostly lengthy, and/or complicated for beginners. In this post, we will try to solve the problem in a more straight-forward way, thanks to a handy plugin, called BP links+.

To begin with, BP links+ is a sidebar widget that adds functionality to the basic links widget by allowing users to create a special links category for administrators which will only show up when an administrator is logged on. It also optionally allows for invisible or private links to also be shown for administrators.

We’ll skip the part that explains how to use the major function of this very widget as it has nothing to do with our topic. Now open the widget page, check the “show private links” option in the drag down menu of BP links+.

Now the links will show up in the sidebar once you are logged as an administrator, just as promised, while you (yes, the avaricious being staring at the screen) probably begin wondering if you will be able to allow some of your friends to see them too, without risking promoting them to administrators.

This could indeed be achieved by simply editing the following line (using the integrated editor of WordPress or not) in the bp_linksplus.php file.
if (current_user_can(‘level_8’)):
The current_user_can function checks whether current user has certain capability or role.

By default, the role number hierarchy in a standard WordPress install is listed as follows:
Administrator: level 10
Editor: level 7
Author: level 4
Contributor: level 2
Subscriber: level 0

Surely you know what to do next.
And it was so. Satisfied?

Posted 22/09/2011 by Tao in category "Uncategorized

Leave a Reply