What about setting a group wide licence that would be applied by default to the CC content in this group?

Thanks for this great module

Comments

kreynen’s picture

Status: Active » Closed (works as designed)

Code for a form_alter like this exists in the Open Media Show module. In Open Media implementations, the default for several fields (including Creative Commons) can be synchronized with settings of the Organic Group node (om_project).

If there is enough interest a generalized version of this could be added to the Creative Commons module, but I think in most use cases you'd be better off with a custom module.


function om_show_form_alter(&$form, $form_state, $form_id) {
  switch ($form['type']['#value']) {
    case 'om_show':
       
      //This only works when og_nodeapi field is visable... it is not when the user only has one project
      $project_nid = $form['og_nodeapi']['visible']['og_groups']['#default_value'][0];
      if (!$project_nid) {
         $project_nid = $_REQUEST['gids'][0];
      }
      
      $project_node = node_load($project_nid);

      //check variable to see if we should be synchronizing the om_show with om_project
      if ($sync_with_project = variable_get('om_show_project_sync', '0')) {
        //Set some default values
      
        if ($project_node->title) {
           $form['group_om_show_basic_info']['title']['#title'] = $project_node->title . ':Title for This Show';
        }
      
        if ($project_node->field_om_theme[0]['nid'] && !$form['group_metadata']['field_om_theme']['#default_value'][0]['nid']) {
          $form['group_metadata']['field_om_theme']['#default_value'][0]['nid'] = $project_node->field_om_theme[0]['nid'];
        }
      
        if ($project_node->field_om_genre[0]['value'] && !$form['group_metadata']['field_om_genre']['#default_value'][0]['value']) {
          $form['group_metadata']['field_om_genre']['#default_value'][0]['value'] = $project_node->field_om_genre[0]['value'];
        }
      
        if ($project_node->field_om_rating[0]['value'] && !$form['group_metadata']['field_om_rating']['#default_value'][0]['value']) {
          $form['group_metadata']['field_om_rating']['#default_value'][0]['value'] = $project_node->field_om_rating[0]['value'];
        }

        if ($project_node->field_om_language[0]['value'] && !$form['group_metadata']['field_om_language']['#default_value'][0]['value']) {
          $form['group_metadata']['field_om_language']['#default_value'][0]['value'] = $project_node->field_om_language[0]['value'];
        }
      
        if ($project_node->field_om_locally_produced[0]['value'] && !$form['group_metadata']['field_om_locally_produced']['#default_value'][0]['value']) {
          $form['group_metadata']['field_om_locally_produced']['#default_value'][0]['value'] = $project_node->field_om_locally_produced[0]['value'];
        }
      
        //set the creative commons defaults
      
        $form['group_om_show_creative_commons']['creativecommons']['select_license_form']['cc_license_uri']['#default_value'] = $project_node->cc->uri;
      
      }
      break;
  }
}

In om_show, the Creative Commons form element is moved to a fieldgroup. I most cases, you probably just set $form['creativecommons']['select_license_form']['cc_license_uri']['#default_value'] = $project_node->cc->uri;

This approach also allows you to set the default for enabled attributes as well as the license.