Customize Organic Group Homepages

dbarach - December 10, 2005 - 03:40
Project:Organic groups
Version:4.6.x-1.x-dev
Component:User interface
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

It seems that there is quite a bit of confusion on how to customize a group homepage.
http://drupal.org/node/34838
http://drupal.org/node/35927
http://drupal.org/node/26559

There are two main issues:

1. Ability to have some sort of "mission statement" show up before the listings of nodes as a welcome statement to the group. This should be done in a way similar to the way it's done on a Drupal site homepage.

2. In the og.module code it mentions that it's possible to theme the homepage, but most people (including me) don't know what that means. It would be very helpful to have some theme sample code to be able to plug in.

Many thanks for an amazing module.

#1

metzlerd - December 22, 2005 - 19:33

I would like to support/assist this request. We're hosting multiple groups for IT governance and we need some basic instructions to appear prior to the content. That would make the module perfect for our needs. Here's what I'd recommend as a solution:

Add a simple textarea field to the group definition called "welcome" or something like it, that would show up in the "add/edit" screen. have this display after the group name and before the group boxes. Make sure it's appropriately themeable.

This wouldn't solve everyones needs, but I think it meets the 80/20 rule.

I'm not currenlty a CVS contributor, but I would be willing to code this up if the developers agree.

Dave

#2

metzlerd - December 23, 2005 - 06:11

I've done some research in the code and I think that I have an easier fix that doesn't require Database cchema mods, like the last one I posted did. I've coded this up and it appears to work:

In the og_form hook, add the textarea field for the node->body, allowing each organic group to store node body information:

$output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
$output .= filter_form('format', $node->format);
</code

In the og_view hook, prior to concatenating the group posting information, make a call to node_prepare to cause the appropriate filter hooks to modify the node->body loaded from the database.

<code>
$node_prepare($node,$teaser);

Then change the last line bulding output to be:

$node->body .= $output. $xml_icon

The end result is you get to specify a "body" for each "group" that you create, and have it appear above the group posting in the home page. So what thinkist the module developer(s). Is this a solution worthy of this module?

I'd be happy to post a revised 4.6.x module, and download/modify and test for 4.7 as well.

#3

Veggieryan - December 25, 2005 - 11:18

Super Crucial!

this is a rad patch my friend..
can you be more specific with what goes where? line numbers are good..
its a little unclear

thanks
ryan grace
thefractal.org

#4

janekb - December 26, 2005 - 15:08

Patch for 4.7 version of Open Groups (using new Form API)

Index: og.module
============================================================RCS file: /cvs/drupal/contributions/modules/og/og.module,v
retrieving revision 1.109
diff -u -r1.109 og.module
--- og.module 12 Dec 2005 23:46:03 -0000 1.109
+++ og.module 26 Dec 2005 15:03:38 -0000
@@ -702,7 +702,7 @@
     $url = url("og/feed/$node->nid");
     $icon = theme('xml_icon', $url);
     drupal_set_html_head("<link rel=\"alternate\" href=\"$url\" title=\"$node->title RSS feed\" type=\"application/rss+xml\" />");
-    $node->body = $output. $icon;
+    $node->body = $node->body . $output. $icon;
   }
   return $node;
}
@@ -746,6 +746,10 @@
   $form['og_register'] = array('#type' => 'checkbox', '#title' => t('registration form'), '#default_value' => $register, '#description' =>t('Should this group be available for subscription during registration?. If checked, a corresponding checkbox will be added to the registration form.'));
   $form['og_directory'] = array('#type' => 'checkbox', '#title' => t('list in groups directory'),  '#default_value' => $directory, '#description' => t('Should this group appear on the %page', array('%page' => l(t('list of groups page'),'og'))));

+   $form['body'] = array(
+    '#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#rows' => 20, '#required' => FALSE
+  );
+
   // group image
   // NOT WORKING YET!!!
/*

#5

Veggieryan - December 27, 2005 - 05:47

thats great for 4.7.. will be using on my personal site...
but what about 4.6?

metzlerd?
i couldnt get the changes you described to work...
need more info.

thanks
ryan grace
thefractal.org

#6

metzlerd - December 27, 2005 - 17:33

Here's the modified 4.6.0 version of the module. The places that I modified are all prefixed are all commented with "metzlerd" just before the code block.

In my latest post, I incorrectly said that I modified the "view hook". The display mods are actually done in the og_theme_view function.

Dave

AttachmentSize
og_5.module 66.9 KB

#7

Veggieryan - December 28, 2005 - 00:47

this is so crucial for groups..
to be able to put an explanation at the top of the group homepage.. not to mention images and even php code is amazing..

this should be standard..
thanks
ryan
thefractal.org

#8

moshe weitzman - January 4, 2006 - 20:02
Status:active» fixed

great aidea. thanks metzlerd and janekb.

about to commit to 4.7 and HEAD

#9

Anonymous - January 18, 2006 - 20:20
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.