Plugin Directory

Changeset 3494297


Ignore:
Timestamp:
03/30/2026 08:41:15 AM (6 days ago)
Author:
niaj
Message:

@v2.2.3

Location:
ghl-wizard
Files:
79 added
3 edited

Legend:

Unmodified
Added
Removed
  • ghl-wizard/trunk/ghl-wizard.php

    r3493207 r3494297  
    55 * Plugin URI:        https://betterwizard.com/lead-connector-wizard/
    66 * Description:       Connect WordPress with the popular LeadConnector CRM(HighLevel) and combine the power of automation and excellent user experience. Including memberships, content protection, WooCommerce automation, custom fields & many more...
    7  * Version:           2.2.2
     7 * Version:           2.2.3
    88 * Author:            Better Wizard
    99 * Author URI:        https://connectorwizard.app/
  • ghl-wizard/trunk/inc/content-protection.php

    r3493207 r3494297  
    55// Check if a particular post has accees to the
    66// Curent logged in user
    7 function hlwpw_has_access( $post_id ){
     7function hlwpw_has_access( $post_id, $user_id = null ){
    88   
    9     if ( current_user_can('manage_options') ) {
     9    $user_id = null === $user_id ? get_current_user_id() : absint( $user_id );
     10
     11    if ( $user_id && user_can( $user_id, 'manage_options' ) ) {
    1012        return true;
    1113    }
     
    2931    // 1. login Restriction
    3032    if ( "logged_in" == $login_restriction_value )  {
    31         $has_access = is_user_logged_in() ? true : false;
     33        $has_access = true; // when they logged in, they can access
    3234    }elseif( "logged_out" == $login_restriction_value ){
    33         $has_access = is_user_logged_in() ? false : true;
     35        $has_access = false; // when they logged in, they can not access
    3436    }
    3537
     
    4345
    4446            $memberships_levels = array_keys( lcw_get_memberships() );
    45             $has_access = hlwpw_membership_restriction( $memberships_levels );
     47            $has_access = hlwpw_membership_restriction( $memberships_levels, $user_id );
    4648
    4749        }else{
    4850
    49             $has_access = hlwpw_membership_restriction( $membership_restriction_value );
     51            $has_access = hlwpw_membership_restriction( $membership_restriction_value, $user_id );
    5052        }
    5153
     
    5759    if ( !empty($tag_restriction_value) && !empty($and_tag_restriction_value) ) {
    5860       
    59         $tag_restriction        = hlwpw_contact_has_tag( $tag_restriction_value );
    60         $and_tag_restriction    = hlwpw_contact_has_tag( $and_tag_restriction_value );
     61        $tag_restriction        = hlwpw_contact_has_tag( $tag_restriction_value, 'any', $user_id );
     62        $and_tag_restriction    = hlwpw_contact_has_tag( $and_tag_restriction_value, 'any', $user_id );
    6163
    6264        if ( $tag_restriction && $and_tag_restriction ) {
     
    6567
    6668    }elseif ( !empty($tag_restriction_value) ) {
    67         $has_access = hlwpw_contact_has_tag( $tag_restriction_value );
     69        $has_access = hlwpw_contact_has_tag( $tag_restriction_value, 'any', $user_id );
    6870    }
    6971
     
    100102// var_dump($m);
    101103
    102 function hlwpw_membership_restriction( $memberships ){
    103 
    104     if ( ! is_user_logged_in() ) {
     104function hlwpw_membership_restriction( $memberships, $user_id = null ){
     105
     106    $user_id = null === $user_id ? get_current_user_id() : absint( $user_id );
     107
     108    if ( ! $user_id ) {
    105109        return false;
    106110    }
    107111
    108112    // Provide access to admin
    109     if ( current_user_can( 'manage_options') ) {
     113    if ( user_can( $user_id, 'manage_options') ) {
    110114        return true;
    111115    }
     
    131135
    132136            // Check membership
    133             if ( hlwpw_contact_has_tag( $membership_tag ) && ! hlwpw_contact_has_tag( [$_payf_tag, $_susp_tag, $_canc_tag ] ) ) {
     137            if ( hlwpw_contact_has_tag( $membership_tag, 'any', $user_id ) && ! hlwpw_contact_has_tag( [$_payf_tag, $_susp_tag, $_canc_tag ], 'any', $user_id ) ) {
    134138
    135139                return true;
     
    197201}
    198202
    199 function hlwpw_contact_has_tag( $tags, $condition = 'any' ){
    200     $user_id = get_current_user_id();
     203function hlwpw_contact_has_tag( $tags, $condition = 'any', $user_id = null ){
     204    $user_id = null === $user_id ? get_current_user_id() : absint( $user_id );
    201205    if ( ! $user_id ) {
    202206        return false;
     
    627631    foreach ( $restricted_posts as $post_id ) {
    628632        // Set the parent access condition
    629         if ( ! hlwpw_has_access( $post_id ) ) {
     633        if ( ! hlwpw_has_access( $post_id, $user_id ) ) {
    630634            $has_not_access[] = $post_id;
    631635        }
  • ghl-wizard/trunk/readme.txt

    r3493207 r3494297  
    66Tested up to: 6.9
    77Requires PHP: 7.4
    8 Stable tag: 2.2.2
     8Stable tag: 2.2.3
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    220220== Changelog ==
    221221
     222= 2.2.3 - 30 March 2026 =
     223* Update Background Job
     224
    222225= 2.2.2 - 28 March 2026 =
    223226* Performance Enhancement
Note: See TracChangeset for help on using the changeset viewer.