[RC] Prime Post Revisions - View all edits to posts

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Scam Warning
Locked
updown
Registered User
Posts: 542
Joined: Sat Jan 05, 2008 6:53 am

Re: [RC] Prime Post Revisions - View all edits to posts

Post by updown » Mon Jul 21, 2008 3:57 am

Hi Prime, besides the new delete function, is there yet a feature planned for easily undoing post edits to a previous version? E.g. select a post-revision to "undo" the last post-changes? Would be very handy... ;)

User avatar
primehalo
Former Team Member
Posts: 2828
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC] Prime Post Revisions - View all edits to posts

Post by primehalo » Mon Jul 21, 2008 9:14 pm

Version 1.2.0:
  • Fixed a minor bug in an SQL statement.
  • Added a language string for when a post has no subject.
  • Added an option to delete all revisions (will not delete the actual post).
  • Added an option to undo the most recent revision to the post.
  • Correctly update the edit time, user, and reason when deleting a revision.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

User avatar
Jaga
Registered User
Posts: 140
Joined: Mon Jun 23, 2008 5:10 am

Re: [RC] Prime Post Revisions - View all edits to posts

Post by Jaga » Mon Jul 21, 2008 11:50 pm

primehalo wrote:Version 1.2.0:
  • Added an option to delete all revisions (will not delete the actual post).
  • Added an option to undo the most recent revision to the post.
I hate to mention it, but I don't see these. I've checked Admin and Global Mod permissions for new fields, and even started a new test topic with multiple revisions. But my Admin user account still just sees the "Delete" button on each post. I also checked the quick mod tools, and didn't see an entry for either feature.

Note: I followed the upgrade routine from 1.0.0

User avatar
primehalo
Former Team Member
Posts: 2828
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC] Prime Post Revisions - View all edits to posts

Post by primehalo » Mon Jul 21, 2008 11:59 pm

Jaga wrote:
primehalo wrote:Version 1.2.0:
  • Added an option to delete all revisions (will not delete the actual post).
  • Added an option to undo the most recent revision to the post.
I hate to mention it, but I don't see these. I've checked Admin and Global Mod permissions for new fields, and even started a new test topic with multiple revisions. But my Admin user account still just sees the "Delete" button on each post. I also checked the quick mod tools, and didn't see an entry for either feature.

Note: I followed the upgrade routine from 1.0.0
The REVISION_PAGE_HEADER must be set to true in order for you to see the Delete All Revisions link, because it appears within that block.

The Undo Most Recent Revision doesn't look like anything special, it's the standard delete X icon, but now it shows up on the topmost revision, since the topmost revision is the current post.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

User avatar
Jaga
Registered User
Posts: 140
Joined: Mon Jun 23, 2008 5:10 am

Re: [RC] Prime Post Revisions - View all edits to posts

Post by Jaga » Tue Jul 22, 2008 12:05 am

Got it, thanks Prime. Those hidden options in the php are something I keep forgetting to look for. Kudos.

User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [RC] Prime Post Revisions - View all edits to posts

Post by IPB_Refugee » Tue Jul 22, 2008 7:07 am

Hi Ken,

thanks for the update! Unfortunately the mentioned error still occurs. When I edit a post that already was edited back in phpBB-2 and then I want to view the post revisions history (e.g. viewtopic.php?p=1630&display_history=true) phpBB shows me this warning:
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1397: Undefined index: 2
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3694: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3014)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3696: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3014)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3697: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3014)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3698: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3014)
Here is my german translation for folder language/de/mods:

Code: Select all

