[support] Anonymous user does not have access to view

Scott scott at bscottholmes.com
Fri May 15 07:14:28 UTC 2009


Anonymous users can view the referenced node when called directly,
ie /node/20.  The problem is that the array element [view] is not
populated for anonymous users.

Here is a section of the output from print_r($node) for anonymous user:
    [field_coupon] => Array
        (
            [0] => Array
                (
                    [nid] => 20
                    [view] => 
                )

        )


And for a logged in user:
    [field_coupon] => Array
        (
            [0] => Array
                (
                    [nid] => 20
                    [view] => Ekizian Coupon
                )

        )

This is true for all the fields defined for this content type, not just
the ones used for node reference.

On Thu, 2009-05-14 at 13:02 -0400, William Smith wrote:
> Did you check the access permissions for the underlying node type (the
> one being referenced) to ensure that Anonymous users have view
> permissions?
> 
> On Thu, May 14, 2009 at 11:34 AM, Scott <scott at bscottholmes.com>
> wrote:
>         
>         I have created a CCK content type that contains a field
>         defined as a
>         node reference. The value in this field is available to logged
>         in users
>         but not to anonymous users. I'm defining a variable thus:
>         
>          $coupon = $node->field_coupon[0][view];
>         
>         then later testing for a value, thus:
>         
>          <?php if ($coupon): ?>
>           <div id="coupon" class="field field-type-nodereference
>         field-field-coupon">
>          <?php print "Print ". $node->field_coupon[0][view] . " for
>         " .
>         $node->field_coupon_terms[0][value]; ?></div>
>          <?php endif; ?>
>         
>         $coupon has a value for logged in users but not for anonymous
>         users.  I
>         do have the nid value available ($node->field_coupon[0][nid])
>         so it is
>         possible to select the referred to node by selecting from the
>         database
>         but I'd rather not if I don't have to.
>         
>         Thanks, Scott
>         
>         --
>         [ Drupal support list | http://lists.drupal.org/ ]
> 
> --
> [ Drupal support list | http://lists.drupal.org/ ]



More information about the support mailing list