Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into enhance/support_…
Browse files Browse the repository at this point in the history
…for_additional_cpts
  • Loading branch information
sapayth committed Oct 15, 2024
2 parents c921651 + f92a621 commit dff2c51
Show file tree
Hide file tree
Showing 21 changed files with 414 additions and 172 deletions.
14 changes: 4 additions & 10 deletions Lib/Appsero/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace WeDevs\Wpuf\Lib\Appsero;

use WP_Error;

/**
* Appsero Client
*
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
12 changes: 2 additions & 10 deletions Lib/WeDevs_Insights.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace WeDevs\Wpuf\Lib;

if ( ! class_exists( 'WPUF_WeDevs_Insights' ) ) :
if ( ! class_exists( 'WeDevs_Insights' ) ) :

/**
* weDevs Tracker
Expand All @@ -17,26 +17,18 @@
*/
class WeDevs_Insights {
/**
* @var object|Appsero\Insights|Insights
* @var object|Appsero\Insights
*/
public $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();
}
}

Expand Down
2 changes: 2 additions & 0 deletions admin/class-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
/**
* WPUF settings
*/

#[AllowDynamicProperties]
class WPUF_Admin_Settings {

/**
Expand Down
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion includes/Admin/Forms/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Form {
/**
* @var array|\WP_Post|null
*/
private $data;
public $data;

public function __construct( $form ) {
if ( is_numeric( $form ) ) {
Expand Down
8 changes: 8 additions & 0 deletions includes/Ajax/Admin_Form_Builder_Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) );
}
Expand Down Expand Up @@ -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' ) );
}
Expand Down
4 changes: 2 additions & 2 deletions includes/Ajax/Frontend_Form_Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions includes/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
Loading

0 comments on commit dff2c51

Please sign in to comment.