You are here

function user_revision_list_build in User Revision 7.2

Build the table of older revisions of a user.

This is used by both user_revision view and user_rev_diff view.

2 calls to user_revision_list_build()
user_revision_overview in ./user_revision.pages.inc
Generate an overview table of older revisions of a user.
user_rev_diff_user_revisions in diff/user_rev_diff.pages.inc
Input form to select two revisions.

File

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

Code

function user_revision_list_build($viewed_user) {
  $revisions = user_revision_list($viewed_user);
  $data = array();
  foreach ($revisions as $revision) {
    $row = array();
    $operations = array();
    $revert_permission = _user_revision_access($viewed_user, array(
      'revert user revisions',
      'revert own user revisions',
    ));
    $delete_permission = _user_revision_access($viewed_user, array(
      'delete user revisions',
      'delete own user revisions',
    ));
    $vid = $revision->vid;
    $link_base = _user_revision_base_path($viewed_user);
    $row[$vid] = array(
      'data' => t('!date by !username', array(
        '!date' => l(format_date($revision->timestamp), "{$link_base}/view/{$revision->vid}"),
        '!username' => theme('username', array(
          'account' => $revision,
        )),
      )) . ($revision->log != '' ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : ''),
      'revision' => $revision,
    );
    if ($revision->current_vid > 0) {
      $operations[] = array(
        'data' => drupal_placeholder(t('current revision')),
        'class' => array(
          'revision-current',
        ),
        'colspan' => 2,
      );
    }
    else {
      $operations[] = $revert_permission ? l(t('revert'), "{$link_base}/{$revision->vid}/revert") : '';
      $operations[] = $delete_permission ? l(t('delete'), "{$link_base}/{$revision->vid}/delete") : '';
    }
    $data[] = array(
      'row' => $row,
      'operations' => $operations,
    );
  }
  return $data;
}