Révision 136a805a
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/forum_access/forum_access.module | ||
---|---|---|
15 | 15 |
* Remind the user to upgrade to Chain Menu Access API 2.x. |
16 | 16 |
*/ |
17 | 17 |
function forum_access_requirements($phase) { |
18 |
require_once DRUPAL_ROOT . '/includes/install.inc'; |
|
18 | 19 |
$result = array(); |
19 | 20 |
switch ( $phase ) { |
20 | 21 |
case 'update': |
... | ... | |
110 | 111 |
|
111 | 112 |
if (is_numeric($comment)) { |
112 | 113 |
$comment = comment_load($comment); |
114 |
if (empty($comment)) { |
|
115 |
return FALSE; |
|
116 |
} |
|
113 | 117 |
} |
114 | 118 |
$node = node_load($comment->nid); |
115 | 119 |
|
... | ... | |
275 | 279 |
} |
276 | 280 |
elseif ($form_id == 'content_access_admin_settings' && empty($_POST)) { |
277 | 281 |
_forum_access_module_load_include('admin.inc'); |
278 |
_forum_access_content_access_admin_form(); |
|
282 |
_forum_access_content_access_admin_form($form_state['build_info']['args'][0]);
|
|
279 | 283 |
} |
280 | 284 |
} |
281 | 285 |
|
... | ... | |
454 | 458 |
* Saves the tid on the forum-specific pages. |
455 | 459 |
*/ |
456 | 460 |
function forum_access_menu_get_item_alter(&$router_item, $path, $original_map) { |
457 |
switch ($original_map[0]) { |
|
458 |
|
|
459 |
case 'forum': |
|
460 |
if (empty($original_map[1])) { |
|
461 |
forum_access_current_tid(0); |
|
462 |
} |
|
463 |
elseif (is_numeric($original_map[1])) { |
|
464 |
forum_access_current_tid($original_map[1]); |
|
465 |
} |
|
466 |
break; |
|
467 |
|
|
468 |
case 'node': |
|
469 |
if (isset($original_map[1]) && is_numeric($nid = $original_map[1]) && ($node = node_load($nid)) && ($tid = _forum_access_get_tid($node))) { |
|
470 |
forum_access_current_tid($tid); |
|
471 |
} |
|
472 |
break; |
|
461 |
if (forum_access_current_tid() == 0) { |
|
462 |
switch ($original_map[0]) { |
|
463 |
case 'forum': |
|
464 |
if (isset($original_map[1]) && is_numeric($original_map[1])) { |
|
465 |
forum_access_current_tid($original_map[1]); |
|
466 |
} |
|
467 |
break; |
|
468 |
case 'node': |
|
469 |
if (isset($original_map[1]) && is_numeric($nid = $original_map[1]) && ($node = node_load($nid)) && ($tid = _forum_access_get_tid($node))) { |
|
470 |
forum_access_current_tid($tid); |
|
471 |
} |
|
472 |
break; |
|
473 |
} |
|
473 | 474 |
} |
474 | 475 |
} |
475 | 476 |
|
... | ... | |
498 | 499 |
foreach ($variables['forums'] as $tid => $forum) { |
499 | 500 |
$forum->forum_access_moderators = NULL; |
500 | 501 |
if ($uids = forum_access_get_moderator_uids($tid)) { |
501 |
$forum->forum_access_moderators = user_load_multiple(uids); |
|
502 |
$forum->forum_access_moderators = user_load_multiple($uids);
|
|
502 | 503 |
} |
503 | 504 |
} |
504 | 505 |
} |
... | ... | |
526 | 527 |
} |
527 | 528 |
} |
528 | 529 |
|
529 |
/** |
|
530 |
* Implements $modulename_preprocess_$hook() for comment. |
|
531 |
* |
|
532 |
* Recreate comment links (they've already been themed), and |
|
533 |
* remove those that aren't accessible to the user. |
|
534 |
*/ |
|
535 |
function forum_access_preprocess_comment(&$variables) { |
|
536 |
if (isset($variables['node']->tid)) { |
|
537 |
_forum_access_module_load_include('node.inc'); |
|
538 |
_forum_access_preprocess_comment($variables); |
|
539 |
} |
|
540 |
} |
|
541 |
|
|
542 | 530 |
/** |
543 | 531 |
* This is also required by ACL module. |
544 | 532 |
*/ |
Formats disponibles : Unified diff
Weekly update of contrib modules