I am trying to figure out how the $premium and $premium_access variables in the $node object work.

Here's what I am trying to accomplish:
1. Protect latest content for three weeks.
2. I am using CCK nodes, themed using Contemplate, so I see the $premium and $premium_access variables pop up. Contemplate lets me theme the teaser and body of the nodes.
3. On listings (ex. taxonomy/term/XX), I want a small icon to appear indicating that the item is protected, premium content.

With that in mind, how do I protect the CCK content, so that only the teaser is revealed during the premium period? Do I have to use a combination of $premium and $premium access to regulate access from within Contemplate? Or should it just show the teaser automatically?

From looking at the code, it looks like $premium is either 0 or 1, and indicates if the item has been restricted, and $premium access is either TRUE or FALSE, and set depending on conditional access ruless inside the module. Does $premium stay set at one even after the premium period has passed?

I would appreciate any help or insight into how people have used CCK with premium.

Comments

dgorton’s picture

Here's one way to make them work:

	if ( $premium_access ) {
		print(@$field_body[0]["view"]); 
	}
	else {
		print('not for you -- login or register first');
	}
dgorton’s picture

UPDATE -- I should have made clear that the above code snippet will work within contemplate:
Home » administer » content » templates (as of 4.7)

allie micka’s picture

Status: Active » Closed (fixed)