Template Field for Editor
-
Would it be possible to add support for an “{editor}” field in the template, that displays the name of the person who most recently made changes to the entry? In some contexts, that may be much more meaningful/useful information than the original author.
-
Thanks for the idea!
I can’t say if it is possible but I noted your suggestion. It will be tracked on the github repository of List Last Changes: https://github.com/rolandbaer/list-last-changes/issues/29
The Version 1.1.0 has now the support for the field {editor} in the template string.
Hope this solves your needs!
Excellent – thank you! This will make the list noticeably more useful, to help people know who’s been recently working on what.
- This reply was modified 7 months ago by Edward Almasy.
Hello,
installed WordPress 6.6.1 and Plugin and Plugin Version 1.1.1.
List Last Changes is fully functionally with the Template String “author”
If we switch to the Template String “editor” only in one Line there is an incorrect User-Name, all other Lines (we Display 100 on a page) are empty.
Checked Database wp_post and the correct names (id from wp_users) are in field post_author but no name is showed in the list. Page and Date are correct
Thank you very much for any idea
I will have a look if I can reproduce your problem.
Maybe you can give me some more informations:
– do you see any relevant difference between the working and the non-working posts?
– are the shown changes on pages or on posts?
– have you tried to disable all other plugins? does the problem still occure with only the List Last Changes plugin?Thanks for your feedback!
Hello rbaer,
thank you for reply. I have configured post and pages to show. The “editor” is showed on maye 5 percent of “pages” all other Post and Pages are empty (Date and Title are filled correctly). I cannot see any differences between the pages with and without Names. On the pages are only text and pictures.
Today disabled all (6 Plugins) and leave LastListChanges active. Tried again to reproduce the problem. Same Result with activated plugins.
I have tried only ListLastChanges
Thank you
I’m not able to reproduce the problem on my testing system. Can you help me with some more information?
Are all edited pages/posts from the same author working and all non-working from other autors (and all edited pages of these autors are not working)? If yes, do you see differences between the working and non-working autors (especially in the display name)?
Hello rbaer,
i have looked to the users. I cann’t see any difference in configuration. Also in User-Database all fields are filled in the same way by all users. 1 User ist “Redakteur” and the othe Users are “Administrators” I can see Pages with tag editor from 4 different Users, but theese 4 Users have several other post and pages where the “editor” is not showing.
Where ist the editor get from database. I have looked to a changed item where the editor is not displayed. In Database i can only find the field “post_author”, there is the orign author from the first post. Here i cann’t find the editor in any field. Maybe Database with wrong structure?
I also found that the last post from yesterday evening the editor is showed. But this editor is the wrong name from an account which yesterday could no be used.
Thank you
Database wp_posts
ID bigint UN AI PK
post_author bigint UN
post_date datetime
post_date_gmt datetime
post_content longtext
post_title text
post_excerpt text
post_status varchar(20)
comment_status varchar(20)
ping_status varchar(20)
post_password varchar(255)
post_name varchar(200)
to_ping text
pinged text
post_modified datetime
post_modified_gmt datetime
post_content_filtered longtext
post_parent bigint UN
guid varchar(255)
menu_order int
post_type varchar(20)
post_mime_type varchar(100)
comment_count bigint- This reply was modified 2 months, 3 weeks ago by binili.
Your database has the same fields as mine. Newer versions of a post are handled as a new post, but the post_type is revision and the post_parent is set to the id of the original post.
For example:ID | post_parent | post_type
1 | 0 | post
2 | 1 | revision
3 | 1 | revisionIf you want to see the history of a post in the database, you can use a command like this (in phpMyAdmin or a similar tool, replace <Post_ID> with the ID of your post):
SELECT * FROM
wp_posts
WHERE ID = <Post_ID> OR post_parent = <Post_ID> ORDER BYwp_posts
.ID
ASCCan you change the code of my Plugin to get some more information? You can do this on the WordPress administration in the menu ‘Plugin’->’Plugin File Editor’. There select the Plugin ‘List Last Changes’ and then the file list-last-changes.php. Please replace the function get_last_editor($post), starting on line 128, with the following code:
static function get_last_editor($post) {
$post_id_to_check = <post-id with error>;
$last_editor_id = get_post_meta( $post->ID, '_edit_last', true );
if($post->ID == $post_id_to_check) { print("<pre>last_editor_id = "); print_r($last_editor_id); print("</pre>"); }
if ( $last_editor_id ) {
$last_user = get_userdata( $last_editor_id );
if($post->ID == $post_id_to_check) { print("<pre>last_user = "); print_r($last_user); print("</pre>"); }
if($post->ID == $post_id_to_check && $last_user) { print("<pre>last_user->display_name = "); print_r($last_user->display_name); print("</pre>"); }
return apply_filters( 'the_modified_author', $last_user ? $last_user->display_name : '' );
}
return '';
}Please replace <post-id with error> with an id of a post that causes troubles. When you then open a page with the plugin included it should post some messages on the screen. Please send these to my email-Adress [email protected] . Of course you can (and should) remove/replace sensitive information like the hashed password of the user.
To restore the normal behaviour here is the original code:
static function get_last_editor($post) {
$last_editor_id = get_post_meta( $post->ID, '_edit_last', true );
if ( $last_editor_id ) {
$last_user = get_userdata( $last_editor_id );
return apply_filters( 'the_modified_author', $last_user ? $last_user->display_name : '' );
}
return '';
}Thanks for your Help!
Hello,
thank you very much, I have sent you an e-mail with the requested
informations.Good morning rbaer,
thank you very much for the quick help, the plugin works
wonderfully now.binili
- You must be logged in to reply to this topic.