I let visitors to add story (node/add/story) in my case the CCK Imagefield is shown to visitors also. But for security reasons I want to hide imagefield to NON Registered users and give them a message at that location (imagefield) something like "If you want to upload photos please do Log-In" my div id for image field is "field-pho-attach-wrapper"

I would really appreciate feedback

Comments

Steve Dondley’s picture

nehalmehta’s picture

Hi,

You can get this by creating node-cotent-type-edit.tpl.php page and putting it into theme. By doing so edit form can be easily theme.

And you can make it roles based by adding following snippet.

global $user;
if (in_array('authenticated',$user->roles)) {

//drupal_render depends on your cck.
print drupal_render($form['field_whatever']['0']['value']);

}else
{
   print "Please register or login to upload image.";
}

I hope this helps. Do mail me whatever is required or if you want to ask more.

Thanks,
Nehal Mehta.

Medya-1’s picture

raised to 30

chadchandler’s picture

You are not going to be able to do this without creating a custom content.edit-tpl.php file and manually inserting all of your fields, as well as some checks. There is documentation if you search for "theming a CCK submission form" . This would take someone experienced in PHP and Drupal around an hour or so. If you really want your site to be successful, I suggest you learn it : )

Alan Cooney’s picture

Hi Medya,

I can offer you a simpler fix in the form of a patch to the imagefield module that comments out the form and replaces it with "Please login or register to upload an image." The javascript and css files will also not be loaded by the module when logged out. Is this acceptable to you? If so please send me an email using my contact form and I can give you my paypal details and then send you either the patch or just a new version of the imagefield.module file.

Thanks,
Alan Cooney,
Avioso Designs
http://www.avioso.com