| 1 |
<?php |
<?php |
| 2 |
// $Id: comms.module,v 1.1.4.21 2009/09/22 22:21:29 evoltech Exp $ |
// $Id: comms.module,v 1.1.4.22 2009/09/23 07:55:59 evoltech Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 341 |
$node->title = $node->sms_message; |
$node->title = $node->sms_message; |
| 342 |
} |
} |
| 343 |
|
|
| 344 |
|
// Initialize the og_groups array. |
| 345 |
|
// @todo figure out if this is necesary. |
| 346 |
|
if (!is_array($node->og_groups)) { |
| 347 |
|
$node->og_groups = array(); |
| 348 |
|
} |
| 349 |
|
|
| 350 |
|
// If associating tags is exclusively the way to add groups then we |
| 351 |
|
// will override the $node->og_groups array, otherwise we have to merge |
| 352 |
|
// in the new groups. There is no way to honor |
| 353 |
|
// comms_taxonomy_group_tags_del here. |
| 354 |
|
// @see http://drupal.org/node/571146 |
| 355 |
|
// Clear the og_groups array if this system is set up to use groups |
| 356 |
|
// exclusively. |
| 357 |
|
// @todo figure out if this is necesary. |
| 358 |
|
if (variable_get('comms_taxonomy_group_tags_exclusive', 1)) { |
| 359 |
|
$node->og_groups = array(); |
| 360 |
|
} |
| 361 |
|
|
| 362 |
$vid = variable_get('comms_taxonomy_group_tags', ''); |
$vid = variable_get('comms_taxonomy_group_tags', ''); |
| 363 |
if (!empty($vid) || empty($node->taxonomy[$vid])) { |
if (!empty($vid) || empty($node->taxonomy[$vid])) { |
| 364 |
// Get all groups associated with the registered tags and bind them to |
// Get all groups associated with the registered tags and bind them to |
| 365 |
// this comms node. |
// this comms node. |
| 366 |
foreach ($node->taxonomy[$vid] as $term_id) { |
foreach ($node->taxonomy[$vid] as $term_id) { |
| 367 |
$gids = _comms_get_gids_by_tid($term_id); |
$gids = _comms_get_gids_by_tid($term_id); |
| 368 |
|
//dpm('$gids associated with '. $term_id .': '. implode(', ', $gids)); |
| 369 |
if (!is_array($gids) || $gids == -1) { |
if (!is_array($gids) || $gids == -1) { |
| 370 |
drupal_set_message(t('comms_submit', 'We are unable to process this submission because there is a critical problem with the tapatio module. Please contact an admin and try again later'), 'error', FALSE); |
drupal_set_message(t('comms_submit', 'We are unable to process this submission because there is a critical problem with the tapatio module. Please contact an admin and try again later'), 'error', FALSE); |
| 371 |
return; |
return; |
| 372 |
} |
} |
| 373 |
|
|
| 374 |
// If associating tags is exclusively the way to add groups then we |
foreach ($gids as $gid => $name) { |
| 375 |
// will override the $node->og_groups array, otherwise we have to merge |
$node->og_groups[$gid] = $gid; |
|
// in the new groups. There is no way to honor |
|
|
// comms_taxonomy_group_tags_del here. |
|
|
// @see http://drupal.org/node/571146 |
|
|
if (variable_get('comms_taxonomy_group_tags_exclusive', 1)) { |
|
|
$node->og_groups = $gids; |
|
|
} else { |
|
|
foreach ($gids as $gid => $name) { |
|
|
$node->og_groups[$gid] = $gid; |
|
|
} |
|
| 376 |
} |
} |
| 377 |
} |
} |
| 378 |
} |
} |
| 379 |
|
dpm('$node->og_groups: '. print_r($node->og_groups, 1)); |
| 380 |
} |
} |
| 381 |
|
|
| 382 |
function comms_form(&$node) { |
function comms_form(&$node) { |
| 1682 |
} |
} |
| 1683 |
} |
} |
| 1684 |
if (!empty($gids)) { |
if (!empty($gids)) { |
| 1685 |
|
//$message = "Attempted to add groups: ". implode(', ', $node->og_groups); |
| 1686 |
og_save_ancestry($node); |
og_save_ancestry($node); |
| 1687 |
} |
} |
| 1688 |
else { |
else { |