Plugin Directory

Changeset 3288605


Ignore:
Timestamp:
05/06/2025 05:29:14 PM (10 months ago)
Author:
arstudios
Message:

Constellation Client Portal release version 2.0.0.

Location:
constellation-client-portal
Files:
133 added
1 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • constellation-client-portal/trunk/README.txt

    r3265198 r3288605  
    44Tags: client portal, private files, private pages, private posts, customer portal, business portal, invoicing, business managemenet, client management
    55Requires at least: 6.0.0
    6 Tested up to: 6.7
    7 Stable tag: 1.11.1
     6Tested up to: 6.8
     7Stable tag: 2.0.0
    88Requires PHP: 7.4
    99License: GPLv3 or later
     
    210210
    211211== Changelog ==
     212= 2.0.0 (Pro) - 2025-5-6 =
     213* Feature: Created new functionality that allows users to better control what data is deleted when file, invoice, and global file posts are deleted.
     214* Feature: Created new functionality that allows users to better control what data is deleted when a company is deleted.
     215* Feature: Created new functionality and settings to allow users control over what data is removed when the plugin is uninstalled.
     216* Feature: Created new data management settings page and functionality to allow users better control over how data is handled.
     217* Fix: Fixed typo in post note meta box message.
     218* Fix: Fixed issue with undefined post__in array key in the company menu shortcode that surfaced in certain instances.
     219* Update: Updated the company menu shortcode to explicitly exit if is_admin to prevent conflict in WP Admin in certain environments.
     220* Feature: Added functionality to allow post notes (accp_post_note post type) to be conditionally displayed in the WP Admin menu for easier management and administration.
     221* Fix: Fixed undefined variable warning in pro admin functions.
     222* Compatibility: Tested the plugin with WP 6.8.
     223
     224= 2.0.0 (Core) - 2025-5-6 =
     225* Update: Updated the file delete notice on the file, invoice, and global file WP list table trash pages.
     226* Update: Deprecated the accp_delete_file_attachment_on_post_permanent_delete, accp_delete_file_attachment_on_bulk_post_permanent_delete, accp_delete_file_attachment_on_post_empty_trash AJAX functions in favor of the WP before_delete_post hook.
     227* Update: Added new core data management class.
     228* Fix: Fixed issue where PHP null value warning could be thrown in the global file WP list table excluded companies column in cases where a company was deleted, but still saved to the excluded companies global file post meta.
     229* Compatibility: Tested the plugin with WP 6.8.
     230
    212231= 1.11.1 (Pro) - 2025-4-1 =
    213232* Update: All core updates.
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-admin.php

    r3200929 r3288605  
    611611
    612612    /**
    613      * AJAX - Delete the file associated with the clientfile post
    614      * when the delete permanently button is clicked.
    615      *
    616      * If there is no file associated with the post the default
    617      * WP functionality will handle the post deletion.
    618      */
    619     public function accp_delete_file_on_post_delete() {
    620 
    621         /**
    622          * Verify the nonce.
    623          */
    624         if ( ! isset( $_POST['file_del_nonce'] ) ) {
    625             die();
    626         }
    627 
    628         $nonce = sanitize_text_field( wp_unslash( $_POST['file_del_nonce'] ) );
    629 
    630         if ( ! wp_verify_nonce( $nonce, 'clientfile_admin_nonce' ) ) {
    631             die();
    632         }
    633 
    634         if ( ! isset( $_POST['file_post_id'] ) ) {
    635             die();
    636         }
    637 
    638         $raw_post_id = (int) $_POST['file_post_id'];
    639         $post_id     = $this->accp_utility_functions->accp_sanitize_integers( $raw_post_id );
    640 
    641         if ( ! $post_id || empty( $post_id ) ) {
    642             die();
    643         }
    644 
    645         $post                = get_post( $post_id );
    646         $post_type           = $post->post_type;
    647         $accp_file           = get_post_meta( $post_id, 'accp_file', true );
    648         $included_post_types = array( 'accp_clientinvoice', 'accp_clientfile', 'accp_global_file' );
    649 
    650         if ( in_array( $post_type, $included_post_types, true ) ) {
    651 
    652             /**
    653              * Check if the post has a file.
    654              */
    655             if ( ! empty( $accp_file ) ) {
    656 
    657                 $file_parse_array    = wp_parse_url( $accp_file['url'] );
    658                 $accp_file_path      = isset( $file_parse_array['path'] ) ? $file_parse_array['path'] : '';
    659                 $accp_file_full_path = untrailingslashit( get_home_path() ) . $accp_file_path;
    660 
    661                 if ( $accp_file_path && ! empty( $accp_file_path ) && file_exists( $accp_file_full_path ) ) {
    662 
    663                     /**
    664                      * If there is a file, delete it.
    665                      */
    666                     wp_delete_file( $accp_file_full_path );
    667 
    668                     /**
    669                      * Also delete the associated post.
    670                      */
    671                     wp_delete_post( $post_id, true );
    672 
    673                     echo 'The file and post were successfully deleted.';
    674 
    675                 } else {
    676 
    677                     /**
    678                      * If the file no longer exists,
    679                      * just delete the post.
    680                      */
    681                     wp_delete_post( $post_id, true );
    682 
    683                     echo 'No file associated with this post. The post was successfully deleted.';
    684 
    685                 }
    686             } else {
    687 
    688                 /**
    689                  * If the post doesn't have a file just delete the post.
    690                  */
    691                 wp_delete_post( $post_id, true );
    692 
    693                 echo 'The post was successfully deleted.';
    694 
    695             }
    696         }
    697 
    698         /**
    699          * Remove any associated post notes if this is the Pro version.
    700          */
    701         $this->accp_delete_post_notes_on_post_delete( $post_id );
    702 
    703         wp_die();
    704     }
    705 
    706 
    707     /**
    708613     * Pro - Delete associated post notes on post delete.
    709614     *
     
    757662
    758663        endif;
    759     }
    760 
    761 
    762 
    763     /**
    764      * AJAX - Bulk delete the files associated with the clientfile
    765      * post when the delete permanently button is clicked.
    766      *
    767      * If there is no file associated with the post, the default
    768      * WP functionality will handle the post deletion.
    769      */
    770     public function accp_bulk_delete_file_on_post_delete() {
    771 
    772         /**
    773          * Verify the nonce.
    774          */
    775         if ( ! isset( $_POST['bulk_delete_nonce'] ) ) {
    776             die();
    777         }
    778 
    779         $nonce = sanitize_text_field( wp_unslash( $_POST['bulk_delete_nonce'] ) );
    780 
    781         if ( ! wp_verify_nonce( $nonce, 'clientfile_admin_nonce' ) ) {
    782             die();
    783         }
    784 
    785         if ( ! isset( $_POST['del_file_post_id_json'] ) ) {
    786             die();
    787         }
    788 
    789         $file_ids            = json_decode( sanitize_text_field( wp_unslash( $_POST['del_file_post_id_json'] ) ) );
    790         $included_post_types = array( 'accp_clientinvoice', 'accp_clientfile', 'accp_global_file' );
    791 
    792         if ( $file_ids && ! empty( $file_ids ) ) {
    793 
    794             foreach ( $file_ids as $post_id ) {
    795 
    796                 $post_id   = $this->accp_utility_functions->accp_sanitize_integers( $post_id );
    797                 $post      = get_post( $post_id );
    798                 $post_type = $post->post_type;
    799                 $accp_file = get_post_meta( $post_id, 'accp_file', true );
    800 
    801                 if ( in_array( $post_type, $included_post_types, true ) ) {
    802 
    803                     /**
    804                      * Check if the post has file.
    805                      */
    806                     if ( ! empty( $accp_file ) ) {
    807 
    808                         $file_parse_array    = wp_parse_url( $accp_file['url'] );
    809                         $accp_file_path      = isset( $file_parse_array['path'] ) ? $file_parse_array['path'] : '';
    810                         $accp_file_full_path = untrailingslashit( get_home_path() ) . $accp_file_path;
    811 
    812                         if ( $accp_file_path && ! empty( $accp_file_path ) && file_exists( $accp_file_full_path ) ) {
    813 
    814                             /**
    815                              * If there is a file, delete it.
    816                              */
    817                             wp_delete_file( $accp_file_full_path );
    818 
    819                             /**
    820                              * Also delete the associated post.
    821                              */
    822                             wp_delete_post( $post_id, true );
    823 
    824                             echo 'The file and post were successfully deleted.';
    825 
    826                         } else {
    827 
    828                             /**
    829                              * If the file no longer exists,
    830                              * just delete the post.
    831                              */
    832                             wp_delete_post( $post_id, true );
    833 
    834                             echo 'The file was successfully deleted.';
    835 
    836                         }
    837                     } else {
    838 
    839                         /**
    840                          * If the post doesn't have a file just delete the post.
    841                          */
    842                         wp_delete_post( $post_id, true );
    843 
    844                         echo 'The file was successfully deleted.';
    845 
    846                     }
    847                 }
    848 
    849                 /**
    850                  * Pro - Delete any associated post notes.
    851                  */
    852                 $this->accp_delete_post_notes_on_post_delete( $post_id );
    853 
    854             }
    855         }
    856 
    857         die();
    858     }
    859 
    860 
    861     /**
    862      * AJAX - Bulk delete the files associated with the clientfile
    863      * post when the empty trash button is clicked.
    864      *
    865      * If there is no file associated with the post the default
    866      * WP functionality will handle the post deletion
    867      */
    868     public function accp_bulk_delete_file_on_empty_trash() {
    869 
    870         /**
    871          * Verify the nonce.
    872          */
    873         if ( ! isset( $_POST['empty_trash_nonce'] ) ) {
    874             die();
    875         }
    876 
    877         $nonce = sanitize_text_field( wp_unslash( $_POST['empty_trash_nonce'] ) );
    878 
    879         if ( ! wp_verify_nonce( $nonce, 'clientfile_admin_nonce' ) ) {
    880             die();
    881         }
    882 
    883         /**
    884          * Set up a query of the clienfile or accp_clientinvoice posts
    885          * with a status of 'trash' so that we can quickly
    886          * get all posts in trash.
    887          */
    888         if ( ! isset( $_POST['post_type'] ) ) {
    889             die();
    890         }
    891 
    892         $post_type = sanitize_text_field( wp_unslash( $_POST['post_type'] ) );
    893 
    894         $args = array(
    895             'post_type'      => $post_type,
    896             'post_status'    => 'trash',
    897             'posts_per_page' => -1,
    898         );
    899 
    900         $trash_query = new WP_Query( $args );
    901 
    902         if ( $trash_query->have_posts() ) :
    903 
    904             while ( $trash_query->have_posts() ) :
    905 
    906                 $trash_query->the_post();
    907 
    908                 $post_id   = get_the_id();
    909                 $post      = get_post( $post_id );
    910                 $post_type = $post->post_type;
    911                 $accp_file = get_post_meta( $post_id, 'accp_file', true );
    912 
    913                 if ( 'accp_clientcompany' !== $post_type ) {
    914 
    915                     /**
    916                      * Check if the post has a file.
    917                      */
    918                     if ( ! empty( $accp_file ) ) {
    919 
    920                         $file_parse_array    = wp_parse_url( $accp_file['url'] );
    921                         $accp_file_path      = isset( $file_parse_array['path'] ) ? $file_parse_array['path'] : '';
    922                         $accp_file_full_path = untrailingslashit( get_home_path() ) . $accp_file_path;
    923 
    924                         if ( $accp_file_path && ! empty( $accp_file_path ) && file_exists( $accp_file_full_path ) ) {
    925 
    926                             /**
    927                              * If there is a file, delete it.
    928                              */
    929                             wp_delete_file( $accp_file_full_path );
    930 
    931                             /**
    932                              * Also delete the associated post.
    933                              */
    934                             wp_delete_post( $post_id, true );
    935 
    936                             echo 'The file and post were successfully deleted.';
    937 
    938                         } else {
    939 
    940                             /**
    941                              * If the file no longer exists,
    942                              * just delete the post.
    943                              */
    944                             wp_delete_post( $post_id, true );
    945 
    946                             echo 'The file was successfully deleted.';
    947 
    948                         }
    949                     } else {
    950 
    951                         /**
    952                          * If the post doesn't have a file just delete the post.
    953                          */
    954                         wp_delete_post( $post_id, true );
    955 
    956                         echo 'The file was successfully deleted.';
    957 
    958                     }
    959 
    960                     /**
    961                      * Pro - Delete any associated post notes.
    962                      */
    963                     $this->accp_delete_post_notes_on_post_delete( $post_id );
    964 
    965                 }
    966 
    967             endwhile;
    968 
    969             wp_reset_postdata();
    970 
    971         endif;
    972 
    973         wp_die();
    974664    }
    975665
     
    33002990                $permanent_delete_notice = apply_filters( 'accp_update_permanent_post_delete_notice', $permanent_delete_notice );
    33012991
    3302                 echo wp_kses_post( '<div class="notice notice-error"><p>' . esc_html( $permanent_delete_notice ) . '</p></div>' );
     2992                echo wp_kses_post( '<div class="notice notice-error"><p>' . $permanent_delete_notice . '</p></div>' );
    33032993
    33042994            }
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-client-pages.php

    r3265190 r3288605  
    385385        }
    386386    }
     387
     388
     389    /**
     390     * Get all client pages assigned to a given company.
     391     *
     392     * @param int $company_id - The post ID of the company.
     393     *
     394     * @return array $client_pages - Array of client page IDs assigned to a company (if any);
     395     */
     396    public function get_all_client_pages_assigned_to_company( $company_id ) {
     397
     398        if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
     399            return;
     400        }
     401
     402        $client_pages = array();
     403
     404        if ( ! $company_id ) {
     405            return $client_pages;
     406        }
     407
     408        $args = array(
     409            'numberposts' => -1,
     410            'post_type'   => 'accp_client_pages',
     411            'fields'      => 'ids',
     412            // phpcs:ignore WordPress.DB.SlowDBQuery
     413            'meta_query'  => array(
     414                'relation' => 'AND',
     415                array(
     416                    'key'     => 'accp_user',
     417                    'value'   => $company_id,
     418                    'compare' => 'IN',
     419                ),
     420                array(
     421                    'relation' => 'OR',
     422                    array(
     423                        'key'     => 'accp_make_page_global',
     424                        'value'   => 'global',
     425                        'compare' => 'NOT LIKE',
     426                    ),
     427                    array(
     428                        'key'     => 'accp_make_page_global',
     429                        'value'   => '',
     430                        'compare' => 'LIKE',
     431                    ),
     432                    array(
     433                        'key'     => 'accp_make_page_global',
     434                        'compare' => 'NOT EXISTS',
     435                    ),
     436                ),
     437            ),
     438        );
     439
     440        $post_ids = get_posts( $args );
     441
     442        if ( ! $post_ids || empty( $post_ids ) ) {
     443
     444            return array();
     445
     446        } else {
     447
     448            $client_pages = (array) $post_ids;
     449
     450        }
     451
     452        return $client_pages;
     453    }
    387454} // END ARS_Constellation_Client_Portal_Client_Pages Class
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-file.php

    r3249801 r3288605  
    863863        wp_die();
    864864    }
     865
     866
     867    /**
     868     * Get all client file posts assigned to a given company.
     869     *
     870     * @param int $company_id - The post ID of the company.
     871     *
     872     * @return array $post_ids - Array of client file post IDs assigned to a company (if any);
     873     */
     874    public function get_all_client_file_posts_assigned_to_company( $company_id ) {
     875
     876        if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
     877            return;
     878        }
     879
     880        $post_ids = array();
     881
     882        if ( ! $company_id ) {
     883            return $post_ids;
     884        }
     885
     886        $args = array(
     887            'numberposts' => -1,
     888            'post_type'   => 'accp_clientfile',
     889            'fields'      => 'ids',
     890            // phpcs:ignore WordPress.DB.SlowDBQuery
     891            'meta_query'  => array(
     892                array(
     893                    'key'     => 'accp_user',
     894                    'value'   => $company_id,
     895                    'compare' => 'IN',
     896                ),
     897            ),
     898        );
     899
     900        $post_ids = get_posts( $args );
     901
     902        if ( ! $post_ids || empty( $post_ids ) ) {
     903
     904            return array();
     905
     906        }
     907
     908        return $post_ids;
     909    }
    865910} // END ARS_Constellation_Client_Portal_Client_File Class
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-invoice.php

    r3249801 r3288605  
    883883        wp_die();
    884884    }
     885
     886
     887    /**
     888     * Get all client invoice posts assigned to a given company.
     889     *
     890     * @param int $company_id - The post ID of the company.
     891     *
     892     * @return array $post_ids - Array of client invoice post IDs assigned to a company (if any);
     893     */
     894    public function get_all_client_invoice_posts_assigned_to_company( $company_id ) {
     895
     896        if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
     897            return;
     898        }
     899
     900        $post_ids = array();
     901
     902        if ( ! $company_id ) {
     903            return $post_ids;
     904        }
     905
     906        $args = array(
     907            'numberposts' => -1,
     908            'post_type'   => 'accp_clientinvoice',
     909            'fields'      => 'ids',
     910            // phpcs:ignore WordPress.DB.SlowDBQuery
     911            'meta_query'  => array(
     912                array(
     913                    'key'     => 'accp_user',
     914                    'value'   => $company_id,
     915                    'compare' => 'IN',
     916                ),
     917            ),
     918        );
     919
     920        $post_ids = get_posts( $args );
     921
     922        if ( ! $post_ids || empty( $post_ids ) ) {
     923
     924            return array();
     925
     926        }
     927
     928        return $post_ids;
     929    }
    885930} // END ARS_Constellation_Client_Portal_Client_Invoice Class
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-settings.php

    r3234166 r3288605  
    714714
    715715            echo wp_kses( $this->generate_settings_page_html( $html, false, false ), $allowed_html );
     716
     717        }
     718    }
     719
     720
     721    /**
     722     * Get the data management settings page content.
     723     */
     724    public function get_data_management_settings_page_content() {
     725
     726        if ( ! is_admin() || ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
     727            return;
     728        }
     729
     730        $allowed_html = $this->get_customized_allowed_html_for_wp_kses();
     731        $is_pro       = $this->utilities->is_pro_plugin( $this->plugin_name );
     732        $html         = '';
     733
     734        /**
     735         * Section html filter.
     736         */
     737        if ( true === $is_pro ) {
     738
     739            $html = apply_filters( 'accp_data_management_settings_page_section_html', $html );
     740
     741        }
     742
     743        if ( ! empty( $html ) ) {
     744
     745            $form_action            = 'options.php';
     746            $instatiate_wp_settings = 'accp-data-management-settings-group';
     747
     748            echo wp_kses( $this->generate_settings_page_html( $html, true, true, $form_action, $instatiate_wp_settings ), $allowed_html );
    716749
    717750        }
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-users.php

    r3179950 r3288605  
    624624        $users = $this->get_all_users_assigned_to_company( $post_id );
    625625
    626         if ( ! $users || empty( $users ) ) {
     626        if ( ! $users || empty( $users ) || ! is_array( $user ) ) {
     627            return;
     628        }
     629
     630        /**
     631         * Set a $should_delete var and allow it
     632         * to be filtered.
     633         *
     634         * Used by the pro data management settings.
     635         */
     636        $should_delete_default = true;
     637        $should_delete         = apply_filters( 'accp_should_delete_user_company_meta_on_company_delete', $should_delete_default, $post_id );
     638
     639        if ( true !== $should_delete ) {
    627640            return;
    628641        }
  • constellation-client-portal/trunk/admin/js/ars-constellation-client-portal-admin.js

    r3145386 r3288605  
    55        accp_admin_make_company_select_field_required();
    66       
    7         accp_initiate_core_select2_fields();
    8        
    9         accp_delete_file_attachment_on_post_permanent_delete();
    10        
    11         accp_delete_file_attachment_on_bulk_post_permanent_delete();
    12                
    13         accp_delete_file_attachment_on_post_empty_trash();     
     7        accp_initiate_core_select2_fields();   
    148
    159        accp_admin_toggle_file_reassign_form();
     
    347341
    348342        }
    349 
    350     }
    351 
    352 
    353     function accp_delete_file_attachment_on_post_permanent_delete(){
    354        
    355         $('table a.submitdelete').click(function (e) {
    356            
    357             if( window.location.href.indexOf("post_status=trash&post_type=accp_clientfile") > -1 ||
    358                 window.location.href.indexOf("post_status=trash&post_type=accp_clientinvoice") > -1 ||
    359                 window.location.href.indexOf("post_status=trash&post_type=accp_global_file") > -1
    360             ){         
    361                
    362                 var file_del_nonce = $('#clientfile-admin-nonce').attr('data-nonce');   
    363                 var file_post_id = $(this).closest('tr').find('td.doc_id').text();             
    364 
    365                 e.preventDefault();
    366 
    367                 $.ajax({
    368                     type: 'POST',               
    369                     url: ajaxurl,
    370                     cache: false,
    371                     headers: {
    372                         'cache-control': 'no-cache',                   
    373                     },             
    374                     data: {
    375                         action:'accp_delete_file_on_post_delete',                           
    376                         file_del_nonce: file_del_nonce,
    377                         file_post_id: file_post_id,                                                                     
    378                     },
    379                     success: function(data){
    380                        
    381                         window.location.reload(true);
    382 
    383                     },
    384                     error: function(jqXHR, textStatus, errorThrown){
    385                         console.log(textStatus, errorThrown);
    386                         console.log(jqXHR);
    387                     },         
    388                                    
    389                 });             
    390 
    391             }
    392 
    393         });
    394 
    395     }
    396 
    397 
    398     function accp_delete_file_attachment_on_bulk_post_permanent_delete(){
    399        
    400         $('#doaction').click(function (e) {     
    401            
    402             if (
    403                 (
    404                 window.location.href.indexOf("post_status=trash&post_type=accp_clientfile") > -1 ||
    405                 window.location.href.indexOf("post_status=trash&post_type=accp_clientinvoice") > -1 ||
    406                 window.location.href.indexOf("post_status=trash&post_type=accp_global_file") > -1
    407                 ) &&
    408                 $('#bulk-action-selector-top').val() == 'delete'
    409             ){ 
    410 
    411                 e.preventDefault();             
    412                
    413                 var del_file_post_id_array = $('tr').find('th.check-column input[type="checkbox"]:checked').map(function() {
    414 
    415                     var file_ids = $(this).closest('tr').find('td.doc_id').text();
    416 
    417                   return file_ids;
    418                  
    419                 }).get();
    420                
    421                 var del_file_post_id_json = JSON.stringify(del_file_post_id_array);
    422                 var bulk_delete_nonce = $('#clientfile-admin-nonce').attr('data-nonce');                                   
    423 
    424                 $.ajax({
    425                     type: 'POST',               
    426                     url: ajaxurl,
    427                     cache: false,
    428                     headers: {
    429                         'cache-control': 'no-cache',                   
    430                     },             
    431                     data: {
    432                         action:'accp_bulk_delete_file_on_post_delete',
    433                         bulk_delete_nonce: bulk_delete_nonce,                           
    434                         del_file_post_id_json: del_file_post_id_json,
    435 
    436                     },
    437                     success: function(data){                   
    438                        
    439                         window.location.reload(true);
    440 
    441                     },
    442                     error: function(jqXHR, textStatus, errorThrown){
    443                         console.log(textStatus, errorThrown);
    444                         console.log(jqXHR);
    445                     },         
    446                                    
    447                 });             
    448 
    449             }
    450         });
    451 
    452     }
    453 
    454 
    455     function accp_delete_file_attachment_on_post_empty_trash(){
    456        
    457          $('#delete_all').click(function (e) {     
    458            
    459             if (window.location.href.indexOf("post_status=trash&post_type=accp_clientfile") > -1 || window.location.href.indexOf("post_status=trash&post_type=accp_clientinvoice") > -1 || window.location.href.indexOf("post_status=trash&post_type=accp_global_file") > -1 ) {   
    460 
    461                 e.preventDefault();
    462 
    463                 var empty_trash_nonce = $('#clientfile-admin-nonce').attr('data-nonce');
    464 
    465                 if(window.location.href.indexOf("post_status=trash&post_type=accp_clientfile") > -1){
    466                     var post_type = 'accp_clientfile';
    467                 }
    468 
    469                 if(window.location.href.indexOf("post_status=trash&post_type=accp_global_file") > -1){
    470                     var post_type = 'accp_global_file';
    471                 }
    472 
    473                 if(window.location.href.indexOf("post_status=trash&post_type=accp_clientinvoice") > -1){
    474                     var post_type = 'accp_clientinvoice';
    475                 }
    476 
    477                 if(window.location.href.indexOf("post_status=trash&post_type=accp_clientcompany") > -1){
    478                     var post_type = 'accp_clientcompany';
    479                 }
    480                
    481                 $.ajax({
    482                     type: 'POST',               
    483                     url: ajaxurl,
    484                     cache: false,
    485                     headers: {
    486                         'cache-control': 'no-cache',                   
    487                     },             
    488                     data: {
    489                         action:'accp_bulk_delete_file_on_empty_trash',
    490                         empty_trash_nonce: empty_trash_nonce,
    491                         post_type: post_type
    492                     },
    493                     success: function(data){
    494                    
    495                         window.location.reload(true);
    496 
    497                     },
    498                     error: function(jqXHR, textStatus, errorThrown){
    499                         console.log(textStatus, errorThrown);
    500                         console.log(jqXHR);
    501                     },         
    502                                    
    503                 });
    504 
    505             }
    506 
    507         });
    508343
    509344    }
  • constellation-client-portal/trunk/ars-constellation-client-portal.php

    r3265190 r3288605  
    77 * Plugin URI:        https://adrianrodriguezstudios.com/constellation-client-portal/
    88 * Description:       Create private pages for each of your clients, post private files, and protect your client files from unauthorized users and search engines.  <strong>Important:</strong> All Site-level File Protection features will cease to function if the plugin is disabled or uninstalled.
    9  * Version:           1.11.1
     9 * Version:           2.0.0
    1010 * Author:            ARS
    1111 * Author URI:        https://adrianrodriguezstudios.com
     
    5757     */
    5858    define('ACCP_PLUGIN_NAME', 'ARS_CONSTELLATION_CLIENT_PORTAL');
    59     define('ACCP_PLUGIN_VERSION', '1.11.1'); // Change the version in the header as well.
     59    define('ACCP_PLUGIN_VERSION', '2.0.0'); // Change the version in the header as well.
    6060    define( ACCP_PLUGIN_NAME, ACCP_PLUGIN_VERSION );
    6161    define( 'ACCP_PLUGIN_FILE_NAME', __FILE__ );
  • constellation-client-portal/trunk/includes/class-ars-constellation-client-portal.php

    r3088740 r3288605  
    108108
    109109        /**
    110          * Core (Basic and Pro Tiers) Admin functions.
     110         * Core Admin functions.
    111111         */
    112112        require_once plugin_dir_path( __DIR__ ) . 'admin/class-ars-constellation-client-portal-admin.php';
     
    121121        require_once plugin_dir_path( __DIR__ ) . 'includes/class-ars-constellation-client-portal-utility-functions.php';
    122122        require_once plugin_dir_path( __DIR__ ) . 'public/shortcodes/class-ars-constellation-client-portal-list-shortcodes.php';
     123        require_once plugin_dir_path( __DIR__ ) . 'admin/class-ars-constellation-client-portal-data-management.php';
    123124
    124125        /**
     
    189190        $plugin_users          = new ARS_Constellation_Client_Portal_Users( $this->get_plugin_name(), $this->get_version() );
    190191        $core_settings         = new ARS_Constellation_Client_Portal_Settings();
     192        $core_data_management  = new ARS_Constellation_Client_Portal_Data_Management();
    191193
    192194        /**
     
    351353
    352354        /**
    353          * Delete file attachments.
    354          */
    355         $this->loader->add_action( 'wp_ajax_accp_delete_file_on_post_delete', $plugin_admin, 'accp_delete_file_on_post_delete' );
    356         $this->loader->add_action( 'wp_ajax_accp_bulk_delete_file_on_post_delete', $plugin_admin, 'accp_bulk_delete_file_on_post_delete' );
    357         $this->loader->add_action( 'wp_ajax_accp_bulk_delete_file_on_empty_trash', $plugin_admin, 'accp_bulk_delete_file_on_empty_trash' );
    358 
    359         /**
    360355         * Change the main submenu title to "Settings."
    361356         */
     
    544539
    545540        }
     541
     542        /**
     543         * Core Data Management
     544         */
     545        /**
     546         * Maybe delete post file attachment on file
     547         * post delete.
     548         */
     549        $this->loader->add_action( 'before_delete_post', $core_data_management, 'delete_post_attachment_on_file_post_delete', 10, 1 );
     550
     551        /**
     552         * Maybe delete post file attachment on invoice
     553         * post delete.
     554         */
     555        $this->loader->add_action( 'before_delete_post', $core_data_management, 'delete_post_attachment_on_invoice_post_delete', 10, 1 );
    546556    }
    547557
  • constellation-client-portal/trunk/uninstall.php

    r3067786 r3288605  
    44 *
    55 * @link       https://adrianrodriguezstudios.com
    6  * @since      1.0.0
    76 *
    87 * @package    ARS_Constellation_Client_Portal
     
    1514    exit;
    1615}
     16
     17if ( ! defined( 'ACCP_PLUGIN_DIR_PATH' ) ) {
     18    define( 'ACCP_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) );
     19}
     20
     21require_once ACCP_PLUGIN_DIR_PATH . 'includes/class-ars-constellation-client-portal-utility-functions.php';
     22
     23/**
     24 * Include the pro uninstall functionality if this
     25 * is the pro plugin.
     26 */
     27global $wp_filesystem;
     28
     29WP_Filesystem();
     30
     31$is_pro = $wp_filesystem->exists( ACCP_PLUGIN_DIR_PATH . 'pro/includes/ars-constellation-client-portal-pro-uninstall.php' );
     32
     33if ( true === $is_pro ) {
     34
     35    require_once ACCP_PLUGIN_DIR_PATH . 'pro/includes/ars-constellation-client-portal-pro-uninstall.php';
     36
     37}
Note: See TracChangeset for help on using the changeset viewer.