Create your own private Twitter site using WordPress

by Jean.

With the incredible popularity of Twitter theses days, many people are asking themselves how can they create their own Twitter-like network for their family, friends or company. This may be a lot easier than you think. In this tutorial, I’m going to show you how to do it easily, using WordPress.

Getting ready

Twitter success is the proof, microblogging is definitely something useful and efficient. It can help you staying tuned with friends, family or coworkers.

While Twitter is great, it may not be the best choice if you’re looking for a private network, for example for sharing work tips with colleagues, or notice your familly about what’s up.
As I was searching for an easy and quick way to create a private microblogging website, I stumbled upon an open source app called laconi.ca, which was created to allow people to launch their own private “Twitter like” microblogging sites. I didn’t really liked it and it was a total pain to install.

After this not so good experience, I decided that WordPress should do that job, and do it good as always.
P2 Theme

Let’s doing it

Well, enought talk for now! Let’s create our own, private microblogging website using our beloved WordPress.

1. Installing WordPress

The first thing to do is obviously to install WordPress on your server. Installing WordPress is definitely easy and and I’ll not explain it here due to the incredible amount of tutorials you can find on the internet.
If you need help for installing WordPress, you should read the documentation. Or even better, you can register at WpWebHost, the WordPress hosting experts, and use Fantastico to get your WordPress installed automatically in a minute. Just click here if you want to know more.

2. Get your copy of the P2 theme

The guys from Automattic (The company behing WordPress) released, some time ago, a very cool WordPress theme for social microblogging. The theme is called P2 and you can get it for free here.

After you downloaded P2, simply uncompress the archive and upload it to the wp-content/themes directory of your WordPress install. Once done, login to your WordPress dashboard and go to “Appearance”, “Themes”. Slect the P2 theme and activate it.

P2 Theme
That’s easy as that, you have sucessfully installed P2 and you’re ready for social microblogging.

3. What about a login form?

Althought the P2 theme itself is very good, it is possible to enhance it even more. As P2 allow users to post directly from the frontpage, without visiting WordPress dashboard, a good idea should be to integrate a control panel in the theme sidebar.
Our control panel will do the following:
If the user isn’t logged in or have no account yet: We’ll display a login form as well as a link to register, so the visitor can create his account.
If the user is already logged in: We’ll display a link to logout as well as a link to account options, so the user (Even if (s)he doesn’t know much about WordPress) can easily update his/her profile.

To integrate a login form in your theme sidebar, simply open the sidebar.php file and paste the following code:

<li>
  <?php global $user_ID, $user_identity, $user_level ?>
  <?php if ( $user_ID ) : ?>
    
    <h2>Control panel</h2>
	 <ul>
	   <li>Identified as <strong><?php echo $user_identity ?></strong>.
	   <ul>
		  <li><a href="<?php bloginfo('url') ?>/wp-admin/">Dashboard</a></li>

			<li><a href="<?php bloginfo('url') ?>/wp-admin/profile.php">Profile and personal options</a></li>
			<li><a href="<?php bloginfo('url') ?>/wp-login.php?action=logout&amp;redirect_to=<?php echo urlencode($_SERVER['REQUEST_URI']) ?>">Logout</a></li>

         <?php
         if (is_single()) {?>
           <li><a href="<?php bloginfo('wpurl');?>/wp-admin/edit.php?p=<?php the_ID(); ?>">Edit Post</a>
           </li>
         <?php } ?>

	</ul>
	</li>
	</ul>

  <?php elseif ( get_option('users_can_register') ) : ?>
    <h2>Identification</h2>
    <ul>
      <li>
  
      <form action="<?php bloginfo('url') ?>/wp-login.php" method="post">
      <p>
        <label for="log"><input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="22" /> User</label><br />
        <label for="pwd"><input type="password" name="pwd" id="pwd" size="22" /> Password</label><br />
<input type="submit" name="submit" value="Login" class="button" />
        <label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Remember me</label><br />
</p>
        <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
      </form>
  
      </li>
      <li><a href="<?php bloginfo('url') ?>/wp-register.php">Register</a></li>
      <li><a href="<?php bloginfo('url') ?>/wp-login.php?action=lostpassword">Recover password</a></li>
    </ul>
  
<?php endif; ?>
</li>

 

4. Making your network private

While the login/register form option can be good in some case, it will still allow people to read your discussions and search engines to index your content. If your need is a 100% private website, don’t worry. This is far from being a problem.
To do so, we’ll use a WordPress plugin, named Private WP. Get your copy here. Once you have it, extract the archive on your hard drive and upload the private-wp to the wp-content/plugins directory of your WordPress install. Then, simply login to WordPress, go to the dashboard, then to “Plugins” and activate the plugin.

That’s all you have to do. Now, your website will automatically detect logged in users, who’ll be able to read and post content, and unknown visitors, who’ll be automatically redirected to WordPress loggin panel.

Conclusion

The first thing which have to be said is that, one more time, WordPress show how extensible and powerful it is. If you’re familiar with WP, creating this “Twitter-like” site using the P2 theme should not take you more than 30 minutes. Isn’t that great? I’ll not say that I love WordPress, because all of you already know 😉

This tutorial was focused on making a private microblogging site and used only basic techniques, but there’s a lot of other interresting things that can be done in order to enhance this “Twitter-like” site. For example, you may want to create a page template listing all members, or even better, filtering posts to see only those posted by a selection of members?
Maybe we’ll see that in a future tutorial, if you enjoyed this one.

CWC Special Deal!

Get one year of quality hosting + domain from A Small Orange for only $40 with our exclusive deal!

Featured WordPress Theme

Caliber - Responsive WordPress Theme