Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed some free features for new users #975

Merged
merged 9 commits into from
Jul 10, 2024
2 changes: 2 additions & 0 deletions includes/admin/class-rop-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ public function enqueue_scripts() {

$rop_api_settings['tracking'] = 'yes' === get_option( 'tweet_old_post_logger_flag', 'no' );
$rop_api_settings['tracking_info_link'] = sanitize_url( 'https://docs.revive.social/article/2008-revive-old-posts-usage-tracking' );
$last_post_shared = get_option( 'rop_last_post_shared', '' );
$rop_api_settings['is_new_user'] = empty( $last_post_shared );

wp_localize_script( $this->plugin_name . '-' . $page, 'ropApiSettings', $rop_api_settings );
wp_localize_script( $this->plugin_name . '-' . $page, 'ROP_ASSETS_URL', array( ROP_LITE_URL . 'assets/' ) );
Expand Down
18 changes: 12 additions & 6 deletions includes/admin/models/class-rop-settings-model.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,42 +52,48 @@ class Rop_Settings_Model extends Rop_Model_Abstract {
* @var array $shorteners The class defaults for shorteners.
*/
private static $shorteners = array(
'rviv.ly' => array(
'id' => 'rviv.ly',
'name' => 'rviv.ly',
'active' => true,
'is_free' => true,
),
'bit.ly' => array(
'id' => 'bit.ly',
'name' => 'bit.ly',
'active' => true,
'is_free' => false,
),
'firebase' => array(
'id' => 'firebase',
'name' => 'google firebase',
'active' => true,
'is_free' => false,
),
'ow.ly' => array(
'id' => 'ow.ly',
'name' => 'ow.ly',
'active' => true,
'is_free' => false,
),
'is.gd' => array(
'id' => 'is.gd',
'name' => 'is.gd',
'active' => true,
'is_free' => false,
),
'rebrand.ly' => array(
'id' => 'rebrand.ly',
'name' => 'rebrand.ly',
'active' => true,
'is_free' => false,
),
'wp_short_url' => array(
'id' => 'wp_short_url',
'name' => 'wp_short_url',
'active' => true,
'is_free' => true,
),
// TODO Reintroduce Rvivly after refactor
// 'rviv.ly' => array(
// 'id' => 'rviv.ly',
// 'name' => 'rviv.ly',
// 'active' => false,
// ),
);

/**
Expand Down
3 changes: 3 additions & 0 deletions includes/class-rop-i18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ public static function get_labels( $key = '' ) {
'instagram_image_post_default' => sprintf( __( '%1$sNote:%2$s Instagram posts need to be an image.', 'tweet-old-post' ), '<strong>', '</strong>' ),
'vk_unsupported_shorteners' => sprintf( __( '%1$sNote:%2$s is.gd shortener is not currently supported by VK.com.', 'tweet-old-post' ), '<strong>', '</strong>' ),
'not_available_with_rop_server' => __( 'This feature is not available for X accounts authorized via Revival Social.', 'tweet-old-post' ),
'custom_meta_field_upsell' => __( 'Custom meta field are only available in the Pro version.', 'tweet-old-post' ),
'custom_meta_upsell' => __( 'Custom field are only available in the Pro version.', 'tweet-old-post' ),
'hashtag_field_upsell' => __( 'The selected option is only available in the Pro version.', 'tweet-old-post' ),
),
'schedule' => array(
'menu_item' => __( 'Custom Schedule', 'tweet-old-post' ),
Expand Down
1 change: 1 addition & 0 deletions vue/src/models/rop_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export default new Vuex.Store({
rop_cron_remote: ropApiSettings.rop_cron_remote,
dom_updated: false,
tracking: Boolean( ropApiSettings.tracking ),
is_new_user: Boolean( ropApiSettings.is_new_user ),
},
mutations: {

Expand Down
97 changes: 77 additions & 20 deletions vue/src/vue-elements/post-format.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
{{ labels.post_content_option_excerpt }}
</option>
<option value="custom_field">
{{ labels.post_content_option_custom_field }}
{{ labels.post_content_option_custom_field }} {{ isNewUserPro ? "(Pro)" : '' }}
</option>
<option
v-if="yoast_seo_active_status"
Expand All @@ -93,25 +93,37 @@
<div
v-if="post_format.post_content === 'custom_field'"
class="columns py-2"
:class="'rop-control-container-'+(!isNewUserPro)"
>
<div class="column col-6 col-sm-12 vertical-align">
<div class="column col-6 col-sm-12 vertical-align rop-control">
<b>{{ labels.custom_meta_title }}</b>
<p class="text-gray">
{{ labels.custom_meta_desc }}
</p>
</div>
<div class="column col-6 col-sm-12 vertical-align">
<div class="column col-6 col-sm-12 vertical-align rop-control">
<div class="form-group">
<input
v-model="post_format.custom_meta_field"
class="form-input"
type="text"
value=""
placeholder=""
:disabled="isNewUserPro"
>
</div>
</div>
</div>
<div
v-if="isNewUserPro && (post_format.post_content === 'custom_field')"
class="columns "
>
<div class="column text-center">
<p class="upsell">
<i class="fa fa-info-circle" /> {{ labels.custom_meta_field_upsell }}
</p>
</div>
</div>

<span class="divider" />

Expand Down Expand Up @@ -214,25 +226,39 @@
</div>
</div>
<span class="divider" />
<div class="columns py-2">
<div class="column col-6 col-sm-12 vertical-align">
<div
class="columns py-2"
:class="'rop-control-container-'+(!isNewUserPro)"
>
<div class="column col-6 col-sm-12 vertical-align rop-control">
<b>{{ labels.meta_link_title }}</b>
<p class="text-gray">
{{ labels.meta_link_desc }}
</p>
</div>
<div class="column col-6 col-sm-12 vertical-align">
<div class="column col-6 col-sm-12 vertical-align rop-control">
<div class="input-group">
<label class="form-checkbox">
<input
v-model="post_format.url_from_meta"
type="checkbox"
:disabled="isNewUserPro"
>
<i class="form-icon" /> {{ labels.yes_text }}
</label>
</div>
</div>
</div>
<div
v-if="isNewUserPro"
class="columns "
>
<div class="column text-center">
<p class="upsell">
<i class="fa fa-info-circle" /> {{ labels.custom_meta_upsell }}
</p>
</div>
</div>

<!-- Custom Field -->
<div
Expand Down Expand Up @@ -348,11 +374,11 @@
<option
v-for="shortener in shorteners"
:key="shortener.id"
:value="shortener.id"
:value="isNewUserPro && ( 'is.gd' === shortener.id ) ? '' : shortener.id"
:disabled="shortener.active !== true"
:selected="shortener.name == post_format.short_url_service"
>
{{ shortener.name }}{{ !shortener.active ? labels_generic.only_pro_suffix : '' }}
{{ shortener.name }}{{ (isNewUserPro && shortener.is_free === false) || shortener.active !== true ? " (Pro)" : '' }}
</option>
</select>
</div>
Expand All @@ -363,27 +389,38 @@
<div
v-for="( credential, key_name ) in post_format.shortner_credentials"
:key="key_name"

:class="'rop-control-container-'+(!isNewUserPro || (post_format.short_url_service === 'rviv.ly' || post_format.short_url_service === 'wp_short_url'))"
class="columns py-2"
>
<div class="column col-6 col-sm-12 vertical-align">
<div class="column col-6 col-sm-12 vertical-align rop-control">
<b>{{ key_name | capitalize }}</b>
<p class="text-gray">
{{ labels.shortner_field_desc_start }} "{{ key_name }}"
{{ labels.shortner_field_desc_end }}
<strong>{{ post_format.short_url_service }}</strong> {{ labels.shortner_api_field }}.
</p>
</div>
<div class="column col-6 col-sm-12 vertical-align">
<div class="column col-6 col-sm-12 vertical-align rop-control">
<div class="form-group">
<input
v-model="post_format.shortner_credentials[key_name]"
class="form-input"
type="text"
:disabled="isNewUserPro && (post_format.short_url_service !== 'rviv.ly' || post_format.short_url_service !== 'wp_short_url')"
>
</div>
</div>
</div>
<div
v-if="isNewUserPro && (post_format.short_url_service !== 'rviv.ly' && post_format.short_url_service !== 'wp_short_url')"
class="columns "
>
<div class="column text-center">
<p class="upsell">
<i class="fa fa-info-circle" /> {{ labels.hashtag_field_upsell }}
</p>
</div>
</div>
</template>


Expand All @@ -409,13 +446,13 @@
{{ labels.hashtags_option_common }}
</option>
<option value="categories-hashtags">
{{ labels.hashtags_option_cats }}
{{ labels.hashtags_option_cats }} {{ isNewUserPro ? "(Pro)" : '' }}
</option>
<option value="tags-hashtags">
{{ labels.hashtags_option_tags }}
{{ labels.hashtags_option_tags }} {{ isNewUserPro ? "(Pro)" : '' }}
</option>
<option value="custom-hashtags">
{{ labels.hashtags_option_field }}
{{ labels.hashtags_option_field }} {{ isNewUserPro ? "(Pro)" : '' }}
</option>
</select>
</div>
Expand Down Expand Up @@ -447,21 +484,23 @@
<div
v-if="post_format.hashtags === 'custom-hashtags'"
class="columns py-2"
:class="'rop-control-container-'+(!isNewUserPro && (post_format.hashtags !== 'common-hashtags'))"
>
<div class="column col-6 col-sm-12 vertical-align">
<div class="column col-6 col-sm-12 vertical-align rop-control">
<b>{{ labels.hastags_field_title }}</b>
<p class="text-gray">
{{ labels.hastags_field_desc }}
</p>
</div>
<div class="column col-6 col-sm-12 vertical-align">
<div class="column col-6 col-sm-12 vertical-align rop-control">
<div class="form-group">
<input
v-model="post_format.hashtags_custom"
class="form-input"
type="text"
value=""
placeholder=""
:disabled="isNewUserPro && (post_format.hashtags !== 'common-hashtags')"
>
</div>
</div>
Expand All @@ -470,21 +509,23 @@
<div
v-if="post_format.hashtags !== 'no-hashtags'"
class="columns py-2"
:class="'rop-control-container-'+(!isNewUserPro || (post_format.hashtags === 'no-hashtags' || post_format.hashtags === 'common-hashtags'))"
>
<div class="column col-6 col-sm-12 vertical-align">
<div class="column col-6 col-sm-12 vertical-align rop-control">
<b>{{ labels.hashtags_length_title }}</b>
<p class="text-gray">
{{ labels.hashtags_length_desc }}
</p>
</div>
<div class="column col-6 col-sm-12 vertical-align">
<div class="column col-6 col-sm-12 vertical-align rop-control">
<div class="form-group">
<input
v-model="post_format.hashtags_length"
class="form-input"
type="number"
value=""
placeholder=""
:disabled="isNewUserPro && (post_format.hashtags !== 'no-hashtags' && post_format.hashtags !== 'common-hashtags')"
>
</div>
</div>
Expand All @@ -493,25 +534,37 @@
<div
v-if="post_format.hashtags !== 'no-hashtags'"
class="columns py-2"
:class="'rop-control-container-'+(!isNewUserPro || (post_format.hashtags === 'no-hashtags' || post_format.hashtags === 'common-hashtags'))"
>
<div class="column col-6 col-sm-12 vertical-align rop-control">
<b>{{ labels.hashtags_randomize }}</b>
<p class="text-gray">
<span v-html="labels.hashtags_randomize_desc" />
</p>
</div>
<div class="column col-6 col-sm-12 vertical-align">
<div class="column col-6 col-sm-12 vertical-align rop-control">
<div class="input-group">
<label class="form-checkbox">
<input
v-model="post_format.hashtags_randomize"
type="checkbox"
:disabled="isNewUserPro && (post_format.hashtags !== 'no-hashtags' && post_format.hashtags !== 'common-hashtags')"
>
<i class="form-icon" /> {{ labels.yes_text }}
</label>
</div>
</div>
</div>
<div
v-if="isNewUserPro && (post_format.hashtags !== 'no-hashtags' && post_format.hashtags !== 'common-hashtags')"
class="columns "
>
<div class="column text-center">
<p class="upsell">
<i class="fa fa-info-circle" /> {{ labels.hashtag_field_upsell }}
</p>
</div>
</div>

<span class="divider" />

Expand Down Expand Up @@ -764,7 +817,11 @@
},
shorteners: function () {
return this.$store.state.generalSettings.available_shorteners;
}
},
isNewUserPro: function () {
console.log(0 === this.license && this.$store.state.is_new_user);
girishpanchal30 marked this conversation as resolved.
Show resolved Hide resolved
return 0 === this.license && this.$store.state.is_new_user;
girishpanchal30 marked this conversation as resolved.
Show resolved Hide resolved
},
},
watch: {
short_url_service: function () {
Expand Down
Loading