By waynedrupal on
Hi.
I want to have user photo in their profile, but only admin to be allowed to upload the photo. I have enabled picture support in User Settings but I do not see where I can not allow users to upload their own picture in permissions. Is there a way to not allow users to upload thier own profile photo?
Comments
I don't believe you can do
I don't believe you can do this through the existing ui, but you should be able to hook_form_alter the upload fieldset out of the form for everyone but the administrator.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
Not sure how to do this. Any
Not sure how to do this. Any recommondations?
Create a little module that
Create a little module that implements hook_form_alter on the profile form and put something like this in it (just a guess, totally untested):
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
=-=
where "mymodule" = the name of your module. ie: user_picture_module_form_alter
The user will also need to check out the developer documentation to understand how to create a .info file and a .module file for this.
I was just working on similar...
I found this nifty module - x_contact_option - to restrict certain roles from creating their own contact form in their profiles.
I looked at the few lines of code, and figured I could do the same with the picture uploads.
Thanks for the
unset($form['picture']);, because I was usingunset($form['picture_upload']);to no avail.Here's my resulting .module that restricts roles (via permissions) from using the picture upload form...
And the chinsey little .info file...
Exactly what I need but...
This is exactly what I need. I copied the text above into x_picture.info and x_picture.module and then installed the module. I didn't have any errors but nothing seems to happen. Should I see a "upload picture to profile" check box in "/admin/user/permissions?" I don't and I'm not sure what I am doing wrong.
.
See http://drupal.org/project/avatar_selection
Michelle
--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.
Thanks Michelle. I was
Thanks Michelle. I was hoping this would do the trick, but it seems that the admin or user/1 would not be able to edit or add photo is disable users ability to change or upload photo.
I only want the admin to be able to upload a photo.
Any other thoughts?
You have your answer
Do as WorldFallz illustrated.
A slightly more flexible variation would be to show the user picture upload form element to anyone with "administer users" permission. Note the field name 'picture_upload' correction.
-------------------------------------------------------
"If you don't read the newspaper you are uninformed;
if you do read the newspaper you are misinformed."
-- Mark Twain
slight difference
FYI, to make this work I had to change your "unset" command to:
unset($form['picture']);Thanks for the code!