This addition to og_forum_nodeapi() will update a group's root forum container in the event that the group's title is changed. Both the forum name and its URL aliases will be updated. Currently, nothing happens when a group's title is changed.

<?php
//in og_forum_nodeapi()...
    case 'update':
      //Make sure if the group's title has changed, the title of it's root forum is updated as well.
      if (og_is_group_type($node->type)) {
        $tid = db_result(db_query('SELECT tid FROM {og_term} WHERE nid = %d', $node->nid));
        if ($tid) {
          $term = taxonomy_get_term($tid);
          $term->name = $node->title;
          $term = (array)$term;
          taxonomy_save_term($term);	//will have any other modules update the term's URL aliases
        }
      }
      break;
?>

Comments

mightyiam’s picture

Thanks for this devin.gardner!

devin.gardner’s picture

You know, thinking about this further, it almost seems like this functionality should be configurable in the admin screen. The reason being is that a Drupal site might want to allow group admins to change the title of their forum container to something other than their group title. In this case keeping the forum title and URL alias synched with the group title is not wanted. I wouldn't think group admins should get the option of keeping them synched or different on a group edit page, so I wonder what the ideal solution is.

mightyiam’s picture

A checkbox in the og_forum administration page titled "Synchronize forum/container name with group name".

If the checkbox is marked, enabled synchronization and prevent change of forum/container name.

Also in the administration page - a "Synchronize now" button, which synchronizes all forum/container names with the group names.

have a drink.

rconstantine’s picture

Thanks for the patch. Will check it out/apply it soon.

As for the container name being different from the group name, that seems to add confusion. Here is why: inside a group, there is only one container, the group container. When one clicks on the 'Group forums' link, that's the only time inside a group that they'll see that title. I can see that changing it there might serve some purpose, though I'm not sure what. The thing that's bad in my mind, however, is when a user it at the site-wide forums, they can see the forums and containers for all groups to which they belong. If a user had joined the 'karate' group, but the owner changed the container name to 'we kick ass', then at the site wide view, the user might not remember that the container is the group he was looking to post in.

Am I out in left field here? Is that not how it might be perceived? I think, therefore, that if the group owner wants the name of the container to appear different inside the group, then that could be a theming issue.

mightyiam’s picture

Group administrators should be either not allowed to change the container/forum name or, if they are allowed to, made clear that they're subscribers may not recognize the container/forum if they changed it's name.

rconstantine’s picture

I still can't think of a good reason why a group owner would even want to change the container name. And I think there is a risk down the line of having issues due to group/container name mismatches.

So, if a rename thing is done, it might be better to collect a name, store it elsewhere, and then present it at the theme level. That way, the underlying vocab isn't messed with.

mightyiam’s picture

So don't give the option to not synchronize the name. that way the container/forum name is always the same as the group name. Should be simple, too.

1. Prevent change of container/forum name.
2. When a group name changes, change it's container/forum name accordingly.
3. Make the "update old groups" button also sync the names.

rconstantine’s picture

Assigned: Unassigned » rconstantine
Status: Needs review » Fixed

Just committed the code to CVS. Look for a new dev after cron runs. For those still interested in new features, bump the request(s) to a new issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)