Group home page style like Drupal Dojo

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

Hi Drupalers,

I would like to create OG group home page similar to Drupal Dojo.
The page has two tabs - View ( will be renamed as Home ) and Discussions.
The second tab is ok for me by using view template og-ghp-discuss cloning from og-ghp-ron. It shows discussions of the current group.

I'm struggling with the default tab "View". I'm finding out :
1. How to rename this tab "Home" from "View" ? ( May need to add a new tab "Home" and remove the "View" tab )
2. The Home tab will display 3 types of information ( 3 blocks ) like Drupal Dojo home page.
- First block shows group name and mission statements.
- Second block shows member list of the group with total number of members.
- Third block shows recent discussions with quick information.

How can I do that ?
I has been finding solution to accomplish this without success.
Please help me if you have any idea.

Comments

1) Either of these modules

caschbre's picture

1) Either of these modules should let you rename a tab:
http://drupal.org/project/tabtamer (rename, reorder, hide, etc.)
http://drupal.org/project/tabname_tweaker (only does renaming)

2) This varies by how you want it displayed and the theme you're using. Typically what you enter in the body of the group content type will be displayed on the home page. That could satisfy the group mission. OG comes with a block to display members I believe which you could enable for the group home page. And the recent discussions could be a view block you add to that page as well.

Got it!

cithukyaw's picture

Hi caschbre,

Thank you for your advice.
I used the module tabname_tweaker to rename the tab.

I noticed that Drupal Dojo home page was done by using panel module. One or more view blocks can be integrated into one page ( panel ) by using panel module. But, I have no enough time to learn the panel module usage.

The following is my step-by-step work :
1) Cloned th view og_ghp_ron and named og_ghp_home for "Recent Discussions".
2) Set Style : HTML List and Row style : Fields in Basic settings section.
3) Node: Title and Node: Comment count in Fields section.
4) Create a template views-view-list--og-ghp-home.tpl.php. "Recent Discussions" is available in this template.
5) But, I need another views "Members". Thus, I created a function mymodule_preprocess_views_view_list__og_ghp_home() to make view result of the view og_members_block available in the template.

<?php
function mymodule_preprocess_views_view_list__og_ghp_home(&$vars, $hook){   
  
// To be available og_members_block views in the template file
$og_members_block_views = views_get_view_result('og_members_block');
if(
count($og_members_block_views)){
       
$vars['og_members'] = $og_members_block_views;
   }
}
?>

6) Display the group members block in the template views-view-list--og-ghp-home.tpl.php using the variable $og_members.

<div class="clearfix"></div>
<div class="og-ghp-home-block">
    <h3 class="title">Members</h3>
    <div class="item-list">
    <?php if($og_members){ ?>
        <<?php print $options['type']; ?>>
        <?php foreach($og_members as $member){ ?>
            <li>
                <?php print l($member->users_name, drupal_get_path_alias('user/'.$member->uid)); ?>
                <?php if($member->og_uid_is_admin){ ?>
                    <em class="group-organizer">(group organizer)</em>
                <?php } ?>
                </li> 
        <?php } ?>
       </<?php print $options['type']; ?>>
    <?php } ?>
    </div>
</div>
<div class="og-ghp-home-block discussion">
    <h3 class="title">Recent Discussions</h3>
    <div class="item-list">
      <?php if (!empty($title)) : ?>
        <h3><?php print $title; ?></h3>
      <?php endif; ?>
      <<?php print $options['type']; ?>>
        <?php foreach ($rows as $id => $row){ ?>
          <li class="<?php print $classes[$id]; ?>"><?php print $row; ?></li>
        <?php } ?>
      </<?php print $options['type']; ?>>
    </div>
</div>
<div class="clearfix"></div>

7) Make group title available in the og-mission.tpl.php.

<?php
function mytheme_preprocess_og_mission(&$vars, $hook){
 
$vars['og_title'] = $vars['form']['#node']->title;
}
?>

I don't know this is the right way or not.
But, I could grasped my target.

With Regards,
Sithu

I'm not sure you have to go

caschbre's picture

I'm not sure you have to go through all of that to get what you're looking for. Here's what I would probably try first...

1) In your group configuration disable the "Group home page view" / set it to none. You don't need a page view on the group homepage from what you've said.

1) Create a group and fill out the title and description. Then look at the group homepage to see what is displayed. The title should already display on the group homepage and depending on the theme, the description/mission should as well. If the mission doesn't display then at this point I would update the template logic to display it.

2) The og_members_block view should already exist when you install OG. You may need to enable it. Then you can go to your block settings page and add the block so it shows up on your group home page. You shouldn't have to modify any templates.

3) Create a new view that has a page and block view. This would be your recent discussions. The block view you can add through your block administration. The page view will simply be available to view all discussions beyond the block.

I think that would get you most of the way.

Are you building your own theme? Or using an existing theme?

Adding blocks

cithukyaw's picture

I'm building a social site with my own theme.
What I know is that blocks can be added into a region, NOT into a particular page ( group home page in this case ).

With Regards,
Sithu

That's correct the blocks are

caschbre's picture

That's correct the blocks are put into regions of a page. Does your group homepage not have any regions? That should be a fairly quick fix to add the region to your theme file and the group homepage template.

You can go with panels as well but if you're only using them on one page it might be overkill. I also try to do things in the theme if I can to avoid extra modules.

Adding blocks

cithukyaw's picture

I'm building a social site with my own theme.
What I know is that blocks can be added into a region, NOT into a particular page ( group home page in this case ).

With Regards,
Sithu