Create your own private Twitter site using WordPress

by Jean. 142 Comments -

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.

Comments (142) - Leave yours

  1. Sumesh said:

    That’s a good tutorial, I’m sure larger blogs would find this useful for internal communication (one blog I worked for used a 3 tier system – IM, Pownce and Wiki. P2 could’ve replaced the first two (although Wiki is necessary).

  2. Alex Denning said:

    A better way to stop anyone from getting into the system would be to use a .htaccess hack – ‘M’ on this post –> http://wpshout.com/a-to-z-of-wordpress-htaccess-hacks/

  3. Jean-Baptiste Jung said:

    @Alex: It is another possibility, but it’s only better if you want to prevent unwanted user registration. Otherwise, both the .htaccess and the plugin (which use PHP redirects) are good.

  4. Kyle Ferran said:

    Nice job! Just finished going thru this and it only took me about 15 minutes while one handed eating a subway sub. :)

    Thanks!

  5. flijten said:

    Wouldn’t it be easier just to use locked twitter accounts and only grant access to the people you want to be able to share this “private twitter”?

  6. Jean-Baptiste Jung said:

    @flijten: You could do that, but locked Twitter account will never give you the extensibility your own site can give you.

    @Otto: Didn’t know there were a widget to do that. Anyways hacks are good for that kind of simple task in my opinion. Too many plugins installed on your blog isn’t a good thing.

  7. You are now listed on FAQPAL said:

    Create your own private Twitter site using WordPress…

    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 …

  8. chrys said:

    “Toyed” with the idea of using “Buddy Press” in WordPress MU – Not quite what I wanted. Downloaded laconi.ca and haven’t studied it too much yet. THANKS for the “shorthand” approach. This may be something that my “simple” mind can actually accomplish! Want to build a blog for bezangle.com also. You may have “set me free!”

    Thanks for “Being There” – Found you at Twitter – Will be back.

  9. Edo said:

    Can we use another theme to do this? I would like to create one page with this ‘Twitter like’ function, but left the rest of my blog as it is.

  10. Jean-Baptiste Jung said:

    @Blake: You could easily, using a custom category and a few modifications to P2 templates, create a blog within the P2 theme. But that kind of site use a whole WordPress databases (options, posts, comments, meta, etc) so in my opinion it will not be that easy to integrate P2 within an existing blog.

    @Edo: The P2 theme is very easy to customize. But as far as I know, there’s no other theme with similar functionalities.

  11. George Serradinho said:

    Wow, I never knew it was that easy. Just shows you powerful WP is. Thanks for sharing this info.

    BTW, I will be posting about this post on my Monday roundup of posts as I think this would be beneficial to others who want to start their own Twitter-like site.

  12. Labelzone said:

    This is great, I’ve been thinking about the best way to implement an internal note system for the company for a while, and this looks like it might be ideal (email would’ve been impossible!)

    Cheers for sharing this.

  13. FreelancerCrowd said:

    There is a Bulgarian WP-based microblogging platform for years http://code.google.com/p/zcblog/
    However I don’t know if they ever tred it to port it in other languages.

  14. Hilmy said:

    wow! so easy. I’ve been looking for “twitter-like” scripts and I found it. Thanks a lot as it has saved me lots of hassles..

  15. Geakz said:

    I’ve had this exact set up for family members now for a few months. It’s all locked down and everyone really digs being able to post quick (or lengthy) updates for all to read. Better than email because discussions take place within the comments. The allure is the ease of posting for all involved. You covered all the bases with your article.

  16. FreelancerCrowd said:

    Jean-Baptiste Jung, I am not actually sure. I’ve tested it once for a project of mine and it worked great (exept the annoyance of using only Gravatar for the avatars), but never saw an actual big broject using it as is.
    Maybe the local twitter-likes like edno23.com/ and clix.bg/ are using parts of it. I don’t actually know

  17. FRPrO said:

    i installed the p2 theme via the add new templates button n found it thru there but now i have a problem, how do i access the sidebar.php file? cant seem to find it anywere :(

  18. Frank Lynch said:

    Hey that’s very impressive! Your tutorial is very simple and easy to understand , basically a layman’s guide to microblogging, which is a wonderful tool to keep your privacy and being seen by unwanted people or the people outside your circle.Kudos to you!!

  19. 晓闻心雨 » Blog Archive » 把WordPress变成Twitter said:

    [...] 原文:Create your own private Twitter site using WordPress 翻译:WordPress啦! This entry was posted on 星期三, 七月 29th, 2009 at 15:08 and is filed under 未分类. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site. Leave a Reply [...]

  20. Elizabeth K. Barone said:

    I’ve been thinking about this for a while. I have a project that is going to require a website using WP that allows everyone to post tidbits to contribute to a large list, sort of similar to FML and other sites like that. There are actually a few ways to do this, and your method seems like the easiest I’ve come across so far. (Which means if I get stuck, I’ve got a plan B!) If you’re already good with WordPress, you could use create a page template that uses comments to allow microblogging and set that page as the default. That’s probably what I’m going to do, but I’m definitely glad to have a plan B!

  21. Melany S. said:

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

    This is great! Sometimes social networking sites like Twitter often become another Myspace or Facebook where you eventually end up with contacts you don’t even know. A private site is a good idea for families, groups of friends or officemates who want to stay in touch without broadcasting their stuff for the world to see.

  22. Tauri said:

    I totally digg this :)

    Is there option where login and registration are not required? Random visitors can post their thoughts while visiting site, no registration needed? Basically something like that: confessions.net/confess.html

  23. step by step directions said:

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

    That’s a great way to enhance my blog site that makes it look like Twitter! Only the users who can log in will be able to read the contents and put in comments.

  24. Smashing Themes said:

    That is a damn useful hack. You can use it to communicate with your clients and use it to update project progress. Thanks for sharing with us, I’m definitely going to give it a try.

  25. Victor Vloemans said:

    Excellent article, got me up and running in no time. As a little extra bonus, use the trick below in your sidebar.php to allow for ‘following’ people, just like on Twitter:

    It creates a list of authors and allows you to ‘follow’ an author through his/her RSS feed.

  26. Victor Vloemans said:

    Sorry about my last comment, the php code snippet was excluded. The function I was referring to was: wp_list_authors(‘show_fullname=1&optioncount=1&feed_image=wp-includes/images/rss.png” width=9 alt=”bla’).

    This will create a list of authors and show the little RSS icon next to their name for easy RSS subscriptions.

  27. dhrobonil said:

    Thank you very much for this post.I have all ready develop some feature for the p2 theme.These features help all to make post easily in the blog.There I also add sharing image,link,question and posting feature that each authorized blogger can enjoy. You may review that development here : dhrobonil.com/test
    thanks

  28. Marks said:

    is it possible to add a picture function, where a user can take a picture with a mobile fone or to upload a picture and send it with a tweett

  29. Haroun Kola said:

    Thanks for the tutorial. I’ve created my fist micro-blogging site following your instructions.
    Please do some more tutorials, I think I’m going to get more involved in this side of design and creation.
    Thanks
    Haroun

  30. oliver obrien said:

    Hi, new to all this twitter stuff, but would like to know if you could set up a basic twitter site for me, give me a price, its bascially twitter but for a certain area, for business and tourists etc, do you think this is poss, i would try myself but im not technical, even though you have made it sound very simple, the time is a factor for me and would be good to have a professional make this for me, what do you think to this suggestion, many thanks, olly

  31. Radz Nguyen said:

    WordPress is no 1 . I think so :) . It is the best code for SEO (search engine optimization) . We are explore about it on our website : http://ghosts-it.com . Thank you for your post :)

  32. Jared said:

    This is why WordPress is so great. You can even create a Twitter site with it. There’s endless possibilities to what you can do. I love it, and this. Thanks.

  33. Michael said:

    For people who mentioned Status.net (formerly Laconica), technically everything you publish with that software is Creative Commons Licensed 3.0.

    –Everything–

    So while that works fine for a group working on open source software or media, if your workgroup is slightly more clandestine in nature you might want to go with WordPress P2. Of course you could just *ignore* the CC license and if your site stays truly private it won’t be a problem. That makes me nervous, though. I like Creative Commons in principle. I guess I’m a slave to my ethics :)

  34. Jamie said:

    This is great! Thanks for sharing the basic technique. Now it’s up to us to enhance and optimize what WordPress has to offer. I’m looking forward to your future posts regarding this one.

  35. Levent said:

    I thinking of implementing P2 into my site. like; p2.mysite.com or mysite.com/p2
    I want to have two different designs working at the same time.
    Any advices? Is this possible?

    I also can’t decide either having a forum for visitors or an extra P2 themed page…
    I’m really confused about these right now.. you know
    What do you think I should do?

  36. Bede said:

    P2 is an interesting setup. Not suitable for our current project, but definitely something to keep an eye on.

    Thanks for the informative post, it sped up my testing phase, and that’s always appreciated.

  37. Jose said:

    I just transferred two of my websites from joomla to wp, and the P2 theme has been pristine! thank you for adding to the awesome! WP all on its own is great for optimization, so this set up you’ve laid out here is the perfect way to start.

    Thank you!

  38. Alex said:

    You forgot to mention that the RSS-page is not secured by login. I could reach the RSS of the “twits” from p2 even when I was logged out! Now Im trying to close this bug, or I have to uninstall p2.

    you can test it yourself:
    yoursite.com/wordpress/?feed=rss2

  39. Alex said:

    I fixed the RSS and login issue simply by installing this plugin:
    Absolute Privacy http://wordpress.org/extend/plugins/absolute-privacy/

  40. Algol said:

    Good article, really.
    But sadly it don’t consider core problems, as usual on the web.

    For our organization purposes, i’v created a well functional Twitter “clone”, using:
    - WordPress
    - P2 theme
    - “Add Local Avatar” plugin
    - “Enhanced Meta Widget” plugin
    - “WP Hide Dashboard” plugin

    I’ts all gold? No. Two very important problems still remain unsolved:
    01. Permit Subscribers to delete their posts and attachments, with a simple frontpage “Delete post” link
    02. Permit user to self delete their account and all relative posts/attachment

    For first problem, i can’t find on the web a secure, functional and simple solution to permit that.
    For second problem you can use “User self delete” plugin, but free version of this plugin is really vulnerable to stupid SQL-injection. DON’t use this plugin. I don’t know if commercial version is afflicted by the same bug.

    In my opinion these are two really big problems. If you don’t care a penny about user rights about their accounts… sadly you can skip second problem.

    All here is free. WP, templates and plugin, and i don’t pretend anything. I only “pretend” articles that really explain what you can achieve or not with a solution!

    I’ll be very gratefull to anyone who will solve this problems.
    Thanks!

  41. Sophie said:

    I just switched from joomla to wp, this a nice tutorial perfect for new guys like me. WordPress is such a great website platform, thanks you crazy cats!

  42. Landon said:

    Hi.
    Thanks for this it is great. I would like to change the redirect page on log out to be my home page and not the log in page. Can you advise me on which part of the code to make that adjustment and what to write.

    Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

Please respect the following rules: No advertising, no spam, no keyword in name field. Thank you!