Currently banging my head on this error:
Notice: Undefined variable: diffs in /path/wp-content/plugins/post-revision-display/post-revision-display.php on line 232 Notice: Undefined variable: rev_content in /path/wp-content/plugins/post-revision-display/post-revision-display.php on line 233
Here are the lines in question (with some extra for context):
// question: should we be applying filters to all the parts and not just content?
function prd_set_globals() {
if (!$post = get_post(get_the_ID())) {
return;
}
$revision = null;
$rev_id = 0;
$is_rev = false;
$note = prd_get_revision_note($post, $revision, $rev_id, $is_rev);
if ($is_rev) {
$diffs = prd_get_revision_diffs($post, $revision);
/* seems clunky, but I don't know a better way -- want to apply_filters
for old revision, but need to skip prd_display_post_revisions filter
to avoid getting stuck in a loop, so will remove filter and add
right back in */
remove_filter('the_content', 'prd_display_post_revisions');
$rev_content = apply_filters('the_content', $revision->post_content);
add_filter('the_content', 'prd_display_post_revisions');
}
$revs = prd_get_revision_list($post, array('since_publish' => true, 'type' => 'revision',
'rev_id' => $rev_id, 'is_rev' => $is_rev));
$GLOBALS['prd_is_rev'] = $is_rev;
$GLOBALS['prd_revision_note'] = $note;
$GLOBALS['prd_revision_list'] = $revs;
$GLOBALS['prd_revision_diffs'] = $diffs;
$GLOBALS['prd_revision_content'] = $rev_content;
$GLOBALS['prd_globals_set'] = true;
}
I’m using Manual Mode. And have this in the template file in use:
if ( $prd == "on" && function_exists('the_revision_note_prd')) {
the_revision_note_prd();
}
the_content();
if ( $prd == "on" ) {
if(function_exists('the_revision_list_prd')) { the_revision_list_prd(true); }
if(function_exists('the_revision_diffs_prd')) { the_revision_diffs_prd(); }
}
The error shows up above the content, and then again below the content. However, despite the error, the revision list still displays and functions as I’d expect. Clicking a revision link takes one to the revision page… complete w/ note at the top. Yet no error messages on past revision pages. Only on ‘current’.
Hi! Thanks for bringing this up. I don’t actively use the plugin and haven’t looked at it for a while, but I’d like to maintain it responsibly. 🙂
Do you have debug mode turned on in your wp-config.php file?
Still, the code should be fixed to not have debug errors. I’ll be happy to look at it, but it might not be in the next day or two. (Maybe this weekend — I’ve learned more about WordPress/PHP so that I feel some motivation to do a little cleanup.)
For now, in debug mode or not, you could try defining the variable here:
$revision = null;
$rev_id = 0;
$is_rev = false;
$diffs = ''; // insert this line
$note = prd_get_revision_note($post, $revision, $rev_id, $is_rev);
I think that would take care of it
And I’ll consider putting it on GitHub — I see no reason not to. And no permission is needed for anything, of course. It’s free software!
Hi!!
I’ve installed your very usefull plugin and now updated to wordpress 3.7.1. Previous version 3.4.2 worked fine…
The result is that everything seems to be ok but the link to each revision is broken (in frontend). It just jumps back to the current version… seems like the browser shows no reaction on URL/?rev=”revision-ID” …any ideas to resolve the issue?
cheers
OK, I have to apologize.. I’ve testet your plugin with another WordPress installation and it works as it should. I think I have a conflict with a another plugin.. maybe Co-Authors Plus.. or some PHP settings…
Thanks, Patzman — I’ve not been doing much WordPress these days but I still keep an eye on these forums. It might have been hard to find some time to work on it but I do want to keep things functional.
I still tryed to locate the problem and I think that it don’t work in combination with a multisite wordpress installation (I’ve set some time ago). Can you confirm that?
Hi — I’ve never tried the plugin on a multisite installation.
I disabled my multisite installation and your plugin worked fine again.. anyeay thanks for reply 😉