[support] Hide ckk field to anonymous user

Marolijo - Pol maresma marolijo at yahoo.es
Mon Dec 3 08:51:20 UTC 2007


Thank's!
User->uid is working, and maybe it's a better solution.

But if I use the 'view' on
    print check_plain($node->field_informacio[0]['view']); 
I see incoirrectly the simbols '`´ and other html chars.

The informacio field is an htmlarea field, I need to select some special
option on the display settings to view correctly using the 'view' option? I
tried with Default, plain, and trimmed and only works with plain.

Thank's for all!
Pol

-----Mensaje original-----
De: support-bounces at drupal.org [mailto:support-bounces at drupal.org] En nombre
de Dale McGladdery
Enviado el: divendres, 30 / novembre / 2007 19:13
Para: support at drupal.org
Asunto: Re: [support] Hide ckk field to anonymous user

The "standard" method for testing if the user is anonymous is testing
$user->uid. If the value is 0, it's the anonymous user, so you can treat it
like a boolean. I don't know if $user->name is always an empty string for
anonymous user, so it may be ok. However, you're definitely safer going with
the group!

Doing the check_plain will make the cck value safe.

Depending on how you've retrieved $node, there should also be a
$node->field_informacio[0]['view']. 'value' is the raw value, 'view'
is the raw value after cck has applied formatting. For example, if you have
a text field set to 'Plain text', the raw value is whatever the user entered
and the view value is filtered to plain text. As long as you have the input
format set up correctly, the output is safe. So if your cck fields are set
up appropriately, you can save yourself some work.


On Nov 30, 2007 7:52 AM, Marolijo - Pol maresma <marolijo at yahoo.es> wrote:
> Thank's but I tried it and doesn't work form me under Drupal5.3.
> When I select the permissions under access control and put the field 
> on Contemplate's Body it allways apear on the node display.
>
> I found a simply solution because I only wanna control if the user is 
> registered, put it on the template's body:
>
> <?php
> global $user;
> if ($user->name<>''){
>     print check_plain($node->field_informacio[0]['value']);
> };
> ?>
>
> Is it secure?
>
> Thank's for all. Gràcies! ;-)
>
> -----Mensaje original-----
> De: support-bounces at drupal.org [mailto:support-bounces at drupal.org] En 
> nombre de Walter Garcia-Fontes Enviado el: divendres, 30 / novembre / 
> 2007 13:56
> Para: support at drupal.org
> Asunto: Re: [support] Hide ckk field to anonymous user
>
>
> Yes, the module is called "CCK Field permissions",
>
> --
> Walter Garcia-Fontes
> Barcelona
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
> __________ Informacisn de NOD32, revisisn 2695 (20071130) __________
>
> Este mensaje ha sido analizado con  NOD32 antivirus system 
> http://www.nod32.com
>
>
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
--
[ Drupal support list | http://lists.drupal.org/ ]

__________ Información de NOD32, revisión 2696 (20071130) __________

Este mensaje ha sido analizado con  NOD32 antivirus system
http://www.nod32.com




More information about the support mailing list