<?php
/**
*
* prime_post_revisions [English]
*
* @package language
* @version $Id: prime_post_revisions.php,v 1.2.0 2008/07/21 13:45:00 primehalo Exp $
* @copyright (c) 2007-2008 Ken F. Innes IV
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* DO NOT CHANGE
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

if (empty($lang) || !is_array($lang))
{
	$lang = array();
}

// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
//
// Some characters you may want to copy&paste:
// ’ » “ ” …
//

$lang = array_merge($lang, array(
	// Viewing posts
	'PRIME_POST_REVISIONS_VIEW'				=> 'Zeige Beitragsversionen',	// Text for the link to view the revision history

	// Viewing revisions
	'PRIME_POST_REVISIONS_VIEWING'			=> 'Betrachtet Beitragsversionen',
	'PRIME_POST_REVISIONS_VIEWING_EXPLAIN'	=> 'Diese Seite zeigt alle Versionen des Beitrags, beginnend mit der aktuellsten Version.',
	'PRIME_POST_REVISIONS_TITLE'			=> 'Überblick der Beitragsversionen: %s',	// The %s is the post title
	'PRIME_POST_REVISIONS_FIRST'			=> 'Ursprünglicher Beitrag: %s',			// The %s is the post title
	'PRIME_POST_REVISIONS_FINAL'			=> 'Aktueller Beitrag: %s',			// The %s is the post title
	'PRIME_POST_REVISIONS_COUNT'			=> 'Version %d: %s',			// The %s is the post title
	'PRIME_POST_REVISIONS_INFO'				=> 'Editiert von %1$s am %2$s.',
	'PRIME_POST_REVISIONS_NO_SUBJECT'		=> '[kein Titel]',	

	// Delete a revision
	'PRIME_POST_REVISIONS_DELETE'			=> 'Lösche Version',
	'PRIME_POST_REVISIONS_DELETE_CONFIRM'	=> 'Bist du sicher, dass du diese Beitragsversion löschen willst?',
	'PRIME_POST_REVISIONS_DELETE_DENIED'	=> 'Du besitzt nicht die erforderlichen Rechte zur Löschung dieser Beitragsversion.',
	'PRIME_POST_REVISIONS_DELETE_FAILED'	=> 'Ein Fehler ist beim Versuch, die Beitragsversion zu löschen, aufgetreten.',
	'PRIME_POST_REVISIONS_DELETE_SUCCESS'	=> 'Die Beitragsversion wurde erfolgreich gelöscht.',
	'PRIME_POST_REVISIONS_DELETE_INVALID'	=> 'Es wurde keine Beitragsversion für die Löschung ausgewählt.',

	// Delete all revisions
	'PRIME_POST_REVISIONS_DELETES'			=> 'Lösche alle Versionen',
	'PRIME_POST_REVISIONS_DELETES_CONFIRM'	=> 'Bist du sicher, dass du diese Beitragsversionen löschen willst?',
	'PRIME_POST_REVISIONS_DELETES_DENIED'	=> 'Du besitzt nicht die erforderlichen Rechte zur Löschung dieser Beitragsversionen.',
	'PRIME_POST_REVISIONS_DELETES_FAILED'	=> 'Ein Fehler ist beim Versuch, diese Beitragsversionen zu löschen, aufgetreten.',
	'PRIME_POST_REVISIONS_DELETES_SUCCESS'	=> 'Die Beitragsversionen wurden erfolgreich gelöscht.',
	'PRIME_POST_REVISIONS_DELETES_INVALID'	=> 'Es wurden keine Beitragsversionen für die Löschung ausgewählt.',
));

?>
Regards
Wolfgang

User avatar
primehalo
Former Team Member
Posts: 2828
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC] Prime Post Revisions - View all edits to posts

Post by primehalo » Tue Jul 22, 2008 7:29 am

This is not something I can debug for you, since it seems to be specific to your conversion. I also did a conversion from phpbb2, and I have no problem editing those old posts. Start with the line where that error occurs. I believe it's this one:

Code: Select all

                $user_cache[$row['post_edit_user']] = $post_edit_list[$row['post_edit_user']];
  
Then add a trigger_error to find out what is actually in that array, like so:

Code: Select all

trigger_error(str_replace("\n", '<br />', print_r($post_edit_list, true)));
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [RC] Prime Post Revisions - View all edits to posts

Post by IPB_Refugee » Tue Jul 22, 2008 11:14 pm

Thanks for your help!

This is what I got:
Array
(
[18] => Array
(
[user_id] => 18
[username] => Mister X
[user_colour] => F87500
)

)
It's also strange, that the edit text on the viewtopic page before I edited the post told:
Last changed by Mister X on 11.09.2007, 14:03, edited 1 time.
And now, after my edition it tells:
Last changed by IPB_Refugee on 23.07.200, 01:10, edited 1 time.
But I had a similiar MOD like Prime Post Editions installed on my phpBB-2 board. Maybe that causes the problems I have and that fortunately only occur in special cases (when the post had already been edited in the phpBB-2 board.)

Regards
Wolfgang

User avatar
primehalo
Former Team Member
Posts: 2828
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC] Prime Post Revisions - View all edits to posts

Post by primehalo » Wed Jul 23, 2008 5:37 am

IPB_Refugee wrote:This is what I got:
Array
(
[18] => Array
(
[user_id] => 18
[username] => Mister X
[user_colour] => F87500
)

)
Try this for me...
Open prime_post_revisions.php
Find:

Code: Select all

            else if ($this->approve_viewing || APPROVE_VIEWING_POSTER)     
Replace with:

Code: Select all

            if ($this->approve_viewing || APPROVE_VIEWING_POSTER)     
See if that changes anything. If it doesn't, undo the change and try this:
Open prime_post_revisions.php
Find:

Code: Select all

        }

        /**
        * Inject user data into the $post_edit_list and $user_cache tables if it does not already exist.
        */  
