Some basic features

Events happening in the community are now at Drupal community events on www.drupal.org.
ebeyrent's picture

There are some pieces of DrupalMU that I need to figure out:

  1. Allow bloggers to customize their blog title
  2. Default About page for each user
  3. Multiple authors per blog
  4. List of blogs

Has anyone coded these features already?

Comments

For the first item listed, I

Cory Goodwin's picture

For the first item listed, I believe the current setup is "!username blog". I don't think there is a way to change it other than making a different user name. Perhaps instead of a normal name the user makes a name like, "The Roses of London" or something like that.

For the fourth item, try using the blogger module.

--
Need professional help with your Drupal project? Goodwin Solutions

Good suggestion regarding

ebeyrent's picture

Good suggestion regarding #4. I shamelessly stole the block code from the module and added most of it to the drupalmu_helper module. There are a few tweaks, however, specifically related to using the profile module to add a field for blog title. Also, I'm trying to make all of this work for D5, so this code may or may not work for D6:

<?php
function drupalmu_helper_block($op = 'list', $delta = 0) {
  if (
$op == 'list') {
   
$blocks[0]['info'] = t('DrupalMU Bloggers');
    return
$blocks;
  }
 
  if (
$op == 'view') {
   
$sql = " SELECT n.uid, u.name, count(u.name) AS numitems, u.picture, pv.value as blogtitle"
       
." FROM {node} n "
       
." INNER JOIN {users} u ON u.uid = n.uid "
       
." LEFT JOIN {profile_values} pv ON pv.uid = u.uid "
       
." INNER JOIN {profile_fields} pf ON pf.fid = pv.fid "
     
." WHERE n.type = 'blog' and n.status = 1 "
     
." and n.uid  "
     
." GROUP BY n.uid "
     
." LIMIT 10"
     
;
   
$results = db_query($sql);
 
   
$block_content = '<div id="blogger">';
 
    if (!
db_num_rows($results)) {
    
$block_content .= 'No blogger';
     
$block_content .= '</div>';
    }
    else {
     
$block_content .= '<table>';
     
$i = 0;
        while (
$data = db_fetch_object($results) ) {
       
$i++;
          if(
$data->blogtitle) {
           
$data->name = $data->blogtitle;
        }
   
        
$showdata = ($shownum ? $data->name.' ('.$data->numitems.')' : $data->name);
         
       if (
$data->picture<>"") {
           
$blogger_img = base_path().$data->picture;
         
$showpict = "<img src='$blogger_img' ".
           (
$blogger_avatar_width<>0 " width=$blogger_avatar_width " : " ").
             (
$blogger_avatar_height<>0 ? " height=$blogger_avatar_height " : " ")."></>";
         }
           else {
             
$showpict = "";
           }
       
        
$block_content .= '<tr class="'.(($i % 2) ? 'odd' : 'even') .'">';
        
$block_content .= '<td '.($blogger_avatar_width<>0 " width=$blogger_avatar_width " : " ").'>'.$showpict.'</td>';
          
$block_content .= '<td>'. l($showdata, "blog/$data->uid").'</td>';
           
$block_content .= '</tr>';
     }
     
      
$block_content .= '</table>';
     
$block_content .= '</div>';
    }
   
   
// add a more link to our page that displays all the links
   
$block_content .=
        
'<div class="more-link">'.
        
l(t("more"), "blogger/list", array("title" => t("More bloggers...")))
         .
'</div>';
       
  }

 
$block['subject'] = t('Bloggers');
 
$block['content'] = $block_content;  
  return
$block;
 
}
?>

If the profile module were

ebeyrent's picture

If the profile module were enabled, we could add a field under the user settings for people to set the title of their blogs. Another solution would be to implement a form and collect the data somewhere. Once we have the data, you could do the following.

Drupal 6:

