Plugin Directory

Changeset 3041524


Ignore:
Timestamp:
02/26/2024 08:46:35 PM (2 years ago)
Author:
palashwpdev
Message:

"new version"

Location:
auto-delete-post
Files:
22 added
2 edited

Legend:

Unmodified
Added
Removed
  • auto-delete-post/trunk/auto-delete-post.php

    r2886567 r3041524  
    44 * Plugin URI:        https://wordpress.org/plugin/auto-delete-post
    55 * Description:       This plugin automatically deletes a post after a certain time
    6  * Version:           1.1.2
     6 * Version:           1.1.3
    77 * Requires at least: 5.2
    88 * Requires PHP:      7.2
     
    3232}
    3333add_action( 'admin_enqueue_scripts', 'adp_all_scripts_inclusion' );
     34
     35/**
     36 * Initialize the plugin tracker
     37 *
     38 * @return void
     39 */
     40function appsero_init_tracker_auto_delete_post() {
     41
     42    if ( ! class_exists( 'Appsero\Client' ) ) {
     43      require_once __DIR__ . '/appsero/src/Client.php';
     44    }
     45
     46    $client = new Appsero\Client( '777556b2-6bfc-4558-a1ef-08a41e10ee58', 'Auto Delete Post – Ultimate plugin for deleting a post automatically', __FILE__ );
     47
     48    // Active insights
     49    $client->insights()->init();
     50
     51}
     52
     53appsero_init_tracker_auto_delete_post();
     54
    3455
    3556/**
     
    5677        add_submenu_page(
    5778            'adp-post-list', // menu slug
    58             esc_html__( 'All Posts List', 'auto-delete-post' ), // title to show in the page
    59             esc_html__( 'All Posts List', 'auto-delete-post' ), // title to show in the submenu page
     79            esc_html__( 'All Post Type List', 'auto-delete-post' ), // title to show in the page
     80            esc_html__( 'All Post Type List', 'auto-delete-post' ), // title to show in the submenu page
    6081            'manage_options', // capability of the user
    6182            'adp-post-list' // mneu slug
     
    204225
    205226$adp_obj = new ADP_Auto_Delete_Post(); // class initialization
     227
     228// Class for creating a custom column on posts list showing the deletion time
     229class ADP_Custom_Post_Column {
     230    public $counter;
     231
     232    public function __construct() {
     233        add_filter( 'manage_posts_columns', [ $this, 'custom_post_delete_column' ] ); // filter hook to add a new column on the posts list
     234
     235        add_action( 'manage_posts_custom_column', [ $this, 'custom_post_delete_column_content' ], 10, 2 ); // action hook to add content in our new custom column on the posts list
     236    }
     237
     238    // callback of custom column
     239    public function custom_post_delete_column( $column ) {
     240        $column['adp_post_deletion_time_column'] = 'Auto Deletion Time';
     241        return $column;
     242    }
     243
     244    // callback of custom column content
     245    public function custom_post_delete_column_content( $column_name, $post_id ) {
     246        $this->counter = get_post_meta( $post_id, 'auto_delete_post_time_key', true );
     247        $converted_user_date_time = strtotime( $this->counter );
     248
     249        if ( empty( $converted_user_date_time ) ) {
     250            $converted_in_date_format = 'Time not set';
     251        } else {
     252            $converted_in_date_format = date( 'Y-m-d h:i A', $converted_user_date_time ) . ' ';
     253        }   
     254
     255        // $final_user_date_time = strtotime( $converted_in_date_format );
     256        if ( 'adp_post_deletion_time_column' == $column_name ) {
     257            // Display the deletion time
     258            printf( esc_html__( '%s', 'auto-delete-post' ), esc_html( $converted_in_date_format ) );
     259        }
     260    }
     261}
     262
     263$adp_custom_post_columb_obj = new ADP_Custom_Post_Column(); // class initialization
     264
     265class Delete_Post_Meta_On_Post_Restore {
     266    public function __construct() {
     267        add_action( 'untrashed_post', [ $this, 'delete_auto_delte_post_meta' ] );
     268    }
     269
     270    // Deleting post meta on clicking restore for every post
     271    public function delete_auto_delte_post_meta( $post_id ) {
     272        // Specifying the meta key
     273        $meta_key_to_delete = 'auto_delete_post_time_key';
     274
     275        // Delete the post meta
     276        delete_post_meta( $post_id, $meta_key_to_delete );
     277    }
     278}
     279
     280$adp_delete_post_meta_on_restore = new Delete_Post_Meta_On_Post_Restore(); // class initialization
     281
     282
     283
  • auto-delete-post/trunk/readme.txt

    r2886567 r3041524  
    11=== Auto Delete Post - Ultimate plugin for deleting a post automatically ===
    22Contributors: palashwpdev
    3 Donate link: https://example.com/
     3Donate link: https://buymeacoffee.com/palash_wp
    44Tags: automatic post delete, automatic delete post, delete post, delete page, delete custom post type, post delete, delete post after a certain time
    55Requires PHP: 7.2
    66Requires at least: 5.2
    7 Tested up to: 6.1.1
    8 Version: 1.1.1
    9 Stable tag: 1.1.2
     7Tested up to: 6.4.3
     8Version: 1.1.3
     9Stable tag: 1.1.3
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3939== Changelog ==
    4040
    41 = 1.1.2 =
    42 Added the menu page where all the posts options are listed.
     41= 1.1.3 =
     42Solved unable to restore post from trash issue.
    4343
    4444== Upgrade Notice ==
    4545
    46 = 1.1.2 =
     46= 1.1.3 =
    4747There is a upgrade available.
Note: See TracChangeset for help on using the changeset viewer.