Add before:

Code: Select all

            else if ($this->viewing_history)
            {
                $row['post_edit_count'] = 0;
                $row['post_edit_reason'] = ''
            }
  
IPB_Refugee wrote:It's also strange, that the edit text on the viewtopic page before I edited the post told:
Last changed by Mister X on 11.09.2007, 14:03, edited 1 time.
And now, after my edition it tells:
Last changed by IPB_Refugee on 23.07.200, 01:10, edited 1 time.
But I had a similiar MOD like Prime Post Editions installed on my phpBB-2 board. Maybe that causes the problems I have and that fortunately only occur in special cases (when the post had already been edited in the phpBB-2 board.)

Regards
Wolfgang
Well, I don't know why it would be cutting off the last digit of the year, but the number of edits makes sense to me. The board keeps track of how many edits were made, but only sometimes, under the right circumstances. This number is stored in the POSTS table. My MOD keeps track of all edits for a post, assuming an edit was actually made (which isn't always the case, as the edit might just be changing it from normal to global, or just adding a reason for editing without actually changing anything). So my edit count comes from how many edits are stored in the POST_REVISIONS table. If that value is greater than the one stored in the POSTS table, then it is displayed, otherwise I display the number stored in the POSTS table.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [RC] Prime Post Revisions - View all edits to posts

Post by IPB_Refugee » Wed Jul 23, 2008 6:39 am

primehalo wrote:Open prime_post_revisions.php
Find:

Code: Select all

            else if ($this->approve_viewing || APPROVE_VIEWING_POSTER)     
Replace with:

Code: Select all

            if ($this->approve_viewing || APPROVE_VIEWING_POSTER)     
Hi Ken,

that worked! The warning from phpBB's debug mode disappeared! Thanks a lot, sir! :)
primehalo wrote:Well, I don't know why it would be cutting off the last digit of the year ...
My mistake, when I translated the sentence. :oops:
primehalo wrote:So my edit count comes from how many edits are stored in the POST_REVISIONS table. If that value is greater than the one stored in the POSTS table, then it is displayed, otherwise I display the number stored in the POSTS table.
The numer of edits is still not correct when I edit a post that had already been edited back in the days of phpBB-2. Let's say the previous number of edits was 2, and after editing the post again now, the number is still 2. In fact, I had to edit this post three times today before it showed that number (3 edits). I guess, your MOD always adds 1 after an edit only to POST_REVISIONS table and not to POSTS table, too. But that's a minor problem.

Thanks again!
Wolfgang

User avatar
primehalo
Former Team Member
Posts: 2828
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC] Prime Post Revisions - View all edits to posts

Post by primehalo » Wed Jul 23, 2008 7:25 am

