3

What is the "right way" to build a community-oriented comparison system in Drupal 7? My primary question is do I need to hand-roll the DB code for this or is there a way to do it with existing Drupal techniques? My secondary question is how would you structure this in Drupal?

The entities of my site are as follows.

User classes:

  • Administrators (me <=1)

  • Analysts (trusted community moderators <100)

  • Authenticated Users (untrusted community content creators <2000)

  • Anonymous site visitors can view all of the reviews (billions of people :)

Products:

  • product classes. (e.g. Cameras, Laptops, Mobile Phones, etc). There will be >500 product classes. Analysts can edit and manage product classes by adding product feature types, etc.

  • products (e.g. Nikon D7000, Canon EOS Rebel, etc) are an instance of a product class. Authenticated Users can add/edit products.

  • product features are the pre-defined set of features of a product class (e.g. Exposure Metering, Exposure Modes, White Balance, Max Shutter Speed, etc). These are administered by Analysts.

  • product feature types. Each product feature must be of a certain type like a star rating, text, price, number, url, etc.

My initial solution was to create a custom content-type for each product class, then use Drupal fields for the product features. My concern with this approach is that I don't know how to allow semi-trusted Analysts to create and manage their own product classes and product feature types without giving them administrator privileges. Also, I imagine having hundreds of product classes and so it feels weird to have a custom content-type for each * product class*.

I'm happy to do it the php-module way, or the pointy-clicky way. How would you approach this?

  • Note that I have found a module that does a lot of what I am looking for called "properties" for Drupal 7. Properties allows you to add properties to a content-type and then compare them with other nodes. – Patrick Collins Jan 6 '13 at 8:57
1

Your initial solution, having own content types, can also support that content editors can only edit their own content. Define an content type, setup user role for "Analysts", and set the appropriate user permissions for them.

Look at http://www.example.com/admin/people/permissions and http://www.example.com/admin/people/permissions/roles.

I'm assuming you have Drupal 7, but Drupal 6 has more or less the same functionality.

1

By using the Group module you might be able to get this to work. Below are some more details to match your content structure and users to the Group module's functionality.

Part 1 - User classes

Administrators

That's just the typical Drupal admin user (like user/1).

Analysts

These "trusted community moderators" could be implement using a Group "role" named (eg) "Analysts".

Authenticated Users

These "untrusted community content creators" are to be considered as the "members" of the Groups. Using Group "permissions" you'd grant them the appropriate authorizations they'd need to be able to create the content of the Group they belong to.

Anonymous

These "site visitors" can view all of the reviews by using Group roles "anonymous" (if not logged in) and/or "outsiders" (logged in, but not considered as "members" of the Groups, like what you call "authenticated users"). You would grant them the permissions to view the actual Group content.

Part 2 - Products

Product classes

Create a Group "Type" for each of your "Product Classes", like Cameras, Laptops, Mobile Phones, etc. And create 1 Group (with a similar name?). So you would have like >500 Group Types. And create a Group Role like "Analysts". That will give you the flexibility to tune the various permissions of each Group Type to fit your needs.

Products

Products (e.g. Nikon D7000, Canon EOS Rebel, etc) can be implemented using content types. So that Authenticated Users can add/edit them. While such products (nodes) are being created and/or edited, they get stored within the appropriate group.

Product features

A possibly implementation for the pre-defined set of features (e.g. Exposure Metering, Exposure Modes, White Balance, Max Shutter Speed, etc) might be to use another content type for them, so that they can be used (referred to) from within a "product" via an "entity reference" field. And by storing them in appropriate groups, you could set the Group permissions so that the administration of them is limited to the Analysts.

Product feature types

These type like a star rating, text, price, number, url, etc. seem to just be an appropriate field for your content type used for Product Features.

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.