Plugin Directory

Changeset 3348753


Ignore:
Timestamp:
08/22/2025 05:40:24 PM (7 months ago)
Author:
delower186
Message:

Kanban board, FullCalendar, comments added

Location:
wp-todo
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • wp-todo/trunk/inc/enqueue.php

    r3345168 r3348753  
    1818    // Custom CSS for modal
    1919    wp_add_inline_style( 'jquery-ui-css', '.wptodo-modal { display:none; }' );
     20
     21    // Custom CSS Style
     22    wp_enqueue_style( "style", PLUGIN_DIR_URL ."assets/css/style.css", array(), "1.0", true );
    2023});
     24
     25add_action('admin_enqueue_scripts', function($hook) {
     26    if ($hook !== 'toplevel_page_wp-todo-dashboard') return;
     27
     28    // FullCalendar
     29    wp_enqueue_script('fullcalendar-js', PLUGIN_DIR_URL . 'assets/js/FullCalendar.min.js', [], '6.1.8', true);
     30
     31    // SortableJS for Kanban
     32    wp_enqueue_script('sortable-js', PLUGIN_DIR_URL . 'assets/js/Sortable.min.js', [], '1.15.0', true);
     33
     34    // Custom dashboard script
     35    wp_enqueue_script('wptodo-dashboard-js', PLUGIN_DIR_URL . 'assets/js/wptodo-dashboard.js', ['jquery','fullcalendar-js','sortable-js'], '1.0', true);
     36
     37    wp_localize_script('wptodo-dashboard-js', 'wptodo_dashboard', [
     38        'ajax_url' => admin_url('admin-ajax.php'),
     39        'nonce'    => wp_create_nonce('wp-todo_dashboard'),
     40    ]);
     41});
  • wp-todo/trunk/list_table/custom_columns.php

    r3345168 r3348753  
    3636
    3737        case 'todo_priority':
    38             $priority = get_post_meta( $post_id , '_todo_priority', true );
     38            $priority_terms = wp_get_post_terms($post_id, 'todo_priority', ['fields' => 'names']);
     39            $priority = !empty($priority_terms) ? $priority_terms[0] : '';
    3940            $priority_class = '';
    4041            switch ( strtolower( $priority ) ) {
     
    4243                case 'normal': $priority_class = 'priority-normal'; break;
    4344                case 'low': $priority_class = 'priority-low'; break;
    44                 case 'important': $priority_class = 'priority-important'; break;
     45                case 'critical': $priority_class = 'priority-critical'; break;
    4546            }
    4647            echo '<span class="' . esc_attr($priority_class) . '">' . esc_html( $priority ) . '</span>';
     
    4849
    4950        case 'todo_status':
    50             $status = get_post_meta( $post_id , '_todo_status', true );
     51            $status_terms   = wp_get_post_terms($post_id, 'todo_status', ['fields' => 'names']);
     52            $status = !empty($status_terms) ? $status_terms[0] : '';
    5153            $status_class = '';
    5254            switch ( strtolower( $status ) ) {
    5355                case 'not started': $status_class = 'status-not-started'; break;
    5456                case 'in progress': $status_class = 'status-in-progress'; break;
    55                 case 'pending': $status_class = 'status-pending'; break;
    5657                case 'in review': $status_class = 'status-in-review'; break;
    5758                case 'completed': $status_class = 'status-completed'; break;
    58                 case 'cancelled': $status_class = 'status-cancelled'; break;
    5959            }
    6060            echo '<span class="' . esc_attr($status_class) . '">' . esc_html( $status ) . '</span>';
     
    9898        .priority-normal { color:#fff; background:#5bc0de; padding:3px 6px; border-radius:4px; font-weight:bold; }
    9999        .priority-low { color:#fff; background:#5bc0de; padding:3px 6px; border-radius:4px; font-weight:bold; }
    100         .priority-important { color:#fff; background:#f0ad4e; padding:3px 6px; border-radius:4px; font-weight:bold; }
     100        .priority-critical { color:#fff; background:#f0ad4e; padding:3px 6px; border-radius:4px; font-weight:bold; }
    101101
    102102        /* Status */
    103103        .status-not-started { background:#6c757d; color:#fff; padding:3px 6px; border-radius:4px; font-weight:bold; }
    104104        .status-in-progress { background:#0275d8; color:#fff; padding:3px 6px; border-radius:4px; font-weight:bold; }
    105         .status-pending { background:#fd7e14; color:#fff; padding:3px 6px; border-radius:4px; font-weight:bold; }
    106105        .status-in-review { background:#17a2b8; color:#fff; padding:3px 6px; border-radius:4px; font-weight:bold; }
    107106        .status-completed { background:#5cb85c; color:#fff; padding:3px 6px; border-radius:4px; font-weight:bold; }
    108         .status-cancelled { background:#dc3545; color:#fff; padding:3px 6px; border-radius:4px; font-weight:bold; }
    109107    </style>';
    110108});
     109
     110
     111// remove comment column from the table
     112add_filter( 'manage_wp-todo_posts_columns', function( $columns ) {
     113    // Remove the comments column
     114    if ( isset( $columns['comments'] ) ) {
     115        unset( $columns['comments'] );
     116    }
     117    return $columns;
     118});
  • wp-todo/trunk/meta_boxes/wptodo_meta_boxe.php

    r3345168 r3348753  
    11<?php
    22/**
    3  * About meta box Information
    4  *
     3 * Register custom taxonomies for Status & Priority
     4 */
     5function wptodo_register_taxonomies() {
     6    // Status
     7    register_taxonomy('todo_status', 'wp-todo', [
     8        'labels' => [
     9            'name'          => 'Statuses',
     10            'singular_name' => 'Status',
     11        ],
     12        'public'       => false,
     13        'show_ui'      => false, // hide default taxonomy meta box
     14        'hierarchical' => false,
     15    ]);
     16
     17    // Priority
     18    register_taxonomy('todo_priority', 'wp-todo', [
     19        'labels' => [
     20            'name'          => 'Priorities',
     21            'singular_name' => 'Priority',
     22        ],
     23        'public'       => false,
     24        'show_ui'      => false, // hide default taxonomy meta box
     25        'hierarchical' => false,
     26    ]);
     27}
     28add_action('init', 'wptodo_register_taxonomies');
     29
     30
     31/**
     32 * Add custom meta boxes
    533 */
    634function wptodo_add_meta_box() {
     
    1240add_action('add_meta_boxes', 'wptodo_add_meta_box');
    1341
     42
     43/**
     44 * Meta box content
     45 */
    1446function wptodo_meta_box_callback($post, $meta) {
    1547    wp_nonce_field('wp-todo_add_meta_box_nonce', 'wp-todo_add_meta_box_nonce_field');
     
    1850        case 'todo_deadline':
    1951            $value = get_post_meta($post->ID, '_todo_deadline', true) ?: gmdate('Y-m-d');
    20             echo '<input type="date" name="todo_deadline" value="'.esc_attr($value).'" style="width:100%;">';
     52            echo '<input type="date" name="todo_deadline" value="' . esc_attr($value) . '" style="width:100%;">';
    2153            break;
    2254
     
    2658            echo '<select name="todo_assignee" style="width:100%">';
    2759            foreach ($users as $user) {
    28                 echo '<option value="' . esc_attr( $user->ID ) . '" ' . selected( $selected, $user->ID, false ) . '>' . esc_html( $user->display_name ) . '</option>';
     60                echo '<option value="' . esc_attr($user->ID) . '" ' . selected($selected, $user->ID, false) . '>' . esc_html($user->display_name) . '</option>';
    2961            }
    3062            echo '</select>';
     
    3264
    3365        case 'todo_status':
    34             $status = get_post_meta($post->ID, '_todo_status', true) ?: 'Not Started';
    35             $options = ['Not Started','In Progress','Pending','In Review','Completed','Cancelled'];
     66            $terms   = get_terms(['taxonomy' => 'todo_status', 'hide_empty' => false]);
     67            $current = wp_get_post_terms($post->ID, 'todo_status', ['fields' => 'ids']);
     68            $current = $current ? $current[0] : '';
    3669            echo '<select name="todo_status" style="width:100%">';
    37             foreach ($options as $opt) {
    38                 echo '<option value="' . esc_attr( $opt ) . '" ' . selected( $status, $opt, false ) . '>' . esc_html( $opt ) . '</option>';
     70            foreach ($terms as $term) {
     71                echo '<option value="' . esc_attr($term->term_id) . '" ' . selected($current, $term->term_id, false) . '>' . esc_html($term->name) . '</option>';
    3972            }
    4073            echo '</select>';
     
    4275
    4376        case 'todo_priority':
    44             $priority = get_post_meta($post->ID, '_todo_priority', true) ?: 'Normal';
    45             $options = ['Low','Normal','High','Important'];
     77            $terms   = get_terms(['taxonomy' => 'todo_priority', 'hide_empty' => false]);
     78            $current = wp_get_post_terms($post->ID, 'todo_priority', ['fields' => 'ids']);
     79            $current = $current ? $current[0] : '';
    4680            echo '<select name="todo_priority" style="width:100%">';
    47             foreach ($options as $opt) {
    48                 echo '<option value="' . esc_attr( $opt ) . '" ' . selected( $priority, $opt, false ) . '>' . esc_html( $opt ) . '</option>';
     81            foreach ($terms as $term) {
     82                echo '<option value="' . esc_attr($term->term_id) . '" ' . selected($current, $term->term_id, false) . '>' . esc_html($term->name) . '</option>';
    4983            }
    5084            echo '</select>';
     
    5488
    5589
     90/**
     91 * Save meta box fields
     92 */
    5693function wptodo_save_meta_box($post_id) {
    57     // Verify nonce
    5894    if (!isset($_POST['wp-todo_add_meta_box_nonce_field']) ||
    59         !wp_verify_nonce(sanitize_text_field(wp_unslash( $_POST['wp-todo_add_meta_box_nonce_field'] )), 'wp-todo_add_meta_box_nonce')) {
     95        !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['wp-todo_add_meta_box_nonce_field'])), 'wp-todo_add_meta_box_nonce')) {
    6096        return;
    6197    }
    6298
    63     // Check autosave
    6499    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
    65 
    66     // Check permissions
    67100    if (!current_user_can('edit_post', $post_id)) return;
    68101
    69     // Save field
     102    // Save deadline
    70103    if (isset($_POST['todo_deadline'])) {
    71104        update_post_meta($post_id, '_todo_deadline', sanitize_text_field(wp_unslash($_POST['todo_deadline'])));
    72105    }
     106
     107    // Save assignee
    73108    if (isset($_POST['todo_assignee'])) {
    74         update_post_meta($post_id, '_todo_assignee', sanitize_text_field(wp_unslash($_POST['todo_assignee'])));
     109        update_post_meta($post_id, '_todo_assignee', intval($_POST['todo_assignee']));
    75110    }
     111
     112    // Save taxonomy terms
    76113    if (isset($_POST['todo_status'])) {
    77         update_post_meta($post_id, '_todo_status', sanitize_text_field(wp_unslash($_POST['todo_status'])));
     114        wp_set_post_terms($post_id, [(int) $_POST['todo_status']], 'todo_status', false);
    78115    }
    79116    if (isset($_POST['todo_priority'])) {
    80         update_post_meta($post_id, '_todo_priority', sanitize_text_field(wp_unslash($_POST['todo_priority'])));
     117        wp_set_post_terms($post_id, [(int) $_POST['todo_priority']], 'todo_priority', false);
    81118    }
    82119}
    83120add_action('save_post', 'wptodo_save_meta_box');
     121
     122
     123/**
     124 * Pre-populate default taxonomy terms on plugin/theme activation
     125 */
     126function wptodo_register_default_terms() {
     127    // Statuses
     128    $statuses = ['Not Started','In Progress','In Review','Completed'];
     129    foreach ($statuses as $status) {
     130        if (!term_exists($status, 'todo_status')) {
     131            wp_insert_term($status, 'todo_status');
     132        }
     133    }
     134
     135    // Priorities
     136    $priorities = ['Low','Normal','High','Critical'];
     137    foreach ($priorities as $priority) {
     138        if (!term_exists($priority, 'todo_priority')) {
     139            wp_insert_term($priority, 'todo_priority');
     140        }
     141    }
     142}
     143add_action('init', 'wptodo_register_default_terms');
     144
  • wp-todo/trunk/readme.txt

    r3345168 r3348753  
    44Requires at least: 6.4 or higher
    55Tested up to: 6.8
    6 Stable tag: 2.0.2
     6Stable tag: 2.1.0
    77Requires PHP: 7.2.24
    88License: GPLv2
     
    1616
    1717== Features ==
    18 * **Brand new design & re-developed from scratch - More Features comming soon!**
     18* Kanban board
     19* FullCalendar
    1920* Create and manage tasks and to-do lists
    20 * Assign priorities (High, Medium, Low) to tasks
    21 * Set statuses (Not Started, In Progress, On Hold, Review, Completed, Cancelled)
     21* Assign priorities (Critical, High, Normal, Low) to tasks
     22* Set statuses (Not Started, In Progress, In Review, Completed)
    2223* Add deadlines for timely task completion
    2324* Track milestones and progress
     
    3435
    3536== Detailed Walkthrough ==
    36 [youtube https://youtu.be/KQF2ouZ1mJM]
     37[youtube https://youtu.be/d6pcudlgMP4]
    3738
    3839== Contribute ==
    3940This may have bugs and lack of many features. If you want to contribute on this project, you are more than welcome. Please fork the repository from [Github](https://github.com/delower186/wp-todo).
    4041
    41 == Donate ==
    42 Please [donate]() for this awesome plugin to continue it's development to bring more awesome features.
     42== Custom Development & Feature Requests ==
    4343
     44Need a custom feature or want to enhance Project Manager to fit your workflow? 
     45I provide custom WordPress plugin development, feature requests, and tailored solutions to make your project management seamless.
     46
     47= Contact for Custom Development =
     48🌐 Website: [https://sandalia.com.bd/apps](https://sandalia.com.bd/apps) 
     49💼 Upwork: [Upwork](https://www.upwork.com/freelancers/delower)
     50💼 Linkedin: [Linkedin](https://www.linkedin.com/in/delower186/)
     51
     52= Do You need any Data Scraping Services? Try =
     53🌐 Marketplace: [SandaliaApps](https://apify.com/sandaliaapps)
     54
     55== Try My Other Plugins ==
     56
     57If you like **WP To Do**, you might also enjoy my other plugins:
     58
     59= [Project Manager Pro](https://wordpress.org/plugins/project-manager-pro) =
     60Project Manager Pro is perfect for freelancers, small teams, or anyone who wants to manage projects directly from their WordPress admin panel without needing external tools.
    4461
    4562== Frequently Asked Questions ==
     
    5976
    6077== Changelog ==
     78
     79= 2.1.0 =
     80* Kanban board added
     81* FullCalendar added
     82* Comments added to todo details page
     83
     84
     85= 2.0.2 =
     86* Best Practice applied
    6187
    6288= 2.0.1 =
  • wp-todo/trunk/todo/count_down_timer.php

    r3345168 r3348753  
    88    if ( $column === 'todo_deadline_countdown' ) {
    99        $deadline = get_post_meta( $post_id, '_todo_deadline', true );
    10         $status   = get_post_meta( $post_id, '_todo_status', true );
     10        $status_terms   = wp_get_post_terms($post_id, 'todo_status', ['fields' => 'names']);
     11        $status   = !empty($status_terms) ? $status_terms[0] : '';
    1112        if ( $deadline ) {
    1213            echo '<span class="wptodo-countdown" data-deadline="'.esc_attr($deadline).'" data-status="'.esc_attr(strtolower($status)).'"></span>';
     
    7677                }
    7778
    78                 if(status === 'cancelled') {
    79                     $(element).html('😢').addClass('wptodo-cancelled');
    80                     return;
    81                 }
    82 
    8379                if(diff <= 0){
    8480                    $(element).text('Deadline passed').addClass('wptodo-passed');
  • wp-todo/trunk/todo/modal_view.php

    r3345168 r3348753  
    11<?php
     2/**
     3 * AJAX: Quick View Modal
     4 */
    25add_action( 'wp_ajax_wp-todo_quick_view', function() {
    3     // First, safely get and unslash the nonce
    46    $nonce = isset( $_POST['wp-todo_nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wp-todo_nonce'] ) ) : '';
    5 
    6     // Verify the nonce
    77    if ( ! wp_verify_nonce( $nonce, 'wp-todo_action' ) ) {
    88        wp_send_json_error( array( 'message' => 'Security check failed' ), 400 );
    9         exit;
    10     }
    11 
    12     // Now process the post ID
     9    }
     10
    1311    $post_id = isset( $_POST['post_id'] ) ? intval( $_POST['post_id'] ) : 0;
    14 
    1512    if ( ! $post_id ) wp_send_json_error('Invalid post ID');
    1613
     
    1815    if ( ! $post || $post->post_type !== 'wp-todo' ) wp_send_json_error('Post not found');
    1916
    20     $assignee_id = get_post_meta( $post_id, '_todo_assignee', true );
     17    $assignee_id   = get_post_meta( $post_id, '_todo_assignee', true );
    2118    $assignee_name = $assignee_id ? get_the_author_meta('display_name', $assignee_id) : '—';
    22     $priority = get_post_meta( $post_id, '_todo_priority', true ) ?: 'Normal';
    23     $status = get_post_meta( $post_id, '_todo_status', true ) ?: 'Not Started';
    24     $deadline = get_post_meta( $post_id, '_todo_deadline', true ) ?: '—';
     19    $priority_terms = wp_get_post_terms($post_id, 'todo_priority', ['fields' => 'names']);
     20    $priority      = !empty($priority_terms) ? $priority_terms[0] : '-';
     21    $status_terms   = wp_get_post_terms($post_id, 'todo_status', ['fields' => 'names']);
     22    $status        = !empty($status_terms) ? $status_terms[0] : '-';
     23    $deadline      = get_post_meta( $post_id, '_todo_deadline', true ) ?: '—';
    2524
    2625    $content = apply_filters('the_content', $post->post_content);
    2726
    28     if (!$deadline) {
     27    if ( ! $deadline ) {
    2928        $deadline = gmdate('Y-m-d');
    3029    }
    3130
    32     $now = new DateTime();
     31    $now         = new DateTime();
    3332    $deadline_dt = new DateTime($deadline);
    34     $interval = $now->diff($deadline_dt);
    35 
    36     // Calculate time left string
    37     if ($now > $deadline_dt) {
     33    $interval    = $now->diff($deadline_dt);
     34
     35    if ( $now > $deadline_dt ) {
    3836        $time_left = 'Deadline passed';
    3937    } else {
     
    4139    }
    4240
    43     // status on modal
    44     if ($status == 'Completed') {
     41    if ( $status == 'Completed' ) {
    4542        $time_left = "🎉";
    46     }elseif ($status == "Cancelled") {
     43    } elseif ( $status == "Cancelled" ) {
    4744        $time_left = "😢";
    4845    }
     
    5754        <p><strong>Time Left:</strong> <?php echo esc_html($time_left); ?></p>
    5855        <div><?php echo wp_kses_post($content); ?></div>
     56
    5957        <div id="wptodo-comments">
     58            <h3>Comments</h3>
    6059            <?php
    61                 // Load WP's comment template for this post
    62                 global $withcomments;
    63                 $withcomments = true; // Force comments to load in non-single views
    64                 comments_template();
     60                $comments = get_comments( array( 'post_id' => $post_id ) );
     61                foreach ( $comments as $comment ) {
     62                    echo '<div class="wptodo-comment" id="comment-' . esc_attr($comment->comment_ID) . '">';
     63                    echo '<strong>' . esc_html($comment->comment_author) . ':</strong> ';
     64                    echo '<p>' . esc_html($comment->comment_content) . '</p>';
     65                    echo '</div>';
     66                }
    6567            ?>
     68            <form id="wptodo-comment-form">
     69                <textarea name="comment" rows="3" style="width:100%;" required></textarea>
     70                <input type="hidden" name="action" value="wp-todo_add_comment" />
     71                <input type="hidden" name="post_id" value="<?php echo esc_attr( $post_id ); ?>" />
     72                <input type="hidden" name="nonce" value="<?php echo esc_attr( wp_create_nonce( 'wp-todo_action' ) ); ?>" />
     73                <button type="submit" class="button button-primary">Post Comment</button>
     74            </form>
    6675        </div>
    6776    </div>
     
    7180
    7281
     82/**
     83 * Admin Footer JS
     84 */
    7385add_action( 'admin_footer-edit.php', function() {
    7486    $screen = get_current_screen();
     
    7789    <script>
    7890    jQuery(document).ready(function($){
    79         // Add data-post-id and clickable class to rows
     91        // Add clickable class to rows
    8092        $('#the-list tr').each(function(){
    8193            var post_id = $(this).attr('id');
     
    8698        });
    8799
    88         // Click event for row
     100        // Quick view modal
    89101        $('#the-list').on('click', 'tr.wptodo-clickable', function(e){
    90             // Prevent click if it is on first 2 columns (checkbox/radio or title)
    91102            if($(e.target).closest('th, td:first-child, td:nth-child(2)').length) return;
    92103
     
    94105            if(!post_id) return;
    95106
    96             // AJAX to fetch modal content
    97107            $.post(wptodo_ajax.ajax_url, {
    98108                action: 'wp-todo_quick_view',
     
    103113                    $('<div class="wptodo-modal"></div>').html(response.data).dialog({
    104114                        modal: true,
    105                         width: 600,
     115                        width: 700,
    106116                        title: 'Todo Details',
    107                         close: function() { $(this).remove(); }
     117                        open: function () {
     118                            var maxH = Math.floor(window.innerHeight * 0.8);
     119                            $(this).css({ maxHeight: maxH + 'px', overflowY: 'auto' });
     120                        },
     121                        close: function() { $(this).dialog('destroy').remove(); }
    108122                    });
    109123                } else {
     
    112126            });
    113127        });
     128
     129        // Handle AJAX comment submit
     130        $(document).on('submit', '#wptodo-comment-form', function(e){
     131            e.preventDefault();
     132            var form = $(this);
     133            $.post(wptodo_ajax.ajax_url, form.serialize(), function(response){
     134                if(response.success){
     135                    $('#wptodo-comments h3').after(response.data.html);
     136                    form[0].reset();
     137                } else {
     138                    alert(response.data);
     139                }
     140            });
     141        });
    114142    });
    115143    </script>
     144    <style>
     145      /* Scrollable modal */
     146      .ui-dialog .ui-dialog-content.wptodo-modal {
     147        max-height: calc(100vh - 160px) !important;
     148        overflow-y: auto !important;
     149        padding-right: 10px;
     150      }
     151      /* Scroll only comments if long */
     152      #wptodo-comments {
     153        max-height: 40vh;
     154        overflow-y: auto;
     155        border: 1px solid #ddd;
     156        padding: 8px;
     157        background: #fff;
     158      }
     159      .wptodo-comment { margin-bottom: 10px; }
     160    </style>
    116161    <?php
    117162});
    118163
     164
     165/**
     166 * Enqueue scripts/styles
     167 */
    119168add_action('admin_enqueue_scripts', function() {
    120     wp_enqueue_script('comment-reply');
    121169    wp_enqueue_style('wp-admin');
    122170});
     171
     172
     173/**
     174 * AJAX: Add Comment
     175 */
     176add_action('wp_ajax_wp-todo_add_comment', function() {
     177    $nonce = isset($_POST['nonce']) ? sanitize_text_field(wp_unslash($_POST['nonce'])) : '';
     178    if ( ! wp_verify_nonce($nonce, 'wp-todo_action') ) {
     179        wp_send_json_error('Security check failed');
     180    }
     181
     182    $current_user = wp_get_current_user();
     183    $commentdata = array(
     184        'comment_post_ID'      => isset($_POST['post_id']) ? intval($_POST['post_id']) : '',
     185        'comment_content'      => isset($_POST['comment']) ? sanitize_textarea_field(wp_unslash($_POST['comment'])) : '',
     186        'user_id'              => $current_user->ID,
     187        'comment_author'       => $current_user->display_name,
     188        'comment_author_email' => $current_user->user_email,
     189        'comment_approved'     => 1,
     190    );
     191
     192    $comment_id = wp_new_comment($commentdata);
     193
     194    if ($comment_id) {
     195        $comment = get_comment($comment_id);
     196
     197        ob_start();
     198        echo '<div class="wptodo-comment" id="comment-' . esc_attr($comment->comment_ID) . '">';
     199        echo '<strong>' . esc_html($comment->comment_author) . ':</strong> ';
     200        echo '<p>' . esc_html($comment->comment_content) . '</p>';
     201        echo '</div>';
     202        $html = ob_get_clean();
     203
     204        wp_send_json_success( array( 'html' => $html ) );
     205    } else {
     206        wp_send_json_error('Failed to add comment');
     207    }
     208});
     209
     210
     211/**
     212 * Disable moderation for wp-todo CPT
     213 */
     214add_filter('pre_comment_approved', function($approved, $commentdata) {
     215    if (isset($commentdata['comment_post_ID'])) {
     216        $post_type = get_post_type($commentdata['comment_post_ID']);
     217        if ($post_type === 'wp-todo') {
     218            return 1;
     219        }
     220    }
     221    return $approved;
     222}, 10, 2);
  • wp-todo/trunk/todo/wptodo_custom_post_type.php

    r3345168 r3348753  
    5151      'publicly_queryable'    => false,
    5252      'show_ui'               => true,
    53       'show_in_menu'          => true,
     53      'show_in_menu'          => false,
    5454      'show_in_nav_menus'     => false,
    5555      'show_in_admin_bar'     => false,
     
    5959      'capability_type'       => 'post',
    6060      'capabilities'          => array(),
    61       'supports'              => array( 'title', 'editor', 'revisions' ),
     61      'supports'              => array( 'title', 'editor', 'revisions', 'author', 'comments' ),
    6262      'taxonomies'            => array(),
    6363      'has_archive'           => true,
  • wp-todo/trunk/wp-todo.php

    r3345168 r3348753  
    55/*
    66Plugin Name: WP To Do
    7 Plugin URI: https://sandalia.com.bd/apps
     7Plugin URI: https://sandalia.com.bd/apps/view_project.php?slug=wp-todo
    88Description: WP-Todo: A full-featured WordPress plugin to create, manage, and track tasks with custom statuses, priorities, and deadlines from your dashboard.
    9 Version:2.0.2
     9Version:2.1.0
    1010Author: Delower
    11 Author URI: https://sandalia.com.bd/apps
     11Author URI: https://github.com/delower186
    1212License: GPLv2 or later
    1313Text Domain: wp-todo
     
    4444include PLUGIN_DIR_PATH . "todo/modal_view.php";
    4545include PLUGIN_DIR_PATH . "todo/count_down_timer.php";
     46include PLUGIN_DIR_PATH . "inc/dashboard.php";
Note: See TracChangeset for help on using the changeset viewer.