I'm having a very odd issue with a custom content type, but the setup is kinda funky so I'll do my best to explain.

The end result is for each user of the site to have a separate "avatar" (profile picture) and name, in each group they are a member of. I've worked for quite some time to develop and implement a solution, and it seems that I have (although it was a ton of work).

I have a custom content type named "Nickname". This content type consist of 2 special fields, one is the "Nickname" which is a simple text field, the other is "Avatar" which is an image field (not using the media widget, but results are the same with either widget). I have added a "Nickname" and "Avatar" field to the "Group" content type, and the OG Membership Type (default). When a user creates a group, or request to join a private group, they type in their Nickname and upload their avatar (image). At this point rules takes over and creates a new "Nickname" content type, sets the data value for "Nickname" and "Avatar" to the value of the "Nickname" and "Avatar" they chose during group creation / membership request. I've then restructured the display of my bw views, messages, contributors, etc... to show the "Avatar" and "Nickname" of the users Nickname content type in that group, rather than the Realname and User Picture.

**PROBLEM STARTS HERE**

Everything works fine until the user edits their "Avatar". When rules creates the Nickname content type, the "Avatar" image is saved in the public directory (as it should, since that is where I have told the system to upload the avatars to). Once the user edits this content type, removes the uploaded image, uploads a new image and saves the content, the image no longer displays. However, the site admin can still view the image. After further investigation, using Firebug I see that the newly uploaded image's path is /system/files/styles/50x50/private/uploaded_image.jpg when the original images path is the correct path of /sites/default/files/styles/50x50/public/uploaded_imgae.jpg .

Essentially, I have a image field that should be saving the uploaded image in the public directory, but its saving in the private directory for reasons that are unknown to me.

My image field is set to upload to public files, not private. Why would this field work properly when rules creates the content, but not when the user edits it? This issue does not exist on public groups, so I'm guessing it's some sort of permissions issue?

Sorry for the long post, but I am at a loss here. I know this setup is very specific, and probably out of the ordinary, but I appreciate any help I can get.

Comments

kloy23’s picture

I'm still having no luck finding a solution to this issue, anyone able to help out? If more information is needed, I'de be glad to provide it.

Thanks,
Kyle

kloy23’s picture

I have found that this issue persist even if rules is not involved. Also, this issue does not exist in Public groups.

I've created a test image field in my "nickname" content type. When a group member uploads a file to this field, it is stored in the private directory instead of the public directory (which the field is configured to save the file to). If the Group Manager uploads a file to this same directory, it is properly stored in the public directory. If a "Public" group member uploads an image to this field, it is once again stored in the proper directory.

This leads me to believe there is a permissions issue of some kind, but I just cannot find it. Is there a Commons module that could be causing this issue?

Any response is appreciated, even if it is not a solution.

Thank you,
Kyle

kloy23’s picture

Component: Miscellaneous » Media

Moving this issue from "Misc" to "Media", as the issue is not present when the commons_media module is disabled. I believe it has something to do with commons_media.private-files.inc, where I can see that images posted into private groups are moved from the public directory to the private directory.

Is there any way around this issue other than hacking the commons_media module? I'm fine with the avatar's being private as long as users within the group can view them. At the moment it is preventing all users from seeing the image unless they have the group "Administrator" role.

Thanks,
Kyle

kloy23’s picture

Status: Active » Closed (fixed)

I'm no longer working on this project. Marking as closed.