I added a file attachment and an image field to the content type "forum topic." They show up and are quite usable when creating a Forum Topic in Advanced Forums. However, when someone is made "Moderator" on the Edit Forum page, he no longer sees these two fields when creating a new Forum Topic. If his role as Moderator is cancelled, the fields return. If he is once again made moderator, the fields disappear and he cannot add image or attach file to Forum Topic.

I also added the same two fields to Comments. Unlike in Forum Topic creation, in comment creation these fields remain visible to and usable by the user whether he is made Moderator or not.

How do I appoint moderators without them losing the ability to add image or attach file to Forum Topic?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

troky’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

Have you tried with AF disabled? AF doesn't deal with permissions and it seems that you should look that way.

LIQUID VISUAL’s picture

I just decided not to have moderator function for now. It is interesting that the first response of most developers, like most public servants, is to point to another jurisdiction.

troky’s picture

Are you sure? Read the first part of my answer again. I am trying to help by isolating the problem because I am pretty sure this is not AF related issue.

LIQUID VISUAL’s picture

Is the moderator function added by AF? As described above, the problem comes and goes with the addition of the moderator function, not with the addition or removal of AF.

troky’s picture

Project: Advanced Forum » Forum Access
Version: 7.x-2.0-beta1 » 7.x-1.x-dev
Component: User interface » Code
Status: Postponed (maintainer needs more info) » Active

Moderator function is part of Forum Access module and has nothing to do with AF.

salvis’s picture

princeofwales in #2:

It is interesting that the first response of most developers, like most public servants, is to point to another jurisdiction.

This comment moves your issue to the bottom of my stack, regardless of your royal descent.

LIQUID VISUAL’s picture

Thanks for the clarification. I will take it up there. Not royal, just a location. And I apologize. I have become polluted by the fact that in Ottawa, pointing somewhere else is almost always an irresponsible dodge, often resulting in serious harm to people. Thanks for your work.

salvis’s picture

Category: support » task
Priority: Normal » Major

I will take it up there.

troky already moved your issue to the right queue.

His response in #1 was 100% correct. Reducing the number of modules is the natural first step to narrow down every issue. This helps to ensure that we don't waste time and effort looking in the wrong place.

The module maintainers are here to maintain and support their modules because we want to be here, and many of us contribute countless hours of our free time. I don't think anyone here has any interest in shoving off responsibility. We're all working together to solve all issues within our reach in the most efficient way, and unless your competence level is such that you can help yourself, then you have to trust us that we'll help to the best of our abilities and capacity.

 

The issue you raised is definitely a Forum Access issue. FA hasn't learned yet how to provide access to fields beyond the basic node. I'm taking note of this, but I'm afraid there won't be a quick solution. This will take a lot of investigation, implementation, and testing.

LIQUID VISUAL’s picture

Thanks. Forum Access is very helpful in other ways. Moderation is possible by other means for the time being.

salvis’s picture

Priority: Major » Normal

We're not making any progress here, but it does not seem to be a hot issue either, or others would have chimed in here.

David4514’s picture

I've just run into the same problem. It is still just a test site, but it would be nice to have this fixed.

salvis’s picture

Do you use a contrib module for protecting your fields, or how do you do it?

David4514’s picture

I do use a custom module, but for a different content type. It has no effect on this.

The issue is with the function _forum_access_node_form in the file forum_access.node.inc.

I have not completely figured out the logic yet. If a moderator is involved, any form element with a key not found in:

$allowed_elements = variable_get('forum_access_allowed_node_edit_elements', array('nid', 'vid', 'uid', 'created', 'type', 'language', 'changed', 'title', 'shadow', 'forum_tid', 'additional_settings', 'revision_information', 'author', 'options', 'actions', 'body', 'taxonomy_forums', 'form_build_id', 'form_token', 'form_id', 'comment_settings', 'attachments'));

will have it's #access value set to FALSE, which hides it. The image and file fields are not included in the list, so they are hidden. If I trap the code and reset the #access to TRUE for the two form elements representing the two fields, then everything shows up.

I just have not yet figured out why when a moderator is involved, restrictions are made on what is shown. If no moderator is involved, then this code is skipped.

salvis’s picture

Thank you for your analysis — I hadn't thought of that! In fact I thought this was a completely different, much more difficult problem.

That code comes straight from the D6 version. There we implemented moderators by tricking Drupal into thinking that the user has the 'administer nodes' and 'administer comments' permissions. This had the effect that the author and timestamp fields would also be open for editing by moderators, which we clearly do not want.

We cannot know what other fields might have been added, and we choose to err on the safe side by listing those fields that we want to expose and hiding all others. Since this is a variable, you could add the additional fields that you want to expose to moderators. Can you try that, please?

We need to analyze whether we actually still need that code in the D7.

David4514’s picture

I've inserted an array_merge to merge in the two keys that represent the two fields that I have attached. It seems to work fine. The problem with this approach is that the code change depends on my field names.

I am using private files in my test. The permission to view this file is dependent on the user's 'view' permission of the node to which this field is attached. So if a user cannot view the post, then they also cannot view the private file. This is done outside of the code in question.

I'm not sure why this section (prior to the "special treatment" part) is even necessary. Non-moderators get full access to the form fields as long as they have edit permissions. Only moderators are being restricted. That just seems backwards! Could that section just be deleted? Then there would be no need to worry about what names fields are using.

David4514’s picture

I've commented out the statement that sets #access to false for form element keys not listed in the $allow_elements variable. I've not noticed any bad side effects yet.

salvis’s picture

Category: task » bug
Status: Active » Fixed

Thank you for your patch and your testing.

I've done some clean-up and committed this to the -dev version (give it up to 12h to be repackaged).

Unfortunately, this will require another round of testing...

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

There is no log message associated with this problem.