0

I am new to tokens but was planning to use the menu to token to create a simple menu allowing group administrators to easily invite users without going to the Group administration menu.

The default Organic Groups (7.2x) link for inviting members is: http://www.example.org/group/node/GID/admin/people/invite-users

As the Group ID (GID) is the same as the Node ID (NID) I thought that the [current-page:url:args] would work well. so I created a menu link with the path

group/node/[current-page:url:args]/admin/people/invite-users

Which crashes all group pages and also makes it impossible to delete the link in the menu as "the website suffered a temporary issues". Uninstalling the Menu token modules solves the issue but I am wondering how to make the menu link work as I intended.

For anyone interested in the bug this seem to be a known issue (see: https://www.drupal.org/node/1205086).

1

I was having similar trouble as you, due to the bug in menu-token.

The way I would go about is, as a work-around, is to create a views-block relative to your groups, adding your node id or gid as a field that is not displayed (you'll have to move this to the top of your fields list in views for it to work).

Then you add a "global text" -field with a value like "Invite", re-writing the output as a link that includes the node id/gid as a token in the URL. This must be located below the node id/gid in the field order(!).

Finally, you will have to set your views filter to restrict the output to the page a user is currently on, this way the Node id/gid field will return only the correct value. Also set your pager to a single result as measure of ensuring only one value is passed through.

Hope this helped!

| improve this answer | |
  • Thank you! Your advice really helped and I'll add a more detailed explanation here below. – Sigvard Jun 11 '15 at 9:08
0

So what I did following limecakes advice:

  1. Create a view as a block.
  2. Create a field with Content:NID, Check the "exclude it from display" box.
  3. Create the link by adding another field with Global:Custom text. Unceck the create label box, in the text box add the text you want in the link (ex Invite). Under "rewrite results" check "output this field as a link". Write the link path you want to use with the [nid] token. In my case: group/node/[nid]/admin/people/invite-users
  4. Add filter criteria "Content type = Group".
  5. Change block settings for access to: OG Permission and the permission "unsubscribe from group". This mean that only group members will see the block.
  6. Create a contextual filter Content: Nid. Under "When the filter value is not available", select Provide default value and the type "Content ID from URL". For when the filter value is available I used Specify validation Criteria with validator "content" of content type Group (my group content type) and filter value format Node ID.
  7. Add the block to your Group content type where you want the link to be shown.

I suspect that only one of the contextual filter selections actually is necessary but I am not very good with them and this works.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.