user_pic_perm.info

; $Id: user_pic_perm.info,v 1.2 2009/08/13 17:29:33 mtndan Exp $
name = User Picture Access
description = Allows setting permissions for users to add/change/delete pictures in user profiles.
core = 7.x
; Information added by drupal.org packaging script on 2009-08-13
version = "7.x-1.0"
core = "7.x"
project = "user_pic_perm"
datestamp = "1250186826"

user_pic_perm.module

<?php
// $Id: user_pic_perm.module,v 1.2 2009/08/13 17:29:33 mtndan Exp $

/**
 * @file
 * Allows setting permissions for users to add/change/delete
 * pictures in user profiles.
 */

/**
 * Implementation of hook_permission().
 * Add access permission for administering user's picture
 */
function user_pic_perm_permission() {
  return array(
    'administer user pictures' => array(
      'title' => t('Administer user pictures'),
      'description' => t('Allow administration of user profile pictures'),
    ),
  );
}

/**
 * Implementation of hook_form_alter().
 * Remove user picture field if user doesn't have correct permission
*/
function user_pic_perm_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_profile_form' && user_access('administer user pictures') == FALSE) {
  	$form['picture'] = FALSE;
  }
}

Comments

star-szr’s picture

Thanks @kylebcooke! I would use this instead though:

$form['picture']['#access'] = FALSE;

@mtndan - I'd be willing to help maintain this module and release a 7.x version.

arnaud.dabouis’s picture

Issue summary: View changes
StatusFileSize
new658 bytes

Updated your version by splitting permissions to add /edit. Tarball attached.

A 7.x release would be nice.

arnaud.dabouis’s picture

I added a new permission to view the user picture, and compatibility with the User Picture Field module.

arnaud.dabouis’s picture

StatusFileSize
new920 bytes

Tarball attached.

arnaud.dabouis’s picture

Title: Ported to D7 » Create a 7.x branch
Category: Feature request » Task
arnaud.dabouis’s picture

arnaud.dabouis’s picture

StatusFileSize
new961 bytes

Added a wrapper around the rendered image to make theming easier.

arnaud.dabouis’s picture

mtndan’s picture

Sorry for the delayed response all. I will get a 7.x branch setup this evening.

mtndan’s picture

Hi all. Sorry for dropping off the face of the Earth! I have created and pushed a 7.x branch. Any requests for collaboration will be appreciated!

mtndan’s picture

Assigned: Unassigned » mtndan
Status: Active » Needs review
star-szr’s picture

Thanks @mtndan, I am no longer available to help maintain this module but happy to see the activity here :)

arnaud.dabouis’s picture

I am currently actively working on this module, if you gave me access to the git repository I could push my work in progress to the 7.x branch.

Thanks in advance.

arnaud.dabouis’s picture

Status: Needs review » Needs work
sense-design’s picture

Could you publish the DEV-Version to the project page for downloading or maybe publish a 7.x-1.0 stable version?