Projet

Général

Profil

Paste
Télécharger (1,07 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / author_pane / modules / user_badges.author-pane.inc @ 6c9579f7

1
<?php
2
/**
3
 * @file
4
 * This file provides a preprocess function on behalf of the User Badges module.
5
 */
6

    
7
/**
8
 * Implements hook_preprocess_author_pane().
9
 */
10
function user_badges_preprocess_author_pane(&$variables) {
11
  // Check if this preprocess needs to be run given who's calling it.
12
  if (!author_pane_run_preprocess('user_badges', $variables['caller'])) {
13
    return;
14
  }
15

    
16
  // Anonymous users has no user badges.
17
  if ($variables['account']->uid != 0) {
18

    
19
    // Only display the badges according badge limit
20
    if (isset($variables['account']->badges)) {
21
      $variables['user_badges'] = '';
22

    
23
      // Loop through and add only the badges that are within the limit,
24
      // $variables['account']->badges, stores the badges within the limit
25
      foreach ($variables['account']->badges as $badge) {
26
        $variables['user_badges'] .= theme('user_badge', array('badge' => $badge));
27
      }
28
    }
29
  }
30
}
31

    
32
/**
33
 * Implements hook_author_pane_allow_preprocess_disable().
34
 */
35
function user_badges_author_pane_allow_preprocess_disable() {
36
  return array('user_badges' => 'User Badges');
37
}