Skip to content

Commit

Permalink
Merge pull request #988 from Codeinwp/feat/pro/527
Browse files Browse the repository at this point in the history
Restricted Instagram, Linkedin and GMB service for basic plan
  • Loading branch information
Soare-Robert-Daniel authored Jul 12, 2024
2 parents 74ab630 + c4e7a6d commit 3110372
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 8 deletions.
7 changes: 5 additions & 2 deletions assets/css/rop_core.css
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,9 @@ a.active {
-moz-appearance: none;
appearance: none;
}

.tw-signin-advanced-config .btn-secondary, .tw-signin-advanced-config .btn.input-group-btn.circle {
border: 0.05rem solid #042440 !important;
}
#rop_core .btn:focus {
box-shadow: 0 0 0 0.1rem rgba(4, 36, 64, 0.2);
}
Expand Down Expand Up @@ -2878,9 +2880,10 @@ a.active {

#rop_core :is( .modal:target, .modal.active ) .modal-container {
z-index: 99999;
max-width: 640px;
max-width: 300px;
-webkit-animation: slide-down 0.2s ease 1;
animation: slide-down 0.2s ease 1;
width: 100%;
}

#rop_core :is( .modal:target, .modal.active ) .modal-container:has(.webhook-headers) {
Expand Down
35 changes: 32 additions & 3 deletions includes/admin/class-rop-global-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,14 @@ function ( $value ) {
$available_services[ $key ] = $service;
}
}
$available_services['instagram'] = $available_services['facebook'];
$available_services['instagram']['name'] = 'Instagram';
$available_services['instagram']['active'] = false;
// Check is new user.
$is_new_user = $this->check_is_new_license();
// Apply new plan(middle) for new free users.
$is_middle_plan = $is_new_user ? $this->license_type() > 1 : $this->license_type() > 0;

$available_services['instagram'] = $available_services['facebook'];
$available_services['instagram']['name'] = 'Instagram';
$available_services['instagram']['active'] = $is_middle_plan ? true : false;
return $available_services;
}

Expand Down Expand Up @@ -713,4 +718,28 @@ public function get_all_services_handle() {

return $all;
}

/**
* Check license is new or not.
*
* @return bool
*/
public function check_is_new_license() {
if ( $this->license_type() <= 0 ) { // Ignore free users.
return false;
}

$product_key = 'tweet_old_post_pro';
$license_data = get_option( $product_key . '_license_data', '' );

if ( ! isset( $license_data->created_at ) ) {
return false;
}

// Is after 9.1?
$created_at = strtotime( date( 'Y-m-d', strtotime( $license_data->created_at ) ) );
$compare_to = strtotime( '2024-07-21' );

return $created_at > $compare_to;
}
}
21 changes: 19 additions & 2 deletions includes/admin/services/class-rop-linkedin-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ private function get_users( $data, $api ) {

$users = array( $user_details );

// only new installs can connect company accounts because they will have the organization scope
if ( $this->rop_show_li_app_btn() ) {
// only new installs & new users can connect company accounts because they will have the organization scope
if ( $this->rop_is_business_plan() ) {
try {
// 'organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&projection=(elements*(organizationalTarget~(localizedName,vanityName,logoV2)))',
$admined_linkedin_pages = $this->api->api(
Expand Down Expand Up @@ -1038,4 +1038,21 @@ private function linkedin_upload_assets( $image_url, $args, $token ) {
return $body;
}

/**
* Method used to decide whether or not to show Linked button
*
* @return bool
* @since 8.5.0
* @access public
*/
public function rop_is_business_plan() {
if ( $this->rop_show_li_app_btn() ) {
$global_settings = new Rop_Global_Settings();
// New users will require a higher plan than the old.
return $global_settings->check_is_new_license() ? $global_settings->license_type() > 1 : $global_settings->license_type() > 0;
}

return false;
}

}
2 changes: 1 addition & 1 deletion vue/src/vue-elements/main-page-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</div>

<div class="columns">
<div class="panel column col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
<div class="panel column col-9 col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
<div
v-if="is_preloading_over > 0"
class="panel-nav"
Expand Down

0 comments on commit 3110372

Please sign in to comment.