Making content type only for groups

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

I have site where we are introducing groups, problem where i am stuck right now is i want to create new content type which can only be added by members who belong to atlest one group. if they are not member of any group they cant add that content type. I cant make audience required as there are other content types in system which can be added on site without any audience.

Any ideas ? any solutions ? any work around ?

Abi

Comments

Hi Abi, if I remember

alexharries's picture

Hi Abi, if I remember correctly, if you simply allow your "authenticated user" role (or whichever role you wish to allow to post into groups) to create this content type, let's call it "organic group discussion", and in the "admin/content/node-type/organic-group-discussion" edit content type page, under "Organic groups", set "Organic groups usage" to "Standard group post (typically only author may edit)".

You will also need to go to admin/og/og_access and set "Visibility of posts" to "Visible only within the targeted groups."; this, if I remember correctly, is the key setting which prevents OG posts from being published elsewhere on the site.

When the member tries to create such a post at "node/add/organic-group-discussion", OG should intercept and check that they're a member of a group and, if they are, presents them with a select list or checkbox list to choose the group(s) to post into. If they're not, I seem to remember they get a big warning message telling them to join a group first.

If you find that these users can create group content regardless of whether or not they're a group member, check that you don't have another node access module overriding the OG grants - enabling the devel module's node grants block should help you get started with debugging.

I'm afraid I'm writing this all from sketchy memory as it's been a couple of weeks since I last got acquainted with OG and I could be massively wrong here, so if what I've written doesn't tally up, it's probably because I'm massively mistaken!!

Best of luck :o)

og_access is for all content types

abi's picture

What you are saying is very much true but problem here is og_access is for all content type not for specific content type. I have several content types in system what i want is to make one specific content type only be created by users who belong to any group. I can write my function to do this but i was looking if there are any way by default in system as this can't unique requirement.

thanks in advance,

abi

Hi Abi, I'm afraid I don't

alexharries's picture

Hi Abi,

I'm afraid I don't understand why og_access isn't appropriate here - could you explain a bit more please?

If you install og_access, go to admin/content/types, edit each content type you don't want posted into groups (i.e. all the ones your regular users cannot create) and expand "Organic groups", then choose "May not be posted into a group" from "Organic groups usage".

This will prevent your chosen content types from being created by users who don't have permission to create content granted by another module, e.g. "node_module" in admin/user/permissions, or nodeaccess.

If that doesn't help, can you give me some more detail? Even if I can't help, the more you can explain, the better the chances someone else will be able to :o)

example

abi's picture

I have done this by writing my own function but let me explain you what i was looking for.

Here is scenario : community exist with 5 different content types , ( a , b, c, d, e) with no groups in sites earlier. Now we are adding organic group in site, groups will NOT be on registration forms anonymous users cant join groups and even cant create any content type both things can be done by any authenticated users.

Only content type A and B are "Standard group post (typically only author may edit)." so i did that by just going in content type. Now client want to add new content type "F" i created that and in organic group i set ""Standard group post (typically only author may edit)." .

Community have more then 40,000+ users what client want is this new content type "F" cant be created by any user who don't belong atlest one group. I understand that can just go and make audience required in /admin/og/og but that will make audience required for other two content types also ( A and B) what i DON'T want.

thanks

Hi Abi, Ok I think I

alexharries's picture

Hi Abi,

Ok I think I understand now. So:

You have three content types - A, B and F for example.

At the moment, users of your site can post content types A and B into a group, or they can post it without it being assigned to a group.

What you have been asked to do is prevent content type F from being posted unless it is posted to a group - is that right?

More specifically:
- Can each "F" node be posted to more than one group at a time?
- Can each "F" node be posted to any group, or just one specific group?

Ah-HA! I have an idea! Why

alexharries's picture

Ah-HA! I have an idea!

Why not use Organic Groups User Roles (OGUR) to assign a role of "Content type F creator" who can create content type F but only within the groups? They shouldn't be able to post content type F outside the group because they would have no access to do so... I think?

One other possibility: you could set content type F to be unpublished by default, and when it is saved for the first time, you could check whether it's been assigned to a group and if not, use actions/rules/trigger to warn the user it will never be published unless they save it in a group; then when they do save it, you could use actions to publish it (and if it's ever saved as "public" in the future, you can simply unpublish it using actions)?

Module

greg.harvey's picture

I appreciate this is an old thread now, but have you seen this?
http://drupal.org/project/og_content_type_admin

Looks like it will do it... =)

The module gives default role

held69's picture

The module (altered version of OGUR) gives default role to a groupadmin or groupmember per groupcontenttype

http://drupal.org/node/837866#comment-3283030