Building Create Content Links with Views and Panels

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
scottAtRoot802's picture

My challenge for the day is to add a "Create Content" link to each page for those that have permission to create pages. This sounds simple enough. However, this is an intranet site built with Organic Groups, which has presented some challenges.

For starters, being an intranet means everyone accessing the site in logged in and needs to adherer to an array of roles and permissions. We use Organic Groups to manages groups (departments) within the site. The site then relies heavily on views and panels to structure the site.

We're using:
Drupal 7.14
Panels 7.x-3.2
Views 7.x-3.3

There is a "Content create links" option in panels, which I'm using to build a list of create content links. However this only displays on the group page. It will not display on any of the group content pages. Here in lies the problem. My client, the one I'm building the intranet for, would like for there to be an easy way to create content from any page.

After searching the web for clues I was finally able to build some "create content links" with views. Great, only views isn't able restrict access to these links appropriately. Only those with Content Author or Content Manager roles should be able to create content. In addition, users in these roles should only be allowed the add content for the Groups they are members of. I can use panels to apply the proper restrictions but I'm having trouble passing the proper contextual filter from panels to the view. So far I've tried the following.

In Views, I create a block with the following contextual filters and relationships. From this I was able to get the nid of the parent group, which I use to build the link. From this nid, drupal knows to auto select the correct group audience.

Contextual filters

  • (OG membership from node) OG membership: OG group gid

Relationships

  • OG membership: OG membership from Node
  • (OG membership from node) OG membership: Node from OG membership
  • (OG membership from node) OG membership: OG group gid
  • (OG group) OG group: Node from OG group

This works great when I place the block on a page. However, when I try to add this to a page with panels it fails. I've tried passing the gid from panels to the view, but with no luck. In Panels, I'm trying the following:

Relationships

  • OG group from node
  • Node from OG group

I then select the Group Audience in Panels to pass to the view. I've tried passing several other group fields, but again no luck.

Any help on this would be appreciated. Of course, as always there is more than one way to solve a problem. If you know of a better way, I would love to hear it.

Thanks

Comments

Did you find a solution with

Yuri's picture

Did you find a solution with panels? I deleted the views pane of 'content create links' that came with the installation and I can't get it back.

http://drupal.org/project/con

bennos's picture

http://drupal.org/project/context_admin

With the module above and panels you cann creat local menu task. look at the youtube videos on the module page.