[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!
Suggested Hosts
Locked
User avatar
primehalo
Former Team Member
Posts: 2833
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 Jun 03, 2010 7:37 am

Acorn wrote:I've just installed this on a 3.0.6 board, and the 'view post history' link is appearing on edited posts, but when I click on it I get the error message:

[phpBB Debug] PHP Notice: in file /includes/prime_post_revisions.php on line 438: array_merge() [function.array-merge]: Argument #2 is not an array

I have this installed on another 3.0.6 where it works beautifully. The only difference I can see between the two is that this board has a different database prefix (ie not phpbb_). I altered the prefix in the sql instruction - maybe I missed something else I needed to change?

Help gratefully received!
Line 438 is this:

Code: Select all

                $row = array_merge($this->current_post, $row); 
The 2nd argument is $row which is passed into the function as an argument from this line in viewtopic.php:

Code: Select all

    $prime_post_revisions->merge_revision_info($post_list, $result, $row); 
The variable $row there should always be an array, as a couple lines above you can see where it comes from:

Code: Select all

while ($row = $db->sql_fetchrow($result)) 
So perhaps you have another MOD installed that is doing something it shouldn't be doing to that variable.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

User avatar
primehalo
Former Team Member
Posts: 2833
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 Jun 03, 2010 7:44 am

*Daniel wrote:Does anyone know how I can get this working with this mod?

http://www.phpbb.com/customise/db/mod/ajax_quick_edit/
I didn't even notice that someone had made an add-on to address this issue. I will repack the MOD to include this optional add-on.
Last edited by primehalo on Thu Jun 03, 2010 9:06 am, edited 1 time in total.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

User avatar
Ashley.S.
Registered User
Posts: 468
Joined: Mon Aug 04, 2008 6:01 pm
Location: Falmouth, Cornwall, UK
Name: Ashley .S.
Contact:

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

Post by Ashley.S. » Thu Jun 03, 2010 9:00 am

primehalo wrote:
*Daniel wrote:Does anyone know how I can get this working with this mod?

http://www.phpbb.com/customise/db/mod/ajax_quick_edit/
I don't think there's any simple solution, code would have to be added for it to handle the posts in the revision table. Unfortunately I don't have the time to look into modifying that MOD>
this post might help: http://www.phpbb.com/community/viewtopi ... 5#p8394255
Regards,
-Ashley.S. [ ProphpBB Free Forum Hosting Moderator ]

User avatar
Acorn
Registered User
Posts: 397
Joined: Tue Sep 26, 2006 8:11 am
Location: UK
Contact:

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

Post by Acorn » Thu Jun 03, 2010 9:09 am

Primehalo, you're wonderful!

Somehow ( :oops: ), instead of adding that line after the bit I was finding, I managed to put it in the middle, so

Code: Select all

while ($row = $db->sql_fetchrow($result))
was appearing after

Code: Select all

$prime_post_revisions->merge_revision_info($post_list, $result, $row);
instead of before it.

Problem solved, many, many thanks. :D
Getting braver all the time. :D

zach'
Registered User
Posts: 44
Joined: Sat Nov 01, 2008 2:07 pm

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

Post by zach' » Wed Jul 07, 2010 10:22 pm

Hi primehalo,

Thanks another time, for this great mod

I was posting in this old message, to provide traduction http://www.phpbb.com/community/viewtopi ... #p10650215

I would like to show the post edit info to all members (at the bottom of posts), but only allow moderator to see the link to history (not showing the link to members)

so $l_edited_link should displays when $auth->acl_get('m_edit, $forum_id)

need help please, i was searching without sucess to do that, :|

Thanks

User avatar
primehalo
Former Team Member
Posts: 2833
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 » Fri Jul 09, 2010 11:20 pm

You probably want to change this line:

Code: Select all

            if (($this->approve_viewing = $auth->acl_get('m_info', $forum_id)) || APPROVE_VIEWING_POSTER) 
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

zach'
Registered User
Posts: 44
Joined: Sat Nov 01, 2008 2:07 pm

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

Post by zach' » Sat Jul 10, 2010 8:53 am

primehalo wrote:You probably want to change this line:

Code: Select all

            if (($this->approve_viewing = $auth->acl_get('m_info', $forum_id)) || APPROVE_VIEWING_POSTER) 
Thanks

but i would display the first part of edit info (at bottom of the post with number of edit, date,name) to all members so i have this :
if (($this->approve_viewing = $auth->acl_get('f_read', $forum_id)) || APPROVE_VIEWING_POSTER)


But the problem, is that i woul'd display the second part of the edit info (with the link to the edit détails history) to all members, but only display to moderator with $auth->acl_get('m_edit ') permission

So i was searching how to do this in this part

Code: Select all

$postrow['EDITED_MESSAGE'] = trim($postrow['EDITED_MESSAGE'] . ' ' . $l_edited_link);
without sucess

If i display the edit info (['EDITED_MESSAGE']) to all members, i would display the history link ($l_edited_link) only to moderators with m_edit permission :?

Any help appreciated
Thanks a lot

User avatar
primehalo
Former Team Member
Posts: 2833
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 12, 2010 8:56 am

Oh, I think you want this line:

Code: Select all

            if ($this->can_view_history($row['user_id']) && !$this->viewing_history && !empty($this->revision_info[$row['post_id']]))
 
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

zach'
Registered User
Posts: 44
Joined: Sat Nov 01, 2008 2:07 pm

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

Post by zach' » Thu Jul 15, 2010 10:33 am

primehalo wrote:Oh, I think you want this line:

Code: Select all

            if ($this->can_view_history($row['user_id']) && !$this->viewing_history && !empty($this->revision_info[$row['post_id']]))
 
hi

i try to edit this line, but give me error, don't understand the way to display the edit info to all member (bottom of post), and show the history link not to members but only to moderators (with m_edit permission)

I want to do that because in normal behaviour phpBB3 don't show all edit information (if there is a moderator edit with no reason, it don't show to other normal member for example),

So i'am very confuse, i don't know if it's possible by few edits of this mod, or if i need to use this mod http://www.phpbb.com/community/viewtopi ... 5#p4543825 (and if it's compatible with prime edit) :|

