Plugin Directory

Changeset 3371066


Ignore:
Timestamp:
10/01/2025 11:43:47 AM (5 months ago)
Author:
arstudios
Message:

Constellation Client Portal release 2.5.0.

Location:
constellation-client-portal
Files:
134 added
1 deleted
6 edited

Legend:

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

    r3363221 r3371066  
    55Requires at least: 6.0.0
    66Tested up to: 6.8
    7 Stable tag: 2.4.0
     7Stable tag: 2.5.0
    88Requires PHP: 7.4
    99License: GPLv3 or later
     
    210210
    211211== Changelog ==
     212= 2.5.0 (Pro) - 2025-10-1 =
     213* Update: Created functionality to store the shortcode ID in the shortcode settings instead of just relying on the array key.
     214* Update: Created new get_single_shortcode_settings method.
     215* Update: Created new get_all_shortcode_settings method.
     216
     217= 2.5.0 (Core) - 2025-10-1 =
     218* Feature: Added feature that allows sample content to be created to quickly give users a better view of how companies, client pages, and file/invoice posts relate to each other.
     219* Fix: Fixed typo in company onboard wizard page title.
     220
    212221= 2.4.0 (Pro) - 2025-9-17 =
    213222* Update: Added link to the company onboard wizard in the WP admin sidebar conditionally displayed Company menu section.
     
    218227* Update: Added link to the company onboard wizard in the WP admin sidebar menu.
    219228* Update: Added link to the company onboard wizard in the plugin settings help section.
    220 * Feature: Add new company onboard wizard.
     229* Feature: Added new company onboard wizard.
    221230
    222231= 2.3.0 (Pro) - 2025-8-29 =
     
    317326* Update: Fixed typo in company reassignment error message text.
    318327
    319 <<<<<<< HEAD
    320 = 1.10.0 (Pro) - 2024-11-1 =
    321 * Fix: Fixed nonce issue preventing new post notifications from being sent when posts are created via the Quick Create UI.
    322 * Update: Updated the automated email functionality to not send a notification if the company has a status with a prevent-file-access action assigned to it.
    323 * Update: Updated the automated email functionality to not send a notification if the primary WP user assigned to a company is not active.
    324 * Update: Removed reference to accp_new_file_email_notification that was hooked to the deprecated accp_after_file_upload action.
    325 * Fix: Updated the new post email notification function to work with both a new post nonce and a CSV import nonce to fix issue in which new post notification emails were not sent during CSV import.
    326 * Fix: Fixed issue with the accp_save_post function that caused errors in automated email post notes, generated via cron, which in turn prevented automated emails from being sent reliably.
    327 * Feature: Added new accp_edit_automated_email_cron_event_schedule filter that allows the automated email WP cron event schedule to be edited.
    328 * Improvement: Improved the company primary user assignment to prevent cases where an unassigned primary company user could still trigger an automated email notification.
    329 * Improvement: Improved the automated email notification digest functionality to ensure that digest emails are grouped properly by company.
    330 * Improvement: Improved the automated email date comparisons to ensure that emails are sent for missed cron jobs, and that duplicate emails are not sent when the current date equals the last sent date.
    331 * Fix: Fixed issue with undefined item_list variable in automated digest emails.
    332 * Update: Removed unneeded instances of wp_doing_cron within automated email functions.
    333 * Update: Updated the recurring email date calculation to fix issues in which no post ID's were returned in a set.
    334 * Update: Updated the automated email date-before and date-after query arg functions to include a type => date key/value in meta query args that contain a date comparison.
    335 
    336 = 1.10.0 (Core) - 2024-11-1 =
    337 * Update: Updated the accp_save_post function to guard against conflicts with other post types, and resolve conflicts with automated email cron note creation.
    338 * Fix: Fixed typo in the note that is posted to file and invoice posts when the company is reassigned.
    339 * Update: Removed unneeded comment.
    340 * Update: Removed extraneous dev file.
    341 
    342 [Full changelog for previous versions](https://constellationclientportal.com/change-log-constellation-client-portal-pro/).
    343 =======
    344328[View full changelog](https://constellationclientportal.com/change-log-constellation-client-portal-pro/).
    345 >>>>>>> wsl-master/master
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-settings.php

    r3363221 r3371066  
    832832        $setup_wizard_url   = $wp_admin_url . 'admin.php?page=accp-plugin-activation-wizard';
    833833        $company_wizard_url = $wp_admin_url . 'admin.php?page=accp-company-onboard-wizard';
     834        $wizards            = new ARS_Constellation_Client_Portal_Wizards();
    834835
    835836        $html = '';
     
    932933
    933934        $html .= '<p>Launch the <a href="' . esc_url( $company_wizard_url ) . '">company onboard wizard</a>. This is used to add a new company, add and a assign a company home page, and add and assign a primary user to the company.</p>';
     935
     936        $html .= '</div>';
     937
     938        /**
     939         * Create Sample Data
     940         */
     941        $class              = 'accp-settings-section-generate-sample-data-button';
     942        $sample_data_button = $wizards->get_generate_sample_content_button_html( $class );
     943
     944        $html .= '<div class="accp-settings-section">';
     945
     946        $html .= '<h2>Generate Sample Data</h2>';
     947
     948        $html .= '<p>Click the button below to generate sample data.  This will create a sample company, sample home page, sample file and invoice posts, and assign the current logged in user to the company.</p>';
     949
     950        $html .= $sample_data_button;
    934951
    935952        $html .= '</div>';
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-wizards.php

    r3363221 r3371066  
    110110         */
    111111        add_action( 'wp_ajax_wizard_add_company_home_page_via_ajax', array( $this, 'wizard_add_company_home_page_via_ajax' ) );
     112
     113        /**
     114         * Wizard - Generate sample content ajax function.
     115         */
     116        add_action( 'wp_ajax_accp_generate_sample_content_ajax', array( $this, 'accp_generate_sample_content_ajax' ) );
    112117    }
    113118
     
    162167        }
    163168
     169        /**
     170         * Allow scripts to be enqueued on additional
     171         * non-wizard pages.
     172         */
     173        $additional_page_slugs = array(
     174            'accp-help-settings',
     175        );
     176
    164177        $url_title_raw = filter_input( INPUT_GET, 'page' );
    165178
     
    170183        foreach ( $defined_pages as $slug => $wizard_page ) {
    171184
    172             if ( $url_title_raw === $slug ) {
     185            if ( $url_title_raw === $slug || in_array( $url_title_raw, $additional_page_slugs, true ) ) {
    173186
    174187                wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/ars-constellation-client-portal-admin-wizard.js', array( 'jquery' ), $this->version, false );
     
    309322
    310323        $page_list = array(
    311             'accp-company-onboard-wizard' => 'Onbard a Company',
     324            'accp-company-onboard-wizard' => 'Onboard a Company',
    312325        );
    313326
     
    563576        $html .= '<p>To help you get started, we\'ll walk you through setting up your first company, adding a company home page, and adding a primary user to the company.</p>';
    564577
     578        /**
     579         * Generate default content section.
     580         */
     581        $html .= $this->get_default_content_button_section_html();
     582
    565583        $html .= '<div class="accp-wizard-button-container accp-wizard-next-setup-button-container">';
    566584
     585        $html .= '<h2 class="accp-wizard-title-with-bottom-margin-35">2. Continue Setup</h2>';
     586
    567587        $html .= '<span class="accp-wizard-continue-button"><a href="' . esc_url( $next_step_url ) . '">Continue Set Up</a></span>';
    568588
     
    578598
    579599        echo wp_kses( $this->generate_wizard_page_html( $html, true, false ), $allowed_html );
     600    }
     601
     602
     603    /**
     604     * Get default content section html.
     605     *
     606     * @return string $html - The section html.
     607     */
     608    public function get_default_content_button_section_html() {
     609
     610        if ( ! is_admin() || ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
     611            return;
     612        }
     613
     614        $html = '';
     615
     616        $html .= '<div class="accp-wizard-generate-default-content-container">';
     617
     618        $html .= '<h2>1. Generate Sample Content (optional)</h2>';
     619
     620        $html .= '<p>';
     621
     622        $html .= 'In addition to proceeding through the wizard, you can optionally click the Genarate Sample Content button below to automitcally create a sample company, sample home page, and assign yourself to the company in order to quickly get a better idea of how the client portal is structured.';
     623
     624        $html .= '</p>';
     625
     626        $html .= $this->get_generate_sample_content_button_html();
     627
     628        $html .= '</div>';
     629
     630        return $html;
     631    }
     632
     633
     634    /**
     635     * Get the Generate Sample Content
     636     * button html.
     637     *
     638     * @param string $classes - Class names separated by a space.
     639     *
     640     * @return string $html - The element html.
     641     */
     642    public function get_generate_sample_content_button_html( $classes = '' ) {
     643
     644        if ( ! is_admin() || ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
     645            return;
     646        }
     647
     648        $nonce = wp_create_nonce( 'accp_generate_default_content' );
     649
     650        $html = '';
     651
     652        $html .= '<span id="accp-wizard-generate-default-content-button-container">';
     653
     654        $html .= '<a href="#" id="accp-wizard-generate-default-content-button" class="' . esc_attr( $classes ) . '" data-nonce="' . esc_attr( $nonce ) . '">Genarate Sample Content</a>';
     655
     656        $html .= '</span>';
     657
     658        return $html;
     659    }
     660
     661
     662    /**
     663     * Generate sample content AJAX function.
     664     */
     665    public function accp_generate_sample_content_ajax() {
     666
     667        if ( ! is_admin() || ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
     668            return;
     669        }
     670
     671        if ( ! isset( $_POST['nonce'] ) ) {
     672            die();
     673        }
     674
     675        $nonce = sanitize_text_field( wp_unslash( $_POST['nonce'] ) );
     676
     677        if ( ! wp_verify_nonce( $nonce, 'accp_generate_default_content' ) ) {
     678            die();
     679        }
     680
     681        $current_user_id = get_current_user_id();
     682        $messages        = array();
     683        $errors          = array();
     684
     685        /**
     686         * Create Company
     687         */
     688        $post_args = array(
     689            'post_type'   => 'accp_clientcompany',
     690            'post_status' => 'publish',
     691            'post_title'  => 'Sample Company',
     692        );
     693
     694        /**
     695         * Add the post.
     696         */
     697        $company_id = wp_insert_post( $post_args );
     698
     699        if ( is_wp_error( $company_id ) ) {
     700
     701            $errors[] = 'The company could not be added.  Please verify your WordPress settings and try again.';
     702            $errors[] = $company_id->get_error_message();
     703
     704            $company_id = '';
     705
     706            $data = array(
     707                'messages'   => $messages,
     708                'errors'     => $errors,
     709                'company_id' => $company_id,
     710            );
     711
     712            echo wp_json_encode( $data );
     713
     714            wp_die();
     715
     716        } else {
     717
     718            $messages[] = 'The company was successfully added';
     719
     720            /**
     721             * Do action after successfully adding a company.
     722             */
     723            do_action( 'accp_after_add_sample_company', $company_id );
     724
     725        }
     726
     727        /**
     728         * Set current user as the primary user for the company.
     729         */
     730        update_post_meta( $company_id, 'accp_company_primary_user', $current_user_id );
     731
     732        /**
     733         * Assign sample company to the current users.
     734         */
     735        $saved_primary_company = get_user_meta( $current_user_id, 'client_company', true );
     736
     737        if ( ! $saved_primary_company || empty( $saved_primary_company ) ) {
     738
     739            /**
     740             * Set the company as the user's primary company.
     741             */
     742            update_user_meta( $current_user_id, 'client_company', $company_id );
     743
     744        } else {
     745
     746            $saved_companies = get_user_meta( $current_user_id, 'client_additional_company', true );
     747
     748            if ( is_array( $saved_companies ) && ! in_array( $current_user_id, $saved_companies, true ) ) {
     749
     750                $saved_companies[] = $company_id;
     751
     752            } else {
     753
     754                $saved_companies = array( $company_id );
     755            }
     756
     757            /**
     758             * Add the company ID to the user's additionally assigned companies.
     759             */
     760            update_user_meta( $current_user_id, 'client_additional_company', $saved_companies );
     761        }
     762
     763        $messages[] = 'The current user has been assigned to the company.';
     764
     765        /**
     766         * Create Client Home Page
     767         */
     768        $page_content = $this->get_sample_page_content_html();
     769
     770        $page_args = array(
     771            'post_type'    => 'accp_client_pages',
     772            'post_status'  => 'publish',
     773            'post_title'   => 'Sample Client Page',
     774            'post_content' => wp_kses_post( $page_content ),
     775        );
     776
     777        /**
     778         * Add the post.
     779         */
     780        $page_id = wp_insert_post( $page_args );
     781
     782        if ( is_wp_error( $page_id ) ) {
     783
     784            $errors[] = $page_id->get_error_message();
     785
     786            $page_id = '';
     787
     788        } else {
     789
     790            /**
     791             * Assign the home page within the
     792             * company post.
     793             */
     794            update_post_meta( $company_id, 'accp_home_page', $page_id );
     795
     796            /**
     797             * Assign the company ID within the client page.
     798             */
     799            update_post_meta( $page_id, 'accp_user', $company_id );
     800
     801            /**
     802             * Create sample unpaid invoice post.
     803             */
     804            $this->add_sample_unpaid_invoice_post( $company_id );
     805
     806            /**
     807             * Create sample paid invoice post.
     808             */
     809            $this->add_sample_paid_invoice_post( $company_id );
     810
     811            /**
     812             * Create sample file post.
     813             */
     814            $this->add_sample_file_post( $company_id );
     815
     816            $messages[] = 'The company home page was successfully added.';
     817
     818        }
     819
     820        $data = array(
     821            'messages'   => $messages,
     822            'errors'     => $errors,
     823            'company_id' => $company_id,
     824        );
     825
     826        echo wp_json_encode( $data );
     827
     828        wp_die();
     829    }
     830
     831
     832    /**
     833     * Get sample client page content.
     834     *
     835     * @return string $html - The post content.
     836     */
     837    public function get_sample_page_content_html() {
     838
     839        if ( ! is_admin() || ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
     840            return;
     841        }
     842
     843        $default_unpaid_inv_shortcode = '[accp_clientinvoices invoice_status="unpaid" display_pay_btn="true" display_number="20" order_by="title" order="ASC" show_excerpt="true" excerpt_length="50" show_thumbnail="true" thumbnail_size="portfolio" align_thumbnail="center" show_post_date="true"]';
     844
     845        $default_unpaid_inv_description = '<p>Below is a list of unpaid invoices that was generated by embedding the &#91;accp_clientinvoices invoice_status="unpaid"&#93; shortcode on the page with the "invoice_status" parameter set to "unpaid".</p>';
     846
     847        $default_paid_inv_shortcode = '[accp_clientinvoices invoice_status="paid" display_number="20" order_by="title" order="ASC" show_excerpt="true" excerpt_length="50" show_thumbnail="true" thumbnail_size="portfolio" align_thumbnail="center" show_post_date="true"]';
     848
     849        $default_paid_inv_description = '<p>Below is a list of paid invoices that was generated by embedding the &#91;accp_clientinvoices invoice_status="paid"&#93; shortcode on the page with the "invoice_status" parameter set to "paid".</p>';
     850
     851        $default_file_shortcode = '[accp_clientfiles display_number="20" order_by="title" order="ASC" show_excerpt="true" excerpt_length="50" show_thumbnail="true" thumbnail_size="portfolio" align_thumbnail="center" show_post_date="true"]';
     852
     853        $default_file_description = '<p>Below is a list of files that was generated by embedding the &#91;accp_clientfiles&#93; shortcode on the page.</p>';
     854
     855        $unpaid_invoice_shortcode = apply_filters( 'accp_update_sample_content_unpaid_invoice_shortcode', $default_unpaid_inv_shortcode );
     856        $paid_invoice_shortcode   = apply_filters( 'accp_update_sample_content_paid_invoice_shortcode', $default_paid_inv_shortcode );
     857        $file_shortcode           = apply_filters( 'accp_update_sample_content_file_shortcode', $default_file_shortcode );
     858
     859        $unpaid_inv_description = apply_filters( 'accp_update_sample_content_unpaid_invoice_description', $default_unpaid_inv_description );
     860        $paid_inv_description   = apply_filters( 'accp_update_sample_content_paid_invoice_description', $default_paid_inv_description );
     861        $file_description       = apply_filters( 'accp_update_sample_content_file_description', $default_file_description );
     862
     863        $html = '';
     864
     865        $html .= '<h1>Sample Client Home Page</h1>';
     866
     867        $html .= '<p>This is a sample client home page to use as a reference.  Three shortcodes have been added below to display, unpaid invoices, paid invoices, and a list of file posts.</p>';
     868
     869        /**
     870         * Unpaid invoice section.
     871         */
     872        $html .= '<h2>Unpaid Invoices</h2>';
     873
     874        $html .= $unpaid_inv_description;
     875
     876        $html .= $unpaid_invoice_shortcode;
     877
     878        /**
     879         * Paid invoice section.
     880         */
     881        $html .= '<h2>Paid Invoices</h2>';
     882
     883        $html .= $paid_inv_description;
     884
     885        $html .= $paid_invoice_shortcode;
     886
     887        /**
     888         * File section.
     889         */
     890        $html .= '<h2>Files</h2>';
     891
     892        $html .= $file_description;
     893
     894        $html .= $file_shortcode;
     895
     896        return $html;
     897    }
     898
     899
     900    /**
     901     * Add sample unpaid invoice post.
     902     *
     903     * @param int $company_id - The post ID of the company associated with the sample post.
     904     */
     905    public function add_sample_unpaid_invoice_post( $company_id ) {
     906
     907        if ( ! is_admin() || ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
     908            return;
     909        }
     910
     911        $company_id = (int) $company_id;
     912
     913        if ( ! $company_id || empty( $company_id ) ) {
     914            return;
     915        }
     916
     917        $default_description = '<p>This is an unpaid invoice.  You can attach a file to this post to allow users to view and download it on the frontend (optional).  The <a href="https://constellationclientportal.com/" target="_blank">Pro version</a> also allows WooCommerce products to be assigned to the invoice, which allows users to make payments within your client portal.</p>';
     918
     919        $description = apply_filters( 'accp_update_sample_unpaid_inv_post_description', $default_description );
     920
     921        $post_content = '<h1>Sample Unpaid Invoice</h1>';
     922
     923        $post_content .= $description;
     924
     925        $args = array(
     926            'post_type'    => 'accp_clientinvoice',
     927            'post_content' => wp_kses_post( $post_content ),
     928            'post_status'  => 'publish',
     929            'post_title'   => 'Sample Unpaid Invoice',
     930
     931        );
     932
     933        $post_id = wp_insert_post( $args );
     934
     935        if ( ! is_wp_error( $post_id ) ) {
     936
     937            /**
     938             * Assign the post to the specified company.
     939             */
     940            update_post_meta( $post_id, 'accp_user', $company_id );
     941
     942            /**
     943             * Set the invoice status.
     944             */
     945            update_post_meta( $post_id, 'invoice_status', 'unpaid' );
     946
     947        }
     948    }
     949
     950
     951    /**
     952     * Add sample paid invoice post.
     953     *
     954     * @param int $company_id - The post ID of the company associated with the sample post.
     955     */
     956    public function add_sample_paid_invoice_post( $company_id ) {
     957
     958        if ( ! is_admin() || ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
     959            return;
     960        }
     961
     962        $company_id = (int) $company_id;
     963
     964        if ( ! $company_id || empty( $company_id ) ) {
     965            return;
     966        }
     967
     968        $default_description = '<p>This is a paid invoice.  You can attach a file to this post to allow users to view and download it on the frontend (optional).</p>';
     969
     970        $description = apply_filters( 'accp_update_sample_paid_inv_post_description', $default_description );
     971
     972        $post_content = '<h1>Sample Paid Invoice</h1>';
     973
     974        $post_content .= $description;
     975
     976        $args = array(
     977            'post_type'    => 'accp_clientinvoice',
     978            'post_content' => wp_kses_post( $post_content ),
     979            'post_status'  => 'publish',
     980            'post_title'   => 'Sample Paid Invoice',
     981
     982        );
     983
     984        $post_id = wp_insert_post( $args );
     985
     986        if ( ! is_wp_error( $post_id ) ) {
     987
     988            /**
     989             * Assign the post to the specified company.
     990             */
     991            update_post_meta( $post_id, 'accp_user', $company_id );
     992
     993            /**
     994             * Set the invoice status.
     995             */
     996            update_post_meta( $post_id, 'invoice_status', 'paid' );
     997
     998        }
     999    }
     1000
     1001
     1002    /**
     1003     * Add sample file post.
     1004     *
     1005     * @param int $company_id - The post ID of the company associated with the sample post.
     1006     */
     1007    public function add_sample_file_post( $company_id ) {
     1008
     1009        if ( ! is_admin() || ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
     1010            return;
     1011        }
     1012
     1013        $company_id = (int) $company_id;
     1014
     1015        if ( ! $company_id || empty( $company_id ) ) {
     1016            return;
     1017        }
     1018
     1019        $default_description = '<p>This is a file post.  You can attach a file to this post to allow users to view and download it on the frontend (optional). The <a href="https://constellationclientportal.com/" target="_blank">Pro version</a> also allows due dates to be added to file and invoice posts.</p>';
     1020
     1021        $description = apply_filters( 'accp_update_sample_paid_inv_post_description', $default_description );
     1022
     1023        $post_content = '<h1>Sample File Post</h1>';
     1024
     1025        $post_content .= $description;
     1026
     1027        $args = array(
     1028            'post_type'    => 'accp_clientfile',
     1029            'post_content' => wp_kses_post( $post_content ),
     1030            'post_status'  => 'publish',
     1031            'post_title'   => 'Sample File Post',
     1032
     1033        );
     1034
     1035        $post_id = wp_insert_post( $args );
     1036
     1037        if ( ! is_wp_error( $post_id ) ) {
     1038
     1039            /**
     1040             * Assign the post to the specified company.
     1041             */
     1042            update_post_meta( $post_id, 'accp_user', $company_id );
     1043
     1044        }
    5801045    }
    5811046
  • constellation-client-portal/trunk/admin/css/ars-constellation-client-portal-admin.css

    r3363221 r3371066  
    10791079}
    10801080
     1081.accp-wizard-generate-default-content-container {
     1082    border-top: 2px solid #efefef;
     1083    border-bottom: 2px solid #efefef;
     1084    padding-bottom: 40px;
     1085    margin-top: 30px;
     1086}
     1087
     1088#accp-wizard-generate-default-content-button-container {
     1089    text-align: center;
     1090    width: 100%;
     1091    display: block;
     1092    margin-top: 25px;
     1093}
     1094
     1095#accp-wizard-generate-default-content-button {
     1096    background-color: #2d88ff;
     1097    color: #fff;
     1098    padding-top: 12px;
     1099    padding-bottom: 12px;
     1100    padding-left: 14px;
     1101    padding-right: 14px;
     1102    text-decoration: none;
     1103}
     1104
     1105#accp-wizard-generate-default-content-button:hover {
     1106    background-color: #1f7af1;
     1107}
     1108
     1109.accp-wizard-title-with-bottom-margin-35 {
     1110    margin-bottom: 35px;
     1111}
     1112
     1113#accp-wizard-generate-default-content-button {
     1114    margin-bottom: 10px;
     1115    display: inline-block;
     1116}
     1117
     1118#accp-wizard-generate-default-content-button.accp-settings-section-generate-sample-data-button {
     1119    margin-bottom: 10px;
     1120    margin-top: 5px;   
     1121    display: inline-block; 
     1122}
     1123
    10811124.accp-wizard-continue-button a[disabled] {
    10821125    color: #a7aaad !important;
  • constellation-client-portal/trunk/admin/js/ars-constellation-client-portal-admin-wizard.js

    r3352742 r3371066  
    6969
    7070        accp_wizard_generate_password_on_click();
     71
     72        accp_generate_sample_content_on_click();
    7173
    7274    }); // End document ready.
     
    737739
    738740
     741    function accp_generate_sample_content_on_click(){
     742
     743        $('#accp-wizard-generate-default-content-button').click(function (e) {
     744           
     745            e.preventDefault();
     746           
     747            var nonce = $(this).attr('data-nonce');
     748
     749            if ( 0 === nonce.length ) {
     750                return;
     751            }
     752
     753            var spinner_elem = '<span class="accp-generate-pw-spinner spinner" style="float: none;"></span>';           
     754           
     755            $(spinner_elem).insertAfter(this);
     756            $('.accp-generate-pw-spinner.spinner').css('visibility', 'visible');
     757            $(this).css('pointer-events', 'none');
     758
     759            $.ajax({
     760                type: 'POST',               
     761                url: ajaxurl,
     762                cache: false,
     763                headers: {
     764                    'cache-control': 'no-cache',                   
     765                },             
     766                data: {
     767                    action:'accp_generate_sample_content_ajax',
     768                    nonce: nonce                                                                                           
     769                },
     770                success: function(data){
     771
     772                    var parsed_data     = JSON.parse(data);                 
     773                    var company_id      = parsed_data.company_id;
     774                    var status          = parsed_data.status;
     775                    var error_messages  = parsed_data.error_message;
     776                    var page_id       = '';
     777                    var page_id_param = '';
     778
     779                    $('.accp-generate-pw-spinner.spinner').remove();                   
     780
     781                    if ( 'error' === status ) {
     782
     783                        if ( 0 !== error_messages.length ) {
     784
     785                            for ( i = 0; i < error_messages.length; i++ ) {
     786
     787                                var message_item = '<p class="accp-wizard-error">Error: ' + error_messages[i] + '</p>';
     788
     789                                $('#accp-wizard-generate-default-content-button').after(message_item);
     790
     791                            }
     792
     793                        } else {
     794
     795                            var message_item = '<p class="accp-wizard-error">Error: There was an error in your request.  Please check your data, refresh the page and try again.</p>';
     796
     797                            $('#accp-wizard-generate-default-content-button').after(message_item);
     798
     799                        }               
     800
     801                        return;
     802
     803                    }
     804
     805                    var message_item = '<p class="accp-wizard-message">Message: The content was successfully generated.</p>';
     806
     807                    $('#accp-wizard-generate-default-content-button').after(message_item);             
     808                },
     809                error: function(jqXHR, textStatus, errorThrown){
     810
     811                    $('.accp-generate-pw-spinner.spinner').remove();
     812
     813                    console.log(textStatus, errorThrown);
     814                    console.log(jqXHR);
     815                },         
     816                               
     817            });     
     818           
     819        });
     820
     821    }
     822
     823
    739824    function accp_get_spinner_html() {
    740825
  • constellation-client-portal/trunk/ars-constellation-client-portal.php

    r3363221 r3371066  
    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:           2.4.0
     9 * Version:           2.5.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', '2.4.0'); // Change the version in the header as well.
     59    define('ACCP_PLUGIN_VERSION', '2.5.0'); // Change the version in the header as well.
    6060    define( ACCP_PLUGIN_NAME, ACCP_PLUGIN_VERSION );
    6161    define( 'ACCP_PLUGIN_FILE_NAME', __FILE__ );
Note: See TracChangeset for help on using the changeset viewer.