Making a member list blog directory

Making a member list blog directory

Sorry for the convoluted title, it's more for search engines. I've found there's quite a few different ways people phrase what they want, but here's how to do it. Ultimately, you will wind up with a separate page off the main blog with a list of all your public member blogs.

You will need:
- a copy of [download#21]
- a copy of the page.php file from your main admin blog's template

Place the list_all plugin in your mu-plugins folder if you have not already done so. Some things to remember are that this plugin does not have an admin menu, so you won't see any changes on the back end. You'll have to call it directly to use it, which is good as you don't want your members making lists too.

Save a copy of your theme's page.php file to your desktop or working folder on your computer, somewhere that you can find it later. Open it up in your favorite text editor. If I have to work on windows, I like to use jEdit or Notepad++ because the default notepad sometimes screws things up. On Linux, I happen to love gPHPedit because of the code highlighting and the instant visuals if I happen to accidentally delete closing tags.

Allrighty, with the page.php template open in front of you, you should see something like this:

<?php get_header(); ?>

<div id="content" class="narrowcolumn">

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<div class="entry">
<?php the_content('<p class="serif">Read the rest of this page Β»</p>'); ?>

<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>

<?php endwhile; endif; ?>
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

The first thing we are going to do is add some comments at the top, so the system will know it is a new page template and what to call it. Add this at the top of the file:

Template Name: Member Listing

You don't have to call it Member Listing, you can call it whatever you like. If you read further down in the template, there is a div next, then the Loop. That's the code that pulls in the actual content of the page. In this case, we don't want it. Delete everything from <?php if (have_posts to <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>. Your page template should look pretty empty.

Now here comes the good stuff; insert the code from the list_all plugin to generate our list of member blogs. This plugin has a few options that you can play with too, but for now you'll tell it to pull a full listing of blogs in alphabetical order. The function for that is this:

<?php list_all_wpmu_blogs('500', 'name', '', '<br />', 'blog_name'); ?>

Paste that between the opening and closing content div tags, replacing the Loop that you just removed. It should look something like this:

Template Name: Member Listing
<?php get_header(); ?>

<div id="content" class="narrowcolumn">
<?php list_all_wpmu_blogs('500', 'name', '', '<br />', 'blog_name'); ?>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

The paramaters passed are the detail in brackets to tell it to show 500 blogs, displayed by name, no HTML in front and a carriage return after each, sorted by name. Please note that this plugin will not display blogs that are listed as private. They have to be set to public to show up.

Now, save your template as a new file, called something like members.php or even listing.php, as long as it doesn't interfere with other template files. Upload this new template file to your mu site to your main blog's theme folder; ie - wp-content/themes/yourmainblogtheme/

Login to MU at the main blog and go to Write Page. Choose a title for your new page, such as "Member Listing". Don't write any text in the post area, as we've taken out the code to make it show up. Here's the important bit though: down the right side, there should now be a blue bar there that says "Page template". Expand it and have a look at the drop-down box. There should be a list that says "default template" and right under it the name of the new page template we just created; in this case it says "members" or whatever you saved the file as. Select this template and publish the page.

If you've chosen a particularly nice theme, there will likely be a navigation bar that automatically pulls in page names for menu items. You'll find your new page there.

Last but not least, make sure your main blog theme is not accessable to your users by following the instructions here.

Based on instruction from Creating your own page templates from the WordPress Codex. If you just scrape the code from this page and copy and paste it, the formatting will be off. So type it in. πŸ™‚

Don't forget to leave me a comment and show off your new page-making skills. You can see mine here.

  • Dr. Mike Wendell
    Posted at 16:37h, 24 March Reply

    The problem with that, and I notice it when I try to pull up your example, is that the data is not cached in any way. It’s a fresh copy every single time which is going to cause processor strain and long delays. Took about 90 seconds for your example page to come up.

    A better idea, no offense Andrea, would be create the output once an hour or so via a cron job and either dump it into a static page or into a database as a single record and use that.

    • John
      Posted at 05:42h, 27 May Reply

      You probably wouldn’t want to install it just for this reason, but WP-Super-Cache takes care of this issue… This page is cached just like the other blog posts.

      Downside of course is the list won’t reflect a newly created blog straight away, but certainly removes the load issue!

      • Dr. Mike Wendell
        Posted at 11:07h, 27 May Reply

        That only applies with wp-super-cache running in full static page mode. I know we’re not running wp-super-cache in full mode as it causes too many issues. (ie Too many plugins fails, mobile support doesn’t work, releasing the cache doesn’t always occur when changes to the blog are made, etc.) I know on all of my installs, wp-super-cache is only running in half mode. Even in half mode, this would still be a bad idea because the plugin isn’t setup to save it;s data anywhere. (At least last time I looked.)

        We actually do something along what I suggested and save the data for ‘x’ amount of minutes within either a sitewide mate option record or another database within the table. You’ll note further down in one of my other comments, I make the suggestion as how get_sitestats saves it’s data.

        Running this script each and every time isn’t the way to do it though. (No offense, Andrea.)

        • andrea
          Posted at 14:29h, 27 May Reply

          Feel free to write up a new tutorial.

          If you don’t like how the list-all plugin grabs data, take it up with the plugin dev.

  • Andrea
    Posted at 16:56h, 24 March Reply

    Good tip though. πŸ™‚ Maybe I’ll write up that next. πŸ˜€

    Actually, that highlights issues the new MU site owner might never think of until the first server crash.

  • Dr. Mike Wendell
    Posted at 17:17h, 24 March Reply

    Another way to do it is like how mu generates the blog count as it only gets updated once an hour. Take a look within wp-includes/wpmu-functions.php for the get_sitestats() function. It saves the data as a site option but will only update it once an hour. That may be another solution/ option here. Save the list as a site option and, if it’s been less than an hour, just grab it out of the site option table. If it’s been more than an hour, recreate the list.

  • Linux-Benutzung » Re: Auf dem Desktop-Markt hat Linux nichts zu suchen ! Die Linux-Lemminge … - Konsortium will Linux auf die Desktops b…
    Posted at 16:04h, 25 March Reply

    […] es kein einziger professioneller > > > > Designer. Viel Spaß mit dem Schrott. > > > und was ist an macromedia so professionell? ich kenne viele, die das > > > Plugin nicht installiert haben und die supertollen […]

  • brandon
    Posted at 22:38h, 12 April Reply

    how can i do this with the authors avatar showing up?

  • nggablog
    Posted at 17:53h, 26 May Reply

    Dear Andrea.

    I need to add alphabetically list of blogs where each letter will display in separate page. So, I have page A B C D ….
    As an example you can see hxxp:// at right sidebar (Quick Browse).

    What’s plugin that can do it?


  • Fouad Fakhreldeen
    Posted at 06:50h, 31 May Reply

    thanks andrea , i’m not a programmer and i find my way hardly through those stuff and your post really helped me

    there’s a problem with the code you posted
    ’, β€˜blog_name’); ?>

    this code won’t work and will give error when applied to page theme
    ‘, ”, ‘last_created’); ?>
    this one worked fine

    actually there’re other functions in the last variation which could be of a very good help to users specially if applied to theme itself , i’m working on one now and used the above code but limiting it to 10 and it works more than fine

    the other problem is with this plugin itself , it limits the number of blogs shown to X number of blogs and not providing navigation , i think it might take alot of time for the volunteer coders but i think it would be great to see it with categorizing the blogs on the system too

    thanks andrea for your help here and on the forums too

  • Fouad Fakhreldeen
    Posted at 06:53h, 31 May Reply

    sorry for sending again but the code didn’t show , it’s about the BEGIN_WRAP parameter in the code you posted
    and the ‘ in the begining of every parameter in the code

  • Cindy
    Posted at 08:11h, 17 June Reply

    After read your blog i think member list blog directory. is necessary for new blogger.. u explain best ways to Making a member list blog directory step by step.’s very useful method for me……thxx…………keep it up..:):):)

  • Richard
    Posted at 08:13h, 18 June Reply

    Will this work with ordinary wordpress? Can we make it work?


  • Andrea
    Posted at 08:21h, 18 June Reply

    The process is similar, but the plugin involved is specifically for WordPressMU.

    For single-install WordPress, try this:

  • Richard
    Posted at 08:30h, 18 June Reply

    Originally Posted By AndreaThe process is similar, but the plugin involved is specifically for WordPressMU.

    For single-install WordPress, try this:

    Thanks Andrea, that’s a usefull link.

  • Russell
    Posted at 15:05h, 18 December Reply

    I am trying to do the this, however use a photo with each blog. Similar to a gravitar I suppose. Any thoughts.

  • OwenM
    Posted at 20:28h, 22 March Reply

    I installed the plugin and followed your instructions, however, the plugin only displays URLs and always sorts in the order created. What would cause this?

    Thanks for any input.

    • John
      Posted at 05:00h, 27 May Reply

      As per the instructions.txt of the plugin file:

      To put a list call list_all_wpmu_blogs(LIMIT, DISPLAY, BEGIN_WRAP, END_WRAP, ORDER);


      LIMIT: can be any number or left blank for unlimited.
      DISPLAY: Can be either ‘name’ which displays the blogs name or ‘url’ which displays the address
      BEGIN_WRAP: html or other code that you would like if front of the generated html. Example: ”
      END_WRAP: html or other code that you would like after the generated html. Example: ”
      ORDER: Can be ‘updated’ which lists blogs by last updated, ‘first_created’ which lists blogs by the first blog to the latest, or ‘last_created’ which lists blogs from the latest to the first created

  • melissa
    Posted at 11:45h, 15 May Reply

    Thanks for these easy to follow directions! Awesome!

  • Working with WPMU: tips/tutorials
    Posted at 12:05h, 15 May Reply

    […] duh!) I was able to install a little plug-in called list-all and by following the instructions on wpmu tutorials I was easily able to create a page listing all of the public […]

  • syamsul
    Posted at 13:42h, 18 July Reply

    Can’t seem to get this working in WPMU 2.8.1. Hope an update will be coming soon! πŸ™‚

  • syamsul
    Posted at 09:26h, 10 August Reply

    Hi I seem to be getting an error message

    Parse error: syntax error, unexpected $end in /var/www/html/wpmu/htdocs/wp-content/themes/illustrative/members.php on line 11

    These are the contents of my members.php

    <?php list_all_wpmu_blogs(‘100’, ‘name’, “, ”, ‘updated’);

    • syamsul
      Posted at 09:28h, 10 August Reply

      Oops not sure why the code got cut off – here’s the full contents. Will be grateful for any advice

      <?php list_all_wpmu_blogs(‘100’, ‘name’, “, ”, ‘updated’);

  • shawn
    Posted at 16:50h, 27 August Reply

    I am using the thesis theme, and there is no page.php page or anything similar.

    I do have an index.php and custom_template.php file, but the only thing in those files is the line

    kinda stumped here

  • chris
    Posted at 21:33h, 17 January Reply

    thanks for this tip.

    I only have one blog running off my main page, but i got it to work here:

    My main question is this: Any way to exclude the main blog from this listing? AS you can see it is listing ‘mba365’ but i only want to list the other blogs…Thanks!

  • Marcus
    Posted at 00:49h, 29 January Reply

    Parse error: syntax error, unexpected ‘>’ in /home5/yoursup2/public_html/blog/wp-content/themes/multichrome/listing.php on line 27
    is the error I get. I have checked the code a lot but that’s all I get

  • Marty Martin
    Posted at 15:36h, 06 August Reply

    I just used this on a restaurant directory website we’re doing for a local market. Perfect, even 2+ years after the original post. πŸ˜€

Post A Comment