Pass Organic Group Context argument to URL
Hi All
Hope somebody might be able to help out a noob... (first post!)
I'm just starting to get my head around all things Drupal and building a site with a number of (organic) groups. I'm not a coder but have figured out how to use views to create a block (working with an argument) to display just the current groups content - and have even got the "more" link of the block to go to a page I created in views with just the current groups content. (Borrowed a PHP argument from the og_files view to get the group context:
if ($node = og_get_group_context()) {
return $node->nid;
}
else {
return NULL;
}What I'd like to do is create a number of URLs (to use as a menu) that somehow pickup the context (like the above code does in the view) and place it in the argument something like www.example.com/mysite/groups/[nid]/myview. At first I thought I was missing something obvious (because I would actually like to do this from a menu) but it appears you can't put arguments into menus (like Primary Links etc.). Don't mind creating my own menus using html in blocks but need to understand how to get the argument to reflect the group context.
Help??
Hope I've been able to explain it OK - and would be very grateful for any help from this great community.
I can post some examples if that might help somebody help me.
Thanks in advance
Robert
Brisbane, Australia

Hi Robert, If you are looking
Hi Robert,
If you are looking to put node/add links in blocks you can try the following:
1. Clone your default og_ghp_ron view
2. In your cloned view, make a block display
3. Use default argument from php code and enter the code you provided in your post
4. In the footer or header, add the following code using the php input filter:
<?php
global $current_view;
print $current_view->args[0];
$gid = arg(1);
if (og_is_group_admin(node_load($gid), $perm)) {
echo "<a href=\"http://mysite.org/node/add/content-type?gids[]=" . arg(1) . "\"><img src='../../sites/default/files/my-icon.png' alt='Add Content type'></a>";
}
?>
This will give you a linked icon to the node/add form and will append the group id. The link is hidden unless you are a group admin (I'm using this with og_user_roles). If you want all group members to see it, you change the code:
if (og_is_group_admin(node_load($gid), $perm)) {to
if (og_is_group_member($gid)) {Thanks for that - I'll give
Thanks for that - I'll give it a try over the weekend and report back.
Really appreciate your help!
Cheers
Robert