Hi, what approach would you suggest for a membership/premium content type site? Some content will be free, some will be behind a paywall. How could I implement this best with Drupal Commerce?

CommentFileSizeAuthor
#53 ruleexport.txt1.24 KBHansKuiters
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rszrama’s picture

Status: Active » Postponed (maintainer needs more info)

You're going to have to figure out your own content access solution, as the Commerce modules don't have anything to do with that. Once you have your method (I've used integrations with both Taxonomy Access Control and Content Access in the past), you can probably then hook in through Commerce by granting roles or specific node access through Rules. I'm really not sure what content access solutions are ready for D7 yet, but if you do some research and can make a good recommendation, this would be a great thread / documentation to have on DrupalCommerce.org.

I'm going to mark this postponed so perhaps other people can see the title and chip in, but as of right now, there's nothing we should have to do in Commerce itself.

berenddeboer’s picture

I need this right now as well. Ubercart has something for this, so will need to whip up a module to sell roles, at least that would fit one of my requirements best.

Happy to contribute this code back to the community, how do I do that rszrama? I have developer access, so could put up this module there, or is there any other preferred method with commerce?

berenddeboer’s picture

Here the features of the module I propose, it's going to work very similar to Ubercart's one:

  • Separate module called Roles.
  • That gives you the ability to attach roles to a product.
  • If you buy that product, you get the role(s).
berenddeboer’s picture

And one more thing I need: one-off payments for content. So that doesn't fit this "role" module so well, it's more payment to access specific content.

berenddeboer’s picture

rszrama, assuming you're right and you can set this up with Rules, it's still a lot of work, isn't it? Would be much nicer if it would be some simple clicks per product or product type.

berenddeboer’s picture

rszrama, just trying this out with rules: how would I specify the condition on the checkout that the order contains my specific subscription? I assume the event is "Completing the checkout process", but it doesn't appear so easy to check if an order contains some specific item.

rfay’s picture

@berenddeboer, #2:

Create a sandbox for your project and get it to basic functionality. If you don't already have full project access, you might want to apply at http://drupal.org/node/1011698, but it's not necessary to get started, as everyone on Drupal.org can commit to a sandbox. See http://drupal.org/contribute/development if you haven't already used git. Let me know and I'll be happy to help.

davidseth’s picture

@berenddeboer, I am interested in your work. How are you progressing? I have a similar requirement and would like to see what you have done and if there is any way that I can contribute to your work.

Cheers.

mtndan’s picture

Thanks for the info and response everyone.

So it sounds like an approach would be to create a product called "premium membership" or something like that, and then simply setup a rule that fired an "add role" event to users who bought this product?

Maybe I'm oversimplifying?

mtndan’s picture

Node Option Premium (http://drupal.org/project/nopremium) looks like a perfect fit.

berenddeboer’s picture

@davidseth, only exploratory work yet, but I simply need this for a project I'm working on, so will definitely develop this. Probably starting next week. If you are interested, I'll add you as developer as soon as I've made my first commits.

berenddeboer’s picture

@mtndan, yes but I tried that and it doesn't work as far as I can see. Because I need to have a rule that fires when a specific product has been bought. So I have a product type membership, three products (bronze/silver/gold), I created a content type membership (insert: I see the flexibility here but isn't this indirection somewhat over the top in 99% of the cases?) and then three pieces of content: bronze/silver/gold.

I can buy that fine, but couldn't make a condition that fires only when something specific is in the cart.

So I'm either adding that (very useful generic feature to have) or perhaps I'll add the role to the product or so. Probably starting with getting to get that specific condition to work.

Jerome F’s picture

Shadlington’s picture

Hmmm. I'm interested in something similar.
I'd quite like to see this tie in with some form of subscription system, too.

mertskeli’s picture

Sorry, for interference, but this sounds to me as a pure content access issue, and can be implemented by standard Drupal functions - a simple custom module with custom permissions and actions.

berenddeboer’s picture

Finally back on this project. Step one was using the role reference field module: http://drupal.org/node/1016526

Very nice module.

berenddeboer’s picture

@mtndan, Node Option Premium is just making some content premium, and having access control. It's not about selling content.

davidseth’s picture

@berenddeboer good to see you back. Do you have a sandbox set up somewhere? I am still keen to see what you are doing and help out / contribute where I can.

Cheers,

David

berenddeboer’s picture

@davidseth, almost, just became maintainer of role reference, and preparing Drupal 7 version.

davidseth’s picture

So how are you using role_reference to achieve paid subscriber things with commerce? Thanks :)

