diff --git a/Lib/Appsero/Client.php b/Lib/Appsero/Client.php index 08b7f654d..1e5b40abe 100644 --- a/Lib/Appsero/Client.php +++ b/Lib/Appsero/Client.php @@ -2,6 +2,8 @@ namespace WeDevs\Wpuf\Lib\Appsero; +use WP_Error; + /** * Appsero Client * @@ -110,13 +112,9 @@ public function __construct( $hash, $name, $file ) { /** * Initialize insights class * - * @return Appsero\Insights + * @return object */ public function insights() { - if ( ! class_exists( __NAMESPACE__ . '\Insights' ) ) { - require_once __DIR__ . '/Insights.php'; - } - // if already instantiated, return the cached one if ( $this->insights ) { return $this->insights; @@ -130,13 +128,9 @@ public function insights() { /** * Initialize license checker * - * @return Appsero\License + * @return object */ public function license() { - if ( ! class_exists( __NAMESPACE__ . '\License' ) ) { - require_once __DIR__ . '/License.php'; - } - // if already instantiated, return the cached one if ( $this->license ) { return $this->license; diff --git a/Lib/WeDevs_Insights.php b/Lib/WeDevs_Insights.php index 702fc4bb8..4a732a00d 100644 --- a/Lib/WeDevs_Insights.php +++ b/Lib/WeDevs_Insights.php @@ -2,7 +2,7 @@ namespace WeDevs\Wpuf\Lib; -if ( ! class_exists( 'WPUF_WeDevs_Insights' ) ) : +if ( ! class_exists( 'WeDevs_Insights' ) ) : /** * weDevs Tracker @@ -17,7 +17,7 @@ */ class WeDevs_Insights { /** - * @var object|Appsero\Insights|Insights + * @var object|Appsero\Insights */ public $insights; @@ -25,18 +25,10 @@ class WeDevs_Insights { * Initialize the class */ public function __construct( $file ) { - if ( ! class_exists( 'Appsero\Client' ) ) { - require_once WPUF_ROOT . '/Lib/Appsero/Client.php'; - } - $client = new Appsero\Client( '958afc63-99f8-4b98-b321-fcbc5cf95694', 'WP User Frontend', $file ); $this->insights = $client->insights(); $this->insights->client = $client; $this->insights->init(); - -// $client = new Appsero\Client( '958afc63-99f8-4b98-b321-fcbc5cf95694', 'WP User Frontend', $file ); -// $this->insights = $client->insights(); -// $this->insights->init(); } } diff --git a/admin/class-admin-settings.php b/admin/class-admin-settings.php index 661d36e48..1aaa7163b 100644 --- a/admin/class-admin-settings.php +++ b/admin/class-admin-settings.php @@ -3,6 +3,8 @@ /** * WPUF settings */ + +#[AllowDynamicProperties] class WPUF_Admin_Settings { /** diff --git a/changelog.txt b/changelog.txt index b7383f68e..97e0d92f2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ += v4.0.12 (14 Oct, 2024) = +* Enhance - Decimal value for subscription pack +* Fix - Required asterisk on password label +* Fix - Field overlapping in address field +* Fix - Read-only does not work for 'Teeny Rich textarea' +* Fix - Integrations not loading properly for Dokan, ACF, WC Vendors + = v4.0.11 (12 Sep, 2024) = * Enhance - Subscription design revamp * Enhance - Consistent format in email templates diff --git a/includes/Admin/Forms/Form.php b/includes/Admin/Forms/Form.php index 13a14c976..70b5433ed 100644 --- a/includes/Admin/Forms/Form.php +++ b/includes/Admin/Forms/Form.php @@ -21,7 +21,7 @@ class Form { /** * @var array|\WP_Post|null */ - private $data; + public $data; public function __construct( $form ) { if ( is_numeric( $form ) ) { diff --git a/includes/Ajax/Admin_Form_Builder_Ajax.php b/includes/Ajax/Admin_Form_Builder_Ajax.php index aa661da58..c5c998cd2 100644 --- a/includes/Ajax/Admin_Form_Builder_Ajax.php +++ b/includes/Ajax/Admin_Form_Builder_Ajax.php @@ -31,6 +31,10 @@ public function save_form() { wp_send_json_error( __( 'Unauthorized operation', 'wp-user-frontend' ) ); } + if ( ! current_user_can( wpuf_admin_role() ) ) { + wp_send_json_error( __( 'Unauthorized operation', 'wp-user-frontend' ) ); + } + if ( empty( $form_data['wpuf_form_id'] ) ) { wp_send_json_error( __( 'Invalid form id', 'wp-user-frontend' ) ); } @@ -86,6 +90,10 @@ public function wpuf_get_post_taxonomies() { wp_send_json_error( __( 'Unauthorized operation', 'wp-user-frontend' ) ); } + if ( ! current_user_can( wpuf_admin_role() ) ) { + wp_send_json_error( __( 'Unauthorized operation', 'wp-user-frontend' ) ); + } + if ( isset( $post_type ) && empty( $post_data['post_type'] ) ) { wp_send_json_error( __( 'Invalid post type', 'wp-user-frontend' ) ); } diff --git a/includes/Ajax/Frontend_Form_Ajax.php b/includes/Ajax/Frontend_Form_Ajax.php index bb2424ed1..ac5dc9bf1 100644 --- a/includes/Ajax/Frontend_Form_Ajax.php +++ b/includes/Ajax/Frontend_Form_Ajax.php @@ -162,9 +162,9 @@ public function submit_post() { $charging_enabled = 'yes'; } - if ( $guest_mode === 'true' && $guest_verify === 'true' && ! is_user_logged_in() && $charging_enabled === 'yes' ) { + if ( 'true' === $guest_mode && 'true' === $guest_verify && ! is_user_logged_in() && 'yes' === $charging_enabled ) { $postarr['post_status'] = wpuf_get_draft_post_status( $this->form_settings ); - } elseif ( $guest_mode === 'true' && $guest_verify === 'true' && ! is_user_logged_in() ) { + } elseif ( 'true' === $guest_mode && 'true' === $guest_verify && ! is_user_logged_in() ) { $postarr['post_status'] = 'draft'; } //if date is set and assigned as publish date diff --git a/includes/Frontend.php b/includes/Frontend.php index 21b10b4fd..7567656aa 100644 --- a/includes/Frontend.php +++ b/includes/Frontend.php @@ -180,12 +180,9 @@ public function enqueue_scripts() { private function dokan_is_seller_dashboard() { return class_exists( 'WeDevs_Dokan' ) && function_exists( 'dokan_is_seller_dashboard' ) - && dokan_is_seller_dashboard() - && ! empty( $wp->query_vars['posts'] ); + && dokan_is_seller_dashboard(); } - - /** * Show/hide admin bar to the permitted user level * diff --git a/includes/Frontend/Frontend_Form.php b/includes/Frontend/Frontend_Form.php index 22c2d087e..92e59a8ad 100755 --- a/includes/Frontend/Frontend_Form.php +++ b/includes/Frontend/Frontend_Form.php @@ -16,6 +16,9 @@ class Frontend_Form extends Frontend_Render_Form { public function __construct() { // // guest post hook add_action( 'init', [ $this, 'publish_guest_post' ] ); + // notification and other tasks after the guest verified the email + add_action( 'wpuf_guest_post_email_verified', [ $this, 'send_mail_to_admin_after_guest_mail_verified' ] ); + $this->set_wp_post_types(); // Enable post edit link for post authors in frontend @@ -326,48 +329,52 @@ public function publish_guest_post() { $pid = isset( $_GET['p_id'] ) ? sanitize_text_field( wp_unslash( $_GET['p_id'] ) ) : ''; $fid = isset( $_GET['f_id'] ) ? sanitize_text_field( wp_unslash( $_GET['f_id'] ) ) : ''; - if ( $post_msg === 'verified' ) { - $response = []; - $post_id = wpuf_decryption( $pid ); - $form_id = wpuf_decryption( $fid ); - $form_settings = wpuf_get_form_settings( $form_id ); - $post_author_id = get_post_field( 'post_author', $post_id ); - $payment_status = new Subscription(); - $form = new Form( $form_id ); - $pay_per_post = $form->is_enabled_pay_per_post(); - $force_pack = $form->is_enabled_force_pack(); - - if ( $form->is_charging_enabled() && $pay_per_post ) { - if ( ( $payment_status->get_payment_status( $post_id ) ) === 'pending' ) { - $response['show_message'] = true; - $response['redirect_to'] = add_query_arg( - [ - 'action' => 'wpuf_pay', - 'type' => 'post', - 'post_id' => $post_id, - ], - get_permalink( wpuf_get_option( 'payment_page', 'wpuf_payment' ) ) - ); - - wp_redirect( $response['redirect_to'] ); - wpuf_clear_buffer(); - wp_send_json( $response ); - } - } else { - $p_status = get_post_status( $post_id ); + if ( $post_msg !== 'verified' ) { + return; + } - if ( $p_status ) { - wp_update_post( - [ - 'ID' => $post_id, - 'post_status' => isset( $form_settings['post_status'] ) ? $form_settings['post_status'] : 'publish', - ] - ); + $response = []; + $post_id = wpuf_decryption( $pid ); + $form_id = wpuf_decryption( $fid ); + $form_settings = wpuf_get_form_settings( $form_id ); + $post_author_id = get_post_field( 'post_author', $post_id ); + $payment_status = new Subscription(); + $form = new Form( $form_id ); + $pay_per_post = $form->is_enabled_pay_per_post(); + $force_pack = $form->is_enabled_force_pack(); + + if ( $form->is_charging_enabled() && $pay_per_post ) { + if ( ( $payment_status->get_payment_status( $post_id ) ) === 'pending' ) { + $response['show_message'] = true; + $response['redirect_to'] = add_query_arg( + [ + 'action' => 'wpuf_pay', + 'type' => 'post', + 'post_id' => $post_id, + ], + get_permalink( wpuf_get_option( 'payment_page', 'wpuf_payment' ) ) + ); + + wp_redirect( $response['redirect_to'] ); + wpuf_clear_buffer(); + wp_send_json( $response ); + } + } else { + $p_status = get_post_status( $post_id ); - echo wp_kses_post( "