/[drupal]/contributions/modules/og_content_type_admin/og_content_type_admin.module
ViewVC logotype

Diff of /contributions/modules/og_content_type_admin/og_content_type_admin.module

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

revision 1.15.2.10, Fri Aug 21 15:29:51 2009 UTC revision 1.15.2.11, Thu Oct 15 11:04:25 2009 UTC
# Line 16  Line 16 
16   * were marked as 'required' by the site admin will always be usable by the group members and   * were marked as 'required' by the site admin will always be usable by the group members and
17   * cannot be deactivated by the group owner.</p>   * cannot be deactivated by the group owner.</p>
18   *   *
19   * @version $Id: og_content_type_admin.module,v 1.15.2.9 2009/02/02 15:29:22 paulbooker Exp $;   * @version $Id: og_content_type_admin.module,v 1.15.2.10 2009/08/21 15:29:51 paulbooker Exp $;
20   * @package OG_CTA   * @package OG_CTA
21   * @category NeighborForge   * @category NeighborForge
22   * @author Ryan Constantine   * @author Ryan Constantine
# Line 773  function og_content_type_admin_menu_alte Line 773  function og_content_type_admin_menu_alte
773  /**  /**
774   * mnode/add access callback override. If gid is present check og_content_type access rights. Otherwise pass processing to original function   * mnode/add access callback override. If gid is present check og_content_type access rights. Otherwise pass processing to original function
775   */   */
776  function og_content_type_admin_menu_access() {  function og_content_type_admin_menu_access() {
777    $args = func_get_args();    $args = func_get_args();
778    $type = array_shift($args);    $type = array_shift($args);
779    $type = isset($type) ? str_replace('-', '_', $type) : NULL;    $type = isset($type) ? str_replace('-', '_', $type) : NULL;
780    $original_callback = array_shift($args);    $original_callback = array_shift($args);
781    
782    // First: Allow access to add a particlar type of group content    // First: Allow access to add a particlar type of group content
783    if (is_array($_GET['gids'])) {    if (is_array($_GET['gids'])) {
784      $gid = $_GET['gids'][0];      $gid = $_GET['gids'][0];
785        $group = node_load($gid);
786      $sql = "SELECT octa.types_active, octa.types_allowed FROM {og_content_type_admin} octa WHERE octa.gid = %d";      $sql = "SELECT octa.types_active, octa.types_allowed FROM {og_content_type_admin} octa WHERE octa.gid = %d";
787      //if we're keeping track of this group, get it's active types, otherwise, get the defaults      //if we're keeping track of this group, get it's active types, otherwise, get the defaults
788      $types = db_fetch_object(db_query($sql, $gid)); // TODO: Should this be $gid ?      $types = db_fetch_object(db_query($sql, $gid));
789      if (!$types) {      if (!$types) {
790        $types = db_fetch_object(db_query($sql, 0));        $types = db_fetch_object(db_query($sql, 0));
791      }      }
792      $active_types = unserialize($types->types_active);      if (_og_content_type_admin_is_admin($group)) {
793          $active_types = unserialize($types->types_allowed);
794        } else {
795              $active_types = unserialize($types->types_active);
796            }
797      if ($active_types[$type]) {      if ($active_types[$type]) {
798        return TRUE;        return TRUE;
799      }      }
# Line 803  function og_content_type_admin_menu_acce Line 808  function og_content_type_admin_menu_acce
808    }    }
809    return FALSE;    return FALSE;
810  }  }
   
811   /**   /**
812   * Interception of the node module's node_add function.   * Interception of the node module's node_add function.
813   *   *

Legend:
Removed from v.1.15.2.10  
changed lines
  Added in v.1.15.2.11

  ViewVC Help
Powered by ViewVC 1.1.2