You are here

function signup_list_user_signups in Signup 6.2

Same name and namespace in other branches
  1. 5.2 includes/views.none.inc \signup_list_user_signups()
  2. 5 signup.module \signup_list_user_signups()

Return an array of all nodes the specified user has signed up for.

Parameters

$uid: The ID of the user to generate a list of signups for.

Return value

Array of all nodes the given user has signed up for. The array is indexed by node ID, and contains titles as links to each node.

3 calls to signup_list_user_signups()
signup_block in includes/no_views.inc
Implementation of hook_block().
signup_user_schedule in includes/no_views.inc
Print a schedule of the given user's signups.
_signup_user_no_views in includes/no_views.inc
Private helper as a partial implementation of hook_user().

File

includes/no_views.inc, line 132
Provides all the code for required UI elements for sites that do not have views.module enabled. If views is enabled, there are default views for all of these things (which are therefore customizable and more powerful) in signup/views/views.inc.

Code

function signup_list_user_signups($uid) {
  $titles = array();

  // We don't want to return anything for anon users.
  if ($uid != 0) {
    $sql = "SELECT n.nid, n.title FROM {node} n INNER JOIN {signup_log} s_l ON n.nid = s_l.nid WHERE s_l.uid = %d ORDER BY n.nid";
    $result = db_query(db_rewrite_sql($sql), $uid);
    while ($node = db_fetch_array($result)) {
      $titles[$node['nid']] = l($node['title'], 'node/' . $node['nid']);
    }
  }
  return $titles;
}