<?php
function drupalmu_helper_preprocess_page(&$vars) {
  if(
$uid = drupalmu_helper_context()) {
  
$user = user_load(array('uid' => $uid));
   
$vars['front_page'] = url('blog/'. $uid);
    if(
strlen($user->profile_blogtitle) > 0) {
     
$vars['site_name'] = $user->profile_blogtitle;
     
$vars['head_title'] = $vars['title'].' | '.$user->profile_blogtitle;
    }
   
$vars['site_slogan'] = '';
   
$vars['breadcrumb'] = '';
   
// We don't want to display the title twice on the bloggers homepage
   
if(arg(0)=="blog") {
     
$vars['title'] = '';
    }
  }
}
?>

Drupal 5: Item #1 can be accomplished in template.php like this:

<?php
function _phptemplate_variables($hook, $vars = array()) {
  switch(
$hook) {
    case
'page':
     
$author = user_load(array('uid' => $vars['node']->uid));
      if(
strlen($author->profile_blogtitle) > 0) {
       
$vars['site_name'] = $author->profile_blogtitle;
       
$vars['head_title'] = $vars['title'].' | '.$author->profile_blogtitle;
        return
$vars;
      }
      break;
  }
}
?>

The problem is that this would have to be done in every theme for D5, which is no good. Is there another way?

profile integration

wmostrey's picture

Integration with the profile module is also something that Tim Millwood suggested: http://drupal.org/node/319560. Thanks for the code Erich!

I'm currently focusing DrupalMU for Drupal 6 only, especially with many features being easily integrated thanks to the powerful views2 module.

I'm thinking #3 could be

ebeyrent's picture

I'm thinking #3 could be solved if we implemented organic groups, and treated each group like a blog. With this type of solution, the group administrator would be treated as the "blog owner", and individual contributors would be group members with permissions to create blog nodes. We'd probably want to force all groups to be public, and theme out the audience select box.

Change thinking

boris mann's picture

I think it's OK to decide what kind of solution you want, and implement to just those features. So, for example, just don't do multiple authors per "blog". e.g. LiveJournal doesn't have multiple authors per blog, but they do have topics / communities.

One could enable a "community selection box" for organizing posts that is just run by taxonomy.

So, my suggestion would to draw a line in the sand and say only own author per blog.

Good points Boris! I agree

ebeyrent's picture

Good points Boris! I agree that the topics/communities would be very easy to implement via taxonomy. On your other points, that would work if you were building a new multi user blog.

The problem I am running into is that I have a client that I'm doing a Drupal site for, but the client also has a WordpressMU setup that I'd love to convert to Drupal. Based on the configuration for those blogs, I need to have multiple authors per blog to prevent loss of functionality.

Using OG for this appears, in my opinion, to be the easiest way to accomplish the goals. Another option is to custom code the whole thing, but I think that would really be unnecessary.

How about...

pkej's picture

Content Type: Blog - Node profile type w/name for blog etc. User can then use the "Add blog" link already provided by node profile.

Then we need some way of assigning all Content Type: Blog Post to reference the Blog node of the user, but without letting the user selecting a node by mistake, ie adding a post to someone else's blog.

That would be a node reference with a view, which takes the current user's uid into the view, and list the only node available.

A list of all blogs would be a view which lists all nodes of Content Type: Blog which has one or more Blog Posts (a relation).

That's kind of what I did

dalehgeist's picture

I'm defining a Content Type: Blog Post and a Content Type: Profile (using the content_profile module, the successor to Node Profile).

The author creates their blog profile when they activate their account - upload a picture, create a global name for their blog, a one-sentence bio, and an "author name" that's distinct from their username.

Then they can Create Content > Blog Post. In that content type there is a nodereference to a View, and the view returns the Profile of the logged-in user (i.e. the author.)

The only quibble I have is that both the Blog Post node and the Author Profile node display the author's username, and the Author Profile node also displays the creation date of the profile; these are all undesirable. Advice about workarounds gratefully accepted.

I've actually implemented

jcfiala's picture

I've actually implemented all of these features on a client's site, but instead of going with OG, I went with taxonomy instead. Look me up at drupalcon (assuming I can still attend) and I'll show it off.

-john

-john

Multi-user blogging

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: