Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6626037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:50:47+00:00 2026-05-25T21:50:47+00:00

I have a Drupal 6 site with a node type that has an optional,

  • 0

I have a Drupal 6 site with a node type that has an optional, unlimited value, Imagefield (Filefield/CCK) setup. The node type’s content permissions are set to allow all authenticated users to be able to edit those nodes, which is great. Users can edit a node and attach images to the Imagefield, also great.

However, when a user is editing one of these nodes, they are also able to edit/delete Imagefield images uploaded by other users. How can I prevent a user from editing and/or deleting Imagefield images that were not uploaded by themselves?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:50:48+00:00Added an answer on May 25, 2026 at 9:50 pm

    Thanks to a few folks in the #drupal-support channel on IRC, I was able to get an answer to this question. Here is an example module based solution:

    function my_module_form_alter(&$form, &$form_state, $form_id) {
      global $user;
      switch ($form['type']['#value']) {
        case "my_content_type":
          if (user_access("administer nodes")) { break; }
          foreach (array_keys($form['field_my_images']) as $key) {
            if (!is_numeric($key)) { continue; }
            if ($form['field_my_images'][$key]['#default_value']['fid']) {
              if ($form['field_my_images'][$key]['#default_value']['uid'] != $user->uid) {
                $form['field_my_images'][$key]['#access'] = false;
              }
            }
          }
          break;
      }
    }
    

    I feel silly now that I realize my whole problem was because I was accessing e.g. :

    $form['#node']->field_my_images

    instead of:

    $form['field_my_images']

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Drupal setup like this: Content type: Apartments Vocabulary: Areas , that
I have a rather complicated deploy setup for our Drupal site that is a
i would like to have a block on my drupal site(latest version) that displays
I have a Drupal (v6.17) Content Type which includes a Taxonomy field. I want
I have a Drupal 6 web site and would like to use a node
I've got a drupal site that gets low traffic, but has tons of new
I have a Drupal site and I have setup a view to power the
I am probably asking a noob question... however: I have a Drupal site that
I have a Drupal 6 site where I've created a view that shows a
I have Drupal 5 site where a button is clicked and it calls a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.