Projet

Général

Profil

Révision c169e7c4

Ajouté par Assos Assos il y a presque 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/advanced_forum/advanced_forum.module
243 243

  
244 244
  // Don't let core do its basic preprocess for forums, as we want to do
245 245
  // other stuff now.
246
  foreach ($theme_registry['forums']['preprocess functions'] as $key => $value) {
247
    if ($value == 'template_preprocess_forums') {
248
      unset($theme_registry['forums']['preprocess functions'][$key]);
246
  if (isset($theme_registry['forums']['preprocess functions'])) {
247
    foreach ($theme_registry['forums']['preprocess functions'] as $key => $value) {
248
      if ($value == 'template_preprocess_forums') {
249
        unset($theme_registry['forums']['preprocess functions'][$key]);
250
      }
249 251
    }
250 252
  }
251 253

  
252 254
  // We duplicate all of core's forum list preprocessing so no need to run
253 255
  // it twice. Running twice also causes problems with & in forum name.
254
  foreach ($theme_registry['forum_list']['preprocess functions'] as $key => $value) {
255
    if ($value == 'template_preprocess_forum_list') {
256
      unset($theme_registry['forum_list']['preprocess functions'][$key]);
256
  if (isset($theme_registry['forum_list']['preprocess functions'])) {
257
    foreach ($theme_registry['forum_list']['preprocess functions'] as $key => $value) {
258
      if ($value == 'template_preprocess_forum_list') {
259
        unset($theme_registry['forum_list']['preprocess functions'][$key]);
260
      }
257 261
    }
258 262
  }
259 263

  
260 264
  // Views handles the topic list pages so remove the core template preprocess.
261
  foreach ($theme_registry['forum_topic_list']['preprocess functions'] as $key => $value) {
262
    if ($value == 'template_preprocess_forum_topic_list') {
263
      unset($theme_registry['forum_topic_list']['preprocess functions'][$key]);
265
  if (isset($theme_registry['forum_topic_list']['preprocess functions'])) {
266
    foreach ($theme_registry['forum_topic_list']['preprocess functions'] as $key => $value) {
267
      if ($value == 'template_preprocess_forum_topic_list') {
268
        unset($theme_registry['forum_topic_list']['preprocess functions'][$key]);
269
      }
264 270
    }
265 271
  }
266 272

  
......
323 329
          }
324 330
        }
325 331
        // Add in our new preprocess functions:
326
        array_splice($theme_registry[$template]['preprocess functions'], $position, 0, $preprocess);
332
        if (isset($theme_registry[$template]['preprocess functions'])) {
333
          array_splice($theme_registry[$template]['preprocess functions'], $position, 0, $preprocess);
334
        }
327 335
      }
328 336
    }
329 337
  }
330 338

  
331 339

  
332 340
  // temp workaround
333
  array_splice($theme_registry['views_view__advanced_forum_topic_list']['preprocess functions'], 1, 0, 'template_preprocess_views_view');
334
  array_splice($theme_registry['views_view__advanced_forum_group_topic_list']['preprocess functions'], 1, 0, 'template_preprocess_views_view');
341
  if (isset($theme_registry['views_view__advanced_forum_topic_list']['preprocess functions'])) {
342
    array_splice($theme_registry['views_view__advanced_forum_topic_list']['preprocess functions'], 1, 0, 'template_preprocess_views_view');
343
  }
344
  if (isset($theme_registry['views_view__advanced_forum_group_topic_list']['preprocess functions'])) {
345
    array_splice($theme_registry['views_view__advanced_forum_group_topic_list']['preprocess functions'], 1, 0, 'template_preprocess_views_view');
346
  }
335 347
  //array_splice($theme_registry['views_view_forum_topic_list__advanced_forum_topic_list']['preprocess functions'], 1, 0, 'template_preprocess_views_view_forum_topic_list');
336 348
}
337 349

  
......
441 453
  }
442 454
}
443 455

  
444
/**
445
 * Implementation of hook_comment_insert().
446
 */
447
function advanced_forum_comment_insert($comment) {
448
  if (!empty($comment->node_type) && ($comment->node_type == "comment_node_forum")) {
449
    advanced_forum_statistics_replies(1);
450
  }
451
}
452

  
453 456
/**
454 457
 * Implementation of hook_comment_update().
455 458
 */
......
1341 1344
  }
1342 1345

  
1343 1346
  $node_id = $node->nid;
1344
  $post_id = $comment->pid;
1347
  $post_id = $comment->cid;
1345 1348

  
1346 1349
  if (!isset($post_order[$node_id])) {
1347 1350
    // Initialize the spot for this node's list.

Formats disponibles : Unified diff