I was interested in this as a nice way of letting admins add single users to their groups as it's really nice functionality I haven't found in another module - but seeing how this module evolved there's an understandable hardcoded dependency on the User Import module. I was wondering if you'd consider changing that or if it would move the module too far from your objectives for it?

I patched my copy
.info

-dependencies[] = user_import

and

function user_import_og_form_alter(&$form, &$form_state, $form_id) {

  $type = $form['#node_type']->type;

  // add option to organic group node type(s) to use user import template
  if ($form_id == 'node_type_form' && module_exists('og') && !empty($type) && og_is_group_type($type)) {

+  if (module_exists('user_import')) {
    $templates = _user_import_settings_select(NULL, 'GET TEMPLATES');
    if (empty($templates)) $help = t('Save a user import to create a template which will be available for selection here.');

    $form['user_import'] = array(
      '#type' => 'fieldset',
      '#title' => t('User Import'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#access' => user_access('og user import'),
      '#description' => $help,
    );

    // if (!empty($templates)) {
    //
    //   $template_settings = variable_get('user_import_og_template', array());
    //   $templates_list = array('-- none --');
    //   $subscribe_feature = variable_get('user_import_og_subscribe', array());
    //
    //   foreach ($templates as $template) {
    //       $templates_list[$template['import_id']] = $template['name'];
    //       $templates_delete[$template['import_id']] = $template['name'];
    //   }
    //
    //   $form['user_import']['user_import_og_template'] = array(
    //     '#type' => 'select',
    //     '#title' => t('Organic Groups Mass Import & Subscribe'),
    //     '#description' => t('Admin(s) of each Organic Group will be able to mass import new and existing users into their group. Enable this feature by selecting a user import template.'),
    //     '#options' => $templates_list,
    //     '#default_value' => $template_settings[$type],
    //   );
    // }

+   }

and nothing drastic seems to have happened so far - and my OG admins love it.

Comments

robert castelo’s picture

Good point.

This module evolved from a client project where single user addition and mass user imports were options in a "Add Users" block.

It will be more flexible if I move the 'add user' functionality to another module. If people want to group the two functions into one block they can style the two blocks to look like one.

Something for the To Do list.

greggles’s picture

Title: Make dependency on user import less/optional/removed? » Make dependency on user import less/optional/removed

Thanks for your feature request and for helping make this a better module. Could you provide this as a patch?