You are here

function user_revision_vid_arg in User Revision 7.2

Return the path index containing the vid value if on a user revision page, otherwise 0. Provided primarily for use by the user_diff module.

See also

user_revision_menu()

2 calls to user_revision_vid_arg()
user_rev_diff_block_view in diff/user_rev_diff.module
Implements hook_block_view().
user_rev_diff_user_view_alter in diff/user_rev_diff.module
Implementation of hook_user_view_alter().

File

./user_revision.module, line 95
Enables user revision.

Code

function user_revision_vid_arg() {
  $required_args = array(
    0 => 'user',
    2 => 'revisions',
    3 => 'account',
    4 => 'view',
    5 => FALSE,
  );

  // The loop must result in one of the return statements being excuted.
  foreach ($required_args as $index => $element) {

    // if at the end, return the final index.
    if (!$element) {
      return $index;
    }

    // If the path doesn't match, return 0.
    if (arg($index) != $element) {
      return 0;
    }
  }
}