Changeset 224

Show
Ignore:
Timestamp:
02/10/09 11:55:00 (19 months ago)
Author:
frans
Message:

reversed upgrade changes -r218:152 because it changes the way users can send Newsletters to neighbours

Location:
trunk/sites/all/modules/og
Files:
6 removed
16 modified
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/sites/all/modules/og

    • Property svn:mergeinfo
      •  

        old new  
        1 /branches/kester/current/sites/all/modules/og:126-131,189 
        2 /external/current/sites/all/modules/messaging/og:130 
        3 /external/current/sites/all/modules/og:127,129,188 
  • trunk/sites/all/modules/og/README.txt

    r152 r224  
    4242INTEGRATION 
    4343--------------------- 
     44- I recommend enabling the job_queue.module. When you do, group email notifications are sent during cron runs, instead of immediately after a post is submitted. This speeds up posting a lot, for big groups. The delay also helps authors fix typos in their posts before the mail is sent. 
    4445- This module exposes an API for retrieving and managing membership via direct PHP functions [og_save_subscription()] and via XMLRPC. 
    45 - Enabling og_notifications provides subscription support for groups and group 
    46 posts. The README in the og_notifications directory provides more information. 
    4746 
    4847UNIT TESTING 
  • trunk/sites/all/modules/og/includes/groupcontent.inc

    r152 r224  
    66    'icon' => 'user-multiple.png', 
    77    'path' => drupal_get_path('module', 'og_panels'). '/', 
    8     'description' => t('The welcome message for the group. Specified on group edit form.'), 
     8    'description' => t('The welcome message for the group. Specified on group edit form'), 
    99    'required context' => new panels_required_context(t('Group'), 'group'), 
    1010    'category' => array(t('Organic groups'), -10), 
     
    184184    '#type' => 'textfield', 
    185185    '#title' => t('Number of members'), 
    186     '#description' => t('Maximum number of members that should appear on the list.'), 
     186    '#description' => t('Maximum number of members that should appear on the list'), 
    187187    '#default_value' => isset($conf['num_items']) ? $conf['num_items'] : 10, 
    188188    '#size' => 5, 
  • trunk/sites/all/modules/og/includes/groupcontext.inc

    r152 r224  
    11<?php 
    2 // $Id: groupcontext.inc,v 1.1.2.4 2008/05/26 14:03:35 weitzman Exp $ 
     2// $Id: groupcontext.inc,v 1.1.2.3 2008/03/22 21:50:52 weitzman Exp $ 
    33/** 
    44 * @file contexts/group.inc 
     
    3535      '#type' => 'checkbox', 
    3636      '#default_value' => $conf['external'], 
    37       '#title' => t('Require this context from an external source (such as containing panel page).'), 
     37      '#title' => t('Require this context from an external source (such as containing panel page)'), 
    3838      '#description' => t('If selected, group selection (below) will be ignored'), 
    3939    ); 
  • trunk/sites/all/modules/og/og.info

    r152 r224  
    33package = "Organic groups" 
    44dependencies = views views_rss 
     5; Information added by drupal.org packaging script on 2008-05-12 
     6version = "5.x-7.2" 
     7project = "og" 
     8datestamp = "1210629035" 
     9 
  • trunk/sites/all/modules/og/og.install

    r152 r224  
    11<?php 
    2 // $Id: og.install,v 1.21.2.32.2.8 2008/10/09 15:06:14 weitzman Exp $ 
     2// $Id: og.install,v 1.21.2.31 2008/05/05 21:27:57 weitzman Exp $ 
    33 
    44function og_install() { 
     
    1313        register int(1) NOT NULL default 0, 
    1414        directory int(1) NOT NULL default 0, 
     15        notification int(1) NOT NULL default 0, 
    1516        language varchar(12) NOT NULL default '', 
    1617        private int(1) NOT NULL default 0, 
     
    2425        is_admin int(1) NOT NULL DEFAULT 0, 
    2526        uid int(11) NOT NULL, 
    26         created int(11) NULL DEFAULT 0, 
    27         changed int(11) NULL DEFAULT 0, 
     27        mail_type int(11) NULL, 
     28        created int(11) NULL DEFAULT 0, 
     29        changed int(11) NULL DEFAULT 0, 
    2830        PRIMARY KEY  (nid, uid) 
    2931      ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); 
    3032       
     33      db_query("CREATE TABLE {og_uid_global} ( 
     34        uid int(11) NOT NULL, 
     35        og_email int(11) NOT NULL DEFAULT 2, 
     36        PRIMARY KEY  (uid) 
     37      ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); 
    3138      db_query("CREATE TABLE {og_ancestry} ( 
    3239        nid int(11) NOT NULL, 
     
    4653        register smallint NOT NULL default 0, 
    4754        directory smallint NOT NULL default 0, 
     55        notification smallint NOT NULL default 0, 
    4856        language varchar(12) NOT NULL default '', 
    4957        private smallint NOT NULL default 0,   
     
    5765        is_admin smallint NOT NULL DEFAULT 0, 
    5866        uid int NOT NULL, 
    59         created int NULL DEFAULT 0, 
    60         changed int NULL DEFAULT 0, 
     67        mail_type int NULL, 
     68            created int NULL DEFAULT 0, 
     69            changed int NULL DEFAULT 0, 
    6170        PRIMARY KEY  (nid, uid) 
    6271      );"); 
    6372       
    64       db_query("CREATE TABLE {og_ancestry} ( 
     73      db_query("CREATE TABLE {og_uid_global} ( 
     74        uid int NOT NULL, 
     75        og_email int NOT NULL DEFAULT 2, 
     76        PRIMARY KEY (uid) 
     77      );"); 
     78       
     79      db_query(" 
     80      CREATE TABLE {og_ancestry} ( 
    6581       nid int NOT NULL, 
    6682       group_nid int NOT NULL, 
     
    7389   
    7490  // enable standard og blocks. for custom profiles, block may not be included yet. 
    75   if (function_exists('_block_rehash')) { 
     91  if (function_exists('block_rehash')) { 
    7692    _block_rehash(); 
    7793  } 
     
    296312} 
    297313 
    298 // populate the og_uid_global table. we have to choose selective here for  
    299 // backward compatibility. To set everyone up for 'always' notifications, run 
    300 // this after the update: UPDATE og_uid_global SET og_email=1 
    301 // og_uid_global is later moved into og_notifications. This update is only 
    302 // around to retain schema consistency - the population script has been removed. 
     314// populate the og_uid_global table. we have to choose selective here for backward compatibility.  
     315// to set everyone up for 'always' notifications, run this after the update: UPDATE og_uid_global SET og_email=1 
    303316function og_update_13() { 
    304317  switch ($GLOBALS['db_type']) {  
     
    319332      break; 
    320333  } 
    321  
     334   
     335  // works for mysql and postgres 
     336  $sql = 'SELECT uid FROM {users} WHERE uid > 0'; 
     337  $result = db_query($sql); 
     338  while ($row = db_fetch_object($result)) { 
     339    $sql = "INSERT INTO {og_uid_global} (uid, og_email) VALUES (%d, %d)"; 
     340    db_query($sql, $row->uid, OG_NOTIFICATION_SELECTIVE); 
     341  } 
    322342  return array(); 
    323343} 
     
    404424} 
    405425 
    406 // Formerly contained og_uid_global code which is no longer required. 
    407426function og_update_19() { 
    408   return array(); 
     427  og_populate_uid_global_table(); 
     428  return array('Populated og_uid_global table'); 
    409429} 
    410430 
     
    444464  $ret = array(); 
    445465  if (variable_get('og_enabled', FALSE) && !module_exists('og_access')) { 
    446     drupal_install_modules(array('og_access')); 
     466    module_enable('og_access'); 
    447467  } 
    448468  // variable_del('og_enabled'); is harmless to leave around, and will help if someone reruns the update. 
     
    477497   return $ret; 
    478498 } 
    479   
    480  /** 
    481   * Force menu rebuild since subscribe/unsubscribe paths are better protected now. 
    482   */  
    483  function og_update_5702() { 
    484    $ret[] = array('success' => TRUE, 'query' => 'Menu has been rebuilt.'); 
    485    menu_rebuild(); 
    486    return $ret; 
    487  } 
    488   
    489 /** 
    490  * Notifications upgrade: Set flag to indicate that this is an upgraded  
    491  * installation. 
    492  */  
    493 function og_update_5703() { 
    494   // Remove mail / no mail options from OG group types and move preferences to 
    495   // og_notifications. 
    496   $types = og_get_types('group_post'); 
    497   $mail_types = array(); 
    498   foreach ($types as $type) { 
    499     $variable = 'og_content_type_usage_'. $type; 
    500     $usage = variable_get($variable, ''); 
    501     switch ($usage) { 
    502       case 'group_post_standard_mail': 
    503         $mail_types[$type] = $type; 
    504       case 'group_post_standard_nomail': 
    505         variable_set($variable, 'group_post_standard'); 
    506         break; 
    507       case 'group_post_wiki_mail': 
    508         $mail_types[$type] = $type; 
    509       case 'group_post_wiki_nomail': 
    510         variable_set($variable, 'group_post_wiki'); 
    511         break; 
    512     } 
    513   } 
    514   // Set variable for og_notifications. If it is never enabled, this variable 
    515   // is also deleted in og_uninstall. 
    516   variable_set('og_notifications_content_types', $mail_types); 
    517  
    518   // Vestigial variable. 
    519   variable_del('og_omitted_email_node_types'); 
    520  
    521   // Set update flag for og_notifications. 
    522   variable_set('og_notifications_update_required', 1); 
    523  
    524   return array(); 
    525 } 
    526  
    527  // end updates // 
     499 
     500// end updates // 
     501 
     502function og_enable() { 
     503  og_populate_uid_global_table(); 
     504} 
     505 
     506// need to populate og_uid_global for existing users on enable 
     507// this is called from update 13 & 19 & og_enable.  
     508// TODO: conditionally use subquery 
     509function og_populate_uid_global_table() { 
     510  $sql = 'SELECT u.uid FROM {users} u LEFT JOIN {og_uid_global} oug ON u.uid=oug.uid WHERE u.uid > 0 AND oug.og_email IS NULL'; 
     511  $result = db_query($sql); 
     512  while ($row = db_fetch_object($result)) { 
     513    $sql = "INSERT INTO {og_uid_global} (uid, og_email) VALUES (%d, %d)"; 
     514    db_query($sql, $row->uid, OG_NOTIFICATION_SELECTIVE); 
     515  } 
     516} 
    528517 
    529518function og_uninstall() { 
     
    531520  db_query('DROP TABLE {og}'); 
    532521  db_query('DROP TABLE {og_uid}'); 
     522  db_query('DROP TABLE {og_uid_global}'); 
    533523  db_query('DROP TABLE {og_ancestry}'); 
    534  
    535   // In case og_notifications has never been enabled, the vestigial  
    536   // og_uid_global table will still be around.  
    537   if (variable_get('og_notifications_update_required', FALSE)) { 
    538     db_query('DROP TABLE {og_uid_global}'); 
    539   } 
    540524 
    541525  // Delete variables 
     
    543527    'og_member_pics', 'og_help', 'og_block_cnt_2', 'og_block_cnt_3', 
    544528    'og_audience_checkboxes', 'og_omitted', 'og_content_type_usage', 
    545     'og_audience_required', 
     529    'og_audience_required', 'og_omitted_email_node_types', 
    546530    'og_visibility_directory', 'og_visibility_registration', 
    547531    'og_home_page_view', 'og_email_max', 'og_node_types', 
     
    552536    'og_new_admin_body', 'og_new_admin_subject', 
    553537    'og_new_node_body', 'og_new_node_subject', 
    554     'og_request_user_body', 'og_request_user_subject', 
    555     'og_notifications_update_required', 'og_notifications_content_types' 
     538    'og_notification', 'og_request_user_body', 'og_request_user_subject', 
    556539  ); 
    557540  foreach ($variables as $variable) { 
  • trunk/sites/all/modules/og/og.module

    r190 r224  
    11<?php 
    2 // $Id: og.module,v 1.298.2.197.2.18 2008/12/30 16:34:33 weitzman Exp $ 
     2// $Id: og.module,v 1.298.2.185 2008/05/08 19:49:26 weitzman Exp $ 
    33 
    44// Selective groups states. chosen by the group admin 
     
    1919define('OG_DIRECTORY_CHOOSE_TRUE', 2); 
    2020define('OG_DIRECTORY_CHOOSE_FALSE', 3); 
     21 
     22// site admin chooses in og_admin_settings() whether new registrants receive group email notifications by default 
     23define('OG_NOTIFICATION_NEVER', 0); 
     24define('OG_NOTIFICATION_ALWAYS', 1); 
     25define('OG_NOTIFICATION_SELECTIVE', 2); 
    2126 
    2227function og_help($section) { 
     
    3641  if ($may_cache) { 
    3742    // anon users should be able to get to the join page 
    38     $items[] = array('path' => 'og/subscribe', 'type' => MENU_CALLBACK, 'callback' => 'og_menu_check_node_view', 'access' => TRUE, 'callback arguments' => array('og_subscribe'), 'title' => t('Join group')); 
     43    $items[] = array('path' => 'og/subscribe', 'type' => MENU_CALLBACK, 'callback' => 'og_subscribe', 'access' => TRUE, 'title' => t('Join group')); 
    3944     
    4045    $items[] = array('path' => 'og/opml', 'type' => MENU_CALLBACK, 'callback' => 'og_opml', 'access' => $access, 'title' => t('OPML')); 
    41     $items[] = array('path' => 'og/unsubscribe', 'type' => MENU_CALLBACK, 'callback' => 'og_menu_check_node_view', 'callback arguments' => array('og_unsubscribe'), 'access' => $access, 'title' => t('Leave group')); 
     46    $items[] = array('path' => 'og/unsubscribe', 'type' => MENU_CALLBACK, 'callback' => 'og_unsubscribe', 'access' => $access, 'title' => t('Leave group')); 
    4247    $items[] = array('path' => 'og/approve', 'type' => MENU_CALLBACK, 'callback' => 'og_approve', 'access' => $access, 'title' => t('Approve membership request')); 
    4348    $items[] = array('path' => 'og/deny', 'type' => MENU_CALLBACK, 'callback' => 'og_deny', 'access' => $access, 'title' => t('Deny membership request')); 
     
    6166      'path' => 'admin/og',  
    6267      'title' => t('Organic groups'), 
    63       'description' => t('Administer the suite of organic groups modules.'), 
     68      'description' => t('Administer the suite of Organic groups modules.'), 
    6469      'position' => 'right', 
    6570      'weight' => -5, 
     
    7378     
    7479    // we get a NOTICE if doing this from within og_theme() so I do it here for now. 
    75     if ($group_node = og_get_group_context()) { 
    76       if ($user->uid || variable_get('cache', CACHE_DISABLED) == CACHE_DISABLED) { 
    77         $_SESSION['og_last'] = $group_node->nid; 
    78       } 
    79     } 
     80    $_SESSION['og_last'] = og_get_group_context(); 
    8081 
    8182    //membership page and its 'add members' tab 
     
    9192      $items[] = array('path' => "og/users/$gid/add_user", 'callback' => 'drupal_get_form', 'title' => t('Add members'), 'callback arguments' => array('og_add_users', $gid), 'type' => MENU_LOCAL_TASK, 'weight' => 5, 'access' => og_is_node_admin($node)); 
    9293    } 
    93  
    94     // Broadcast tab on group node. 
     94     
     95    // email tab on group node 
    9596    if (arg(0) == 'node' && is_numeric(arg(1))) { 
    9697      $node = node_load(arg(1)); 
    9798      if (og_is_group_type($node->type)) { 
    98         $items[] = array( 
    99           'path' => 'node/'. arg(1) .'/broadcast', 
    100           'title' => t('Broadcast'), 
    101           'callback' => 'drupal_get_form', 
    102           'callback arguments' => array('og_broadcast_form', arg(1)), 
    103           'access' => og_broadcast_access($node), 
    104           'type' => MENU_LOCAL_TASK, 
    105           'weight' => 7 
    106         ); 
     99        $items[] = array('path' => 'node/'. arg(1). '/email', 'title' => t('E-mail'), 'callback' => 'drupal_get_form', 'callback arguments' => array('og_email_form', arg(1)), 'access' => og_is_node_admin($node), 'type' => MENU_LOCAL_TASK, 'weight' => 7); 
    107100      } 
    108101    } 
     
    126119    drupal_access_denied(); 
    127120  } 
    128 } 
    129  
    130 // check for node access 'view' and then pass along to the real menu callback 
    131 // arguments must be in this order: function, $gid, <extra params required by function> 
    132 function og_menu_check_node_view() { 
    133   global $user; 
    134  
    135   $args = func_get_args(); 
    136   $function = array_shift($args); 
    137   $gid = $args[0]; 
    138   $node = node_load((int)$gid); 
    139   if (node_access('view', $node)) { 
    140     return call_user_func_array($function, $args); 
    141   } 
    142   else { 
    143     drupal_access_denied(); 
    144   } 
    145    
    146121} 
    147122 
     
    281256        // node is in multiple groups. preference goes to the group we showed on the prior page view (if any), 
    282257        // then to a group the current user is a member of 
    283         if (in_array($_SESSION['og_last'], $node->og_groups)) { 
    284           $group_node = node_load($_SESSION['og_last']); 
     258        if (in_array($_SESSION['og_last']->nid, $node->og_groups)) { 
     259          $group_node = node_load($_SESSION['og_last']->nid); 
    285260          $custom_theme = $group_node->og_theme; 
    286261        } 
     
    305280 
    306281/** 
    307  * Admins may broadcast messages to all their members. 
     282 * Admins may broadcast email to all their members 
    308283 * 
    309284 * @param $gid 
    310285 *   the nid of a group. 
    311286 */ 
    312  function og_broadcast_form($gid) { 
     287 function og_email_form($gid) { 
    313288  $node = node_load($gid); 
    314   drupal_set_title(t('Send message to %group', array('%group' => $node->title))); 
     289  drupal_set_title(t('Send email to %group', array('%group' => $node->title))); 
    315290   
    316291  $result = db_query(og_list_users_sql(1), $gid); 
    317292  $txt = format_plural(db_num_rows($result), 'the sole member', 'all @count members'); 
    318293  if (!$_POST) { 
    319     drupal_set_message(t('Your message will be sent to !count in this group.', array('!count' => l($txt, "og/users/$gid")))); 
    320   } 
    321  
    322   $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#size' => 70, '#maxlength' => 250, '#description' => t("Enter a subject for your message."), '#required' => true); 
    323   $form['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#rows' => 5, '#cols' => 90, '#description' => t('Enter the body of your message.'), '#required' => true); 
    324   $form['send'] = array('#type' => 'submit', '#value' => t('Send message')); 
     294    drupal_set_message(t('Your email will be sent to !count in this group. Please use this feature sparingly.', array('!count' => l($txt, "og/users/$gid")))); 
     295  } 
     296 
     297  $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#size' => 70, '#maxlength' => 250, '#description' => t("Enter a subject for your email."), '#required' => true); 
     298  $form['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#rows' => 5, '#cols' => 90, '#description' => t('Enter a body for your email.'), '#required' => true); 
     299  $form['send'] = array('#type' => 'submit', '#value' => t('Send email')); 
    325300  $form['gid'] = array('#type' => 'value', '#value' => $gid); 
    326301  return $form; 
    327302} 
    328303 
    329 function og_broadcast_form_submit($form_id, $form_values) { 
    330   global $user; 
    331  
    332   $sql = og_list_users_sql(1); 
    333   $result = db_query($sql, $form_values['gid']); 
    334   $recipients = array(); 
    335   while ($row = db_fetch_object($result)) { 
    336     $recipients[] = $row->uid; 
    337   } 
    338  
     304function og_email_form_submit($form_id, $form_values) { 
    339305  $node = node_load($form_values[gid]); 
     306 
    340307  $variables = array( 
    341308    '@group' => $node->title, 
     
    345312    '!url_unsubscribe' => url("og/unsubscribe/$node->nid", NULL, NULL, TRUE) 
    346313  ); 
    347   $message = array( 
    348     'from' => $user, 
    349     'subject' => $form_values['subject'], 
    350     'body' => _og_user_mail_text('og_admin_email_body', $variables) 
    351   ); 
    352  
    353   // Send notifications to each member; Sending an array of recipients implies 
    354   // that this is a bulk message. 
    355   module_invoke_all('og', 'user broadcast', $gid, $recipients, $message); 
    356   drupal_set_message(format_plural(count($recipients), '1 message queued for delivery.', '@count messages queued for delivery.')); 
    357  
     314   
     315  global $user; 
     316  $from = $user->mail; 
     317  $sql = og_list_users_sql(1); 
     318  $result = db_query($sql, $form_values['gid']); 
     319  while ($row = db_fetch_object($result)) { 
     320     $emails[] = $row->mail; 
     321  } 
     322  foreach ($emails as $mail) { 
     323    drupal_mail('og_mail', trim($mail), $form_values['subject'], _og_user_mail_text('og_admin_email_body', $variables), $from); 
     324  } 
     325  drupal_set_message(format_plural(count($emails), '1 email sent.', '@count emails sent')); 
    358326  drupal_goto("node/{$form_values[gid]}"); 
    359327} 
     
    362330  global $user; 
    363331 
     332  // warn users who can't receive mail anyway 
     333  if ($txt = user_validate_mail($user->mail)) { 
     334    drupal_set_message($txt, 'error'); 
     335    return ''; 
     336  } 
     337   
    364338  $group = node_load($gid); 
    365339  $bc[] = array('path' => "og", 'title' => t('Groups')); 
     
    388362  } 
    389363 
     364  switch ($user->og_email) { 
     365    // og_email can be NULL when you enable og on an existing site. 
     366    case NULL: 
     367    case OG_NOTIFICATION_SELECTIVE: 
     368      $form['mail_type'] = array('#type' => 'radios', '#title' => t('Email notification'), '#default_value' => $user->og_groups[$group->nid]['mail_type'], '#options' => array(1 => t('enabled'), 0 => t('disabled')), '#description' => t('Do you want to receive an email each time a message is posted to this group?')); 
     369      $submit = TRUE; 
     370      break; 
     371    case OG_NOTIFICATION_ALWAYS: 
     372      $form['mail_type'] = array('#type' => 'item', '#title' => t('Email notification'), '#value' => t('Your <a href="!prof">personal profile</a> is configured to: <em>Always receive email notifications</em>.', array('!prof' => url("user/$user->uid/edit"))));  
     373      break; 
     374    case OG_NOTIFICATION_NEVER: 
     375      $form['mail_type'] = array('#type' => 'item', '#title' => t('Email notification'), '#value' => t('Your <a href="!prof">personal profile</a> is configured to: <em>Never receive email notifications</em>.', array('!prof' => url("user/$user->uid/edit"))));  
     376      break; 
     377  } 
     378  if ($submit) { 
     379    $form['op'] = array('#type' => 'submit', '#value' => t('Submit')); 
     380  } 
    390381  $form['gid'] = array('#type' => 'value', '#value' => $group->nid); 
    391382  return $form; 
     
    406397 * @param $uid user ID of user 
    407398 * @param $args an array with details of this membership. Possible array keys are: 
    408      is_active, is_admin, created 
     399     is_active, is_admin, mail_type, created 
    409400 */ 
    410401function og_save_subscription($gid, $uid, $args = array()) { 
     
    412403  $cnt = db_result(db_query($sql, $gid, $uid)); 
    413404  $time = time(); 
    414    
    415   // Allow other modules to pass their data inside the $args. 
    416   $og_allowed_args = array('is_active', 'is_admin', 'created'); 
    417   $return_args = $args; 
    418   foreach ($args as $key => $value) { 
    419     if (!in_array($key, $og_allowed_args)) { 
    420       unset($args[$key]); 
    421     } 
    422   } 
    423405  if ($cnt == 0) { 
    424406    // this pattern borrowed from user_save() 
     
    429411      $fields[] = db_escape_string($key); 
    430412      $values[] = $value; 
    431       $s[] = "'%s'";         
     413      $s[] = "'%s'"; 
    432414    } 
    433415    db_query('INSERT INTO {og_uid} ('. implode(', ', $fields). ') VALUES (%d, %d, %d, %d, '. implode(', ', $s). ')', $values); 
    434     module_invoke_all('og', 'user insert', $gid, $uid, $return_args); 
     416    module_invoke_all('og', 'user insert', $gid, $uid, $args); 
    435417  } 
    436418  else { 
     
    441423    $cond = implode(', ', $cond); 
    442424    db_query("UPDATE {og_uid} SET $cond WHERE nid = %d AND uid = %d", $gid, $uid); 
    443     module_invoke_all('og', 'user update', $gid, $uid, $return_args); 
    444   } 
    445 } 
    446  
    447 function og_delete_subscription($gid, $uid, $args = array()){ 
     425    module_invoke_all('og', 'user update', $gid, $uid, $args); 
     426  } 
     427} 
     428 
     429function og_delete_subscription($gid, $uid){ 
    448430  $sql = "DELETE FROM {og_uid} WHERE nid = %d AND uid = %d"; 
    449431  db_query($sql, $gid, $uid); 
    450   // Allow other modules to pass their data inside the $args. 
    451   module_invoke_all('og', 'user delete', $gid, $uid, $args); 
     432  module_invoke_all('og', 'user delete', $gid, $uid, array()); 
    452433} 
    453434 
     
    461442    } 
    462443    if (in_array($gid, array_keys($account->og_groups))) { 
    463       drupal_set_message(t("!name already approved to group %group.", array('!name' => theme('username', $account), '%group' => $node->title)), 'error'); 
     444      drupal_set_message(t("!name already approved to group %group", array('!name' => theme('username', $account), '%group' => $node->title)), 'error'); 
    464445      return ''; 
    465446    } 
     
    469450            
    470451      $variables = array( 
    471         '@title' => $node->title, 
    472         '!group_url'=> url("node/$node->nid", NULL, NULL, TRUE) 
    473       ); 
    474       $message = array( 
    475         'subject' => _og_user_mail_text('og_approve_user_subject', $variables), 
    476         'body' => _og_user_mail_text('og_approve_user_body', $variables) 
    477       ); 
    478  
    479       module_invoke_all('og', 'user approve', $gid, $uid, $message); 
     452         '@title' => $node->title, 
     453         '!group_url'=> url("node/$node->nid", NULL, NULL, TRUE) 
     454      );      
     455       
     456      $from = variable_get('site_mail', ini_get('sendmail_from')); 
     457      $account = user_load(array('uid' => $uid)); 
     458      drupal_mail('og_approve', $account->mail, _og_user_mail_text('og_approve_user_subject', $variables), _og_user_mail_text('og_approve_user_body', $variables), $from); 
    480459      drupal_goto("node/$gid"); 
    481460    } 
     
    494473    $variables = array( 
    495474      '@title' => $node->title, 
    496       '!group_url'=> url("node/$node->nid", NULL, NULL, TRUE) 
     475      '!group_url' => url("node/$node->nid", NULL, NULL, TRUE) 
    497476    ); 
    498     $message = array( 
    499       'subject' => _og_user_mail_text('og_deny_user_subject', $variables), 
    500       'body' => _og_user_mail_text('og_deny_user_body', $variables) 
    501     ); 
    502  
    503     module_invoke_all('og', 'user deny', $gid, $uid, $message); 
     477     
     478    $from = variable_get('site_mail', ini_get('sendmail_from')); 
     479    $account = user_load(array('uid' => $uid)); 
     480    drupal_mail('og_deny', $account->mail, _og_user_mail_text('og_deny_user_subject', $variables), _og_user_mail_text('og_deny_user_body', $variables), $from); 
    504481    drupal_goto("node/$gid"); 
    505482  } 
     
    542519   
    543520  og_save_subscription($node->nid, $account->uid, array('is_admin' => 1)); 
    544   drupal_set_message(t('%name was promoted to %ga.', array('%name' => $account->name, '%ga' => t('group administrator')))); 
     521  drupal_set_message(t('%name was promoted to %ga', array('%name' => $account->name, '%ga' => t('group administrator')))); 
    545522   
    546523  $variables = array( 
     
    549526    '@username' => $account->name 
    550527  ); 
    551   $message = array( 
    552     'subject' => _og_user_mail_text('og_new_admin_subject', $variables), 
    553     'body' => _og_user_mail_text('og_new_admin_body', $variables) 
    554   ); 
    555  
    556   module_invoke_all('og', 'admin create', $node->nid, $account->uid, $message); 
     528   
     529  $from = variable_get('site_mail', ini_get('sendmail_from')); 
     530  drupal_mail('og_new_admin', $account->mail, _og_user_mail_text('og_new_admin_subject', $variables), _og_user_mail_text('og_new_admin_body', $variables), $from); 
    557531  return "og/users/$node->nid"; 
    558532} 
     
    590564  $gid = $form_values['gid']; 
    591565  og_save_subscription($gid, $account->uid, array('is_admin' => 0)); 
    592   drupal_set_message(t('%name is no longer a %ga.', array('%name' => $account->name, '%ga' => t('group administrator')))); 
     566  drupal_set_message(t('%name is no longer a %ga', array('%name' => $account->name, '%ga' => t('group administrator')))); 
    593567  return "og/users/$gid"; 
    594568} 
     
    625599  $emails = explode(',', $mails); 
    626600  if (count($emails) > $max) { 
    627     form_set_error('mails', t('You may not specify more than %max email addresses or usernames.', array('%max' => $max))); 
     601    form_set_error('mails', t("You may not specify more than %max email addresses or usernames.", array('%max' => $max))); 
    628602  } 
    629603  elseif (in_array($user->mail, $emails)) { 
    630     form_set_error('mails', t('You may not invite yourself - @self', array('@self' => $user->mail))); 
     604    form_set_error('mails', t("You may not invite yourself - @self", array('@self' => $user->mail))); 
    631605  } 
    632606  else { 
     
    652626    } 
    653627    if (count($bad)) { 
    654       form_set_error('mails', t('Invalid email address or username:') .' '. implode(' ', $bad)); 
     628      form_set_error('mails', t('invalid email address or username: '). implode(' ', $bad)); 
    655629    } 
    656630    else { 
     
    696670  } 
    697671  $node = node_load($gid); 
    698   if ($node->og_selective >= OG_INVITE_ONLY || $node->status == 0 || !og_is_group_type($node->type)) { 
     672  if ($node->og_selective >= OG_INVITE_ONLY || $node->status == 0) { 
    699673    drupal_access_denied(); 
    700674    exit(); 
     
    744718 
    745719/** 
    746  * Create a new membership for a given user to given group. Edits to membership should  
     720 * Create a new membership for a given user to given group and send proper email. Edits to membership should  
    747721 * go through og_save_subscription(). No access control since this is an API function. 
    748722 * 
     
    755729    case OG_MODERATED: 
    756730      og_save_subscription($gid, $account->uid, array('is_active' => 0)); 
    757  
    758731      $sql = og_list_users_sql(1, 1); 
    759732      $res = db_query($sql, $node->nid); 
    760       $admins = array(); 
    761733      while ($row = db_fetch_object($res)) { 
    762         $admins[] = $row->uid; 
    763       } 
    764  
    765       if (!empty($admins)) { 
    766         // Prepend user's request text with standard cruft. Should be a 
    767         // variable but that's a bit annoying. 
    768         if ($request) { 
    769           $request = t("\n\nPersonal message from @name:\n------------------\n\n@request", array('@name' => $account->name, '@request' => $request)); 
     734        if ($row->mail) { 
     735          $admins[] = $row->mail; 
    770736        } 
     737      } 
     738      if ($admins) {         
    771739        $variables = array( 
    772740          '@group' => $node->title, 
     
    775743          '!group_url' => url("og/users/$node->nid", NULL, NULL, TRUE) 
    776744        ); 
    777         $message = array( 
    778           'subject' => _og_user_mail_text('og_request_user_subject', $variables), 
    779           'body' => _og_user_mail_text('og_request_user_body', $variables) . $request 
    780         ); 
    781  
    782         // Send notifications to each admin; Sending an array of recipients 
    783         // implies that this is a bulk message. 
    784         module_invoke_all('og', 'user request', $gid, $admins, $message); 
    785       } 
    786  
     745         
     746        $from = variable_get('site_mail', ini_get('sendmail_from')); 
     747        // prepend user's request text with standard cruft. should be a mail variable but thats a bit annoying 
     748        if ($request) { 
     749          $request = t("\n\nPersonal message from @name:\n------------------\n\n@request", array('@name' => $account->name, '@request' => $request)); 
     750        } 
     751        drupal_mail('og_subscription_request', implode(', ', $admins), _og_user_mail_text('og_request_user_subject', $variables), _og_user_mail_text('og_request_user_body', $variables). $request, $from); 
     752      } 
    787753      $return_value = array('type' => 'approval', 
    788754                            'message' => t('Membership request to the %group group awaits approval by an administrator.', array('%group' => $node->title))); 
     
    792758      og_save_subscription($gid, $account->uid, array('is_active' => 1)); 
    793759      $return_value = array('type' => 'subscribed', 
    794                             'message' => t('You are now a member of the %group.', array('%group' => $node->title))); 
     760                            'message' => t('You are now a member of the %group', array('%group' => $node->title))); 
    795761      break; 
    796762    case OG_CLOSED: 
     
    814780  } 
    815781  $node = node_load($gid); 
    816   $account = user_load(array('uid' => $uid)); 
    817   if (!in_array($gid, array_keys(og_get_subscriptions($account->uid, 0))) || ($uid != $user->uid && !og_is_node_admin($node))) { 
    818     // Ubsubscribee must be a member or awaiting approval 
    819     // Only admins can remove another member. 
     782  if ($uid != $user->uid && !og_is_node_admin($node)) { 
     783    // only admins can remove another member 
    820784    drupal_access_denied(); 
    821785    exit(); 
    822786  } 
    823   if (!og_is_group_type($node->type) || ($node->og_selective == OG_CLOSED && !og_is_node_admin($node)) || $node->uid == $uid){ 
     787  if (($node->og_selective == OG_CLOSED && !og_is_node_admin($node)) || $node->uid == $uid){ 
    824788    // Regular users may not leave from a closed group 
    825789    // Group manager may never leave (TODO: fix), such a link should never be generated 
     
    916880    } 
    917881    else { 
    918       $bad[] = check_plain($name); 
     882      $bad[] = $name; 
    919883      $err = TRUE; 
    920884    } 
    921885  } 
    922886  if ($err) { 
    923     form_set_error('og_names', t('Unrecognized %names:', array('%names' => format_plural(count($bad), 'name', 'names'))) .' '. implode(', ', $bad)); 
     887    form_set_error('og_names', t('Unrecognized %names: ', array('%names' => format_plural(count($bad), 'name', 'names'))). implode(', ', $bad)); 
    924888  } 
    925889} 
     
    937901    og_save_subscription($form_values['gid'], $account->uid, array('is_active' => 1)); 
    938902  } 
    939   drupal_set_message(format_plural(count($accounts), '1 user added to the group.', '@count users added to the group.')); 
     903  drupal_set_message(format_plural(count($accounts), '1 user added to the group', '@count users added to the group')); 
    940904} 
    941905 
     
    948912  // prepend the group manager 
    949913  $i=0; 
    950   $rows[$i][] = array('data' => theme('username', $node). '&nbsp;<em>'. t('Manager'). '</em>', 'colspan' => 3); 
     914  $rows[$i][] = array('data' => theme('username', $node). '&nbsp;<em>'. t('manager'). '</em>', 'colspan' => 3); 
    951915  $i++; 
    952916 
     
    957921      if ($account->uid != $node->uid) { 
    958922        $username = theme('username', $account); 
    959         if  (!$account->is_active)  { $username .= '&nbsp;<em>'. t('(approval needed)'). '</em>'; } 
    960         elseif ($account->is_admin) { $username .= '&nbsp;<em>'. t('Administrator'). '</em>'; } 
     923        if  (!$account->is_active)  { $username .= '&nbsp;<em>'.t('(approval needed)'). '</em>'; } 
     924        elseif ($account->is_admin) { $username .= '&nbsp;<em>'.t('administrator'). '</em>'; } 
    961925        $rows[$i][] = $username; 
    962926        if ($access) { 
    963927          if ($account->is_active) { 
    964             $rows[$i][] = l(t('Remove'), "og/unsubscribe/$gid/$account->uid", array(), "destination=og/users/$gid"); 
     928            $rows[$i][] = l(t('remove'), "og/unsubscribe/$gid/$account->uid", array(), "destination=og/users/$gid"); 
    965929            if ($account->is_admin) { 
    966               $rows[$i][] = l(t('Admin: Remove'), "og/delete_admin/$gid/$account->uid", array(), 'destination='. $_GET['q']); 
     930              $rows[$i][] = l(t('admin: remove'), "og/delete_admin/$gid/$account->uid", array(), 'destination='. $_GET['q']); 
    967931            } 
    968932            else { 
    969               $rows[$i][] = l(t('Admin: Create'), "og/create_admin/$gid/$account->uid", array(), 'destination='. $_GET['q']); 
     933              $rows[$i][] = l(t('admin: create'), "og/create_admin/$gid/$account->uid", array(), 'destination='. $_GET['q']); 
    970934            } 
    971935          } 
    972936          else { 
    973             $rows[$i][] = l(t('Approve'), "og/approve/$gid/$account->uid", array(), "destination=og/users/$gid"); 
    974             $rows[$i][] = l(t('Deny'), "og/deny/$gid/$account->uid", array(), "destination=og/users/$gid"); 
     937            $rows[$i][] = l(t('approve'), "og/approve/$gid/$account->uid", array(), "destination=og/users/$gid"); 
     938            $rows[$i][] = l(t('deny'), "og/deny/$gid/$account->uid", array(), "destination=og/users/$gid"); 
    975939          } 
    976940        } 
     
    992956function og_list_users_faces_page($gid, $column_count = 5, $row_count = 10, $pager_id = 0) { 
    993957  $max_per_page = $row_count * $column_count; 
    994   $sql = og_list_users_sql(1, 0, 'ou.is_admin DESC, u.picture DESC, u.name ASC'); 
     958  $sql = og_list_users_sql(0, 0, 'ou.is_admin DESC, u.picture DESC, u.name ASC'); 
    995959  /* list group admins first, members with pics second, regular members last.  Alphabetize within each of these categories */ 
    996960  $result = pager_query($sql, $max_per_page, $pager_id, NULL, $gid); 
     
    1032996  $content .= '</table>'; 
    1033997   
    1034   if ($total) { 
     998  if ($content) { 
    1035999    return $content; 
    10361000  } 
     
    11091073    unset($node->content['body']); 
    11101074    $node->content['og_mission'] = array( 
    1111       '#value' => $node->body, // node_prepare() already ran check_markup()  
     1075      '#value' => check_markup($node->body, $node->format, FALSE),  
    11121076      '#node' => $node, 
    11131077      '#weight' => -3, 
     
    11371101        og_home_empty($node); 
    11381102      } 
    1139       drupal_set_title(check_plain(views_get_title($view, 'page'))); 
     1103      drupal_set_title(filter_xss_admin(views_get_title($view, 'page'))); 
    11401104    }  
    11411105  } 
     
    13061270 
    13071271function og_load_group(&$node) { 
    1308   $sql = 'SELECT selective AS og_selective, description AS og_description, theme AS og_theme, register AS og_register, directory AS og_directory, language AS og_language, private AS og_private FROM {og} WHERE nid = %d'; 
     1272  $sql = 'SELECT selective AS og_selective, description AS og_description, theme AS og_theme, register AS og_register, directory AS og_directory, notification AS og_notification, language AS og_language, private AS og_private FROM {og} WHERE nid = %d'; 
    13091273  $result = db_query($sql, $node->nid); 
    13101274  $node = (object) array_merge((array)$node, (array)db_fetch_array($result)); 
     
    13131277 
    13141278function og_insert_group($node) { 
    1315   $sql = "INSERT INTO {og} (nid, theme, selective, description, register, directory, language, private) VALUES (%d, '%s', %d, '%s', %d, %d, '%s', %d)"; 
    1316   db_query($sql, $node->nid, $node->og_theme, $node->og_selective, $node->og_description, $node->og_register, $node->og_directory, $node->og_language, $node->og_private); 
     1279  $sql = "INSERT INTO {og} (nid, theme, selective, description, register, directory, notification, language, private) VALUES (%d, '%s', %d, '%s', %d, %d, %d, '%s', %d)"; 
     1280  db_query($sql, $node->nid, $node->og_theme, $node->og_selective, $node->og_description, $node->og_register, $node->og_directory, $node->og_notification, $node->og_language, $node->og_private); 
    13171281} 
    13181282 
    13191283function og_update_group($node) { 
    1320   $sql = "UPDATE {og} SET theme = '%s', selective = %d, register = %d, description = '%s', directory = %d, language = '%s', private = %d WHERE nid = %d"; 
    1321   db_query($sql, $node->og_theme, $node->og_selective, $node->og_register, $node->og_description, $node->og_directory, $node->og_language, $node->og_private, $node->nid); 
     1284  $sql = "UPDATE {og} SET theme = '%s', selective = %d, register = %d, description = '%s', directory = %d, notification = %d, language = '%s', private = %d WHERE nid = %d"; 
     1285  db_query($sql, $node->og_theme, $node->og_selective, $node->og_register, $node->og_description, $node->og_directory, $node->og_notification, $node->og_language, $node->og_private, $node->nid); 
    13221286  if (!db_affected_rows()) { 
    13231287    og_insert_group($node);   
     
    13621326      break; 
    13631327    case 'validate': 
    1364       // Ensure that a group is selected if groups are required. needed when author has no groups. In other cases, fapi does the validation 
    1365       if (og_is_group_post_type($node->type) && variable_get('og_audience_required', FALSE) && !user_access('administer nodes')) { 
    1366         if (!isset($node->og_groups)) { 
    1367           form_set_error('title', t('You must !join before posting on this web site.', array('!join' => l(t('join a group'), 'og')))); 
     1328      if (og_is_group_type($node->type)) { 
     1329        // Email address is required for contacting the Manager 
     1330        $account = user_load(array('uid' => $node->uid)); 
     1331        if ($account->uid > 0 && empty($account->mail)) { 
     1332          form_set_error('name', t('The group manager, %name, must have an email address in his <a href="!profile">profile</a>.', array('%name' => $account->name, '!profile' => url("user/$node->uid/edit")))); 
    13681333        } 
     1334         
     1335        // Must be authored in the default input format or else admins might not get their admin perms 
     1336        // If Body field is omitted, there may not yet be a $node->format 
     1337        if (isset($node->format) && $node->format != filter_resolve_format(FILTER_FORMAT_DEFAULT)) { 
     1338          form_set_error('body', t("You must use the default input format when authoring a group node.")); 
     1339        } 
     1340      } 
     1341      else { 
     1342        // Ensure that a group is selected if groups are required. needed when author has no groups. In other cases, fapi does the validation 
     1343        if (og_is_group_post_type($node->type) && variable_get('og_audience_required', FALSE) && !user_access('administer nodes')) { 
     1344          if (!isset($node->og_groups)) { 
     1345            form_set_error('title', t('You must !join before posting on this web site.', array('!join' => l(t('join a group'), 'og')))); 
     1346          } 
     1347        } 
     1348         
    13691349      } 
    13701350      break; 
     
    14031383          '!invite_url' => url("og/invite/$node->nid", NULL, NULL, TRUE) 
    14041384        ); 
    1405         $message = array( 
    1406           'subject' => _og_user_mail_text('og_new_admin_subject', $variables), 
    1407           'body' => _og_user_mail_text('og_new_admin_body', $variables) 
    1408         ); 
    1409  
    1410         // Alert the user that they are now the admin of the group. 
    1411         module_invoke_all('og', 'admin new', $gid, $account->uid, $message); 
     1385 
     1386        // alert the user that they are now the admin of the group   
     1387        $from = variable_get('site_mail', ini_get('sendmail_from')); 
     1388        drupal_mail('og_new_admin', $account->mail, _og_user_mail_text('og_new_admin_subject', $variables), _og_user_mail_text('og_new_admin_body', $variables), $from);       
    14121389      } 
    14131390      else { 
    14141391        og_save_ancestry($node); 
     1392      } 
     1393       
     1394      $skip_notification = FALSE;  
     1395      // Any module that returns TRUE from its hook_og_notify($node) will prevent sending notifications. 
     1396      // og2list and og_subscriptions use this to send own notifications. 
     1397      foreach(module_implements('og_notify') as $module) { 
     1398        if (module_invoke($module,'og_notify',$node)) { 
     1399          $skip_notification = TRUE; 
     1400          break; 
     1401        } 
     1402      } 
     1403      if (!$skip_notification && $node->status && og_is_mail_type($node->type) && $node->og_groups) { 
     1404        if (module_exists('job_queue')) { 
     1405          $description = t('OG: notify group members about node %nid - !link', array('%nid' => $node->nid, '!link' => l($node->title, "node/$node->nid"))); 
     1406          job_queue_add('og_mail', $description, array('node', $node->nid)); 
     1407        } 
     1408        else { 
     1409          og_mail('node', $node); 
     1410        } 
    14151411      } 
    14161412      break; 
     
    14391435          $ret[] = array('key'   => 'group', 
    14401436                         'value' => check_plain($title), 
    1441                          'attributes' => array( 
    1442                            'domain' => url("node/$gid", NULL, NULL, TRUE), 
    1443                            'xmlns' => 'http://drupal.org/project/og', 
    1444                           ), 
    1445           ); 
     1437                         'attributes' => array('domain' => url("node/$gid", NULL, NULL, TRUE))); 
    14461438        } 
    14471439        // to get these modifications to work on 4.7, one needs to patch as per http://drupal.org/node/41703 
     
    15081500 
    15091501  if ($form_id == 'views_edit_view') { 
    1510     $form['page-info']['url']['#description'] .= '<p>'. t("To display a View as a tab on your Organic Groups group home pages, set the url to 'node/\$group/custom' (where <em>custom</em> is whatever you wish). Then open Page >> Menu and check <em>Provide Menu</em> and <em>Provide Menu as Tab</em>; also make the first argument in the View be the <em>OG: Group nid(s)</em> argument. The <em>\$group</em> path element is a placeholder for the group nid and it ensures that the tab <strong>only</strong> appears on OG group nodes.") .'</p>'; 
     1502    $form['page-info']['url']['#description'] .= t("<p>To display a View as a tab on your Organic Groups group home pages, set the url to 'node/\$group/custom' (where <em>custom</em> is whatever you wish). Then open Page >> Menu and check <em>Provide Menu</em> and <em>Provide Menu as Tab</em>; also make the first argument in the View be the <em>OG: Group nid(s)</em> argument. The <em>\$group</em> path element is a placeholder for the group nid and it ensures that the tab <strong>only</strong> appears on OG group nodes.</p>"); 
    15111503  } 
    15121504   
     
    15691561function og_node_delete_group_form(&$form) { 
    15701562  $options[] = t('Do nothing.'); 
    1571   $options[] = t("Delete all group posts which don't also belong to another group."); 
     1563  $options[] = t('Delete all group posts which don\'t also belong to another group.'); 
    15721564  if (user_access('administer nodes')) { 
    15731565    $options[] = t('Move all group posts to the group listed below.'); 
     
    15781570    unset($options[$form['nid']['#value']]); 
    15791571    $form['target'] = array('#type' => 'select', '#title' => t('Target group'), '#default_value' => 0, '#options' => $options, '#weight' => 0, '#description' => t('If you chose <b>Move all group posts</b> above, specify a destination group.')); 
    1580   } 
    1581   // register a submit handler 
    1582   $form['#submit']['og_node_delete_confirm_submit'] = array(); 
     1572    // register a submit handler 
     1573    $form['#submit']['og_node_delete_confirm_submit'] = array(); 
     1574  } 
    15831575  $form['actions']['submit']['#value'] = t('Delete group'); 
    15841576} 
     
    16041596} 
    16051597 
    1606 // Submit handler for node delete form. handles deletes to group nodes. 
     1598// submit handler for node delete form. handles deletes to group nodes 
    16071599function og_node_delete_confirm_submit($form_id, $form_values) { 
    16081600  $deleted_group_nid = $form_values['nid']; 
     
    16141606    unset($node->og_groups[$deleted_group_nid]); 
    16151607    if ($move_children) { 
    1616       // There is an array_unique() in og_save_ancestry() which guards against duplicates so don't worry here. 
    1617       $node->og_groups[$target_group_nid] = $target_group_nid; 
     1608      // there is an array_unique() in og_save_ancestry which giards against duplicates so don't worry here. 
     1609      $node->og_groups[] = $target_group_nid; 
    16181610    } 
    16191611    if ($delete_orphans && count($node->og_groups) == 0) { 
     
    17461738  } 
    17471739   
    1748   // Show read only item if we are non-admin, and in simple mode (i.e. non-checkboxes) and at least one group is in querystring 
     1740  // show read only item if we are non-admin, and in simple mode (i.e. non-checkboxes) and at least one group is in querystring 
    17491741  $simple = !user_access('administer organic groups') && !variable_get('og_audience_checkboxes', TRUE) && count($gids); 
    17501742   
     
    17831775    if (count($groups)) { 
    17841776      foreach ($groups as $gid) { 
    1785         $titles[] = check_plain($options[$gid]); 
     1777        $titles[] = $options[$gid]; 
    17861778        $item_value = implode(', ', $titles); 
    17871779      } 
     
    18171809} 
    18181810 
     1811function og_comment($comment, $op) { 
     1812  switch ($op) { 
     1813    case 'publish': 
     1814      $comment = (array) $comment; 
     1815      // fall through 
     1816    case 'insert': 
     1817      $skip_notification = FALSE;  
     1818      // Any module that returns true from its hook_og_notify($node) will prevent sending notifications. 
     1819      // og2list uses this to send its own notifications instead for mailing list content. 
     1820      $node = node_load($comment['nid']); 
     1821 
     1822      foreach(module_implements('og_notify') as $module) { 
     1823        if (module_invoke($module, 'og_notify', $node)) { 
     1824          $skip_notification = TRUE; 
     1825          break; 
     1826        } 
     1827      } 
     1828      // remove the perm check after 5.3 is released. 
     1829      if ($comment['status'] == COMMENT_PUBLISHED && !$skip_notification && og_is_mail_type($node->type) && isset($node->og_groups) && !empty($node->og_groups)) { 
     1830        if (module_exists('job_queue')) { 
     1831          $description = t('OG: notify group members about comment %id on !link', array('%id' => $comment['cid'], '!link' => l($node->title, "node/$node->nid", NULL, NULL, 'comment-'. $comment['cid']))); 
     1832          job_queue_add('og_mail', $description, array('comment', $comment['cid'])); 
     1833        } 
     1834        else { 
     1835          og_mail('comment', (object)$comment); 
     1836        } 
     1837      } 
     1838      break; 
     1839  }   
     1840} 
     1841 
     1842 
     1843/** 
     1844 * Send this node/comment via email to all email members. Called from og_nodeapi() and og_comment(). 
     1845 * Sometimes called from during cron if job_queue.module is enabled (recommended). 
     1846 * TODO: this function is a bit messy. rethink. 
     1847 * 
     1848 * @param $type 
     1849 *   the object type: node or comment 
     1850 * @param $id 
     1851 *   a node or comment object. if a non object is supplied, a load() operation is performed. 
     1852 * @return 
     1853 *   none 
     1854 */ 
     1855function og_mail($type, $obj) { 
     1856  if ($type == 'comment') { 
     1857    if (!is_object($obj)) { 
     1858      $obj = _comment_load($obj); 
     1859    } 
     1860    // registered user 
     1861    if ($obj->uid) { 
     1862      $account = user_load(array('uid' => $obj->uid)); 
     1863      $obj->name = $account->name; 
     1864    } 
     1865    else { 
     1866      $obj->name = variable_get('anonymous', 'Anonymous'); 
     1867    } 
     1868    $rendered = check_markup($obj->comment, $obj->format, FALSE); 
     1869     
     1870    $obj->body = $rendered; 
     1871    $obj->teaser = $rendered; 
     1872    $originalurl = url("node/$obj->nid", NULL, "comment-$obj->cid", TRUE); 
     1873    $replyurl = url("comment/reply/$obj->nid/$obj->cid", NULL, NULL, TRUE); 
     1874    $node = node_load($obj->nid); 
     1875    $obj->og_groups = $node->og_groups; 
     1876    $obj->title = $node->title; 
     1877    $obj->msgid = $obj->nid. '-'. $obj->cid. og_msgid_server(); 
     1878    $reply = $obj->nid. '-'; 
     1879    if ($obj->pid) { 
     1880      $reply .= $obj->pid; 
     1881    } 
     1882    else { 
     1883      $reply .= '0'; 
     1884    } 
     1885    $obj->in_reply_to .= $reply. og_msgid_server(); 
     1886    $type_friendly = 'comment'; 
     1887  } 
     1888  else { 
     1889    if (!is_object($obj)) { 
     1890      $obj = node_load($obj); 
     1891    } 
     1892    $account = user_load(array('uid' => $obj->uid)); 
     1893    $obj->name = $account->name; 
     1894    $obj->subject = $obj->title; 
     1895    // These calls to og_node_view() setup the node body and teaser, apply the 
     1896    // appropriate input filters, and handle CCK fields, event fields, etc. 
     1897    $obj->body = og_node_view($obj, FALSE); 
     1898    $obj->teaser = og_node_view($obj, TRUE); 
     1899    $obj->msgid = $obj->nid. '-0'. og_msgid_server(); 
     1900    $originalurl = url("node/$obj->nid", NULL, NULL, TRUE); 
     1901    $replyurl = url("comment/reply/$obj->nid", NULL, 'comment-form', TRUE); 
     1902    $type_friendly = node_get_types('name', $obj); 
     1903  } 
     1904   
     1905  // set email from variables 
     1906  $variables = array( 
     1907    '@user_mail' => $account->mail ? $account->mail : variable_get("site_mail", ini_get("sendmail_from")), 
     1908    '@user_name' => mime_header_encode($obj->name), 
     1909    '@site_mail' => variable_get("site_mail", ini_get("sendmail_from")), 
     1910    '@site_name' => mime_header_encode(variable_get("site_name", 'Drupal')), 
     1911  ); 
     1912  $from_mail = strtr(variable_get("og_email_notification_pattern", '@user_name  <@site_mail>'), $variables);  
     1913 
     1914  $headers = array('X-Mailer' => 'Drupal - og_mail', 'Precedence' => 'list', 'Message-Id' => "<$obj->msgid>"); 
     1915  if ($obj->in_reply_to) { 
     1916    $headers['In-Reply-To'] =  "<$obj->in_reply_to>"; 
     1917  } 
     1918 
     1919  // set email body variables 
     1920  $variables = array( 
     1921    '@site' => variable_get('site_name', 'drupal'),  
     1922    '!read_more' => $obj->readmore ? t('Read more') : t('View original'), 
     1923    '!content_url' => $originalurl, 
     1924    '!reply_url' => $replyurl, 
     1925    '@title' => trim($obj->title), 
     1926    '@subject' => trim($obj->subject), 
     1927    '@node_full' => trim(og_mail_output($obj->body)), 
     1928    '@node_teaser' => trim(og_mail_output($obj->teaser)), 
     1929    '@username' => $obj->name 
     1930  ); 
     1931   
     1932  // Send email to selective subscribers and global subscribers. 
     1933  // We use if() here in case node/comment no longer has any groups (i.e. this function can be called from cron). 
     1934  if (is_array($obj->og_groups) && !empty($obj->og_groups)) { 
     1935    $groups = implode(', ', $obj->og_groups); 
     1936    // tricky query here. mysql returns NULL in the case of NULL != 0 so i rework this for 2 positive statements about og_email field 
     1937    // ORDER BY favors newer groups to help them get ramped up. Thus, they are perceived as active. 
     1938    $sql = "SELECT u.mail, ou.nid AS gid, n.title AS group_name, n.uid AS group_uid, u.name AS group_owner, oug.og_email  
     1939            FROM {og_uid} ou INNER JOIN {users} u ON ou.uid=u.uid  
     1940            INNER JOIN {og_uid_global} oug ON ou.uid=oug.uid  
     1941            INNER JOIN {node} n ON ou.nid=n.nid  
     1942            WHERE ou.nid IN ($groups) AND ( 
     1943              (oug.og_email = %d AND ou.mail_type=1) OR 
     1944              (oug.og_email = %d) 
     1945              ) AND u.status = 1 AND u.mail != '' AND ou.is_active = 1  
     1946              ORDER by u.mail DESC, n.created DESC 
     1947              "; 
     1948    $result = db_query($sql, OG_NOTIFICATION_SELECTIVE, OG_NOTIFICATION_ALWAYS); 
     1949    $last_mail = ''; 
     1950    while ($row = db_fetch_object($result)) { 
     1951      // only notify each user once. we used to do this with GROUP BY but got very hard to assure that all the selected fields came from same record. 
     1952      if ($row->mail == $last_mail) { 
     1953        continue; 
     1954      } 
     1955      $last_mail = $row->mail; 
     1956       
     1957      // TODO: add node_access('view') call here in case node is moderated or other. 
     1958      // Hopefully D6 will avert need to impersonate. 
     1959      // Append these group specific variables. 
     1960      $variables['@group'] = $row->group_name; 
     1961      $variables['!group_url'] = url("og/manage/$row->gid", NULL, NULL, TRUE); 
     1962      $variables['@type'] = $type_friendly; 
     1963 
     1964      $unsubscribe = url("og/manage/$row->gid", NULL, NULL, TRUE); 
     1965      $ownerurl = url("user/$row->group_uid", NULL, NULL, TRUE); 
     1966      $group_home = url("node/$row->gid", NULL, NULL, TRUE); 
     1967      $groupheaders = $headers + array( 
     1968        'List-Id' => mime_header_encode($row->group_name). " <$group_home>",  
     1969        'List-Unsubscribe' => "<$unsubscribe>",  
     1970        'List-Owner' => mime_header_encode($row->group_owner). " <$ownerurl>",  
     1971        "List-Archive" => "<$group_home>" 
     1972      ); 
     1973      drupal_mail('og_mail', $row->mail, _og_user_mail_text('og_new_node_subject', $variables), _og_user_mail_text('og_new_node_body', $variables), $from_mail, $groupheaders); 
     1974    } 
     1975  } 
     1976} 
     1977 
    18191978/** 
    18201979 * Similar to node_view() but without calling theme('node'). 
    18211980 * 
    18221981 * This is needed to get the proper body or teaser for nodes (e.g. Event, 
    1823  * Location, CCK node types) and to clean up the body for use in notifications. 
     1982 * Location, CCK node types) and to clean up the body for use in email 
     1983 * notifications. 
    18241984 * 
    18251985 * @param $node 
     
    18532013} 
    18542014 
    1855 /** 
    1856  * Define all OG message strings. 
     2015// 2 functions ripped from mail.inc in project.module package 
     2016function og_mail_urls($url = 0) { 
     2017  static $urls = array(); 
     2018  if ($url) { 
     2019    $urls[] = strpos($url, '://') ? $url : url($url, NULL, NULL, 1); 
     2020    return count($urls); 
     2021  } 
     2022  return $urls; 
     2023} 
     2024 
     2025// takes filtered HTML as input and transforms for email 
     2026// modified from project.module  
     2027function og_mail_output($body, $html = TRUE) { 
     2028  static $i = 0; 
     2029 
     2030  if ($html) { 
     2031    $pattern = '@<a +([^ >]+ )*?href *= *"([^>"]+?)"[^>]*>([^<]+?)</a>@ei'; 
     2032    $body = preg_replace($pattern, "'\\3 ['. og_mail_urls('\\2') .']'", $body); 
     2033    $urls = og_mail_urls(); 
     2034    if (count($urls)) { 
     2035      $body .= "\n"; 
     2036      for ($max = count($urls); $i < $max; $i++) { 
     2037        $body .= '['. ($i + 1) .'] '. $urls[$i] ."\n"; 
     2038      } 
     2039    } 
     2040 
     2041    $body = preg_replace('!</?blockquote>!i', '"', $body); 
     2042    $body = preg_replace('!</?(em|i)>!i', '/', $body); 
     2043    $body = preg_replace('!</?(b|strong)>!i', '*', $body); 
     2044    $body = preg_replace("@<br />(?!\n)@i", "\n", $body); 
     2045    $body = preg_replace("@</p.*>(?!\n\n)@i", "\n\n", $body); 
     2046    $body = preg_replace("@</h1>(?!\n\n)@i", " #\n", $body); 
     2047    $body = preg_replace("@</h2>(?!\n\n)@i", " ##\n", $body); 
     2048    $body = preg_replace("@</h3>(?!\n\n)@i", " ###\n", $body); 
     2049    $body = preg_replace("@</h4>(?!\n\n)@i", " ####\n", $body); 
     2050    $body = preg_replace("@</(li|dd)>\n?@i", "\n", $body); 
     2051    $body = preg_replace("@<h1.*>@i", "\n\n# ", $body); 
     2052    $body = preg_replace("@<h2.*>@i", "\n\n## ", $body); 
     2053    $body = preg_replace("@<h3.*>@i", "\n\n### ", $body); 
     2054    $body = preg_replace("@<h4.*>@i", "\n\n#### ", $body); 
     2055    $body = preg_replace("@<li.*>@i", "* ", $body); 
     2056    $body = strip_tags($body); 
     2057    $body = decode_entities($body); 
     2058    $body = wordwrap($body, 72); 
     2059  } 
     2060  else { 
     2061    $body = decode_entities($body); 
     2062  } 
     2063  return $body; 
     2064} 
     2065 
     2066/** 
     2067 * Define all OG emails 
    18572068 * Modelled after Drupal's user.module 
    18582069 */ 
     
    18682079        return t("@group: '@title' at @site", $variables); 
    18692080      case 'og_new_node_body': 
    1870         return t("@type '@subject' by @username\n\n@node_teaser\n\n!read_more: !content_url\nPost reply: !reply_url\n\n--\nYou are subscribed from the group '@group' at @site.\nTo manage your subscription, visit !group_url.", $variables);     
     2081        return t("@type '@subject' by @username\n\n@node_teaser\n\n!read_more: !content_url\nPost reply: !reply_url\n\n--\nYou are subscribed from the group '@group' at @site.\nTo manage your subscription, visit !group_url", $variables);     
    18712082      case 'og_admin_email_body': 
    1872         return t("@body\n\n--\nThis message was sent by an administrator in the '@group' group at @site. To visit this group, browse to !url_group. To unsubscribe from this group, visit !url_unsubscribe.", $variables); 
     2083        return t("@body\n\n--\nThis message was sent by an administrator in the '@group' group at @site. To visit this group, browse to !url_group. To unsubscribe from this group, visit !url_unsubscribe", $variables); 
    18732084      case 'og_approve_user_subject': 
    18742085        return t("Membership request approved for '@title'", $variables); 
    18752086      case 'og_approve_user_body': 
    1876         return t("You may now post messages in this group located at !group_url.", $variables); 
     2087        return t("You may now post messages in this group located at !group_url", $variables); 
    18772088      case 'og_deny_user_subject': 
    1878         return t("Membership request denied for '@title'.", $variables); 
     2089        return t("Membership request denied for '@title'", $variables); 
    18792090      case 'og_deny_user_body': 
    18802091        return t("Sorry, your membership request was denied.", $variables); 
    18812092      case 'og_invite_user_subject': 
    1882         return t("Invitation to join the group '@group' at @site.", $variables); 
     2093        return t("Invitation to join the group '@group' at @site", $variables); 
    18832094      case 'og_invite_user_body': 
    18842095        return t("Hi. I'm a member of '@group' and I welcome you to join this group as well. Please see the link and message below.\n\n@group\n@description\nJoin: !group_url\n@body", $variables); 
    18852096      case 'og_request_user_subject': 
    1886         return t("Membership request for '@group' from '@username'.", $variables);         
     2097        return t("Membership request for '@group' from '@username'", $variables);         
    18872098      case 'og_request_user_body': 
    18882099        return t("To instantly approve this request, visit !approve_url.\nYou may deny this request or manage members at !group_url.", $variables);        
    18892100      case 'og_new_admin_subject': 
    1890         return t("You are now an administrator for the group '@group'.", $variables);         
     2101        return t("You are now an administrator for the group '@group'", $variables);         
    18912102      case 'og_new_admin_body': 
    18922103        return t("@username, you are now an administrator for the group '@group'.\n\nYou can administer this group by logging in here:\n !group_url", $variables);        
     
    19112122 */ 
    19122123function og_is_node_admin($node) { 
    1913   global $user; 
    1914   return og_is_group_type($node->type) && (user_access('administer nodes') || !empty($user->og_groups[$node->nid]['is_admin'])); 
     2124  return node_access('update', $node); 
    19152125} 
    19162126 
     
    19512161      } 
    19522162      return $form; 
     2163    case 'form': 
     2164      if ($category == 'account' && !empty($account->og_groups)) { 
     2165        $form['og_settings'] = array( 
     2166          '#type' => 'fieldset', 
     2167          '#title' => t('Organic groups settings'), 
     2168          '#collapsible' => TRUE, 
     2169          '#weight' => 4); 
     2170        $options = array(OG_NOTIFICATION_NEVER => t('Never send email notifications. Useful when tracking activity via RSS feed instead.'), 
     2171                         OG_NOTIFICATION_ALWAYS =>  t('Always send email notifications'), 
     2172                         OG_NOTIFICATION_SELECTIVE =>   t('Selectively send email notification based on the checkbox for each of my group\'s <em>My Membership</em> page'), 
     2173                          ); 
     2174                          
     2175        $form['og_settings']['og_email'] = array('#type' => 'radios',  
     2176                                            '#title' => t('Email notifications'),  
     2177                                            '#options' => $options,  
     2178                                            '#default_value' => isset($account->og_email) ? $account->og_email : variable_get('og_notification', 2), 
     2179                                            '#description' => t('When posts are submitted into your groups, you may be notified via email.'), 
     2180                                            ); 
     2181        return $form; 
     2182      } 
     2183      break; 
    19532184    case 'insert': 
    19542185      if (is_array($edit['og_register'])) { 
     
    19612192      } 
    19622193       
     2194      $sql = 'INSERT INTO {og_uid_global} (uid, og_email) VALUES (%d, %d)'; 
     2195      db_query($sql, $account->uid, variable_get('og_notification', OG_NOTIFICATION_ALWAYS)); 
     2196      $account->og_email = NULL; 
     2197      break; 
     2198    case 'update': 
     2199      if (isset($edit['og_email'])) { 
     2200        $sql = 'UPDATE {og_uid_global} SET og_email=%d WHERE uid=%d'; 
     2201        db_query($sql, $edit['og_email'], $account->uid); 
     2202        $account->og_email = NULL; 
     2203      } 
    19632204      break; 
    19642205    case 'delete': 
     2206      // user delete doesn't exist, but it should and will one day. 
     2207      $sql = 'DELETE FROM {og_uid_global} WHERE uid=%d'; 
     2208      db_query($sql, $account->uid); 
     2209 
    19652210      $sql = 'DELETE FROM {og_uid} WHERE uid=%d'; 
    19662211      db_query($sql, $account->uid); 
     
    19682213    case 'load': 
    19692214      $account->og_groups = og_get_subscriptions($account->uid); 
     2215 
     2216      $result = db_query("SELECT og_email FROM {og_uid_global} WHERE uid = %d", $account->uid); 
     2217      if (db_num_rows($result)) { 
     2218        $account->og_email = db_result($result); 
     2219      } 
    19702220      break; 
    19712221    case 'view': 
     
    20012251 */ 
    20022252function og_node_type($op, $info) { 
     2253  $values = variable_get($variable, array()); 
    20032254  switch ($op) { 
    20042255    case 'delete': 
     
    20162267    'group' => t('Group node'), 
    20172268    'omitted' => t('May not be posted into a group.'), 
    2018     'group_post_standard' => t('Standard group post (typically only author may edit).') 
     2269    'group_post_standard_mail' => t('Standard group post (typically only author may edit). Sends email notifications.'), 
     2270    'group_post_standard_nomail' => t('Standard group post (typically only author may edit). No email notification.'), 
    20192271  ); 
    20202272   
    20212273  if (module_exists('og_access')) { 
    2022     $usages['group_post_wiki'] = t('Wiki group post (any group member may edit).'); 
     2274    $usages['group_post_wiki_mail'] = t('Wiki group post (any group member may edit). Sends email notifications.'); 
     2275    $usages['group_post_wiki_nomail'] = t('Wiki group post (any group member may edit). No email notification.'); 
    20232276  } 
    20242277   
     
    20432296} 
    20442297 
     2298// returns TRUE if node type should generate email notifications when posted to a group. 
     2299function og_is_mail_type($type) { 
     2300  $usage = variable_get('og_content_type_usage_'. $type, 'omitted'); 
     2301  return strpos($usage, 'mail') && !strpos($usage, 'nomail') ? TRUE : FALSE; 
     2302} 
     2303 
    20452304// returns TRUE if node type lets all subscribers edit the node. 
    20462305function og_is_wiki_type($type) { 
     
    20772336  header("HTTP/1.1 301 Moved Permanently"); 
    20782337  header('Location: '. url("node/$gid/feed", NULL, NULL, TRUE)); 
    2079 } 
    2080  
    2081 /** 
    2082  * Check a user's membership in a group. Site admins always return TRUE. 
    2083  */ 
    2084 function og_is_group_member($gid, $user) { 
    2085   $groups = array_keys($user->og_groups); 
    2086   return user_access('administer nodes') || in_array($gid, $groups) ? TRUE : FALSE; 
    20872338} 
    20882339 
     
    21712422    // only members can see this block 
    21722423    if (in_array($groupnode->nid, array_keys($user->og_groups))) { 
    2173       $content = t('This group offers a !groupfeed and a !subscription.', array('!groupfeed' => l(t('RSS feed'), "node/$groupnode->nid/feed"), '!subscription' => l(t('subscription option'), 'og/manage/'. $groupnode->nid))); 
     2424      $content = t('This group offers a !groupfeed and an !email.', array('!groupfeed' => l(t('RSS feed'), "node/$groupnode->nid/feed"), '!email' => l(t('email subscription'), 'og/manage/'. $groupnode->nid))); 
    21742425      if (module_exists('views') && module_exists('views_rss')) { 
    21752426        // NOTE: See og.css for styling specific to these lists 
    2176         $content .= ' '. t('Or subscribe to these personalized, sitewide feeds:'); 
     2427        $content .= t(' Or subscribe to these personalized, sitewide feeds:'); 
    21772428        $inline = array('class' => 'links inline');       
    2178         $l1[] = array('title' => t('Feed'), 'href' => 'group/myunread/feed'); 
    2179         $l1[] = array('title' => t('Page'), 'href' => 'group/myunread'); 
    2180         $links['my_unread'] = t('My unread:') .' '. theme('links', $l1, $inline); 
     2429        $l1[] = array('title' => t('feed'), 'href' => 'group/myunread/feed'); 
     2430        $l1[] = array('title' => t('page'), 'href' => 'group/myunread'); 
     2431        $links['my_unread'] = t('my unread: '). theme('links', $l1, $inline); 
    21812432       
    2182         $l2[] = array('title' => t('Feed'), 'href' => 'group/mytracker/feed'); 
    2183         $l2[] = array('title' => t('Page'), 'href' => 'group/mytracker'); 
    2184         $links['my_group'] = t('My group:') .' '. theme('links', $l2, $inline); 
     2433        $l2[] = array('title' => t('feed'), 'href' => 'group/mytracker/feed'); 
     2434        $l2[] = array('title' => t('page'), 'href' => 'group/mytracker'); 
     2435        $links['my_group'] = t('my group: '). theme('links', $l2, $inline); 
    21852436       
    2186         $l3[] = array('title' => t('Feed'), 'href' => 'group/tracker/feed'); 
    2187         $l3[] = array('title' => t('Page'), 'href' => 'group/tracker'); 
    2188         $links['all_posts'] = t('All posts:') .' '. theme('links', $l3, $inline); 
     2437        $l3[] = array('title' => t('feed'), 'href' => 'group/tracker/feed'); 
     2438        $l3[] = array('title' => t('page'), 'href' => 'group/tracker'); 
     2439        $links['all_posts'] = array('data' => t('all posts: '). theme('links', $l3, $inline)); 
    21892440        $content .= theme('item_list', $links); 
    21902441      } 
     
    22602511 *   An HTML list. 
    22612512 **/ 
    2262 function og_block_subscribers_list($gid, $max = 10, $is_admin = array('members', 'admins'), $show_more = TRUE, $show_picture = NULL) { 
     2513function og_block_subscribers_list($gid, $max = 10, $is_admin = array('members', 'admin'), $show_more = TRUE, $show_picture = NULL) { 
    22632514  $placeholders = array_fill(0, count(array_filter($is_admin)), '%d'); 
    22642515  $placeholders = implode(', ', $placeholders); 
     
    23342585    } 
    23352586    $links['subscribers'] = $txt; 
    2336     $links['manager'] =  t('Manager:') .' '. theme('username', $node); 
     2587    $links['manager'] =  t('Manager: '). theme('username', $node); 
    23372588    $subscribe = isset($subscription) ? l(t('My membership'), "og/manage/$node->nid") : og_subscribe_link($node); 
    23382589    if(isset($subscribe)) { 
     
    24452696  return $form; 
    24462697} 
    2447  
    24482698function og_admin_settings() { 
    24492699  drupal_set_title(t('Organic groups configuration')); 
     
    24722722  $form['og_settings']['group_details'] = array('#type' => 'fieldset', '#title' => t('Group details'), '#collapsible' => TRUE, '#collapsed' => TRUE); 
    24732723  // groups directory visibility 
    2474   $options = array(t("New groups don't appear in the groups directory. Administrators control the directory exclusively."), 
     2724  $options = array(t('New groups don\'t appear in the groups directory. Administrators control the directory exclusively.'), 
    24752725              t('New groups always appear in the groups directory.'), 
    24762726              t('Group creator chooses whether her group appears in the directory. Defaults to %in.', array('%in' => t('in directory'))), 
     
    24802730   
    24812731  // groups registration visibility 
    2482   $options = array(t("New groups don't appear on the registration form. Administrators control the form exclusively."), 
     2732  $options = array(t('New groups don\'t appear on the registration form. Administrators control the form exclusively.'), 
    24832733              t('New groups always appear on the registration form.'), 
    24842734              t('Group creator chooses whether her group appears on the registration form. Defaults to %in.', array('%in' => t('on form'))), 
     
    24872737  $form['og_settings']['group_details']['og_visibility_registration'] = array('#type' => 'radios', '#title' => t('Registration form control'), '#default_value' => variable_get('og_visibility_registration', OG_REGISTRATION_CHOOSE_FALSE), '#description' =>t('OG admins always see the checkbox for adding a group to the %dir. Note that changing this setting has no effect on existing posts. Re-save those posts to acquire this new setting.', array('%dir' => t('registration form'))), '#options' => $options); 
    24882738 
     2739  // email notifications default 
     2740  $options = array(OG_NOTIFICATION_SELECTIVE => t('New members are not subscribed to group email notifications by default. A member may choose to enable this from her profile page or her My membership page.'), 
     2741              OG_NOTIFICATION_ALWAYS => t('New members are subscribed to group email notifications by default. A member may choose to disable this from her profile page.'), 
     2742              ); 
     2743  $form['og_settings']['group_details']['og_notification'] = array('#type' => 'radios', '#title' => t('Group email notifications'), '#default_value' => variable_get('og_notification', OG_NOTIFICATION_ALWAYS), '#description' =>t('Should new members automatically be notified via email when new content is posted to their group? Note that changing this setting has no effect on existing members.'), '#options' => $options); 
     2744   
    24892745  // audience checkboxes 
    24902746  $form['og_settings']['group_details']['og_audience_checkboxes'] = array('#type' => 'checkbox', '#title' => t('Audience checkboxes'), '#default_value' => variable_get('og_audience_checkboxes', TRUE), '#description' => t('Show each group that the user is a member of as a checkbox in the Audience section. This enables the member to place her post into multiple groups. If unchecked, simplify the user interface by omitting the checkboxes and assuming user wants to post into the current group. This simplification only applies to new nodes, and not to edits of existing nodes. Group administrators always see checkboxes.')); 
     
    25022758  $form['og_settings']['group_details']['og_member_pics'] = array('#type' => 'checkbox', '#title' => t('Member pictures'), '#default_value' => variable_get('og_member_pics', TRUE), '#description' => t('Should member pictures be shown on the members page, the group members block, and group details block? You must also enable pictures in !user.', array('!user' => l(t('User configuration'), 'admin/user/settings')))); 
    25032759 
    2504   // Messages fieldset. 
    2505   $form['og_settings']['notifications'] = array( 
    2506     '#type' => 'fieldset', 
    2507     '#title' => t('Messaging & Notifications'), 
    2508     '#collapsible' => TRUE, 
    2509     '#collapsed' => TRUE 
    2510   ); 
    2511   $form['og_settings']['notifications']['og_email_notification_pattern'] = array( 
     2760  $form['og_settings']['email'] = array('#type' => 'fieldset', '#title' => t('Email settings'), '#collapsible' => TRUE, '#collapsed' => TRUE); 
     2761 
     2762  $form['og_settings']['email']['og_email_notification_pattern'] = array( 
    25122763    '#type' => 'textfield', 
    25132764    '#title' => t('Format of From: field'), 
     
    25152766    '#description' => t('Specify the format of the "From:" field on outgoing notifications. Available variables: @user_mail, @user_name, @site_mail, @site_name. Note that the @user_mail token reveals the author\'s email address. If the admin email examples above appear blank, you need to set your site email in the Site Configuration panel.'), 
    25162767  ); 
    2517   $form['og_settings']['notifications']['og_new_node_subject'] = array( 
    2518     '#type' => 'textfield', 
    2519     '#title' => t('New content subject'), 
    2520     '#description' => t('Subject of notification message for new content. Available variables: @group, !group_url, @type, @site, !content_url, !reply_url, @title, @subject, @node_full, @node_teaser, @username. %subject contains the comment title in the case of a comment but the node title in the case of a new post. @title is always the node title.'), 
    2521     '#default_value' => _og_user_mail_text('og_new_node_subject') 
    2522   ); 
    2523   $form['og_settings']['notifications']['og_new_node_body'] = array( 
    2524     '#type' => 'textarea', 
    2525     '#title' => t('New content body'), 
    2526     '#rows' => 10, 
    2527     '#description' => t('Body of the notification for new content. Available variables: @group, !group_url, @type, @site, !content_url, !reply_url, @title, @subject, @node_full, @node_teaser, @username. @subject contains the comment title in the case of a comment but the node title in the case of a new post. %title is always the node title.'), 
    2528     '#default_value' => _og_user_mail_text('og_new_node_body') 
    2529   ); 
    2530   $form['og_settings']['notifications']['og_admin_email_body'] = array( 
    2531     '#type' => 'textarea', 
    2532     '#title' => t('Group admin notification body'), 
    2533     '#rows' => 10, 
    2534     '#description' => t('The body of the message sent to users from the group admin. Available variables: @group, @body, @site, !url_group, !url_unsubscribe'), 
    2535     '#default_value' => _og_user_mail_text('og_admin_email_body') 
    2536   ); 
    2537   $form['og_settings']['notifications']['og_approve_user_subject'] = array( 
    2538     '#type' => 'textfield', 
    2539     '#title' => t('User approved notification subject'), 
    2540     '#description' => t('The subject of the message sent to new approved members. Available variables: !group_url, @title'), 
    2541     '#default_value' => _og_user_mail_text('og_approve_user_subject') 
    2542   ); 
    2543   $form['og_settings']['notifications']['og_approve_user_body'] = array( 
    2544     '#type' => 'textarea', 
    2545     '#title' => t('User approved notification body'), 
    2546     '#rows' => 10, 
    2547     '#description' => t('The body of the message sent to new approved members. Available variables: !group_url, @title'), 
    2548     '#default_value' => _og_user_mail_text('og_approve_user_body') 
    2549   );    
    2550   $form['og_settings']['notifications']['og_deny_user_subject'] = array( 
    2551     '#type' => 'textfield', 
    2552     '#title' => t('User denied notification subject'), 
    2553     '#description' => t('The subject of the message sent to denied users. Available variables: !group_url, @title'), 
    2554     '#default_value' => _og_user_mail_text('og_deny_user_subject') 
    2555   ); 
    2556   $form['og_settings']['notifications']['og_deny_user_body'] = array( 
    2557     '#type' => 'textarea', 
    2558     '#title' => t('User denied notification body'), 
    2559     '#rows' => 10, 
    2560     '#description' => t('The body of the message sent to denied users. Available variables: !group_url, @title'), 
    2561     '#default_value' => _og_user_mail_text('og_deny_user_body') 
    2562   );    
    2563   $form['og_settings']['notifications']['og_invite_user_subject'] = array( 
    2564     '#type' => 'textfield', 
    2565     '#title' => t('Invite user notification subject'), 
    2566     '#description' => t('The subject of the message sent to users invited to join a group. Available variables: @group, @site, @description, !group_url, @body'), 
    2567     '#default_value' => _og_user_mail_text('og_invite_user_subject') 
    2568   ); 
    2569   $form['og_settings']['notifications']['og_invite_user_body'] = array( 
    2570     '#type' => 'textarea', 
    2571     '#title' => t('Invite user notification body'), 
    2572     '#rows' => 10, 
    2573     '#description' => t('The body of the message sent to users invited to join a group. Available variables: @group, @site, @description, !group_url, @body'), 
    2574     '#default_value' => _og_user_mail_text('og_invite_user_body') 
    2575   );    
    2576   $form['og_settings']['notifications']['og_request_user_subject'] = array( 
    2577     '#type' => 'textfield', 
    2578     '#title' => t('Request user notification subject'), 
    2579     '#description' => t("The subject of the message sent to a user's request to join a group. Available variables: @group, @username, !approve_url, !group_url"), 
    2580     '#default_value' => _og_user_mail_text('og_request_user_subject') 
    2581   ); 
    2582   $form['og_settings']['notifications']['og_request_user_body'] = array( 
    2583     '#type' => 'textarea', 
    2584     '#title' => t('Request user notification body'), 
    2585     '#rows' => 10, 
    2586     '#description' => t("The body of the message sent to a user's request to join a group. Available variables: @group, @username, !approve_url, !group_url"), 
    2587     '#default_value' => _og_user_mail_text('og_request_user_body') 
    2588   ); 
    2589   $form['og_settings']['notifications']['og_new_admin_subject'] = array( 
    2590     '#type' => 'textfield', 
    2591     '#title' => t('New admin user notification subject'), 
    2592     '#description' => t('The subject of the message sent to a new admin for a group. Available variables: @group, @username, !group_url'), 
    2593     '#default_value' => _og_user_mail_text('og_new_admin_subject') 
    2594   ); 
    2595   $form['og_settings']['notifications']['og_new_admin_body'] = array( 
    2596     '#type' => 'textarea', 
    2597     '#title' => t('New admin user notification body'), 
    2598     '#rows' => 10, 
    2599     '#description' => t('The body of the message sent to a new admin for a group. Available variables: @group, @username, !group_url, !invite_url'), 
    2600     '#default_value' => _og_user_mail_text('og_new_admin_body') 
    2601   ); 
     2768  $form['og_settings']['email']['og_new_node_subject'] = array('#type' => 'textfield', '#title' => t('New content subject'), '#description' => 'Subject of email for new content. Available variables: @group, !group_url, @type, @site, !content_url, !reply_url, @title, @subject, @node_full, @node_teaser, @username. %subject contains the comment title in the case of a comment but the node title in the case of a new post. @title is always the node title.', '#default_value' => _og_user_mail_text('og_new_node_subject')); 
     2769  $form['og_settings']['email']['og_new_node_body'] = array('#type' => 'textarea', '#title' => t('New content body'), '#rows' => 10, '#description' => 'Body of email for new content. Available variables: @group, !group_url, @type, @site, !content_url, !reply_url, @title, @subject, @node_full, @node_teaser, @username. @subject contains the comment title in the case of a comment but the node title in the case of a new post. %title is always the node title.', '#default_value' => _og_user_mail_text('og_new_node_body')); 
     2770  $form['og_settings']['email']['og_admin_email_body'] = array('#type' => 'textarea', '#title' => t('Group admin email body'), '#rows' => 10, '#description' => 'The body of the email sent to users from the group admin. Available variables: @group, @body, @site, !url_group, !url_unsubscribe', '#default_value' => _og_user_mail_text('og_admin_email_body')); 
     2771  $form['og_settings']['email']['og_approve_user_subject'] = array('#type' => 'textfield', '#title' => t('User approved email subject'), '#description' => 'The subject of the email sent to new approved members. Available variables: !group_url, @title', '#default_value' => _og_user_mail_text('og_approve_user_subject')); 
     2772  $form['og_settings']['email']['og_approve_user_body'] = array('#type' => 'textarea', '#title' => t('User approved email body'), '#rows' => 10, '#description' => 'The body of the email sent to new approved members. Available variables: !group_url, @title', '#default_value' => _og_user_mail_text('og_approve_user_body'));    
     2773  $form['og_settings']['email']['og_deny_user_subject'] = array('#type' => 'textfield', '#title' => t('User denied email subject'), '#description' => 'The subject of the email sent to denied users. Available variables: !group_url, @title', '#default_value' => _og_user_mail_text('og_deny_user_subject')); 
     2774  $form['og_settings']['email']['og_deny_user_body'] = array('#type' => 'textarea', '#title' => t('User denied email body'), '#rows' => 10, '#description' => 'The body of the email sent to denied users. Available variables: !group_url, @title', '#default_value' => _og_user_mail_text('og_deny_user_body'));    
     2775  $form['og_settings']['email']['og_invite_user_subject'] = array('#type' => 'textfield', '#title' => t('Invite user email subject'), '#description' => 'The subject of the email sent to users invited to join a group. Available variables: @group, @site, @description, !group_url, @body', '#default_value' => _og_user_mail_text('og_invite_user_subject')); 
     2776  $form['og_settings']['email']['og_invite_user_body'] = array('#type' => 'textarea', '#title' => t('Invite user email body'), '#rows' => 10, '#description' => 'The body of the email sent to users invited to join a group. Available variables: @group, @site, @description, !group_url, @body', '#default_value' => _og_user_mail_text('og_invite_user_body'));    
     2777  $form['og_settings']['email']['og_request_user_subject'] = array('#type' => 'textfield', '#title' => t('Request user email subject'), '#description' => 'The subject of the email sent to a user\'s request to join a group. Available variables: @group, @username, !approve_url, !group_url', '#default_value' => _og_user_mail_text('og_request_user_subject')); 
     2778  $form['og_settings']['email']['og_request_user_body'] = array('#type' => 'textarea', '#title' => t('Request user email body'), '#rows' => 10, '#description' => 'The body of the email sent to a user\'s request to join a group. Available variables: @group, @username, !approve_url, !group_url', '#default_value' => _og_user_mail_text('og_request_user_body')); 
     2779  $form['og_settings']['email']['og_new_admin_subject'] = array('#type' => 'textfield', '#title' => t('New admin user email subject'), '#description' => 'The subject of the email sent to a new admin for a group. Available variables: @group, @username, !group_url', '#default_value' => _og_user_mail_text('og_new_admin_subject')); 
     2780  $form['og_settings']['email']['og_new_admin_body'] = array('#type' => 'textarea', '#title' => t('New admin user email body'), '#rows' => 10, '#description' => 'The body of the email sent to a new admin for a group. Available variables: @group, @username, !group_url, !invite_url', '#default_value' => _og_user_mail_text('og_new_admin_body')); 
    26022781 
    26032782  return system_settings_form($form); 
     
    26492828      'og_xmlrpc_subscribe_user', 
    26502829      array('struct', 'string', 'string', 'int', 'int'), 
    2651       t('Add a user to a group.')), 
     2830      t('Add a user to a group')), 
    26522831    array( 
    26532832      'og.getAllSubscribers', 
     
    27092888  switch ($type) { 
    27102889    case 'node': 
    2711       // Set some defaults. 
    2712       $values['ogname'] = ''; 
    2713       $values['ogname-raw'] = ''; 
    2714       $values['og-id'] = ''; 
    2715       $values['og-type'] = ''; 
    2716       $values['og-type-name'] = ''; 
    2717  
    27182890      if (is_array($object->og_groups)) { 
    27192891        $gids = array_filter($object->og_groups); 
     
    27282900          break; 
    27292901        } 
    2730       } 
    2731       return $values; 
    2732   } 
    2733  
    2734   return; 
     2902        return $values; 
     2903      } 
     2904      break;     
     2905  } 
     2906   
     2907  // No group info found. Return defaults. 
     2908  $values['ogname'] = ''; 
     2909  $values['ogname-raw'] = ''; 
     2910  $values['og-id'] = ''; 
     2911  $values['og-type-name'] = ''; 
     2912  $values['og-type'] = ''; 
     2913  return $values; 
    27352914} 
    27362915 
     
    27472926    $query['where'] =  'oga.group_nid = '. $args['og_nid']; 
    27482927    return $query; 
     2928  } 
     2929} 
     2930 
     2931// A hook from replies.module. Return TRUE if og is handling the notification to a given recipient on a given reply 
     2932function og_replies_mine($comment, $recipient) { 
     2933  $node = node_load($comment->nid); 
     2934  // check each group that this node is in 
     2935  foreach ((array)$node->og_groups as $gid) { 
     2936    // check if recipient is an active member 
     2937    if (isset($recipient->og_groups[$gid]) && $recipient->og_groups[$gid]['is_active']) { 
     2938      // check if user is already getting this group notification 
     2939      if ($recipient->og_email || $recipient->og_groups[$gid]['mail_type']) { 
     2940        return TRUE; 
     2941      } 
     2942    } 
    27492943  } 
    27502944} 
     
    27652959        } 
    27662960     
     2961    if (!module_exists('job_queue')) { 
     2962      $requirements['og_modules']  = array( 
     2963        'title' => $t('Organic groups modules'), 
     2964        'value' => $t('Organic groups works best when !job_queue.module is enabled. See the Integration section of the !readme.', array('!job_queue' => l('job_queue.module', 'http://drupal.org/project/job_queue'), '!readme' => og_readme())), 
     2965        'severity' => REQUIREMENT_INFO 
     2966      ); 
     2967    } 
     2968     
    27672969    if (!module_exists('og_access')) { 
    27682970      $requirements['og_access'] = array( 
     
    27993001  return FALSE; 
    28003002} 
    2801  
    2802 /** 
    2803  * Access callback: og_notifications (or similar) is required for the broadcast 
    2804  * tab. Override menu item to amend. 
    2805  */ 
    2806 function og_broadcast_access($node) { 
    2807   return og_is_node_admin($node) && module_exists('og_notifications'); 
    2808 } 
  • trunk/sites/all/modules/og/og_access.info

    r152 r224  
    33package = "Organic groups" 
    44dependencies = og 
     5; Information added by drupal.org packaging script on 2008-05-12 
     6version = "5.x-7.2" 
     7project = "og" 
     8datestamp = "1210629035" 
     9 
  • trunk/sites/all/modules/og/og_access.module

    r152 r224  
    11<?php 
    2 // $Id: og_access.module,v 1.1.2.11 2008/05/26 14:03:35 weitzman Exp $ 
     2// $Id: og_access.module,v 1.1.2.10 2008/05/08 19:49:26 weitzman Exp $ 
    33 
    44// visibility states for private groups. site admin chooses in og_access_settings() 
     
    1818    $items[] = array( 
    1919      'path' => 'admin/og/og_access', 
    20       'title' => t('Organic groups access configuration'), 
     20      'title' => t('Organic Groups Access configuration'), 
    2121      'description' => t('Choose whether new groups should be private or public'), 
    2222      'callback' => 'drupal_get_form', 
     
    3131  drupal_add_js(drupal_get_path('module', 'og_access'). '/og_access.js'); // load the form javascript to handle private groups / node visibility conflicts in the og access settings form. 
    3232   
    33   $options = array(t('Visible only within the targeted groups.'), t('Visible within the targeted groups and on other pages.'), t('Visibility chosen by author/editor using a checkbox on the posting form.') .' '. t('Checkbox defaults to @pub.', array('@pub' => t('Public'))), t('Visibility chosen by author/editor using a checkbox on the posting form. '). t('Checkbox defaults to @pri.', array('@pri' => t('Private')))); 
    34   $form['og_visibility'] = array('#type' => 'radios', '#title' => t('Visibility of posts'), '#default_value' => variable_get('og_visibility', 0), '#description' =>t('Determine how broadly available a given post should be when it is affiliated with a group. OG admins always see the checkbox for making a post @pub. Note that changing this setting has no effect on existing posts. Re-save those posts to acquire this new setting. If the setting you want is disabled here, check the settings under <em>Private Groups</em> setting below. You cannot set node visibility to always be public if private groups are set to always on and vice versa.', array('@pub' => t('Public'))), '#options' => $options); 
     33  $options = array(t('Visible only within the targeted groups'), t('Visible within the targeted groups and on other pages'), t('Visibility chosen by author/editor using a checkbox on the posting form. '). t('Checkbox defaults to @pub.', array('@pub' => t('Public'))), t('Visibility chosen by author/editor using a checkbox on the posting form. '). t('Checkbox defaults to @pri.', array('@pri' => t('Private')))); 
     34  $form['og_visibility'] = array('#type' => 'radios', '#title' => t('Visibility of posts'), '#default_value' => variable_get('og_visibility', 0), '#description' =>t('Determine how broadly available a given post should be when it is affiliated with a group. OG admins always see the checkbox for making a post @pub. Note that changing this setting has no effect on existing posts. Re-save those posts to acquire this new setting.  If the setting you want is disabled here, check the settings under <em>Private Groups</em> setting below. You cannot set node visibility to always be public if private groups are set to always on and vice versa.', array('@pub' => t('Public'))), '#options' => $options); 
    3535   
    3636  // private groups control 
     
    4545    '#options' => $options,  
    4646    '#default_value' => variable_get('og_private_groups', OG_PRIVATE_GROUPS_CHOOSE_FALSE),     
    47     '#description' => '<p>'. t("A private group's group home page cannot be seen by non-members, and new posts created in the group will default to being private. This setting controls what private groups options can be used when creating a new group or editing an existing group. If you select one of the <em>group administrator chooses</em> options then it will be up to group admins whether their new groups are private or not, with the default you specify here.") .'<p><p>'. t('Note that the privacy of all <em>content</em> in the group is determined as each node is created or edited, according to the <em>Node authoring form / Visibility of Posts</em> setting on this page. Note also that changing this setting only affects the default for new groups being created, not the privacy of any existing groups! To change those you must edit the groups and their individual content nodes directly. If the setting you want is disabled here, check <em>Visibility of Posts</em> above. You cannot choose to only have private groups if node visibility is set to be always public, and vice versa.') .'</p>',                               
     47    '#description' =>t("<p>A private group's group home page cannot be seen by non-members, and new posts created in the group will default to being private.  This setting controls what private groups options can be used when creating a new group or editing an existing group.  If you select one of the <em>group administrator chooses</em> options then it will be up to group admins whether their new groups are private or not, with the default you specify here.<p><p>Note that the privacy of all <em>content</em> in the group is determined as each node is created or edited, according to the <em>Node authoring form / Visibility of Posts</em> setting on this page.  Note also that changing this setting only affects the default for new groups being created, not the privacy of any existing groups!  To change those you must edit the groups and their individual content nodes directly.  If the setting you want is disabled here, check <em>Visibility of Posts</em> above.  You cannot choose to only have private groups if node visibility is set to be always public, and vice versa.</p>"),                               
    4848  ); 
    4949  return system_settings_form($form); 
     
    8282      $form['og_private'] = array ( 
    8383        '#type' => 'checkbox', 
    84         '#title' => t('Private group'),  
     84        '#title' => t('private group'),  
    8585        '#default_value' => $node->nid ? $node->og_private : $default,  
    86         '#description' => t('Should this group be visible only to its members? Disabled if the group is set to <em>List in Directory</em> or <em>Membership requests: open</em>.')); 
     86        '#description' => t('Should this group be visible only to its members?  Disabled if the group is set to <em>List in Directory</em> or <em>Membership requests: open</em>')); 
    8787        break; 
    8888  } 
     
    258258function og_access_node_access_explain($row) { 
    259259  if ($row->realm == 'og_public') { 
    260     return t('All users may view this node.'); 
     260    return t('All users may view this node.', array('@op' => $op)); 
    261261  } 
    262262  elseif ($row->realm == 'og_subscriber') { 
    263263    $node = node_load((int)$row->gid); 
    264     return t('Members of !group_n may view this node.', array('!group_n' => l($node->title, "node/$row->gid"))); 
    265   } 
    266 } 
     264    return t('Members of !group_n may view this node.', array('@op' => $op, '!group_n' => l($node->title, "node/$row->gid"))); 
     265  } 
     266} 
  • trunk/sites/all/modules/og/og_panels.info

    r152 r224  
    44package = "Organic groups" 
    55dependencies = og panels panels_views 
     6; Information added by drupal.org packaging script on 2008-05-12 
     7version = "5.x-7.2" 
     8project = "og" 
     9datestamp = "1210629035" 
     10 
  • trunk/sites/all/modules/og/og_panels.install

    r152 r224  
    11<?php 
    2 // $Id: og_panels.install,v 1.1.2.4.2.1 2008/10/31 12:16:14 weitzman Exp $ 
     2// $Id: og_panels.install,v 1.1.2.4 2008/03/17 15:04:28 weitzman Exp $ 
    33 
    44function og_panels_install() { 
     
    2727        default_page integer NULL, 
    2828        show_blocks integer NULL, 
    29         weight smallint NOT NULL DEFAULT 0, 
     29        weight integer(4) NOT NULL DEFAULT 0, 
    3030        PRIMARY KEY  (did) 
    3131      );"); 
  • trunk/sites/all/modules/og/og_panels.module

    r152 r224  
    11<?php 
    2 // $Id: og_panels.module,v 1.1.2.32.2.1 2008/10/31 12:12:27 weitzman Exp $ 
     2// $Id: og_panels.module,v 1.1.2.30 2008/04/20 17:51:10 weitzman Exp $ 
    33 
    44function og_panels_help($section) { 
     
    77      return t('After enabling this module, visit the new Pages tab on any group. There, group admins may create as many pages as desired for their group. The pages may contain any layout that the site offers and admins may arrange many different types of content as desired. Site admins can restrict the types of content that may be added on the <a href="!settings">og_panels settings</a> page. You might want to make some Views available using <a href="!apv">admin/panels/views</a>. Group admins may designate one page as their group home page.', array('!settings' => url('admin/og/og_panels'), '!apv' => url('admin/panels/views'))); 
    88      case (arg(0) == 'node' && arg(2) == 'og_panels' && !arg(3)): 
    9         return '<p>'. t('Create custom pages for your group. Use custom pages to organize your content in a pretty and informative manner. Your group can group to be a whole website within a web site. Each custom page becomes a tab when viewing your group. One of your custom pages should be designated as your <em>group home page</em>. That page will then display when visitors first arrive at your group.') .'</p><p>'. t('Start by clicking the <a href="!url">Add new page</a> tab. Then you will choose a custom layout for your page. Then you will want to <em>edit content</em> for your custom page.', array('!url' => url('node/'. arg(1). '/og_panels/form'))) .'</p>'; 
     9        return t( 
     10          '<p>Create custom pages for your group. Use custom pages to organize your content in a pretty and informative manner. Your group can group to be a whole website within a web site. Each custom page becomes a tab when viewing your group. One of your custom pages should be designated as your <em>group home page</em>. That page will then display when visitors first arrive at your group.</p> 
     11          <p>Start by clicking the <a href="!url">Add new page</a> tab. Then you will choose a custom layout for your page. Then you will want to <em>edit content</em> for your custom page.</p>', array('!url' => url('node/'. arg(1). '/og_panels/form'))); 
    1012  } 
    1113} 
     
    1517    $items[] = array( 
    1618      'path' => 'admin/og/og_panels', 
    17       'title' => t('Organic groups panels'), 
    18       'description' => t('Configure the content that is available to group admins when creating group pages.'), 
     19      'title' => 'Organic groups panels', 
     20      'description' => 'Configure the content that is available to group admins when creating group pages.', 
    1921      'callback' => 'og_panels_admin_content', 
    2022      'access' => user_access('administer organic groups'), 
     
    150152function og_panels_delete_confirm_submit($form_id, $form_values) { 
    151153  og_panels_delete($form_values['did']); 
    152   drupal_set_message(t('%title has been deleted.', array('%title' => $form_values['page_title']))); 
     154  drupal_set_message(t('%title has been deleted', array('%title' => $form_values['page_title']))); 
    153155} 
    154156 
     
    182184    $item['page_title'] = array('#value' => l($display->page_title, "node/$nid/$display->path")); 
    183185    $item['weight'] = array('#type' => 'weight', '#default_value' => $display->weight); 
    184     $item['edit content'] = array('#value' => l(t('Edit content'), "node/$nid/og_panels/$display->did/panel_content", array(), drupal_get_destination())); 
    185     $item['change layout'] = array('#value' => l(t('Change layout'), "node/$nid/og_panels/$display->did/panel_layout")); 
    186     $item['edit layout settings'] = array('#value' => l(t('Edit layout settings'), "node/$nid/og_panels/$display->did/panel_settings")); 
    187     $item['edit page'] = array('#value' => l(t('Edit page'), "node/$nid/og_panels/form/$display->did", array(), drupal_get_destination())); 
    188     $item['delete page'] =  array('#value' => l(t('Delete page'), "node/$nid/og_panels/$display->did/delete", array(), drupal_get_destination())); 
     186    $item['edit content'] = array('#value' => l(t('edit content'), "node/$nid/og_panels/$display->did/panel_content", array(), drupal_get_destination())); 
     187    $item['change layout'] = array('#value' => l(t('change layout'), "node/$nid/og_panels/$display->did/panel_layout")); 
     188    $item['edit layout settings'] = array('#value' => l(t('edit layout settings'), "node/$nid/og_panels/$display->did/panel_settings")); 
     189    $item['edit page'] = array('#value' => l(t('edit page'), "node/$nid/og_panels/form/$display->did", array(), drupal_get_destination())); 
     190    $item['delete page'] =  array('#value' => l(t('delete page'), "node/$nid/og_panels/$display->did/delete", array(), drupal_get_destination())); 
    189191      
    190192    $form['displays'][$display->did] = $item; 
     
    205207  $form['submit'] = array( 
    206208    '#type' => 'submit',  
    207     '#value' => t('Save settings'), 
     209    '#value' => t('Save Settings'), 
    208210  ); 
    209211 
     
    271273  drupal_set_breadcrumb($bc); 
    272274  // Mark node as read and show feed icon for any group panel page (how to do this better?) 
    273   drupal_add_feed(url("node/$group_node->nid/feed"), t('@name at @site', array('@name' => $group_node->title, '@site' => variable_get('site_name', 'drupal')))); 
    274   node_tag_new($group_node->nid); 
     275  drupal_add_feed(url("node/$nid/feed"), t('@name at @site', array('@name' => $node->title, '@site' => variable_get('site_name', 'drupal')))); 
     276  node_tag_new($node->nid); 
    275277   
    276278   
     
    579581   
    580582    $items['og_subscribers'] = array( 
    581       'title' => t('OG members'), 
     583      'title' => t('OG Members'), 
    582584      'content_types' => 'og_panels_ct_list_subscribers', 
    583585      'single' => TRUE, // only provides a single content type 
     
    602604    if (og_is_picture()) { 
    603605      $items['og_faces'] = array( 
    604         'title' => t('OG faces'), 
     606        'title' => t('OG Faces'), 
    605607        'content_types' => 'og_panels_ct_list_faces', 
    606608        'single' => TRUE, // only provides a single content type 
     
    634636  switch ($delta) { 
    635637    case 2: 
    636       // Provide alternate versions of these content items 
     638      // Provide alternate versions as content items 
    637639      unset($info); 
    638640      break; 
    639     default: 
     641    case 'default': 
    640642      $info['icon'] = 'user-multiple.png'; 
    641643      $info['required context'] = new panels_required_context(t('Group'), 'group'); 
  • trunk/sites/all/modules/og/og_views.inc

    r152 r224  
    11<?php 
    2 // $Id: og_views.inc,v 1.12.2.55.2.4 2008/10/06 07:56:45 karthik Exp $ 
     2// $Id: og_views.inc,v 1.12.2.54 2008/05/08 19:49:26 weitzman Exp $ 
    33/** 
    44 * Implementation of the hook_views_tables() 
     
    3232        ), 
    3333        'count' => array( 
    34           'name' => t('OG: Group: Members count'), 
     34          'name' => t('OG: Group: Members Count'), 
    3535          'handler' => 'og_handler_field_count', 
    3636          'help' => t('Number of members for a group. Excludes memberships which are pending approval.'), 
     
    3939        ), 
    4040        'post_count' => array( 
    41           'name' => t('OG: Group: Post count'), 
     41          'name' => t('OG: Group: Post Count'), 
    4242          'handler' => 'og_handler_post_count', 
    4343          'sortable' => FALSE, 
     
    5353        ), 
    5454        'post_count_new' => array( 
    55           'name' => t('OG: Group: Post count *new*'), 
     55          'name' => t('OG: Group: Post Count *New*'), 
    5656          'handler' => 'og_handler_post_count_new', 
    5757          'sortable' => FALSE, 
     
    6161             '#type' => 'select', 
    6262             '#options' => array( 
    63                'normal' => t('Normal'), 
    64                'withmark' => t('With new mark') 
     63               'normal' => 'Normal', 
     64               'withmark' => 'With new mark' 
    6565              ), 
    6666          ), 
     
    7171        'private' => array( 
    7272          'name' => t('OG: Group: Private'), 
    73           'handler' => 'og_handler_field_private', 
    74           'sortable' => TRUE, 
    75           'help' => t('Displays whether a group is private or public with respect to groups.'), 
    7673        ), 
    7774        'subscribe' => array( 
     
    8279          'notafield' => TRUE, 
    8380          'help' => t('Displays a links for joining a group when a user is not already a member.'), 
     81        ), 
     82        'notification' => array( 
     83          'name' => t('OG: Group: Notification'), 
     84          'handler' => 'og_handler_field_yesempty', 
     85          'help' => t('Displays <em>yes</em> if group automatically sends email notifications to members'), 
    8486        ), 
    8587        'language' => array( 
     
    224226      ), 
    225227      'fields' => array( 
     228        'mail_type' => array( 
     229          'name' => t('OG: Subscription email'), 
     230          'handler' => 'og_handler_field_yesempty', 
     231          'sortable' => false, 
     232          'help' => t('Does member receive email notifications for a group.'), 
     233        ), 
    226234        'managelink' => array( 
    227235          'name' => t('OG: Manage membership link'), 
     
    239247        'currentuidsimple' => array( 
    240248          'field' => 'uid', 
    241           'name' => t("OG: Group in user's groups"), 
     249          'name' => t('OG: Group in User\'s Groups'), 
    242250          'operator' => 'views_handler_operator_eqneq', 
    243251          'list' => 'views_handler_filter_usercurrent', 
     
    324332      ), 
    325333      'help' => t('Filter for the one or more organic groups. Groups should be specified by name, or part of a name. Use the <em>Option</em> field to specify how to match the supplied name.'), 
    326       ), 
    327     'og_uid' => array( 
    328       'name' => t('OG: User is subscribed to group'),  
    329       'handler' => 'og_views_handler_argument_uid', 
    330       'help' => t("Filter for groups that user is subscribed to.  User is specified by user ID (integer).  This argument exposes a user's group subscriptions to other users. Depending on your site, this may be a violation of their privacy. Use it thoughfully."), 
    331     ), 
     334      ) 
    332335    ); 
    333336  return $args; 
     
    360363    case 'title': 
    361364      return db_result(db_query_range('SELECT title FROM {node} WHERE nid = %d', $query, 0, 1));; 
    362   } 
    363 } 
    364  
    365 /** 
    366  * Custom argument for filtering by groups that a user is subscribed to 
    367  */ 
    368 function og_views_handler_argument_uid($op, &$query, $a1, $a2 = null) { 
    369   switch ($op) { 
    370     case 'filter': 
    371       $query->ensure_table('og_uid'); 
    372       $query->add_where("og_uid.uid = %d", $a2); 
    373       break; 
    374     case 'title': 
    375       // This returns the title for this node in the title, breadcrumb, etc. 
    376       return db_result(db_query('SELECT name FROM {users} WHERE uid = %d', $a2)); 
    377365  } 
    378366} 
     
    437425  $view = new stdClass(); 
    438426  $view->name = 'og_mytracker'; 
    439   $view->description = t('Shows all activity in subscribed groups.'); 
     427  $view->description = 'Shows all activity in subscribed groups.'; 
    440428  $view->access = array ( 
    441429  0 => '2', 
     
    443431  $view->view_args_php = ''; 
    444432  $view->page = TRUE; 
    445   $view->page_title = t('Recent posts in my groups'); 
     433  $view->page_title = 'Recent posts in my groups'; 
    446434  $view->page_header = ''; 
    447435  $view->page_header_format = '1'; 
    448436  $view->page_footer = ''; 
    449437  $view->page_footer_format = '1'; 
    450   $view->page_empty = t('There are no posts in your subscribed groups.'); 
     438  $view->page_empty = 'There are no posts in your subscribed groups.'; 
    451439  $view->page_empty_format = '1'; 
    452440  $view->page_type = 'table'; 
     
    455443  $view->nodes_per_page = '25'; 
    456444  $view->menu = TRUE; 
    457   $view->menu_title = t('My recent'); 
     445  $view->menu_title = 'My recent'; 
    458446  $view->menu_tab = TRUE; 
    459447  $view->menu_tab_weight = '0'; 
     
    490478      'tablename' => 'node', 
    491479      'field' => 'title', 
    492       'label' => t('Title'), 
     480      'label' => 'Title', 
    493481      'handler' => 'views_handler_field_nodelink_with_mark', 
    494482      'sortable' => '1', 
     
    498486      'tablename' => 'users', 
    499487      'field' => 'name', 
    500       'label' => t('Author'), 
     488      'label' => 'Author', 
    501489      'sortable' => '1', 
    502490    ), 
     
    504492      'tablename' => 'node_comment_statistics', 
    505493      'field' => 'comment_count', 
    506       'label' => t('Replies'), 
     494      'label' => 'Replies', 
    507495      'handler' => 'views_handler_comments_with_new', 
    508496      'sortable' => '1', 
     
    511499      'tablename' => 'node_comment_statistics', 
    512500      'field' => 'last_comment_timestamp', 
    513       'label' => t('Last post'), 
     501      'label' => 'Last Post', 
    514502      'handler' => 'views_handler_field_since', 
    515503      'sortable' => '1', 
     
    541529  $view = new stdClass(); 
    542530  $view->name = 'og_unread'; 
    543   $view->description = t('Shows unread posts in subscribed groups.'); 
     531  $view->description = 'Shows unread posts in subscribed groups.'; 
    544532  $view->access = array ( 
    545533  0 => '2', 
     
    547535  $view->view_args_php = ''; 
    548536  $view->page = TRUE; 
    549   $view->page_title = t('Unread posts in my groups'); 
     537  $view->page_title = 'Unread posts in my groups'; 
    550538  $view->page_header = ''; 
    551539  $view->page_header_format = '1'; 
    552540  $view->page_footer = ''; 
    553541  $view->page_footer_format = '1'; 
    554   $view->page_empty = t('There are no new posts in your subscribed groups.'); 
     542  $view->page_empty = 'There are no new posts in your subscribed groups.'; 
    555543  $view->page_empty_format = '1'; 
    556544  $view->page_type = 'table'; 
     
    559547  $view->nodes_per_page = '25'; 
    560548  $view->menu = TRUE; 
    561   $view->menu_title = t('My unread'); 
     549  $view->menu_title = 'My unread'; 
    562550  $view->menu_tab = TRUE; 
    563551  $view->menu_tab_weight = '-5'; 
     
    583571      'tablename' => 'og_node_data', 
    584572      'field' => 'title', 
    585       'label' => t('Group'), 
     573      'label' => 'Group', 
    586574    ), 
    587575    array ( 
    588576      'tablename' => 'node', 
    589577      'field' => 'type', 
    590       'label' => t('Type'), 
     578      'label' => 'Type', 
    591579      'sortable' => '1', 
    592580    ), 
     
    594582      'tablename' => 'node', 
    595583      'field' => 'title', 
    596       'label' => t('Title'), 
     584      'label' => 'Title', 
    597585      'handler' => 'views_handler_field_nodelink_with_mark', 
    598586      'sortable' => '1', 
     
    602590      'tablename' => 'users', 
    603591      'field' => 'name', 
    604       'label' => t('Author'), 
     592      'label' => 'Author', 
    605593      'sortable' => '1', 
    606594    ), 
     
    608596      'tablename' => 'node_comment_statistics', 
    609597      'field' => 'comment_count', 
    610       'label' => t('Replies'), 
     598      'label' => 'Replies', 
    611599      'handler' => 'views_handler_comments_with_new', 
    612600      'sortable' => '1', 
     
    615603      'tablename' => 'node_comment_statistics', 
    616604      'field' => 'last_comment_timestamp', 
    617       'label' => t('Last post'), 
     605      'label' => 'Last Post', 
    618606      'handler' => 'views_handler_field_since', 
    619607      'sortable' => '1', 
     
    656644  $view = new stdClass(); 
    657645  $view->name = 'og_ghp_ron'; 
    658   $view->description = t('OG: Group home page - River of news. Default'); 
     646  $view->description = 'OG: Group home page - River of news. Default'; 
    659647  $view->page = TRUE; 
    660648  $view->page_type = 'teaser'; 
     
    711699  $view = new stdClass(); 
    712700  $view->name = 'og_my'; 
    713   $view->description = t("List user's subscribed groups and provide link to manage subscription"); 
     701  $view->description = 'List user\'s subscribed groups and provide link to manage subscription'; 
    714702  $view->access = array ( 
    715703  0 => '2', 
     
    717705  $view->view_args_php = ''; 
    718706  $view->page = TRUE; 
    719   $view->page_title = t('My groups'); 
    720   $view->page_header = t('You might be interested in an <a href="!url" rel="nofollow">OPML feed containing feeds from all your subscribed groups</a>.', array('!url' => url('og/opml'))); 
     707  $view->page_title = 'My groups'; 
     708  $view->page_header = strtr('You may edit all your email subscriptions using this convenient page. Also, you might be interested in an <a href="!url" rel="nofollow">OPML feed containing feeds from all your subscribed groups</a>.', array('!url' => url('og/opml'))); 
    721709  $view->page_header_format = '1'; 
    722710  $view->page_footer = '<?php 
     
    727715?>'; 
    728716  $view->page_footer_format = '2'; 
    729   $view->page_empty = t('No subscribed groups'); 
     717  $view->page_empty = 'No subscribed groups'; 
    730718  $view->page_empty_format = '1'; 
    731719  $view->page_type = 'table'; 
     
    764752      'tablename' => 'node', 
    765753      'field' => 'title', 
    766       'label' => t('Group'), 
     754      'label' => 'Group', 
    767755      'handler' => 'views_handler_field_nodelink', 
    768756      'options' => 'link', 
     
    771759      'tablename' => 'users', 
    772760      'field' => 'name', 
    773       'label' => t('Manager'), 
     761      'label' => 'Manager', 
    774762    ), 
    775763    array ( 
    776764      'tablename' => 'og', 
    777765      'field' => 'count', 
    778       'label' => t('Members'), 
     766      'label' => 'Members', 
     767    ), 
     768    array ( 
     769      'tablename' => 'og_uid', 
     770      'field' => 'mail_type', 
     771      'label' => 'Email', 
    779772    ), 
    780773    array ( 
    781774      'tablename' => 'og_uid', 
    782775      'field' => 'managelink', 
    783       'label' => t('Manage'), 
     776      'label' => 'Manage', 
    784777    ), 
    785778  ); 
     
    821814  $view->view_args_php = ''; 
    822815  $view->page = TRUE; 
    823   $view->page_title = t('Groups directory'); 
     816  $view->page_title = 'Groups directory'; 
    824817  $view->page_header = ''; 
    825818  $view->page_header_format = '2'; 
    826819  $view->page_footer = ''; 
    827820  $view->page_footer_format = '1'; 
    828   $view->page_empty = t('No groups'); 
     821  $view->page_empty = 'No groups'; 
    829822  $view->page_empty_format = '1'; 
    830823  $view->page_type = 'table'; 
     
    833826  $view->nodes_per_page = '90'; 
    834827  $view->menu = TRUE; 
    835   $view->menu_title = t('Groups'); 
     828  $view->menu_title = 'Groups'; 
    836829  $view->menu_tab = TRUE; 
    837830  $view->menu_tab_weight = '-5'; 
     
    857850      'tablename' => 'node', 
    858851      'field' => 'title', 
    859       'label' => t('Group'), 
     852      'label' => 'Group', 
    860853      'handler' => 'views_handler_field_nodelink', 
    861854      'sortable' => '1', 
     
    865858      'tablename' => 'users', 
    866859      'field' => 'name', 
    867       'label' => t('Manager'), 
     860      'label' => 'Manager', 
    868861    ), 
    869862    array ( 
    870863      'tablename' => 'og', 
    871864      'field' => 'count', 
    872       'label' => t('Members'), 
     865      'label' => 'Members', 
    873866    ), 
    874867    array ( 
    875868      'tablename' => 'og', 
    876869      'field' => 'description', 
    877       'label' => t('Description'), 
     870      'label' => 'Description', 
    878871    ), 
    879872    array ( 
    880873      'tablename' => 'og', 
    881874      'field' => 'subscribe', 
    882       'label' => t('Join'), 
     875      'label' => 'Join', 
    883876    ), 
    884877  ); 
     
    917910      'tablename' => 'node', 
    918911      'field' => 'title', 
    919       'label' => t('Search for a group by name'), 
     912      'label' => 'Search for a group by name', 
    920913      'optional' => '1', 
    921914      'is_default' => '0', 
     
    931924  $view = new stdClass(); 
    932925  $view->name = 'og_tracker'; 
    933   $view->description = t('Shows active posts across the whole site'); 
     926  $view->description = 'Shows active posts across the whole site'; 
    934927  $view->access = array ( 
    935928); 
    936929  $view->view_args_php = ''; 
    937930  $view->page = TRUE; 
    938   $view->page_title = t('Recent posts across whole site'); 
     931  $view->page_title = 'Recent posts across whole site'; 
    939932  $view->page_header = ''; 
    940933  $view->page_header_format = '1'; 
     
    948941  $view->nodes_per_page = '25'; 
    949942  $view->menu = TRUE; 
    950   $view->menu_title = t('Recent posts'); 
     943  $view->menu_title = 'Recent posts'; 
    951944  $view->menu_tab = TRUE; 
    952945  $view->menu_tab_weight = '5'; 
     
    968961      'type' => 'uid', 
    969962      'argdefault' => '2', 
    970       'title' => t('Recent posts for %1'), 
     963      'title' => 'Recent posts for %1', 
    971964      'options' => '', 
    972965      'wildcard' => '', 
     
    991984      'tablename' => 'node', 
    992985      'field' => 'title', 
    993       'label' => t('Title'), 
     986      'label' => 'Title', 
    994987      'handler' => 'views_handler_field_nodelink_with_mark', 
    995988      'options' => 'link', 
     
    998991      'tablename' => 'users', 
    999992      'field' => 'name', 
    1000       'label' => t('Author'), 
     993      'label' => 'Author', 
    1001994    ), 
    1002995    array ( 
    1003996      'tablename' => 'node_comment_statistics', 
    1004997      'field' => 'comment_count', 
    1005       'label' => t('Replies'), 
     998      'label' => 'Replies', 
    1006999      'handler' => 'views_handler_comments_with_new', 
    10071000    ), 
     
    10091002      'tablename' => 'og_node_data', 
    10101003      'field' => 'title', 
    1011       'label' => t('Groups'), 
     1004      'label' => 'Groups', 
    10121005    ), 
    10131006    array ( 
    10141007      'tablename' => 'node_comment_statistics', 
    10151008      'field' => 'last_comment_timestamp', 
    1016       'label' => t('Last post'), 
     1009      'label' => 'Last Post', 
    10171010      'handler' => 'views_handler_field_since', 
    10181011    ), 
     
    10361029  $view = new stdClass(); 
    10371030  $view->name = 'og_search'; 
    1038   $view->description = t('Search within a particular group'); 
     1031  $view->description = 'Search within a particular group'; 
    10391032  $view->access = array ( 
    10401033); 
    10411034  $view->view_args_php = ''; 
    10421035  $view->page = TRUE; 
    1043   $view->page_title = t('Search'); 
     1036  $view->page_title = 'Search'; 
    10441037  $view->page_header = ''; 
    10451038  $view->page_header_format = '1'; 
    10461039  $view->page_footer = ''; 
    10471040  $view->page_footer_format = '1'; 
    1048   $view->page_empty = t('No posts found.'); 
     1041  $view->page_empty = 'No posts found.'; 
    10491042  $view->page_empty_format = '1'; 
    10501043  $view->page_type = 'teaser'; 
     
    10641057      'type' => 'gid', 
    10651058      'argdefault' => '1', 
    1066       'title' => t('Search results for %1'), 
     1059      'title' => 'Search results for %1', 
    10671060      'options' => '', 
    10681061      'wildcard' => '', 
     
    10921085      'tablename' => 'temp_search_results', 
    10931086      'field' => 'word', 
    1094       'label' => t('Enter keyword'), 
     1087      'label' => 'Enter keyword', 
    10951088      'optional' => '1', 
    10961089      'is_default' => '0', 
     
    11051098  $view = new stdClass(); 
    11061099  $view->name = 'og_comments_recent'; 
    1107   $view->description = t('Display recent comments block in a group'); 
     1100  $view->description = 'Display recent comments block in a group'; 
    11081101  $view->access = array ( 
    11091102); 
    11101103  $view->view_args_php = ''; 
    11111104  $view->block = TRUE; 
    1112   $view->block_title = t('Recent comments'); 
     1105  $view->block_title = 'Recent comments'; 
    11131106  $view->block_header = ''; 
    11141107  $view->block_header_format = '1'; 
     
    11781171  $view = new stdClass(); 
    11791172  $view->name = 'og_recent_type_term'; 
    1180   $view->description = t('Recent posts for current term filtered by node type and/or taxonomy term'); 
     1173  $view->description = 'Recent posts for current term filtered by node type and/or taxonomy term'; 
    11811174  $view->access = array ( 
    11821175); 
     
    12691262  return in_array($data->nid, array_keys($user->og_groups)) ? l($cnt, "og/users/$data->nid") : $cnt; 
    12701263} 
    1271  
    1272 function og_handler_field_private($fieldinfo, $fielddata, $value, $data) { 
    1273   return $value ? t('Private') : t('Public'); 
    1274 } 
    1275  
    12761264 
    12771265function og_handler_field_language($fieldinfo, $fielddata, $value, $data) { 
  • trunk/sites/all/modules/og/og_workflow_ng.inc

    r152 r224  
    11<?php 
    2 // $Id: og_workflow_ng.inc,v 1.1.2.4 2008/07/31 20:08:16 weitzman Exp $ 
     2// $Id: og_workflow_ng.inc,v 1.1.2.2 2008/04/14 14:02:14 weitzman Exp $ 
    33 
    44/** 
    55 * @file 
    6  * workflow_ng integration for og module. 
     6 * workflow_ng integration for og module 
    77 */ 
    88 
    99/** 
    10  * Implementation of hook_event_info(). 
     10 * Implementation of hook_event_info() 
    1111 */ 
    1212function og_event_info() { 
     
    1717      '#arguments' => og_workflow_ng_events_hook_og_arguments(), 
    1818    ), 
    19     'og_user_approved' => array( 
    20       '#label' => t('User approved to group by admin'), 
    21       '#module' => t('OG'), 
    22       '#description' => t('A pending member is approved by a group administrator.'), 
    23       '#arguments' => og_workflow_ng_events_hook_og_arguments(), 
    24     ), 
    2519    'og_user_delete' => array( 
    2620      '#label' => t('User leaves group'), 
    2721      '#module' => t('OG'), 
    2822      '#arguments' => og_workflow_ng_events_hook_og_arguments(), 
    29    ), 
    30  );     
     23    ), 
     24  ); 
    3125} 
    3226 
    3327/** 
    34  * Describes the arguments available for the og hook. 
     28 * Describes the arguments available for the og hook 
    3529 *  
    3630 * We pass uid and gid to workflow-ng so that the argument handlers can load the full entities. 
     
    4741 
    4842/** 
    49  * handler to get user. 
     43 * handler to get user 
    5044 */ 
    5145function og_workflow_ng_events_argument_og_user($uid, $gid) { 
     
    5448 
    5549/** 
    56  * handler to get node. 
     50 * handler to get node 
    5751 */ 
    5852function og_workflow_ng_events_argument_og_node($uid, $gid) { 
     
    6155 
    6256/** 
    63  * Implementation of hook_og(). 
     57 * Implementation of hook_og() 
    6458 */ 
    65 function og_og($op, $gid, $uid, $args) { 
    66   if (in_array($op, array('user insert', 'user delete'))) {    
     59function og_og($op, $gid, $uid, $args){ 
     60  if (in_array($op, array('user insert', 'user delete'))) {      
    6761    $op = str_replace(' ', '_', $op);     
    6862    workflow_ng_invoke_event('og_'. $op, $uid, $gid);    
    6963  } 
    70   // Pending member was approved. 
    71   elseif ($op = 'user update' && $args['is_active']) { 
    72     workflow_ng_invoke_event('og_user_approved', $uid, $gid); 
    73   } 
    7464} 
    75  
    76  
    77 /** 
    78  * Implementation of hook_action_info(). 
    79  */ 
    80 function og_action_info() { 
    81   return array( 
    82     'og_workflow_ng_action_subscribe_user' => array( 
    83       '#label' => t('Subscribe user to group'), 
    84       '#arguments' => array( 
    85         'user' => array('#entity' => 'user', '#label' => t('User who will be subscribed')), 
    86         'group' => array('#entity' => 'node', '#label' => t('Group that user will be subscribed to')), 
    87       ), 
    88       '#description' => t('Subscribe a user to a group.'), 
    89       '#module' => 'OG', 
    90     ),   
    91     'og_workflow_ng_action_remove_user' => array( 
    92       '#label' => t('Unsubscribe user from group'), 
    93       '#arguments' => array( 
    94         'user' => array('#entity' => 'user', '#label' => t('User who will be unsubscribed')), 
    95         'group' => array('#entity' => 'node', '#label' => t('Group that user will be unsubscribed from')), 
    96       ), 
    97       '#description' => t('Unsubscribe a user from a group.'), 
    98       '#module' => 'OG', 
    99     ), 
    100   ); 
    101 } 
    102  
    103 /** 
    104  * Action: Subscribe user to group. 
    105  */ 
    106</