Hi,

How do I set a group's home to the original node view (the one that is shown when og spaces is disabled and when no features are used).

thanks.

Comments

mikemccaffrey’s picture

I believe that the short answer is that you can't. When og_spaces is installed, it looks for the feature which is set to be the group home page. If no feature is set, it brings the user to the features page and prompts them to select a default feature, or gives them an access denied error if they don't have permission to select features for the space.

In my opinion this is a tad overly aggressive stance to take. For one, upon installation on an existing site, og_spaces essentially disables the viewing of all groups by the public until their default home page feature is set. Secondly, it apparently takes away the standard functionality of being able to view the node content and accessing the node tabs, without providing any alternative means of doing so without writing custom code.

Personally, I'd prefer that the group just default to the node if no specific home feature is selected. Is there any reason that I am not seeing why this wouldn't work?

Thanks!

Mike

mani.atico’s picture

I've been able to show the group's original content using views or cutom code (as mikemccaffrey mentioned), but I agree that there should be an option, maybe a pre-set feature, which enables the standard display of a group.

redben’s picture

+1. Couldn't agree more. Spaces og should allow "group node view" as default group homepage

geshan’s picture

Yes it should allow that.

socialnicheguru’s picture

Component: Code » User interface
Category: feature » support
Priority: Critical » Normal

I have been searching for this too.

i tried using panels.

created a panel
mygrouphome/!nid
created a menu item
Home pointing to mygrouphome in Features menu

I created a homepage feature from this
I can click on the icon but no page comes up.

I don't know how to pass !nid to the panel page automatically.

Again, we can't use node/%nid override for the reasons mentioned above.

Thanks for any insight.

EDIT:
In views you can specify a default value defined by php for an argument. But in panels you cannot so I don't think this approach will work unless someone can share how to set a default value.

socialnicheguru’s picture

This also holds for user and having the user/% page be accessible as the homepage for space-user.

redben’s picture

Component: User interface » Code
Category: support » feature
Priority: Normal » Critical

Maybe this should be a (critical?) feature request, since it seems impossible right now ?

redben’s picture

There is a workaround on issue #632200: Bring in group node description in views (group space) comment #3 ,
One could create a feature and add custom code that defines a menu callback. In the menu callback you can use the code snippet :

$space = spaces_get_space();
$gid = $space->sid;
$node = node_load($gid);
return theme('node', $node)

Haven't tried it myself but should work

socialnicheguru’s picture

Component: User interface » Code
Category: support » feature
Priority: Normal » Critical

@redben
how do i create a menu callback?
If I were to override node/$gid with a panel, would the node referred to by the menu callback be overwritten?

Edit: I don't know too much about the menu system but I thought i'd start

function og_node_display_menu()
{

// determine space and get node ID from there
// should check to make sure spaces is enabled
 $space = spaces_get_space();
 $gid = $space->sid;

// ghome is the name of the panel page that I am trying to call
// ghome/!nid where nid is the node id that I want to pass down to the panel

  $menu['mygrouphomepage'] = array
  (
  'title' => 'Group home',
  'page callback' => 'ghome',
  'page arguments' => $gid,
  'type' => MENU_NORMAL_ITEM,
  );

  return $menu;
}

redben’s picture

I think this might work if you add it to as feature module

function myfeaturemodule_menu () {
  $menu['group-home'] = array
  (
  'title' => 'Group home',
  'page callback' => 'myfeaturemodule_ghome',
  'type' => MENU_NORMAL_ITEM 
  );

  return $menu;
}

function myfeaturemodule_ghome () {
  $space = spaces_get_space();
  $gid = $space->sid;
  $node = node_load($gid);
  return theme('node', $node)
}

and in your myfeaturemodule.info add

features[menu][] = "group-home"
...
spaces[types][] = "og"

So that spaces gives you the opportunity to choose this as the default space feature
Again, i haven't tried it myself but i think this should be a good starting point

hefox’s picture

going to need to also implement the menu hook (pages == myfeaturedmodule)

anyhow to update the

function pages_ghome () {
  module_load_include('node','node.pages');
  $space = spaces_get_space();
  $gid = $space->sid;
  if (!$gid) drupal_not_found();
  
  $node = node_load($gid);
  menu_set_active_item('node/'.$gid);
  return node_page_view($node);
}

menu set active item sets it so tabs etc. show up
$gid cause things can still acces the front page

in the module.features.inc

/**
 * Implementation of hook_menu_default_items().
 */
function pages_menu_default_items() {
  module_load_include('inc', 'pages', 'pages.defaults');
  $args = func_get_args();
  return call_user_func_array('_pages_menu_default_items', $args);
}

in module.defaults.inc

/**
 * Helper to implementation of hook_menu_default_items().
 */
function _pages_menu_default_items() {
  $items = array();

  $items[] = array(
    'title' => 'Home',
    'path' => 'front',
    'weight' => '0',
    'description' => 'A simple front page.',
  );
  // Translatables
  array(
    t('A simple front page.'),
    t('Home'),
  );

  return $items;
}
hefox’s picture

http://github.com/hefox/spacesoghome put the functionality mentioned into it's own feature; I believe it's working, but as I originally had it in a different module there may be some reminiscent of that.

socialnicheguru’s picture

@hefox, Ok I feel a little silly, but once I enable this, what do I do? How do I select the homepage. and does this only work for groups as opposed to users in space_user (I assume it only works for groups)?

Edits: Sometimes I should have a beer instead of posting comments.
Enable feature
goto group
select feature
have fun

Edit: This shows a list of nodes instead of the node page itself. Did I miss something?

hefox’s picture

That is the node, right? Visit the node itself and see if there's a difference. Should also be edit tab for group node, etc. I'm not sure what exactly og is doing, but it embeds a view (set via og settings) in the node; default view is listing of nodes for that group.

I believe homepage also needs to be set to "Home" for it to work.

socialnicheguru’s picture

Is there anyway to modify so that 'front' would point to a panel page that I setup that takes the current gid as an argument?

For example, front points to mygrouphomepage/$gid

I tried this below and it doesn't seem to work

function spacesoghome_menu() {

  $space = spaces_get_space();
  $gid = $space->sid;
  $home_path = 'mygrouphomepage/'.$gid;

  $items['front'] =  array(
    'title' => t('Home page'),
    'type' => MENU_CALLBACK,
    'path' => $home_path,
    'access arguments' => array('access content'),
    'weight' => -10
  );

  return $items;
}
hefox’s picture

There's some work in the 3x branch to add in support for node/% panel override (
http://github.com/hefox/spacesoghome/blob/spaces-3.x/spacesoghome.module) , but there's a conflict in general with node/% panel override and spaces/purl (basically panels doesn't call node_view with $page = 1) .

Add in node_page_view($node); in page_manager/lugins/tasks/node_view.inc before the first return and it'll should work.
See #723570: Conflict between panels node/% override and spaces router activation

jmiccolis’s picture

Status: Active » Fixed

In Spaces 3.x we don't make the group node so difficult to get to. Setting this to fixed, If you've got specific questions about what's going on in 3.x please open a new ticket.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.