IPB_Refugee wrote:
primehalo wrote:So my edit count comes from how many edits are stored in the POST_REVISIONS table. If that value is greater than the one stored in the POSTS table, then it is displayed, otherwise I display the number stored in the POSTS table.
The numer of edits is still not correct when I edit a post that had already been edited back in the days of phpBB-2. Let's say the previous number of edits was 2, and after editing the post again now, the number is still 2. In fact, I had to edit this post three times today before it showed that number (3 edits). I guess, your MOD always adds 1 after an edit only to POST_REVISIONS table and not to POSTS table, too. But that's a minor problem.

Thanks again!
Wolfgang
My MOD doesn't add or alter anything to the POSTS table (except when deleting post revisions). I choose to do it like this because I didn't want to overrule the board's settings. For instance, if a user edits their post shortly after they post it, often the board won't keep track of the edit and thus won't display the message that it has been edited. I think most people like this, as they won't constantly have to see that message whenever someone quickly corrects a spelling error or whatever. However, my MOD stores the edit, so if you're allowed to view the revisions then my MOD takes over and you'll see the message that the post was edited.

Now, a post that had already been edited twice will have an edit count of 2 stored in the POSTS table. If you then install my MOD and edit the post, there will be 1 revision stored in POST_REVISIONS. If you're still seeing 2, it means the board did not increment the post count. This would be due to the board's rules for when it should register an edit and when it should not; my MOD doesn't interfere with this. So how did the edit message get there in the first place? Well, maybe phpbb2 had different rules for determining when to store an edit. Or perhaps that other MOD you had installed added the edit count. Whatever the reason is, if the board isn't incrementing that edit count, then you won't see a bigger number until the number of revisions in the POST_REVISIONS table reaches 3.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [RC] Prime Post Revisions - View all edits to posts

Post by IPB_Refugee » Thu Jul 24, 2008 6:09 am

Thank you for the explanation! :) It helps to understand phpBB and your MOD better.

Regards
Wolfgang

ibelphegor
Registered User
Posts: 453
Joined: Wed Oct 24, 2007 8:37 am

Re: [RC] Prime Post Revisions - View all edits to posts

Post by ibelphegor » Thu Jul 24, 2008 8:50 am

Install and have error

Code: Select all

SQL ERROR [ mysql4 ]

Incorrect string value: '\xD7\x9E\xD7\x96\xD7\x9C...' for column 'post_subject' at row 1 [1366]
For fix:
Open phpadmin and click on "phpbb_post_revisions"
change:
post_subject, bbcode_uid And post_edit_reason from "latin1_swedish_ci" to "utf8_bin"

Regards,
uzi

User avatar
primehalo
Former Team Member
Posts: 2828
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC] Prime Post Revisions - View all edits to posts

Post by primehalo » Thu Jul 24, 2008 9:06 pm

ibelphegor wrote:Install and have error

Code: Select all

SQL ERROR [ mysql4 ]

Incorrect string value: '\xD7\x9E\xD7\x96\xD7\x9C...' for column 'post_subject' at row 1 [1366]
For fix:
Open phpadmin and click on "phpbb_post_revisions"
change:
post_subject, bbcode_uid And post_edit_reason from "latin1_swedish_ci" to "utf8_bin"

Regards,
uzi
I wonder why those were added as latin1_swedish_ci.... what method did you use for installing the database portions? Did you use the file or manually execute the sql from the instructions file?
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

ibelphegor
Registered User
Posts: 453
Joined: Wed Oct 24, 2007 8:37 am

Re: [RC] Prime Post Revisions - View all edits to posts

Post by ibelphegor » Fri Jul 25, 2008 3:08 pm

primehalo wrote: I wonder why those were added as latin1_swedish_ci.... what method did you use for installing the database portions? Did you use the file or manually execute the sql from the instructions file?
manually execute the sql from the instructions file,
Do you think that is a phpadmin config problem?

Some question and request :)
Who can see now the edit? i think only admin, correct?
For Delete history need to enter to specific post?

If all above correct i think option to delete automatic after X days will be great
and option to add permission to who can see edit history.

Locked

Return to “[3.0.x] MODs in Development”