[support] Permitting access to node teasers but denying access to full nodes

Alex Tang altitude at funkware.com
Wed Mar 19 20:31:26 UTC 2008


This may be sub-optimal, but you could probably do it pretty simply in a 
theme.

For example, in the garland theme, change the section of the 
node.tpl.php file from :

      <div class="content">
        <?php print $content ?>
      </div>
      

to

      <div class="content">
        <?php global $user ?>
        <?php if (!$teaser && ($user->uid == 0)): ?>
          You must be a paid member to view this node content.
        <?php else: ?>
          <?php print $content ?>
        <?php endif ?>
      </div>
      

The advantage of this route is that you wouldn't need a module to 
control it. The obvious drawback is that you don't have a module to 
control it. 

...alex...



Shai Gluskin wrote:
> Tim, this is just off the top of my head, and is in reference to 
> Drupal 5. As with most things in Drupal, there are probably 8 ways to 
> do this.
>
> Check out: http://drupal.org/project/cck_field_perms
>
> The problem there is that the teaser in Drupal is not a cck generated 
> field ad that module only controls cck generated fields. It's not 
> difficult to ditch using the native Drupal body/teaser fields and 
> create cck replacements for them. But it also means your 
> implementation of this is no 15 minute job. I also don't know how much 
> legacy data you have.
>
> There might be a simpler solution that I'm not thinking of.
>
> Shai
>
> On 3/19/08, *Tim Vaughan* <tim at timvaughan.co.uk 
> <mailto:tim at timvaughan.co.uk>> wrote:
>
>     Hi list,
>
>     I want to be able to allow anonymous users to see node teasers but not
>     full nodes.  Logged-in users should have access to the full nodes.  Is
>     there currently a module for 5.x or 6.x that will let me do this?
>
>     Thanks!
>
>     --
>     Tim Vaughan
>     07725749263
>
>     --
>     [ Drupal support list | http://lists.drupal.org/ ]
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20080319/6b417d2f/attachment.htm 


More information about the support mailing list