berenddeboer’s picture

role reference dev version now available. So what you do is add a role reference field to your product type.

I'm now working on a rule you can add so that on checkout user is added to all roles found in all products they bought.

berenddeboer’s picture

Assigned: Unassigned » berenddeboer
Status: Postponed (maintainer needs more info) » Needs review

@rfay, sandbox version is here: http://drupal.org/sandbox/berend/1154764

It all appears to work. How to move this forward?

berenddeboer’s picture

On Node Option Premium, don't use that module, it modifies the node table!!!

berenddeboer’s picture

There are two other options, the Premium module, but this has effectively been abandoned, and maintainers do not want to give up control (deep sigh).

There's a fork of that, Premium content, which is a fork of the above, but that's only available in a Drupal 6 version.

So need to do some thinking.

berenddeboer’s picture

It seems premium content is the way to go. Works actually quite nice in Drupal 6, if all bugs would be fixed :-) Have asked the maintainer to add me as co-maintainer so I could take care of the Drupal 7 port.

Shadlington’s picture

You could probably do quite well just using page manager + panels, to be honest.
Have a page variant for users without the premium role that displays minimum content (plus any blocks you want to add that explain how to get the premium role) and a page variant for users with the premium role that displays it all.

keithm’s picture

subscribe

berenddeboer’s picture

Looks like a lot of work Shadlington, especially for multiple subscription levels.

Shadlington’s picture

You'd still need the module you proposed for handling the purchasing of roles - page manager would just handle access control.
Its good because you can do it at as fine-grain as you like (and its really not that much work once you get used to it).

However, if you weren't planning on using page manager and panels it would almost certainly be overkill, yes.
I was merely suggesting it as another access control module that could be used in place of modules like premium content for more complex setups. I, for example, am not content with simply preventing the user from accessing premium nodes, I want them to be able to access a restricted version of them. That's easy to do with PM + panels.

One way or another I think site builders should be able to use your proposed module for allowing users to subscribe to roles, but then use whatever module they feel best meets their needs for access control.

berenddeboer’s picture

Just dropped the premium content Drupal 7 port.

So that's premium content solved.

Two things remaining on my task list: one-off payments for content and recurring payments.

One-off payments is basically making just that node accessible, if user has bought that node, and you don't have access to it otherwise. Maybe I can do that within Drupal Commerce, as I can make a node a product as well obviously, but this probably adds an "Add to shopping" cart to every instance, which is not required.

So probably need to have an access pass product or so.

And then recurring payments which in my case would tie-in with the roles bought: they expire after X days unless payment is received, so looks like a new field type like subscription expiry.

berenddeboer’s picture

Further thoughts on recurring payments: create a new field type, recurring. This allows you to say "weekly", "monthly", "quarterly", that kind of thing.

Add that to the product type. If someone buys a product, at the time specified by the recurring fields we fire a rule trigger. That allows people to either swipe the credit card again, unset roles, or whatever.

Shadlington’s picture

It should really tie in with recurring payment options for different payment gateways (like PayPal).
Users aren't going to want to enter their credit card details every month (or any other monthly action) to maintain their subscription.

berenddeboer’s picture

I've started my recurring field project here: http://drupal.org/sandbox/berend/1162096

Nothing in there yet :-)

berenddeboer’s picture

Recurring module now at a state where you can set a value for the recurring state. I'm now working on actually firing rules.

berenddeboer’s picture

It appears that you might not actually need the recurring field. I'm now building rules stuff where you have as input the line items that are in need of triggering (so you can do a payment batch).

So the view can have stuff like this is monthly/quarterly, but perhaps a separate field is clearer and easier to work with.

berenddeboer’s picture

Some more thoughts: should a recurring payment be handled as a new order?

Shadlington’s picture

I'd say so. They usually are (I think!)

rszrama’s picture

Yeah, I think treating each new payment as a unique order referencing the products that generated the recurring payment is the way to go. It provides for an easy, clean payment history for customers, too.

BenK’s picture

Subscribing

berenddeboer’s picture

That's the only option Drupal Commerce gives yes. But I think the ultimate correct way would have been to have only 1 order, and just generate invoices.

But as far as I can see Drupal Commerce doesn't do invoices (yet).

berenddeboer’s picture

I finally managed to get recurring payments working. You need Commerce Recurring, and do some work yourself.

How I did it: I created a rules component that can be scheduled, and reschedules itself.

This rules component loops over a view which returns all line items that are recurring line items. Then it creates a new order for that line item. That's part of the Commerce Recurring module.

