You are here

function signup_view_user_list_access in Signup 6

Same name and namespace in other branches
  1. 6.2 signup.module \signup_view_user_list_access()
  2. 7 signup.module \signup_view_user_list_access()

Menu access callback for the signup_plugin_access_user_signup_list plugin.

1 string reference to 'signup_view_user_list_access'
signup_plugin_access_user_signup_list::get_access_callback in views/plugins/signup_plugin_access_user_signup_list.inc

File

./signup.module, line 1694
The Signup module (http://drupal.org/project/signup) manages replies to nodes. In particular, it's good for event management. Signup supports sending reminder emails and automatically closing signups for nodes with a start time, via the Event…

Code

function signup_view_user_list_access($view_name, $display_id, $argument_name) {
  global $user;
  if (user_access('view all signups')) {
    return TRUE;
  }
  $view = views_get_view($view_name);
  $view
    ->set_display($display_id);
  $view
    ->init_handlers();

  // Find the values for any arguments embedded in the path via '%'.
  $i = 0;
  foreach (explode('/', $view->display_handler
    ->get_option('path')) as $element) {
    if ($element == '%') {
      $view->args[] = arg($i);
    }
    $i++;
  }

  // Now handle any implicit arguments from the end of the path.
  $num_arguments = count($view->argument);
  while (count($view->args) < $num_arguments) {
    $view->args[] = arg($i);
    $i++;
  }
  return $user->uid == $view->argument[$argument_name]
    ->get_value();
}