Plugin Directory

Changeset 1956151


Ignore:
Timestamp:
10/13/2018 04:21:31 AM (7 years ago)
Author:
jamiechong
Message:

setting to preserve author or not

Location:
revisionize/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • revisionize/trunk/readme.txt

    r1944336 r1956151  
    1919Visit [revisionize.pro](https://revisionize.pro) to add functionality that makes Revisionize even more powerful.
    2020
     21
     22
    2123= Compatible with =
    2224
     
    3739
    3840== Changelog ==
     41
     42= 2.3.0 =
     43* New. Setting to preserve original author or overwrite it with author who is revisionizing.
    3944
    4045= 2.2.8 =
  • revisionize/trunk/revisionize.php

    r1944336 r1956151  
    44 Plugin URI: https://revisionize.pro
    55 Description: Draft up revisions of live, published content. The live content doesn't change until you publish the revision manually or with the scheduling system.
    6  Version: 2.2.8
     6 Version: 2.3.0
    77 Author: Jamie Chong
    88 Author URI: https://revisionize.pro
     
    183183  $post_status = $post->post_status;
    184184
    185   if ($to) {
     185  if (!$to) {
     186    $post_status = $status;
     187  }
     188
     189  if ($to && is_original_author_preserved($to->ID)) {
    186190    $author_id = $to->post_author;  // maintain original author.
    187191  } else {
    188     $post_status = $status;
    189192    $author = wp_get_current_user();
    190193   
     
    464467}
    465468
     469function is_original_author_preserved($id) {
     470  return apply_filters('revisionize_preserve_author', true, $id) === true; 
     471}
     472
    466473function show_dashboard_widget() {
    467474  return apply_filters('revisionize_show_dashboard_widget', false);
  • revisionize/trunk/settings.php

    r1944336 r1956151  
    3434  add_filter('revisionize_keep_original_on_publish', __NAMESPACE__.'\\filter_keep_backup');
    3535  add_filter('revisionize_preserve_post_date', __NAMESPACE__.'\\filter_preserve_date');
     36  add_filter('revisionize_preserve_author', __NAMESPACE__.'\\filter_preserve_author');
    3637}
    3738
     
    181182
    182183  input_setting('checkbox', 'Preserve Date', 'preserve_date', "The date of the original post will be maintained even if the revisionized post date changes. In particular, a scheduled revision won't modify the post date once it's published.", true, 'revisionize_section_basic');
     184
     185  input_setting('checkbox', 'Preserve Author', 'preserve_author', "The author of the original post will be maintained even if the author of the revisionized post differs.", true, 'revisionize_section_basic'); 
    183186}
    184187
     
    447450}
    448451
     452function filter_preserve_author($b) {
     453  return is_checkbox_checked('preserve_author', $b); 
     454}
     455
    449456// basic inputs for now
    450457// $type: text|email|number|checkbox
Note: See TracChangeset for help on using the changeset viewer.