Displaying counts from the Invite module

Last modified: August 26, 2009 - 23:07

This assumes you are using the Invite module.
I am also using this layout: http://drupal.org/node/89817

We need to determine user_access and output the $base_url in a link

<?php
global $user, $base_url;
?>

Only call invite_get_counts and display this section if the user has permission to send invitations

<?php
if($user->uid != $account->uid && user_access('send invitations')):
?>

Use the invite_get_counts function to get the data

<?php
    $counts
= invite_get_counts($account->uid);
   
$accepted = $counts['accepted'];
   
$pending = $counts['pending'];
   
$expired = $counts['expired'];
 
?>

Output the HTML with the counts

  <h2 class="title">Invitations</h2>
  <dl>
    <dt>Accepted:</dt><dd><?php print $accepted; ?> </dd>
    <dt>Pending:</dt><dd><?php print $pending; ?></dd>
    <dt>Expired:</dt><dd><?php print $expired; ?></dd>
    <dt>Send invitations:</dt><a href="<?php print $base_url; ?>/invite">Go to the invitations page.</a><dd>
  </dl>

<?php
endif;
?>

 
 

Drupal is a registered trademark of Dries Buytaert.