/[drupal]/contributions/modules/forum_access/forum_access.node.inc
ViewVC logotype

Diff of /contributions/modules/forum_access/forum_access.node.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.5, Thu Apr 30 22:31:21 2009 UTC revision 1.6, Sun Oct 4 22:43:46 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: forum_access.node.inc,v 1.4 2009/03/22 17:52:17 salvis Exp $  // $Id: forum_access.node.inc,v 1.5 2009/04/30 22:31:21 salvis Exp $
3    
4  /**  /**
5   * @file forum_access.node.inc   * @file forum_access.node.inc
# Line 75  function _forum_access_node_form(&$form, Line 75  function _forum_access_node_form(&$form,
75      // We gave this user the 'administer nodes' permission, which he doesn't      // We gave this user the 'administer nodes' permission, which he doesn't
76      // normally have. Remove controls that should be reserved to true node      // normally have. Remove controls that should be reserved to true node
77      // administrators.      // administrators.
78        _forum_access_disable_moderator();  // not needed anymore
79      $allowed_elements = variable_get('forum_access_allowed_node_edit_elements', array('nid', 'vid', 'uid', 'created', 'type', 'changed', 'title', 'shadow', 'body_field', 'revision_information', 'form_build_id', 'form_token', 'form_id', 'comment_settings', 'taxonomy'));      $allowed_elements = variable_get('forum_access_allowed_node_edit_elements', array('nid', 'vid', 'uid', 'created', 'type', 'changed', 'title', 'shadow', 'body_field', 'revision_information', 'form_build_id', 'form_token', 'form_id', 'comment_settings', 'taxonomy'));
80      $allowed_options = variable_get('forum_access_allowed_node_edit_options', array('status', 'sticky', 'subscriptions_notify'));      $allowed_options = variable_get('forum_access_allowed_node_edit_options', array('status', 'sticky', 'subscriptions_notify'));
81      foreach (element_children($form) as $key) {      foreach (element_children($form) as $key) {
# Line 102  function _forum_access_node_form(&$form, Line 103  function _forum_access_node_form(&$form,
103            }            }
104        }        }
105      }      }
106        if ($user->_forum_access_moderator == 1) {
107          $form['options']['#access'] = FALSE;
108          $form['comment_settings']['#access'] = FALSE;
109        }
110    }    }
111  }  }
112    
# Line 132  function _forum_access_comment_form(&$fo Line 137  function _forum_access_comment_form(&$fo
137        }        }
138        else {        else {
139          if (isset($form['admin']) && !empty($user->_forum_access_moderator)) {          if (isset($form['admin']) && !empty($user->_forum_access_moderator)) {
140            foreach (element_children($form['admin']) as $key) {            switch ($user->_forum_access_moderator) {
141              if ($key != 'status') {              case 2:
142                $form['admin'][$key]['#access'] = FALSE;                foreach (element_children($form['admin']) as $key) {
143              }                  if ($key != 'status') {
144                      $form['admin'][$key]['#access'] = FALSE;
145                    }
146                  }
147                  break;
148                case 1:
149                  $form['admin']['#access'] = FALSE;
150            }            }
151          }          }
152        }        }
# Line 203  function _forum_access_preprocess_commen Line 214  function _forum_access_preprocess_commen
214    
215    $tid = $variables['node']->tid;    $tid = $variables['node']->tid;
216    $links = module_invoke_all('link', 'comment', $variables['comment'], 0);    $links = module_invoke_all('link', 'comment', $variables['comment'], 0);
217    
218      if (!empty($user->_forum_access_moderator) && arg(0) == 'node' && arg(2) == NULL) {
219        _forum_access_disable_moderator();
220      }
221    
222    if (isset($links['comment_reply']) && (!preg_match('#<li class="[^"]*comment_reply[^"]*".*</li>#U', $variables['links']) || !forum_access_access($tid, 'create'))) {    if (isset($links['comment_reply']) && (!preg_match('#<li class="[^"]*comment_reply[^"]*".*</li>#U', $variables['links']) || !forum_access_access($tid, 'create'))) {
223      unset($links['comment_reply']);      unset($links['comment_reply']);
224    }    }
# Line 224  function _forum_access_preprocess_commen Line 240  function _forum_access_preprocess_commen
240      );      );
241    }    }
242    $variables['links'] = theme('links', $links);    $variables['links'] = theme('links', $links);
   
   if (!empty($user->_forum_access_moderator) && arg(0) == 'node' && arg(2) == NULL) {  
     // Remove the permissions again to avoid confusing devel_node_access.module.  
     _forum_access_disable_moderator();  
   }  
243  }  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.2