0

In OA I'm trying to set the default page to a group i.e. I've selected then put in a group name for example 'intranet' but this says that the page does not exist...

Does anybody know how I can default the front page to a specific group when users log in?

Shane
  • 1,603
  • 4
  • 26
  • 54

2 Answers2

0

A bit late replication but hope it will help someone else. You can use function hook_user() with $op 'login'.

yourmoudlename_user($op, &$edit, &$account) {
    if ($op == 'login') {
        $groups = $account->og_groups;
        // redirect to the first group of user
        if ($groups) {
            $groups = array_values($groups);
            $group_node = node_load($groups[0]['nid']);
            $_REQUEST['destination'] = $group_node->purl;
        }        
    }
}
Kjuly
  • 34,476
  • 22
  • 104
  • 118
summer
  • 26
  • 2
0

You need your group's nid/gid...Go to your group's page and click the 'edit' tab, you should see something like "node/123/edit" or "group/123/edit". The number in the middle is your node ID or group ID. if the path starts with 'node' your front page will be "node/node_id", if it's group your front page will be "group/group_id".

Hope that makes sense

Clive
  • 36,918
  • 8
  • 87
  • 113
  • Thanks for the reply, I've done that which takes you into the group but the page displays a message saying 'You are not authorized to access this page.' Any ideas ?? – Shane Sep 27 '11 at 13:30
  • That normally means the logged in user (or anonymous user if no login is available) doesn't have permissions to access the group. Can you check that? – Clive Sep 27 '11 at 13:32
  • Yeah I've checked, if I go to the group manually with that user they can access it ok. – Shane Sep 27 '11 at 13:39
  • Hmmm that doesn't make any sense it's exactly the same access function that will be called when that page callback is called, regardless of the path. Are you able to share a link to a site with the problem? – Clive Sep 27 '11 at 13:40
  • Yeah it is strange, unfortunatley unable to provide a link as it's on a local development area. – Shane Sep 27 '11 at 13:49
  • So you can get directly to "node/123" by typing the address in the bar, but when you've set your front page path to `node/123` (by visiting admin/config/system/site-information) it gives an authorisation error on the home page? That is really messed up, there must be something very wrong with your Drupal installation to make that happen. Try disabling contrib modules one by one to see if you can find the culprit – Clive Sep 27 '11 at 13:57
  • I'm using Open Atrium - accessing it as node/123 directly doesn't work but if I directly put in /intranet (that's my group name) it does work but I can't save that as 'My Front Page' – Shane Sep 27 '11 at 14:01