Premium only works on regular nodes

shunshifu - October 13, 2006 - 22:30
Project:Premium
Version:5.x-1.x-dev
Component:Miscellaneous
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

I have premium installed and after patching it with the code listed in the bug report on "can't create premium content"

It seems to work fine with a regular node but with cck nodes or video nodes it is not working for me. The checkbox is there but when navigating to the node as a test user I am allowed access.

The only difference I can find is the node type.

Thanks

Phil

#1

shunshifu - October 14, 2006 - 17:13

Ok I've just figured out on the video node what's happening. The view section of the node is protected but the play section is not. So essentially only the caption for the video is protected.

Thanks

Phil

#2

Allie Micka - December 11, 2006 - 05:19

The module allows visitors to view the teasers but not the full body content. If the video is avialable in the teaser then it will not be protected.

Is this what is happening?

#3

Chill35 - December 12, 2006 - 05:27

If someone is interested...

I have modified the Premium module (small changes) so that

- in its settings, you can decide (with radio buttons) to show the teaser OR not to users who have no access.

It seems to work.

I am attaching this new and improved premium.module

The new option is at the bottom of the form in Administer->settings->Premium

Selecting 'Title and teaser are displayed' will make Premium behave as usual. That's the default value.

Selecting 'Only the title is displayed' will have that result : no teaser will be displayed for premium content.

There seems to be a problem with displaying the content as part of a list, though. I will figure it out soon enough. Or maybe someone can help ?

Try it at your own risk. (J/K : it's safe...)

AttachmentSize
premium.module 6.44 KB

#4

Chill35 - December 12, 2006 - 05:37

Here are the modifications I have made :

In premium_settings() I added this :

  // showing teaser and title or just title
  $form['premium_teaser_mode'] = array(
    '#type'          => 'radios',
    '#title'         => t('Teaser mode'),
    '#default_value' => variable_get('premium_teaser_mode', '0'),
    '#options'       => array(
      '0' => t('Title and teaser are displayed'),
      'no teaser' => t('Only the title is displayed'),
    ),
  );

In premium_nodeapi(&$node, $op, $teaser) I modified this :

if ($teaser && !variable_get('premium_teaser_mode', 0)) {
        return;                  // not viewing the body
      }

Finally I modified the theming function :

function theme_premium_body($node) {
  $new_body = "";
  if (!variable_get('premium_teaser_mode', 0)) {
  $new_body = $node->teaser. '<br />';
  }
  return $new_body.variable_get('premium_message','');
}

OK as I am reviewing this code I see a small error that does not cause problems BUT...

I had not initialized $new_body... the above code is much better LOL..

There's still that same problem though : in List view (many nodes view) the teaser is displayed. In single view, the teaser is not displayed. (That is if you have set the proper settings for premium, i.e. "no teaser").

AttachmentSize
premium_0.module 6.46 KB

#5

Chill35 - December 12, 2006 - 05:56

Before I made the changes to premium.module, I had tried Premium with FlexiNode and can assure you that the entire content (all fields) of the custom node were hidden. I then tried Premium with CCK and all fields were shown, doh!. So I could not use CCK with Premium, I could only use FlexiNode.

Now with the changes I have made, I don't know...

Premium is simple, powerful, and the code is easy to understand, hence to modified.

I hope it gets ported to Drupal 5.

#6

ckjian - January 15, 2007 - 08:09

I'm having the same problem. I can't get it works together with CCK. Is there any solution to this one?

#7

jaks1970 - January 15, 2007 - 14:59

This will be perfect for me if it works with CCK. Eagarly awaiting a fix aswell :)

Jaks

#8

ednique - January 15, 2007 - 15:48
Project:Premium» Privatemsg
Version:4.7.x-1.x-dev» 4.7.x-1.x-dev

The problem is caused by CCK... they remove all content added by different modules and rebuild the teaser and body...

I fixed it using Contemplate and the patches listed here:
http://drupal.org/node/93935

#9

ajwwong - January 19, 2007 - 06:19
Project:Privatemsg» Premium
Version:4.7.x-1.x-dev» 4.7.x-1.x-dev

#10

Allie Micka - July 13, 2008 - 19:09
Version:4.7.x-1.x-dev» 5.x-1.x-dev
 
 

Drupal is a registered trademark of Dries Buytaert.