Thursday, December 23, 2010

Turn Your WordPress Into A Private Twitter-like System

inhouse-twitter-mainWordPress is best known as a blogging platform, but it can be a versatile piece of software as well, allowing you to turn it to almost anything you want. Here is how you can turn a WordPress installation into a in-house private Twitter-like microblogging system.

There is little or no coding required. What you need here is a custom theme and some plugins. There are currently two themes that can instantly turn your blog into a status update system: Prologue and P2.

Both themes require little or no configuration. As soon as you activate the theme, your blog frontend instantly become a Twitter clone.

WordPress Prologue Theme
Prologue Theme

WordPress P2-Theme
P2 Theme

Prologue theme is just a basic Twitter-like theme with no configuration option. On the other hand, P2 theme is more comprehensive and allows you to switch between "status update", "blog post", "Quote" and "Link".

With the P2 theme, you can also configure who can post update, the background image/color, show/hide sidebar etc.

inhouse-twitter-p2-options

Adding a login form to the sidebar


Instead of getting your users to go to the wp-login page, it will be great if you can add a login form to your sidebar and let your users login from the front page.

What you need here is the sidebar-login plugin. Install the plugin and add the widget to your sidebar.

inhouse-twitter-sidebar-login

At the sidebar-login option page, remember to set the "Login Redirect Url" to your Home page.

inhouse-twitter-login-options

Show status update only for logged in users


If you want to use this as a in-house private Twitter system, you won't want the public to see your update. The best way is to show the update only for logged in users.

Open the index.php file in your P2 theme folder.

Scroll down until you see the code:

[php]</h2>
<ul id="postlist">
<?php if ( have_posts() ) : ?>[/php]

Insert in the following code after </h2>

[php]<?php if(!is_user_logged_in()): ?>
<p>You need to log in to view the status update!</p>
<?php else : ?>[/php]

So now you should have:

[php]</h2>
<?php if(!is_user_logged_in()): ?>
<p>You need to log in to view the status update!</p>
<?php else : ?>
<ul id="postlist">
<?php if ( have_posts() ) : ?>[/php]

and don't forget to close the loop. Insert <?php endif; ?> before the </div><!-- main-->.

[php] <?php endif; ?>
</div> <!-- main -->[/php]

Repeat the same for the single.php file as well. You should see the following for non-logged in users.

inhouse-twitter-not-logged-in

Alternatively, you can also use the Private-WP plugin to force your users to login before they can read your status update. This is an easier implementation, but a less elegant solution.

This tutorial only touches the tip of the iceberg. If you have added your own modifications/enhancement, do let us know in the comments.

No comments:

Post a Comment