Moderator don't edit the content for his forum's category
| Project: | Forum Access |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | snowwind |
| Status: | patch (code needs work) |
I give the register user right of moderator for one forum's category. This category contain some forum's topics by another user, for example there have three topicls in here. The moderator can edit three topics and delete it. But i will don't let this user to make the moderator,delete his right. i don't have another choice for it, moderator is null. there will have lots of topics in this forum's category.
then i will let new user to make moderator to this forum's category. this time i found the bug that new moderator don't edit the topic
between after delete the old moderator and create the new moderator for same forum's category. so i need how to change it or may be need some configure to fix this bug in drupal's admin, please tell me something ,thank you. please.......

#1
I'm sorry, I don't understand exactly what you mean, but please make sure you have the latest ACL module installed: http://drupal.org/project/acl — it fixes at least one bug related to the moderator feature.
If this doesn't help, you may have to get someone to translate, or maybe there's someone here who can translate for you. What is your native language?
#2
sorry, maybe my description is mess.
acl version: 5.x-1.4
forum_access version: 5.x-1.7
the moderator's right can edit one forum's topic by admin set,right?
there have a forum name is aaaa, and contain two topics in here.the title is mycontent, newcontent
For example step by step:
1.let user1 to make moderator for aaaa(it's not a container,it's a forum type). by then userone can edit mycontent and newcontent.
2.I'll remove the userone from moderator list and then post new topic in aaaa
3.add user2 to make moderator for aaaa, and try to edit the articl in aaaa,you'll find the bug that don't have right to edit everyone
#3
Yes, your step-by-step explanation has helped, and I was able to reproduce the issue:
1. have User1 as moderator
2. remove User1 from moderator list, post a topic as admin
3. add User2 as moderator
User2 cannot edit the topic. The topic has no node_access entry for the acl realm. If you post another topic now, this new topic will have the acl node_access entry.
It seems that assigning a moderator does not enable administering topics that were created while there was no moderator, but only topics that are created with a moderator in place. I'm not sure whether this is intentional or a bug...
#4
I think it's a bug.
can you change this function that edit all topics be moderator?
#5
Ahh, I see what is happening now.
You can work around this bug by going to the node settings and rebuilding the node access table.
#6
I already fixed this bug and text it. add new moderator and they will have right to edit all topics in this forum.
you need update this new code:
<?php
/**old code **/
// mass update
$result = db_query("SELECT n.nid FROM {node} n LEFT JOIN {term_node} tn ON tn.nid = n.nid WHERE tn.tid = %d", $form_values['tid']);
while ($node = db_fetch_object($result)) {
node_access_write_grants($node, $grants, 'forum_access');
}
/**add new code in here **/
// mass update
$result = db_query("SELECT n.nid FROM {node} n LEFT JOIN {term_node} tn ON tn.nid = n.nid WHERE tn.tid = %d", $form_values['tid']);
while ($node = db_fetch_object($result)) {
$acl_id = db_result(db_query("SELECT acl_id FROM {acl_node} WHERE nid = %d",$node->nid));
$count_acluser = db_result(db_query("SELECT COUNT(*) FROM {acl_user} WHERE acl_id = %d", $acl_id));
if ($count_acluser != 0) {
$acl_sql = db_query("SELECT * FROM {acl_node} WHERE nid = %d",$node->nid);
unset($grants_acl);
while ($row = db_fetch_object($acl_sql)){
$grants_acl[] = array(
'realm' => 'acl',
'gid' => $row->acl_id,
'grant_view' => $row->grant_view,
'grant_update' => $row->grant_update,
'grant_delete' => $row->grant_delete,
);
}
node_access_write_grants($node, $grants_acl);
}
node_access_write_grants($node, $grants, 'forum_access');
}
?>
I change the function when add new moderator by admin, and then will give moderator all right to this forum ,not just after create new topic in this forum.
If you find problem or new bug, please tell me :) right now. thank you everyone.
#7
Could you possibly submit this as a patch?
#8
of course, my pleasure
#9
I think merlinofchaos meant to upload a patch file (generated with diff -up, ensures perfect transmission) and then set the status to patch (code needs review).
#10
Created the patch based on code above.
#11
Thank you. Have you tested it? In what way does it need work?
#12
yes, what will happen if there 30,000 or 100,000 topics under forum, I think in this way it'll enhance load of server, and maybe crash server
#13
Yes, wuyang is right. It works ok for smaller sites, but once the site has a lot of topics it will run into trouble. Will look for an alternative solution.
#14
This is definitely a problem. It's not done often and I don't think it could crash the server, because it's only one job, but it could time out and leave the database in an intermediate state. This could be said of the old code, too, but there's more processing done in the new code, so it's more likely to happen.
There seems to be no solution for handling time/memory-consuming operations such as this one under Drupal 5, and applying a patch like this one could push FA over the edge for large sites. This has to wait for Drupal 6.
see http://drupal.org/node/196002