0

Organic groups 7.x-2.6 Entity reference prepopulate 7.x-1.5

Hello, I am trying to create custom "create posting" link for my organic groups. Each Organic Group has its own content posting content types, so when a user visits the panel page for that group the add posting link should be specific to that group.

I have 2 groups: Amigo group, and Authenticated group I read that target bundles are globally defined for Groups Audience, so I read that you have to add an extra group audience to the Posting content type for your group. You are then supposed to set the target bundle on the 2nd to match the group content type. My problem is that when I try to set the "Content Create Links" section in my panel it wants to only set one group audience field, and I have 2 created, one for each group's posting content type.

I recorded images of each part of this problem for ease of understanding.

Here is my Amigo group's posting content type called "Amigo Group Post". Notice the extra Group's Audience field added to the bottom of the content type. Clicking edit on this allows us to change the settings on this field enter image description here

Clicking on group audience for Amigo Post takes us to that group audiences configuration page. Here I am choosing to prepopulate the entity reference. enter image description here

Here is my panel for the Organic Groups group. Lets go to the Content Create Links setting page. enter image description here

Here you can set ONE of the 2 posting content types to be the content type used for new group postings, but I need it to just choose the posting content type by the type of Organic Group. I chose one because I could only choose one. enter image description here

Looking at the Amigo group page we can see that the create post section is not even showing up. enter image description here

This is the Authenticated group page. When viewing this page we do see the create post section, because we had to set one field name for the "content create links" section in the Panel. enter image description here

Does anyone have any idea how to have the panel choose the content creation link type based on the current group?

3 Answers 3

0

I solved this problem. I am not sure if this is the best way. If a better way exists, please do inform me.

To solve this problem I create 2 "Content Create Links" panels within the page. Each added panel references the group audience specific for the Group Posting content type for the group. At first both will probably show up, but you have to go to the global "OG Permissions Overview" and for each group type make sure that create content for that Groups posting content type is checked. For all other type on the page you should not have "Create ____ Content" checked otherwise that content type (a posting type) will also show up as a "Content Create Links" for the wrong posting type for that group.

Do that for each Group type you have created, allowing "Create__(groups post content type) Content" and not having the "Create__(other groups post content type)__ content" for all other group posting content types for the other groups.

Now when I open up "Amigos" groups, I only get "Amigo Group Post" as the posting content type, and NOT "Authenticated Group Post" as well.

If this is too "hacky" I welcome other suggestions on how to configure this properly.

0

You can also build these custom links yourself, and use an argument, context or php to fill in the group id.

The url would be like <a href="/node/add/nodetype?og_group_ref={GROUPID}}">Post content of type to group</a>.

This way you can create those content urls everywhere, in blocks, pages, content, views, etc. If you do not hardcode the groupid, but fetch it from context (which is added to grouppages) you can have those kind of links on all your group subpages.

2
  • Hello, my solution that I posted does not seem to be working. Can you elaborate more on how to get just the content type for the particular group that is being shown in the panel? I'm working in a panel and adding custom content to the panel content which allows me to manually create a link like you showed, but I'm not sure how to get the groupid...I'm assuming through the panel context, but I'm very new with panels and would value a walkthrough.
    – David Pugh
    Mar 25, 2015 at 18:19
  • Turns out my solution does work, but if you are logged in as an administrator it shows all of the Content create links and does not filter based on the current group. I'm still interested in experimenting with your solution...
    – David Pugh
    Mar 26, 2015 at 16:20
0

If you are not using panels module, then install og_extras since it will create a block with all the correct links for posting content. All you need to then do is also enable the block. To quote from og_extras module page:

Extra functions, blocks, and views for Organic Groups 7.2. In particular, this module adds views and blocks needed by sites that are not using Panels, although it also may be useful to sites that do use Panels. This module is for Organic Groups 7.2. It will not work with Organic Groups 7.1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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