Plugin Directory

Changeset 3410439


Ignore:
Timestamp:
12/04/2025 05:48:08 AM (3 months ago)
Author:
monarchwp23
Message:

Update to version 2.2 from GitHub

Location:
default-post-author
Files:
21 added
1 deleted
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • default-post-author/tags/2.2/default-post-author.php

    r3343426 r3410439  
    44 * Plugin URI:  https://wordpress.org/plugins/default-post-author/
    55 * Description: The easiest way to set default post author in your WordPress Site.
    6  * Version:     2.1
     6 * Version:     2.2
    77 * Requires at least: 6.1
    88 * Requires PHP: 8.0
     
    1515
    1616if ( ! defined( 'ABSPATH' ) ) {
    17     exit; // Exit if accessed directly.
     17    exit;
     18}
     19
     20// Plugin constants.
     21define( 'DPAP_VERSION', '2.2' );
     22define( 'DPAP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
     23define( 'DPAP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
     24define( 'DPAP_OPTIONS', 'dpap_options' );
     25
     26// Include admin class.
     27require_once DPAP_PLUGIN_DIR . 'includes/class-dpap-admin.php';
     28
     29/**
     30 * Initialize admin.
     31 *
     32 * @return void
     33 */
     34function dpap_init() {
     35    if ( is_admin() ) {
     36        new DPAP_Admin();
     37    }
     38}
     39add_action( 'plugins_loaded', 'dpap_init' );
     40
     41/**
     42 * Get plugin option.
     43 *
     44 * @param string $key     Option key.
     45 * @param mixed  $default Default value.
     46 * @return mixed Option value.
     47 */
     48function dpap_get_option( $key, $default = '' ) {
     49    $options = get_option( DPAP_OPTIONS, array() );
     50    return isset( $options[ $key ] ) ? $options[ $key ] : $default;
    1851}
    1952
    2053/**
    21  * Option name constant.
    22  */
    23 if ( ! defined( 'DPAP_OPTION_NAME' ) ) {
    24     define( 'DPAP_OPTION_NAME', 'default_post_author' );
    25 }
    26 
    27 /**
    28  * Register setting for storing default author ID.
    29  */
    30 function dpap_register_setting() {
    31     register_setting(
    32         'dpap_options_group',
    33         DPAP_OPTION_NAME,
    34         array(
    35             'type'              => 'integer',
    36             'sanitize_callback' => 'absint',
    37             'default'           => 1,
    38         )
    39     );
    40 }
    41 add_action( 'admin_init', 'dpap_register_setting' );
    42 
    43 /**
    44  * Add settings page under Settings menu.
    45  */
    46 function dpap_add_admin_menu() {
    47     add_options_page(
    48         __( 'Default Post Author', 'default-post-author' ),
    49         __( 'Default Post Author', 'default-post-author' ),
    50         'manage_options',
    51         'default-post-author',
    52         'dpap_render_options_page'
    53     );
    54 }
    55 add_action( 'admin_menu', 'dpap_add_admin_menu' );
    56 
    57 /**
    58  * Render the options page HTML. The form posts to admin-post.php handlers.
    59  */
    60 function dpap_render_options_page() {
    61     if ( ! current_user_can( 'manage_options' ) ) {
    62         return;
    63     }
    64 
    65     $current_value = get_option( DPAP_OPTION_NAME, 1 );
    66 
    67     // Fetch users with roles author, editor, administrator.
    68     $user_query = new WP_User_Query( array(
    69         'role__in' => array( 'author', 'editor', 'administrator' ),
    70         'orderby'   => 'display_name',
    71         'order'     => 'ASC',
    72     ) );
    73 
    74     $users = $user_query->get_results();
    75     ?>
    76     <div class="wrap">
    77         <h1><?php esc_html_e( 'Default Post Author Settings', 'default-post-author' ); ?></h1>
    78 
    79         <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
    80             <?php // Settings fields for WP Settings API (keeps option group consistent).
    81             settings_fields( 'dpap_options_group' ); ?>
    82 
    83             <table class="form-table" role="presentation">
    84                 <tr>
    85                     <th scope="row"><label for="default_post_author"><?php esc_html_e( 'Default Post Author', 'default-post-author' ); ?></label></th>
    86                     <td>
    87                         <select id="default_post_author" name="default_post_author">
    88                             <?php if ( empty( $users ) ) : ?>
    89                                 <option value="0"><?php esc_html_e( 'No eligible users found', 'default-post-author' ); ?></option>
    90                             <?php else : ?>
    91                                 <?php foreach ( $users as $user ) : ?>
    92                                     <option value="<?php echo esc_attr( $user->ID ); ?>" <?php selected( $user->ID, $current_value ); ?>>
    93                                         <?php echo esc_html( $user->display_name ); ?>
    94                                     </option>
    95                                 <?php endforeach; ?>
    96                             <?php endif; ?>
    97                         </select>
    98                         <p class="description"><?php esc_html_e( 'Select the default author for new posts.', 'default-post-author' ); ?></p>
    99                     </td>
    100                 </tr>
    101             </table>
    102 
    103             <?php // Nonce and action for saving settings.
    104             wp_nonce_field( 'dpap_save_settings_action', 'dpap_save_settings_nonce' ); ?>
    105             <input type="hidden" name="action" value="dpap_save_settings">
    106             <?php submit_button( __( 'Save Changes', 'default-post-author' ), 'primary', 'submit' ); ?>
    107         </form>
    108 
    109         <hr />
    110 
    111         <h2><?php esc_html_e( 'Update Existing Posts Authors', 'default-post-author' ); ?></h2>
    112         <p><?php esc_html_e( "Click the button below to change all existing posts' authors to the selected default author. This operation uses batch updates to avoid timeouts and will respect WordPress hooks for each post update.", 'default-post-author' ); ?></p>
    113 
    114         <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
    115             <?php wp_nonce_field( 'dpap_update_old_posts_action', 'dpap_update_old_posts_nonce' ); ?>
    116             <input type="hidden" name="action" value="dpap_update_old_posts">
    117             <input type="hidden" name="default_post_author" value="<?php echo esc_attr( $current_value ); ?>">
    118             <?php submit_button( __( 'Update All Existing Posts to Default Author', 'default-post-author' ), 'secondary', 'dpap_update_old_authors' ); ?>
    119         </form>
    120     </div>
    121     <?php
    122 }
    123 
    124 /**
    125  * Handle save settings via admin-post action.
    126  */
    127 function dpap_handle_save_settings() {
    128     if ( ! current_user_can( 'manage_options' ) ) {
    129         wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'default-post-author' ) );
    130     }
    131 
    132     $nonce = isset( $_POST['dpap_save_settings_nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['dpap_save_settings_nonce'] ) ) : '';
    133 
    134     if ( ! wp_verify_nonce( $nonce, 'dpap_save_settings_action' ) ) {
    135         wp_die( esc_html__( 'Security check failed.', 'default-post-author' ) );
    136     }
    137 
    138     if ( isset( $_POST['default_post_author'] ) ) {
    139         $new_author = absint( wp_unslash( $_POST['default_post_author'] ) );
    140         update_option( DPAP_OPTION_NAME, $new_author );
    141     }
    142 
    143     wp_safe_redirect( wp_get_referer() ? wp_get_referer() : admin_url( 'options-general.php?page=default-post-author' ) );
    144     exit;
    145 }
    146 add_action( 'admin_post_dpap_save_settings', 'dpap_handle_save_settings' );
    147 
    148 /**
    149  * Handle update of existing posts to the selected default author.
    150  * Processes posts in batches to avoid memory/timeouts and uses wp_update_post so hooks run.
    151  */
    152 function dpap_handle_update_old_posts() {
    153     if ( ! current_user_can( 'manage_options' ) ) {
    154         wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'default-post-author' ) );
    155     }
    156 
    157     $nonce = isset( $_POST['dpap_update_old_posts_nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['dpap_update_old_posts_nonce'] ) ) : '';
    158 
    159     if ( ! wp_verify_nonce( $nonce, 'dpap_update_old_posts_action' ) ) {
    160         wp_die( esc_html__( 'Security check failed.', 'default-post-author' ) );
    161     }
    162 
    163     $default_author_id = get_option( DPAP_OPTION_NAME, 1 );
    164 
    165     if ( isset( $_POST['default_post_author'] ) ) {
    166         $default_author_id = absint( wp_unslash( $_POST['default_post_author'] ) );
    167         update_option( DPAP_OPTION_NAME, $default_author_id );
    168     }
    169 
    170     $user = get_userdata( $default_author_id );
    171     if ( ! $user || ! array_intersect( array( 'author', 'editor', 'administrator' ), $user->roles ) ) {
    172         wp_die( esc_html__( 'Selected default author is invalid.', 'default-post-author' ) );
    173     }
    174 
    175     // Batch process posts to avoid timeout/memory issues.
    176     $args = array(
    177         'post_type'      => 'post',
    178         'post_status'    => 'any',
    179         'posts_per_page' => 100,
    180         'fields'         => 'ids',
    181         'orderby'        => 'ID',
    182         'order'          => 'ASC',
    183         'paged'          => 1,
    184     );
    185 
    186     $total_updated = 0;
    187 
    188     while ( true ) {
    189         $query = new WP_Query( $args );
    190         if ( ! $query->have_posts() ) {
    191             break;
    192         }
    193 
    194         foreach ( $query->posts as $post_id ) {
    195             // Skip auto-drafts.
    196             $post_status = get_post_status( $post_id );
    197             if ( 'auto-draft' === $post_status ) {
    198                 continue;
    199             }
    200 
    201             // Only update if different.
    202             $current_author = (int) get_post_field( 'post_author', $post_id );
    203             if ( $current_author === $default_author_id ) {
    204                 continue;
    205             }
    206 
    207             // Use wp_update_post so hooks & cache invalidation run as expected.
    208             $updated_post_id = wp_update_post( array(
    209                 'ID'          => $post_id,
    210                 'post_author' => $default_author_id,
    211             ), true );
    212 
    213             if ( is_wp_error( $updated_post_id ) ) {
    214                 if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
    215                     // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
    216                     error_log( sprintf( 'dpap: failed to update post %d: %s', $post_id, $updated_post_id->get_error_message() ) );
    217                 }
    218                 continue;
    219             }
    220 
    221             $total_updated++;
    222         }
    223 
    224         // Move to next page.
    225         $args['paged']++;
    226 
    227         // Avoid infinite loops - break if no more found.
    228         if ( 0 === count( $query->posts ) ) {
    229             break;
    230         }
    231 
    232         // Clean up.
    233         wp_reset_postdata();
    234     }
    235 
    236     /* translators: %d: number of posts updated */
    237     $message = sprintf( esc_html( _n( '%d post author updated.', '%d post authors updated.', $total_updated, 'default-post-author' ) ), $total_updated );
    238 
    239     // Store message as transient to display after redirect.
    240     set_transient( 'dpap_update_result', $message, 30 );
    241 
    242     wp_safe_redirect( wp_get_referer() ? wp_get_referer() : admin_url( 'options-general.php?page=default-post-author' ) );
    243     exit;
    244 }
    245 add_action( 'admin_post_dpap_update_old_posts', 'dpap_handle_update_old_posts' );
    246 
    247 /**
    248  * Show admin notices for the batch update result (transient-based).
    249  */
    250 function dpap_admin_notices() {
    251     if ( ! current_user_can( 'manage_options' ) ) {
    252         return;
    253     }
    254 
    255     $message = get_transient( 'dpap_update_result' );
    256     if ( $message ) {
    257         echo '<div class="notice notice-success is-dismissible"><p>' . esc_html( $message ) . '</p></div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    258         delete_transient( 'dpap_update_result' );
    259     }
    260 }
    261 add_action( 'admin_notices', 'dpap_admin_notices' );
    262 
    263 /**
    26454 * Set default author for new posts during creation only.
    265  * Uses wp_insert_post_data filter.
    26655 *
    26756 * @param array $data    Array of slashed post data.
     
    27059 */
    27160function dpap_force_post_author( $data, $postarr ) {
    272     $default_author_id = (int) get_option( DPAP_OPTION_NAME, 1 );
     61    // Check if feature is enabled.
     62    if ( ! dpap_get_option( 'enable_default_author', true ) ) {
     63        return $data;
     64    }
    27365
    274     if ( empty( $postarr['ID'] ) ) {
     66    $default_author_id = (int) dpap_get_option( 'default_author', 1 );
     67
     68    // Only for new posts (not updates).
     69    if ( empty( $postarr['ID'] ) && 'post' === $data['post_type'] ) {
    27570        $data['post_author'] = $default_author_id;
    27671    }
     
    28277/**
    28378 * Ensure revision author matches original post author.
    284  * Hook into wp_save_post_revision which provides revision ID and original post.
    285  * Use wp_update_post to avoid direct DB queries.
    28679 *
    28780 * @param int     $revision_id Revision post ID.
    288  * @param WP_Post $post       The original post object.
     81 * @param WP_Post $post        The original post object.
     82 * @return void
    28983 */
    29084function dpap_set_revision_author( $revision_id, $post ) {
     85    // Check if feature is enabled.
     86    if ( ! dpap_get_option( 'sync_revisions', true ) ) {
     87        return;
     88    }
     89
    29190    $revision_id = (int) $revision_id;
    29291    $post_author = (int) $post->post_author;
    29392
    294     $result = wp_update_post( array(
    295         'ID'          => $revision_id,
    296         'post_author' => $post_author,
    297     ), true );
     93    $result = wp_update_post(
     94        array(
     95            'ID'          => $revision_id,
     96            'post_author' => $post_author,
     97        ),
     98        true
     99    );
    298100
    299101    if ( is_wp_error( $result ) ) {
    300         if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
     102        if ( defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
    301103            // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
    302104            error_log( 'dpap: Failed to update revision author for post ID ' . $post->ID . ': ' . $result->get_error_message() );
     
    306108add_action( 'wp_save_post_revision', 'dpap_set_revision_author', 10, 2 );
    307109
    308 
    309 // Redirect to settings page once the plugin is activated
    310    
     110/**
     111 * Redirect to settings page on activation.
     112 *
     113 * @param string $plugin Plugin basename.
     114 * @return void
     115 */
    311116function dpap_activation_redirect( $plugin ) {
    312     if( $plugin == plugin_basename( __FILE__ ) ) {
     117    if ( plugin_basename( __FILE__ ) === $plugin ) {
     118        // Set default options on first activation.
     119        if ( ! get_option( DPAP_OPTIONS ) ) {
     120            update_option(
     121                DPAP_OPTIONS,
     122                array(
     123                    'default_author'        => 1,
     124                    'enable_default_author' => true,
     125                    'sync_revisions'        => true,
     126                )
     127            );
     128        }
    313129        wp_safe_redirect( admin_url( 'options-general.php?page=default-post-author' ) );
    314 exit;
     130        exit;
    315131    }
    316132}
    317133add_action( 'activated_plugin', 'dpap_activation_redirect' );
    318134
    319 
    320135/**
    321  * Uninstall cleanup: remove option when plugin is uninstalled.
     136 * Uninstall cleanup.
     137 *
     138 * @return void
    322139 */
    323140function dpap_uninstall() {
    324     delete_option( DPAP_OPTION_NAME );
     141    delete_option( DPAP_OPTIONS );
    325142}
    326143register_uninstall_hook( __FILE__, 'dpap_uninstall' );
    327 
    328 /* End of file */
    329 
  • default-post-author/tags/2.2/readme.txt

    r3343426 r3410439  
    11=== Default Post Author ===
    22Contributors: wpdelower, monarchwp23
    3 Tags: post author, default post author, wp post, posts
     3Tags: post author, default post author, wp post, posts, author management
    44Requires at least: 6.1
    5 Tested up to: 6.8
     5Tested up to: 6.9
    66Requires PHP: 8.0
    7 Stable tag: 2.1
     7Stable tag: 2.2
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1010Donate Link: https://www.monarchwp.com/donate
    1111
    12 
    13 The easiest way to set a default post author in your WordPress Site.
     12The easiest way to set a default post author in your WordPress site.
    1413
    1514== Description ==
     
    1716**Try Default Post Author on a demo site: Click here => [https://tastewp.com/plugins/default-post-author](https://tastewp.org/plugins/default-post-author/).**
    1817
    19 The Default Post Author plugin is a powerful tool designed to simplify the process of setting a default post author on your WordPress site. With this plugin, you can easily define a default author for all new posts, ensuring consistency and saving you valuable time.
    20 
    21 Setting up the plugin is quick and straightforward. Once installed and activated, you can navigate to the plugin settings page in your WordPress dashboard. Here, you will find a user-friendly interface that allows you to choose the default author from a list of existing users on your site.
     18The **Default Post Author** plugin is a powerful tool designed to simplify the process of setting a default post author on your WordPress site. With this plugin, you can easily define a default author for all new posts, ensuring consistency and saving you valuable time.
     19
     20= ✨ Key Features =
     21
     22* **Easy Setup** - Quick and straightforward configuration
     23* **Modern Admin Interface** - Beautiful, intuitive settings page with smooth animations
     24* **Toggle Controls** - Enable/disable features with modern toggle switches
     25* **Bulk Update** - Update all existing posts to the default author with one click
     26* **Revision Sync** - Keep revision authors in sync with parent posts
     27* **AJAX-Powered** - Real-time saving without page reloads
     28* **Progress Tracking** - Visual progress bar for bulk operations
     29* **Responsive Design** - Works perfectly on all devices
     30* **Lightweight** - Optimized code for maximum performance
     31
     32= 🎨 Modern Admin Interface =
     33
     34Version 2.2 introduces a completely redesigned admin interface featuring:
     35
     36* Clean, card-based layout
     37* Smooth animations and transitions
     38* Modern toggle switches instead of checkboxes
     39* Interactive buttons with loading states
     40* Toast notifications for instant feedback
     41* Progress indicators for bulk operations
     42* Fully responsive design
     43
     44= 🚀 How It Works =
     45
     461. Install and activate the plugin
     472. Navigate to **Settings > Default Post Author**
     483. Select your preferred default author from the dropdown
     494. Enable/disable features using the toggle switches
     505. Save your settings - that's it!
    2251
    2352By selecting a default author, you ensure that every new post created on your site will automatically be attributed to that specific author. This feature is particularly useful for multi-author blogs or websites where different users contribute content regularly.
    2453
    25 The Default Post Author plugin also offers additional customization options to enhance your workflow. For instance, you can choose to override the default author setting on a per-post basis, giving you the flexibility to assign different authors to specific posts if needed.
    26 
    27 Furthermore, the plugin provides seamless integration with other popular plugins and themes, ensuring compatibility and a smooth user experience. It is also regularly updated to ensure optimal performance and compatibility with the latest versions of WordPress.
    28 
    29 In summary, the Default Post Author plugin is a must-have tool for WordPress site owners who want to streamline their content creation process. By setting a default post author, you can ensure consistency and save time in managing authorship for your posts. Install this plugin today and enjoy the benefits of effortless default author assignment in your WordPress site.
     54= 🔧 Feature Toggles =
     55
     56* **Enable Default Author** - Turn the default author feature on/off without deactivating the plugin
     57* **Sync Revision Authors** - Keep revision authors matching the parent post author
     58
     59= 📦 Bulk Update Existing Posts =
     60
     61Need to change the author of all existing posts? The plugin includes a powerful bulk update feature that:
     62
     63* Processes posts in batches to prevent timeouts
     64* Shows real-time progress
     65* Provides detailed completion messages
     66* Works with any number of posts
     67
     68= 🔒 Security =
     69
     70* Proper WordPress nonces for all operations
     71* Capability checks for admin functions
     72* Sanitized inputs and escaped outputs
     73* Follows WordPress coding standards
     74
     75= 🌐 Compatibility =
     76
     77* WordPress 6.1 and higher
     78* PHP 8.0 and higher
     79* Compatible with multisite installations
     80* Works with popular themes and plugins
    3081
    3182= Contributing & Bug Report =
     
    3586
    3687= From within WordPress =
    37 1. Visit 'Plugins > Add New'
    38 2. Search for 'Default Post Author'
    39 3. Activate Default Post Author from your Plugins page.
    40 4. Go to Settings > Default Post Author
    41 5. At the bottom of that page you will see a dropdown with all your users list
    42 4. That's all.
     881. Visit **Plugins > Add New**
     892. Search for **'Default Post Author'**
     903. Click **Install Now** and then **Activate**
     914. Go to **Settings > Default Post Author**
     925. Select your default author and configure the toggle options
     936. Click **Save Settings** - that's all!
    4394
    4495= Manual Installation =
    45 1. Upload the `default-post-author` folder to the `/wp-content/plugins/` directory
    46 2. Activate the Default Post Author plugin through the 'Plugins' menu in WordPress
    47 3. That's all.
    48 
     961. Download the plugin zip file
     972. Upload the `default-post-author` folder to the `/wp-content/plugins/` directory
     983. Activate the **Default Post Author** plugin through the **Plugins** menu in WordPress
     994. Navigate to **Settings > Default Post Author** to configure
     100
     101= After Activation =
     102The plugin will automatically redirect you to the settings page after activation, making it easy to get started right away.
    49103
    50104== Frequently Asked Questions ==
     
    52106= Where is the settings page? =
    53107
    54 Settings > General
     108Navigate to **Settings > Default Post Author** in your WordPress admin dashboard.
    55109
    56110= Is it compatible with multisite? =
    57111
    58 Yes! It's compatible with both single sites and multisite.
    59 
    60 = How frequently is the “Default post author” plugin updated? =
     112Yes! The plugin is fully compatible with both single sites and WordPress multisite installations.
     113
     114= Can I disable the default author feature temporarily? =
     115
     116Yes! Version 2.2 includes a toggle switch to enable/disable the default author feature without deactivating the plugin.
     117
     118= How does the bulk update feature work? =
     119
     120The bulk update feature processes posts in batches of 100 to prevent server timeouts. It shows a progress bar and notifies you when complete. Only posts with different authors are updated.
     121
     122= Will this affect my existing posts? =
     123
     124No, by default the plugin only affects new posts. To update existing posts, you must explicitly use the **Update All Posts** feature on the settings page.
     125
     126= What happens to post revisions? =
     127
     128If the **Sync Revision Authors** toggle is enabled, revision authors will automatically match their parent post's author.
     129
     130= How frequently is the plugin updated? =
    61131
    62132The plugin is actively maintained and updated regularly to ensure compatibility with the latest versions of WordPress and to address any potential issues.
    63133
    64 = Is there any customer support available? =
    65 
    66 Yes, in case you encounter any difficulties or have questions, the plugin’s support team is available to assist you and provide prompt and helpful responses.
    67 
     134= Is there customer support available? =
     135
     136Yes! If you encounter any difficulties or have questions, please visit the [support forum](https://wordpress.org/support/plugin/default-post-author/) or contact us through our website.
     137
     138= Can I contribute to the plugin? =
     139
     140Absolutely! We welcome contributions on our [GitHub repository](https://github.com/WordPress-Satkhira-Community/default-post-author).
    68141
    69142== Screenshots ==
    70143
    71 1. A general settings page where you can set the default post author option.
     1441. Modern settings page with card-based layout and gradient header
     1452. Default author selection with styled dropdown
     1463. Feature toggles with modern switch controls
     1474. Bulk update section with progress indicator
     1485. Success notification toast message
     1496. Mobile responsive design
    72150
    73151== Upgrade Notice ==
    74152
     153= 2.2 =
     154Major UI update! New modern admin interface with toggle switches, AJAX saving, progress indicators, and improved user experience. Recommended for all users.
     155
     156= 2.1 =
     157Bug fixes and stability improvements.
     158
     159= 2.0 =
     160Security and performance updates. New bulk update feature to change all existing posts to the default author.
     161
     162== Changelog ==
     163
     164= 2.2 - (Decemeber 04, 2025) =
     165* **New:** Completely redesigned modern admin interface
     166* **New:** Toggle switches replace checkboxes for better UX
     167* **New:** AJAX-powered settings saving (no page reload)
     168* **New:** Toast notifications for instant feedback
     169* **New:** Progress bar for bulk update operations
     170* **New:** Enable/disable default author feature toggle
     171* **New:** Sync revision authors toggle option
     172* **New:** Animated UI elements and smooth transitions
     173* **New:** Card-based settings layout
     174* **New:** Responsive design improvements
     175* **Improved:** Separated code structure (PHP, CSS, JS)
     176* **Improved:** Better code organization with admin class
     177* **Improved:** Enhanced security measures
     178* **Improved:** Optimized asset loading
     179* **Improved:** Better error handling
     180
    75181= 2.1 - (August 12, 2025) =
    76 - Bug Fix
     182* Bug Fix
    77183
    78184= 2.0 - (August 12, 2025) =
    79 - Security Update
    80 - Performance Update
    81 - Ability to Update All Existing Posts to Default Author
     185* Security Update
     186* Performance Update
     187* New: Ability to Update All Existing Posts to Default Author
    82188
    83189= 1.1.5 - (January 28, 2025) =
    84 - Security Update
    85 - Performance Update
    86 - TasteWP Live Demo Added
     190* Security Update
     191* Performance Update
     192* TasteWP Live Demo Added
    87193
    88194= 1.1.4 - (November 17, 2024) =
    89 - Security Update
    90 - Performance Update
    91 - WordPress 6.7 compatibility
     195* Security Update
     196* Performance Update
     197* WordPress 6.7 compatibility
    92198
    93199= 1.1.3 - (July 17, 2024) =
    94 - Security Update
    95 - Performance Update
    96 - WordPress 6.6 compatibility
     200* Security Update
     201* Performance Update
     202* WordPress 6.6 compatibility
    97203
    98204= 1.1.2 - (April 15, 2024) =
    99 - Security Update
     205* Security Update
    100206
    101207= 1.1.1 - (April 15, 2024) =
    102 - Bug Fix
    103 - Performance Update
    104 - Security Update
    105 
    106 = 1.1 - 23-03-2024 =
    107 - Performance Update
    108 
    109 = 1.0.2 - 17-02-2024 =
    110 - Performance Update
    111 
    112 = 1.0.1 - 17-02-2024 =
    113 - Simple Bug Fix
     208* Bug Fix
     209* Performance Update
     210* Security Update
     211
     212= 1.1 - (March 23, 2024) =
     213* Performance Update
     214
     215= 1.0.2 - (February 17, 2024) =
     216* Performance Update
     217
     218= 1.0.1 - (February 17, 2024) =
     219* Simple Bug Fix
    114220
    115221= 1.0 =
    116222* Initial release
    117 
    118 == Changelog ==
    119 
    120 = 2.1 - (August 12, 2025) =
    121 - Bug Fix
    122 
    123 = 2.0 - (August 12, 2025) =
    124 - Security Update
    125 - Performance Update
    126 - Ability to Update All Existing Posts to Default Author
    127 
    128 = 1.1.5 - (January 28, 2025) =
    129 - Security Update
    130 - Performance Update
    131 - TasteWP Live Demo Added
    132 
    133 = 1.1.4 - (November 17, 2024) =
    134 - Security Update
    135 - Performance Update
    136 - WordPress 6.7 compatibility
    137 
    138 = 1.1.3 - (July 17, 2024) =
    139 - Security Update
    140 - Performance Update
    141 - WordPress 6.6 compatibility
    142 
    143 = 1.1.2 - (April 15, 2024) =
    144 - Security Update
    145 
    146 = 1.1.1 - (April 15, 2024) =
    147 - Bug Fix
    148 - Performance Update
    149 - Security Update
    150 
    151 = 1.1 - 23-03-2024 =
    152 - Performance Update
    153 
    154 = 1.0.2 - 17-02-2024 =
    155 - Performance Update
    156 
    157 = 1.0.1 - 17-02-2024 =
    158 - Simple Bug Fix
    159 
    160 = 1.0 =
    161 * Initial release
  • default-post-author/trunk/default-post-author.php

    r3343426 r3410439  
    44 * Plugin URI:  https://wordpress.org/plugins/default-post-author/
    55 * Description: The easiest way to set default post author in your WordPress Site.
    6  * Version:     2.1
     6 * Version:     2.2
    77 * Requires at least: 6.1
    88 * Requires PHP: 8.0
     
    1515
    1616if ( ! defined( 'ABSPATH' ) ) {
    17     exit; // Exit if accessed directly.
     17    exit;
     18}
     19
     20// Plugin constants.
     21define( 'DPAP_VERSION', '2.2' );
     22define( 'DPAP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
     23define( 'DPAP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
     24define( 'DPAP_OPTIONS', 'dpap_options' );
     25
     26// Include admin class.
     27require_once DPAP_PLUGIN_DIR . 'includes/class-dpap-admin.php';
     28
     29/**
     30 * Initialize admin.
     31 *
     32 * @return void
     33 */
     34function dpap_init() {
     35    if ( is_admin() ) {
     36        new DPAP_Admin();
     37    }
     38}
     39add_action( 'plugins_loaded', 'dpap_init' );
     40
     41/**
     42 * Get plugin option.
     43 *
     44 * @param string $key     Option key.
     45 * @param mixed  $default Default value.
     46 * @return mixed Option value.
     47 */
     48function dpap_get_option( $key, $default = '' ) {
     49    $options = get_option( DPAP_OPTIONS, array() );
     50    return isset( $options[ $key ] ) ? $options[ $key ] : $default;
    1851}
    1952
    2053/**
    21  * Option name constant.
    22  */
    23 if ( ! defined( 'DPAP_OPTION_NAME' ) ) {
    24     define( 'DPAP_OPTION_NAME', 'default_post_author' );
    25 }
    26 
    27 /**
    28  * Register setting for storing default author ID.
    29  */
    30 function dpap_register_setting() {
    31     register_setting(
    32         'dpap_options_group',
    33         DPAP_OPTION_NAME,
    34         array(
    35             'type'              => 'integer',
    36             'sanitize_callback' => 'absint',
    37             'default'           => 1,
    38         )
    39     );
    40 }
    41 add_action( 'admin_init', 'dpap_register_setting' );
    42 
    43 /**
    44  * Add settings page under Settings menu.
    45  */
    46 function dpap_add_admin_menu() {
    47     add_options_page(
    48         __( 'Default Post Author', 'default-post-author' ),
    49         __( 'Default Post Author', 'default-post-author' ),
    50         'manage_options',
    51         'default-post-author',
    52         'dpap_render_options_page'
    53     );
    54 }
    55 add_action( 'admin_menu', 'dpap_add_admin_menu' );
    56 
    57 /**
    58  * Render the options page HTML. The form posts to admin-post.php handlers.
    59  */
    60 function dpap_render_options_page() {
    61     if ( ! current_user_can( 'manage_options' ) ) {
    62         return;
    63     }
    64 
    65     $current_value = get_option( DPAP_OPTION_NAME, 1 );
    66 
    67     // Fetch users with roles author, editor, administrator.
    68     $user_query = new WP_User_Query( array(
    69         'role__in' => array( 'author', 'editor', 'administrator' ),
    70         'orderby'   => 'display_name',
    71         'order'     => 'ASC',
    72     ) );
    73 
    74     $users = $user_query->get_results();
    75     ?>
    76     <div class="wrap">
    77         <h1><?php esc_html_e( 'Default Post Author Settings', 'default-post-author' ); ?></h1>
    78 
    79         <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
    80             <?php // Settings fields for WP Settings API (keeps option group consistent).
    81             settings_fields( 'dpap_options_group' ); ?>
    82 
    83             <table class="form-table" role="presentation">
    84                 <tr>
    85                     <th scope="row"><label for="default_post_author"><?php esc_html_e( 'Default Post Author', 'default-post-author' ); ?></label></th>
    86                     <td>
    87                         <select id="default_post_author" name="default_post_author">
    88                             <?php if ( empty( $users ) ) : ?>
    89                                 <option value="0"><?php esc_html_e( 'No eligible users found', 'default-post-author' ); ?></option>
    90                             <?php else : ?>
    91                                 <?php foreach ( $users as $user ) : ?>
    92                                     <option value="<?php echo esc_attr( $user->ID ); ?>" <?php selected( $user->ID, $current_value ); ?>>
    93                                         <?php echo esc_html( $user->display_name ); ?>
    94                                     </option>
    95                                 <?php endforeach; ?>
    96                             <?php endif; ?>
    97                         </select>
    98                         <p class="description"><?php esc_html_e( 'Select the default author for new posts.', 'default-post-author' ); ?></p>
    99                     </td>
    100                 </tr>
    101             </table>
    102 
    103             <?php // Nonce and action for saving settings.
    104             wp_nonce_field( 'dpap_save_settings_action', 'dpap_save_settings_nonce' ); ?>
    105             <input type="hidden" name="action" value="dpap_save_settings">
    106             <?php submit_button( __( 'Save Changes', 'default-post-author' ), 'primary', 'submit' ); ?>
    107         </form>
    108 
    109         <hr />
    110 
    111         <h2><?php esc_html_e( 'Update Existing Posts Authors', 'default-post-author' ); ?></h2>
    112         <p><?php esc_html_e( "Click the button below to change all existing posts' authors to the selected default author. This operation uses batch updates to avoid timeouts and will respect WordPress hooks for each post update.", 'default-post-author' ); ?></p>
    113 
    114         <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
    115             <?php wp_nonce_field( 'dpap_update_old_posts_action', 'dpap_update_old_posts_nonce' ); ?>
    116             <input type="hidden" name="action" value="dpap_update_old_posts">
    117             <input type="hidden" name="default_post_author" value="<?php echo esc_attr( $current_value ); ?>">
    118             <?php submit_button( __( 'Update All Existing Posts to Default Author', 'default-post-author' ), 'secondary', 'dpap_update_old_authors' ); ?>
    119         </form>
    120     </div>
    121     <?php
    122 }
    123 
    124 /**
    125  * Handle save settings via admin-post action.
    126  */
    127 function dpap_handle_save_settings() {
    128     if ( ! current_user_can( 'manage_options' ) ) {
    129         wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'default-post-author' ) );
    130     }
    131 
    132     $nonce = isset( $_POST['dpap_save_settings_nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['dpap_save_settings_nonce'] ) ) : '';
    133 
    134     if ( ! wp_verify_nonce( $nonce, 'dpap_save_settings_action' ) ) {
    135         wp_die( esc_html__( 'Security check failed.', 'default-post-author' ) );
    136     }
    137 
    138     if ( isset( $_POST['default_post_author'] ) ) {
    139         $new_author = absint( wp_unslash( $_POST['default_post_author'] ) );
    140         update_option( DPAP_OPTION_NAME, $new_author );
    141     }
    142 
    143     wp_safe_redirect( wp_get_referer() ? wp_get_referer() : admin_url( 'options-general.php?page=default-post-author' ) );
    144     exit;
    145 }
    146 add_action( 'admin_post_dpap_save_settings', 'dpap_handle_save_settings' );
    147 
    148 /**
    149  * Handle update of existing posts to the selected default author.
    150  * Processes posts in batches to avoid memory/timeouts and uses wp_update_post so hooks run.
    151  */
    152 function dpap_handle_update_old_posts() {
    153     if ( ! current_user_can( 'manage_options' ) ) {
    154         wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'default-post-author' ) );
    155     }
    156 
    157     $nonce = isset( $_POST['dpap_update_old_posts_nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['dpap_update_old_posts_nonce'] ) ) : '';
    158 
    159     if ( ! wp_verify_nonce( $nonce, 'dpap_update_old_posts_action' ) ) {
    160         wp_die( esc_html__( 'Security check failed.', 'default-post-author' ) );
    161     }
    162 
    163     $default_author_id = get_option( DPAP_OPTION_NAME, 1 );
    164 
    165     if ( isset( $_POST['default_post_author'] ) ) {
    166         $default_author_id = absint( wp_unslash( $_POST['default_post_author'] ) );
    167         update_option( DPAP_OPTION_NAME, $default_author_id );
    168     }
    169 
    170     $user = get_userdata( $default_author_id );
    171     if ( ! $user || ! array_intersect( array( 'author', 'editor', 'administrator' ), $user->roles ) ) {
    172         wp_die( esc_html__( 'Selected default author is invalid.', 'default-post-author' ) );
    173     }
    174 
    175     // Batch process posts to avoid timeout/memory issues.
    176     $args = array(
    177         'post_type'      => 'post',
    178         'post_status'    => 'any',
    179         'posts_per_page' => 100,
    180         'fields'         => 'ids',
    181         'orderby'        => 'ID',
    182         'order'          => 'ASC',
    183         'paged'          => 1,
    184     );
    185 
    186     $total_updated = 0;
    187 
    188     while ( true ) {
    189         $query = new WP_Query( $args );
    190         if ( ! $query->have_posts() ) {
    191             break;
    192         }
    193 
    194         foreach ( $query->posts as $post_id ) {
    195             // Skip auto-drafts.
    196             $post_status = get_post_status( $post_id );
    197             if ( 'auto-draft' === $post_status ) {
    198                 continue;
    199             }
    200 
    201             // Only update if different.
    202             $current_author = (int) get_post_field( 'post_author', $post_id );
    203             if ( $current_author === $default_author_id ) {
    204                 continue;
    205             }
    206 
    207             // Use wp_update_post so hooks & cache invalidation run as expected.
    208             $updated_post_id = wp_update_post( array(
    209                 'ID'          => $post_id,
    210                 'post_author' => $default_author_id,
    211             ), true );
    212 
    213             if ( is_wp_error( $updated_post_id ) ) {
    214                 if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
    215                     // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
    216                     error_log( sprintf( 'dpap: failed to update post %d: %s', $post_id, $updated_post_id->get_error_message() ) );
    217                 }
    218                 continue;
    219             }
    220 
    221             $total_updated++;
    222         }
    223 
    224         // Move to next page.
    225         $args['paged']++;
    226 
    227         // Avoid infinite loops - break if no more found.
    228         if ( 0 === count( $query->posts ) ) {
    229             break;
    230         }
    231 
    232         // Clean up.
    233         wp_reset_postdata();
    234     }
    235 
    236     /* translators: %d: number of posts updated */
    237     $message = sprintf( esc_html( _n( '%d post author updated.', '%d post authors updated.', $total_updated, 'default-post-author' ) ), $total_updated );
    238 
    239     // Store message as transient to display after redirect.
    240     set_transient( 'dpap_update_result', $message, 30 );
    241 
    242     wp_safe_redirect( wp_get_referer() ? wp_get_referer() : admin_url( 'options-general.php?page=default-post-author' ) );
    243     exit;
    244 }
    245 add_action( 'admin_post_dpap_update_old_posts', 'dpap_handle_update_old_posts' );
    246 
    247 /**
    248  * Show admin notices for the batch update result (transient-based).
    249  */
    250 function dpap_admin_notices() {
    251     if ( ! current_user_can( 'manage_options' ) ) {
    252         return;
    253     }
    254 
    255     $message = get_transient( 'dpap_update_result' );
    256     if ( $message ) {
    257         echo '<div class="notice notice-success is-dismissible"><p>' . esc_html( $message ) . '</p></div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    258         delete_transient( 'dpap_update_result' );
    259     }
    260 }
    261 add_action( 'admin_notices', 'dpap_admin_notices' );
    262 
    263 /**
    26454 * Set default author for new posts during creation only.
    265  * Uses wp_insert_post_data filter.
    26655 *
    26756 * @param array $data    Array of slashed post data.
     
    27059 */
    27160function dpap_force_post_author( $data, $postarr ) {
    272     $default_author_id = (int) get_option( DPAP_OPTION_NAME, 1 );
     61    // Check if feature is enabled.
     62    if ( ! dpap_get_option( 'enable_default_author', true ) ) {
     63        return $data;
     64    }
    27365
    274     if ( empty( $postarr['ID'] ) ) {
     66    $default_author_id = (int) dpap_get_option( 'default_author', 1 );
     67
     68    // Only for new posts (not updates).
     69    if ( empty( $postarr['ID'] ) && 'post' === $data['post_type'] ) {
    27570        $data['post_author'] = $default_author_id;
    27671    }
     
    28277/**
    28378 * Ensure revision author matches original post author.
    284  * Hook into wp_save_post_revision which provides revision ID and original post.
    285  * Use wp_update_post to avoid direct DB queries.
    28679 *
    28780 * @param int     $revision_id Revision post ID.
    288  * @param WP_Post $post       The original post object.
     81 * @param WP_Post $post        The original post object.
     82 * @return void
    28983 */
    29084function dpap_set_revision_author( $revision_id, $post ) {
     85    // Check if feature is enabled.
     86    if ( ! dpap_get_option( 'sync_revisions', true ) ) {
     87        return;
     88    }
     89
    29190    $revision_id = (int) $revision_id;
    29291    $post_author = (int) $post->post_author;
    29392
    294     $result = wp_update_post( array(
    295         'ID'          => $revision_id,
    296         'post_author' => $post_author,
    297     ), true );
     93    $result = wp_update_post(
     94        array(
     95            'ID'          => $revision_id,
     96            'post_author' => $post_author,
     97        ),
     98        true
     99    );
    298100
    299101    if ( is_wp_error( $result ) ) {
    300         if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
     102        if ( defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
    301103            // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
    302104            error_log( 'dpap: Failed to update revision author for post ID ' . $post->ID . ': ' . $result->get_error_message() );
     
    306108add_action( 'wp_save_post_revision', 'dpap_set_revision_author', 10, 2 );
    307109
    308 
    309 // Redirect to settings page once the plugin is activated
    310    
     110/**
     111 * Redirect to settings page on activation.
     112 *
     113 * @param string $plugin Plugin basename.
     114 * @return void
     115 */
    311116function dpap_activation_redirect( $plugin ) {
    312     if( $plugin == plugin_basename( __FILE__ ) ) {
     117    if ( plugin_basename( __FILE__ ) === $plugin ) {
     118        // Set default options on first activation.
     119        if ( ! get_option( DPAP_OPTIONS ) ) {
     120            update_option(
     121                DPAP_OPTIONS,
     122                array(
     123                    'default_author'        => 1,
     124                    'enable_default_author' => true,
     125                    'sync_revisions'        => true,
     126                )
     127            );
     128        }
    313129        wp_safe_redirect( admin_url( 'options-general.php?page=default-post-author' ) );
    314 exit;
     130        exit;
    315131    }
    316132}
    317133add_action( 'activated_plugin', 'dpap_activation_redirect' );
    318134
    319 
    320135/**
    321  * Uninstall cleanup: remove option when plugin is uninstalled.
     136 * Uninstall cleanup.
     137 *
     138 * @return void
    322139 */
    323140function dpap_uninstall() {
    324     delete_option( DPAP_OPTION_NAME );
     141    delete_option( DPAP_OPTIONS );
    325142}
    326143register_uninstall_hook( __FILE__, 'dpap_uninstall' );
    327 
    328 /* End of file */
    329 
  • default-post-author/trunk/readme.txt

    r3343426 r3410439  
    11=== Default Post Author ===
    22Contributors: wpdelower, monarchwp23
    3 Tags: post author, default post author, wp post, posts
     3Tags: post author, default post author, wp post, posts, author management
    44Requires at least: 6.1
    5 Tested up to: 6.8
     5Tested up to: 6.9
    66Requires PHP: 8.0
    7 Stable tag: 2.1
     7Stable tag: 2.2
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1010Donate Link: https://www.monarchwp.com/donate
    1111
    12 
    13 The easiest way to set a default post author in your WordPress Site.
     12The easiest way to set a default post author in your WordPress site.
    1413
    1514== Description ==
     
    1716**Try Default Post Author on a demo site: Click here => [https://tastewp.com/plugins/default-post-author](https://tastewp.org/plugins/default-post-author/).**
    1817
    19 The Default Post Author plugin is a powerful tool designed to simplify the process of setting a default post author on your WordPress site. With this plugin, you can easily define a default author for all new posts, ensuring consistency and saving you valuable time.
    20 
    21 Setting up the plugin is quick and straightforward. Once installed and activated, you can navigate to the plugin settings page in your WordPress dashboard. Here, you will find a user-friendly interface that allows you to choose the default author from a list of existing users on your site.
     18The **Default Post Author** plugin is a powerful tool designed to simplify the process of setting a default post author on your WordPress site. With this plugin, you can easily define a default author for all new posts, ensuring consistency and saving you valuable time.
     19
     20= ✨ Key Features =
     21
     22* **Easy Setup** - Quick and straightforward configuration
     23* **Modern Admin Interface** - Beautiful, intuitive settings page with smooth animations
     24* **Toggle Controls** - Enable/disable features with modern toggle switches
     25* **Bulk Update** - Update all existing posts to the default author with one click
     26* **Revision Sync** - Keep revision authors in sync with parent posts
     27* **AJAX-Powered** - Real-time saving without page reloads
     28* **Progress Tracking** - Visual progress bar for bulk operations
     29* **Responsive Design** - Works perfectly on all devices
     30* **Lightweight** - Optimized code for maximum performance
     31
     32= 🎨 Modern Admin Interface =
     33
     34Version 2.2 introduces a completely redesigned admin interface featuring:
     35
     36* Clean, card-based layout
     37* Smooth animations and transitions
     38* Modern toggle switches instead of checkboxes
     39* Interactive buttons with loading states
     40* Toast notifications for instant feedback
     41* Progress indicators for bulk operations
     42* Fully responsive design
     43
     44= 🚀 How It Works =
     45
     461. Install and activate the plugin
     472. Navigate to **Settings > Default Post Author**
     483. Select your preferred default author from the dropdown
     494. Enable/disable features using the toggle switches
     505. Save your settings - that's it!
    2251
    2352By selecting a default author, you ensure that every new post created on your site will automatically be attributed to that specific author. This feature is particularly useful for multi-author blogs or websites where different users contribute content regularly.
    2453
    25 The Default Post Author plugin also offers additional customization options to enhance your workflow. For instance, you can choose to override the default author setting on a per-post basis, giving you the flexibility to assign different authors to specific posts if needed.
    26 
    27 Furthermore, the plugin provides seamless integration with other popular plugins and themes, ensuring compatibility and a smooth user experience. It is also regularly updated to ensure optimal performance and compatibility with the latest versions of WordPress.
    28 
    29 In summary, the Default Post Author plugin is a must-have tool for WordPress site owners who want to streamline their content creation process. By setting a default post author, you can ensure consistency and save time in managing authorship for your posts. Install this plugin today and enjoy the benefits of effortless default author assignment in your WordPress site.
     54= 🔧 Feature Toggles =
     55
     56* **Enable Default Author** - Turn the default author feature on/off without deactivating the plugin
     57* **Sync Revision Authors** - Keep revision authors matching the parent post author
     58
     59= 📦 Bulk Update Existing Posts =
     60
     61Need to change the author of all existing posts? The plugin includes a powerful bulk update feature that:
     62
     63* Processes posts in batches to prevent timeouts
     64* Shows real-time progress
     65* Provides detailed completion messages
     66* Works with any number of posts
     67
     68= 🔒 Security =
     69
     70* Proper WordPress nonces for all operations
     71* Capability checks for admin functions
     72* Sanitized inputs and escaped outputs
     73* Follows WordPress coding standards
     74
     75= 🌐 Compatibility =
     76
     77* WordPress 6.1 and higher
     78* PHP 8.0 and higher
     79* Compatible with multisite installations
     80* Works with popular themes and plugins
    3081
    3182= Contributing & Bug Report =
     
    3586
    3687= From within WordPress =
    37 1. Visit 'Plugins > Add New'
    38 2. Search for 'Default Post Author'
    39 3. Activate Default Post Author from your Plugins page.
    40 4. Go to Settings > Default Post Author
    41 5. At the bottom of that page you will see a dropdown with all your users list
    42 4. That's all.
     881. Visit **Plugins > Add New**
     892. Search for **'Default Post Author'**
     903. Click **Install Now** and then **Activate**
     914. Go to **Settings > Default Post Author**
     925. Select your default author and configure the toggle options
     936. Click **Save Settings** - that's all!
    4394
    4495= Manual Installation =
    45 1. Upload the `default-post-author` folder to the `/wp-content/plugins/` directory
    46 2. Activate the Default Post Author plugin through the 'Plugins' menu in WordPress
    47 3. That's all.
    48 
     961. Download the plugin zip file
     972. Upload the `default-post-author` folder to the `/wp-content/plugins/` directory
     983. Activate the **Default Post Author** plugin through the **Plugins** menu in WordPress
     994. Navigate to **Settings > Default Post Author** to configure
     100
     101= After Activation =
     102The plugin will automatically redirect you to the settings page after activation, making it easy to get started right away.
    49103
    50104== Frequently Asked Questions ==
     
    52106= Where is the settings page? =
    53107
    54 Settings > General
     108Navigate to **Settings > Default Post Author** in your WordPress admin dashboard.
    55109
    56110= Is it compatible with multisite? =
    57111
    58 Yes! It's compatible with both single sites and multisite.
    59 
    60 = How frequently is the “Default post author” plugin updated? =
     112Yes! The plugin is fully compatible with both single sites and WordPress multisite installations.
     113
     114= Can I disable the default author feature temporarily? =
     115
     116Yes! Version 2.2 includes a toggle switch to enable/disable the default author feature without deactivating the plugin.
     117
     118= How does the bulk update feature work? =
     119
     120The bulk update feature processes posts in batches of 100 to prevent server timeouts. It shows a progress bar and notifies you when complete. Only posts with different authors are updated.
     121
     122= Will this affect my existing posts? =
     123
     124No, by default the plugin only affects new posts. To update existing posts, you must explicitly use the **Update All Posts** feature on the settings page.
     125
     126= What happens to post revisions? =
     127
     128If the **Sync Revision Authors** toggle is enabled, revision authors will automatically match their parent post's author.
     129
     130= How frequently is the plugin updated? =
    61131
    62132The plugin is actively maintained and updated regularly to ensure compatibility with the latest versions of WordPress and to address any potential issues.
    63133
    64 = Is there any customer support available? =
    65 
    66 Yes, in case you encounter any difficulties or have questions, the plugin’s support team is available to assist you and provide prompt and helpful responses.
    67 
     134= Is there customer support available? =
     135
     136Yes! If you encounter any difficulties or have questions, please visit the [support forum](https://wordpress.org/support/plugin/default-post-author/) or contact us through our website.
     137
     138= Can I contribute to the plugin? =
     139
     140Absolutely! We welcome contributions on our [GitHub repository](https://github.com/WordPress-Satkhira-Community/default-post-author).
    68141
    69142== Screenshots ==
    70143
    71 1. A general settings page where you can set the default post author option.
     1441. Modern settings page with card-based layout and gradient header
     1452. Default author selection with styled dropdown
     1463. Feature toggles with modern switch controls
     1474. Bulk update section with progress indicator
     1485. Success notification toast message
     1496. Mobile responsive design
    72150
    73151== Upgrade Notice ==
    74152
     153= 2.2 =
     154Major UI update! New modern admin interface with toggle switches, AJAX saving, progress indicators, and improved user experience. Recommended for all users.
     155
     156= 2.1 =
     157Bug fixes and stability improvements.
     158
     159= 2.0 =
     160Security and performance updates. New bulk update feature to change all existing posts to the default author.
     161
     162== Changelog ==
     163
     164= 2.2 - (Decemeber 04, 2025) =
     165* **New:** Completely redesigned modern admin interface
     166* **New:** Toggle switches replace checkboxes for better UX
     167* **New:** AJAX-powered settings saving (no page reload)
     168* **New:** Toast notifications for instant feedback
     169* **New:** Progress bar for bulk update operations
     170* **New:** Enable/disable default author feature toggle
     171* **New:** Sync revision authors toggle option
     172* **New:** Animated UI elements and smooth transitions
     173* **New:** Card-based settings layout
     174* **New:** Responsive design improvements
     175* **Improved:** Separated code structure (PHP, CSS, JS)
     176* **Improved:** Better code organization with admin class
     177* **Improved:** Enhanced security measures
     178* **Improved:** Optimized asset loading
     179* **Improved:** Better error handling
     180
    75181= 2.1 - (August 12, 2025) =
    76 - Bug Fix
     182* Bug Fix
    77183
    78184= 2.0 - (August 12, 2025) =
    79 - Security Update
    80 - Performance Update
    81 - Ability to Update All Existing Posts to Default Author
     185* Security Update
     186* Performance Update
     187* New: Ability to Update All Existing Posts to Default Author
    82188
    83189= 1.1.5 - (January 28, 2025) =
    84 - Security Update
    85 - Performance Update
    86 - TasteWP Live Demo Added
     190* Security Update
     191* Performance Update
     192* TasteWP Live Demo Added
    87193
    88194= 1.1.4 - (November 17, 2024) =
    89 - Security Update
    90 - Performance Update
    91 - WordPress 6.7 compatibility
     195* Security Update
     196* Performance Update
     197* WordPress 6.7 compatibility
    92198
    93199= 1.1.3 - (July 17, 2024) =
    94 - Security Update
    95 - Performance Update
    96 - WordPress 6.6 compatibility
     200* Security Update
     201* Performance Update
     202* WordPress 6.6 compatibility
    97203
    98204= 1.1.2 - (April 15, 2024) =
    99 - Security Update
     205* Security Update
    100206
    101207= 1.1.1 - (April 15, 2024) =
    102 - Bug Fix
    103 - Performance Update
    104 - Security Update
    105 
    106 = 1.1 - 23-03-2024 =
    107 - Performance Update
    108 
    109 = 1.0.2 - 17-02-2024 =
    110 - Performance Update
    111 
    112 = 1.0.1 - 17-02-2024 =
    113 - Simple Bug Fix
     208* Bug Fix
     209* Performance Update
     210* Security Update
     211
     212= 1.1 - (March 23, 2024) =
     213* Performance Update
     214
     215= 1.0.2 - (February 17, 2024) =
     216* Performance Update
     217
     218= 1.0.1 - (February 17, 2024) =
     219* Simple Bug Fix
    114220
    115221= 1.0 =
    116222* Initial release
    117 
    118 == Changelog ==
    119 
    120 = 2.1 - (August 12, 2025) =
    121 - Bug Fix
    122 
    123 = 2.0 - (August 12, 2025) =
    124 - Security Update
    125 - Performance Update
    126 - Ability to Update All Existing Posts to Default Author
    127 
    128 = 1.1.5 - (January 28, 2025) =
    129 - Security Update
    130 - Performance Update
    131 - TasteWP Live Demo Added
    132 
    133 = 1.1.4 - (November 17, 2024) =
    134 - Security Update
    135 - Performance Update
    136 - WordPress 6.7 compatibility
    137 
    138 = 1.1.3 - (July 17, 2024) =
    139 - Security Update
    140 - Performance Update
    141 - WordPress 6.6 compatibility
    142 
    143 = 1.1.2 - (April 15, 2024) =
    144 - Security Update
    145 
    146 = 1.1.1 - (April 15, 2024) =
    147 - Bug Fix
    148 - Performance Update
    149 - Security Update
    150 
    151 = 1.1 - 23-03-2024 =
    152 - Performance Update
    153 
    154 = 1.0.2 - 17-02-2024 =
    155 - Performance Update
    156 
    157 = 1.0.1 - 17-02-2024 =
    158 - Simple Bug Fix
    159 
    160 = 1.0 =
    161 * Initial release
Note: See TracChangeset for help on using the changeset viewer.