thanks again for your help

User avatar
primehalo
Former Team Member
Posts: 2833
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 15, 2010 8:27 pm

I think you just need to change this code:

Code: Select all

$this->can_view_history($row['user_id']) &&  
To something like this:

Code: Select all

$user->data['is_registered'] &&  
That code should show up in two functions, set_edit_count() and inject_user_data(). I think you should change it in both. In the inject_user_data() function, I believe you will need to add the variable $user to the list of global variables.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

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

Post by 4_seven » Thu Jul 15, 2010 8:58 pm

after some trys to login this message appears on testboard

Code: Select all

General Error
SQL ERROR [ mysqli ]

Out of range value for column 'user_login_attempts' at row 1 [1264]

An SQL error occurred while fetching this page. Please contact the Board Administrator if this problem persists.

Code: Select all

You exceeded the maximum allowed number of login attempts. In addition to your username and password you now also have to enter the confirm code from the image you see below.
Goku says LOG IN NOW!
may someone find it funny to change the pw for the user tester..
Current Mods | Mod Base | php(BB) programming | No help via PM

User avatar
primehalo
Former Team Member
Posts: 2833
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 15, 2010 9:34 pm

Yep, it seems someone changed the password and so the counter for the number of login attempts exceeded the maximum allocated space in the database. Appears to be a phpbb3 bug. I just added a check to the code so the counter would not increment once the limit was reached.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

zach'
Registered User
Posts: 44
Joined: Sat Nov 01, 2008 2:07 pm

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

Post by zach' » Thu Jul 15, 2010 10:14 pm

primehalo wrote:I think you just need to change this code:

Code: Select all

$this->can_view_history($row['user_id']) &&  
To something like this:

Code: Select all

$user->data['is_registered'] &&  
That code should show up in two functions, set_edit_count() and inject_user_data(). I think you should change it in both. In the inject_user_data() function, I believe you will need to add the variable $user to the list of global variables.
Thanks for your help
i have mad this (in bold):
function prime_post_revisions(&$post_list, $forum_id = 0, $topic_id = 0, $post_id = 0)
{
global $db, $auth, $user, $phpbb_root_path, $phpEx;

if (!ENABLE_POST_REVISIONS)
{
return;
}

$this->approve_removal = $auth->acl_get('a_');
$this->forum_id = $forum_id;
$this->topic_id = $topic_id;
$this->post_id = $post_id;

// Allow user to view the post history if they have permission to view post details. If not
// and APPROVE_VIEWING_POSTER is TRUE, then we won't know until we have the poster_id.
if (($this->approve_viewing = $auth->acl_get('m_edit', $forum_id)) || APPROVE_VIEWING_POSTER)
and this (in bold) :
function set_edit_count(&$row)
{
global $user, $user_cache;

if (!ENABLE_POST_REVISIONS)
{
return;
}
if ($user->data['is_registered'] && !empty($this->revision_info[$row['post_id']]))
and this (in bold) :
function inject_user_data(&$row)
{
global $user, $user_cache, $post_edit_list;
$user_id = $row['post_edit_user'];

if ($user->data['is_registered'] && isset($this->user_cache[$user_id]))
There is no more error, but the edit info (at bottom of post) still not display to normal member, there is nothing display, so seems not working :|

And if in the first code, i change "m_edit" by "f_read" permission, the edit info displays to members, but they will see the history link, and acess the history détails, so there is no change :|

thanks again if you can see how to do that :|

User avatar
primehalo
Former Team Member
Posts: 2833
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 15, 2010 10:36 pm

Ah, I believe I know what the problem is... the revision_info variable only gets filled with the information when the approve_viewing variable is set to true. If approve_viewing is false, it never gets the info to display at the bottom of the post. So, use the f_read permission in order to make approve_viewing true temporarily, and then once inside that block of code add a new line of code to change approve_viewing back to what you originally wanted it to be, like:

Code: Select all

$this->approve_viewing = $auth->acl_get('m_edit', $forum_id); 
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

zach'
Registered User
Posts: 44
Joined: Sat Nov 01, 2008 2:07 pm

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

Post by zach' » Fri Jul 16, 2010 7:55 am

primehalo wrote:Ah, I believe I know what the problem is... the revision_info variable only gets filled with the information when the approve_viewing variable is set to true. If approve_viewing is false, it never gets the info to display at the bottom of the post. So, use the f_read permission in order to make approve_viewing true temporarily, and then once inside that block of code add a new line of code to change approve_viewing back to what you originally wanted it to be, like:

Code: Select all

$this->approve_viewing = $auth->acl_get('m_edit', $forum_id); 
Thanks seems working fine :D ;)

Locked

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