Obviously you need to make the payment. I've finished the Commerce Payment eWAY and added a token billing rule there, so in my system that's part of the above ruleset: every created order is passed to a token billing action, and does its thing.

Hopefully this helps a few people out, and I'm sure there is a lot that can be improved. So not sure I should release this as this is all at a stage only developers can use it.

Comments/suggestions most welcome.

berenddeboer’s picture

I'm now working on one-off payments for content.

Shadlington’s picture

Has anyone tried out the Commerce Subscription module?

rszrama’s picture

Status: Needs review » Postponed

I'm just moving this out of Commerce's needs review queue. : )

mgladding’s picture

You can create a product (for example, "Subscription Membership") and then assign a role on checkout. Then control content type access by role in permissions.

I set up a Rule using Rules UI that assigns a role upon successful checkout. I can confirm that this works when using Drupal Commerce and the example payment checkout method.

Here's how I did it:

I created a new Rule called "Assign Role Name"

I added two events: 1. Completing the checkout process and 2. When an order is first paid in full

I added a condition: Order contains a particular product, Parameter: Order: [commerce_order], Product SKU: productsku

I added an action: Add user role, Parameter: User: [site:current-user], Roles: Role Name

federico.parra’s picture

Hi guys. I actually need to sell access to particular nodes for a limited amount of time, for a pay-per-view system. Is there anything like UC Node Access (http://drupal.org/project/uc_node_access) for Drupal Commerce? Unfortunately UC Node Access only works on D6.

As a personal note, it is embarrassing that Drupal doesn't provide as a core functionality to grant particular, per-user access to particular nodes. And I don't understand either how ecommerce modules don't have as a feature to sell content-as-products! (nodes-as-products)

It's such an obvious feature!

All best and hope I find a solution to this.

jessicakoh’s picture

@mgladding

How to write a rule to demote his role after 1 year?

mgladding’s picture

@jessicakoh

Sorry for the late reply - I just saw your comment.

I don't know who to set this up in Rules, but maybe this module could be a solution: http://drupal.org/project/role_expire

the_g_bomb’s picture

Just a thought berenddeboer, but would you really want the entire node to be in accessible if a user hasn't purchased the required access, how about offering teaser content with a link to purchase full access?

berenddeboer’s picture

That's what premium content does.

the_g_bomb’s picture

Excellent, just checking it was in the mix

likewhoa’s picture

for those that don't know already, there is commerce_sp which provides subscription based products and used together with commerce_sp_paypal you can have recurring subscriptions handled via paypal. This is what I have just recently implemented and it works great since commerce_sp is mostly powered by rules in which I assign a user role to all orders that are subscription based and I even can send notification emails to users when their subscription has expired.

HansKuiters’s picture

FileSize
1.24 KB

I tried the steps in comment #45 form @mgladding. Thanks for posting, it helped me a lot. I needed to do some tweaks to get it work in my situation.

Project: get e-learning membership, buy one course as anonymous user.

Two changes:
- Because user is not logged in at thsi stage, the rule action parameter User: [site:current-user] didn't match. Now I fetch the entity from the order emailadress.
- Condition doesn't check for payment status (tested with the Icepay module). So in case the payment is pending, the user would still get the new role. I added the payment balance check.

Attached is my rule export. I don't know if this is the right place to post this, but I hope I can help someone with this.

amittarkar’s picture

I am creating a site for sellers. I have following requirements.
1. the account of a seller who has paid subscription for a period should get promoted for that period.
2. The total amount of money made by the seller should be visible on his profile and the profile those sellers (free or paid) who have made most money should get promoted on every page site and this should change dynamically according to the amount of money they make. i.e. If a seller makes more total money in his store than another seller whose profile(store) is currently promoted then that seller replaces him.

Thanks and Regards

bojanz’s picture

Assigned: berenddeboer » Unassigned
Issue summary: View changes
Status: Postponed » Fixed

It's time to close this.
There have been multiple options over the years and people have been building membership websites.

The official Commerce Guys initiative this year resulted in Commerce License which now has a stable release.
It is a framework for any kind of digital ecommerce.
Commerce License Role (submodule) allows you to license roles for a limited or unlimited time, and the customer gets the role selected on the product. Switching the product (plan) switches the role.
Then you can just use a content access module to grant access to the role.

We are also working on stabilizing Commerce License Billing which provides easy recurring charging of licenses. It has full test coverage, an initial live deployment, and a beta happening soon.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.