You are here

function user_rev_diff_inline_show in User Revision 7.2

Same name in this branch
  1. 7.2 diff/user_rev_diff.api.php \user_rev_diff_inline_show()
  2. 7.2 diff/user_rev_diff.pages.inc \user_rev_diff_inline_show()

Show the inline diff of a given user object v. the user with $old_vid. If $old_vid = 0 returns the normally rendered content of the user object. If metadata is TRUE a header will be added with a legend explaining the color code. This function returns HTML code.

2 calls to user_rev_diff_inline_show()
user_rev_diff_inline_ajax in diff/user_rev_diff.module
AJAX callback for rendering the inline diff of a user.
user_rev_diff_user_view_alter in diff/user_rev_diff.module
Implementation of hook_user_view_alter().

File

diff/user_rev_diff.pages.inc, line 230
Menu callbacks for hook_menu().

Code

function user_rev_diff_inline_show($user, $old_vid = 0, $metadata = TRUE) {
  $new_user = $user;
  user_build_content($new_user);
  $new = drupal_render($new_user->content);
  module_load_include('inc', 'diff', 'diff.pages');
  if ($old_vid) {
    $old_user = user_revision_load($user->uid, $old_vid, TRUE);
    user_build_content($old_user);
    $old = drupal_render($old_user->content);
    $output = $metadata ? theme('user_rev_diff_inline_metadata', array(
      'user' => $new_user,
    )) : '';
    $output .= diff_get_inline($old, $new);
    return $output;
  }
  return $new;
}