Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions admin/class-convertkit-admin-refresh-resources.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ public function refresh_resources( $request ) {
break;

case 'restrict_content':
// Fetch Forms.
$forms = new ConvertKit_Resource_Forms( 'user_refresh_resource' );
$results_forms = $forms->refresh();

// Bail if an error occured.
if ( is_wp_error( $results_forms ) ) {
return rest_ensure_response( $results_forms );
}

// Fetch Tags.
$tags = new ConvertKit_Resource_Tags( 'user_refresh_resource' );
$results_tags = $tags->refresh();
Expand All @@ -126,6 +135,7 @@ public function refresh_resources( $request ) {
// Return resources.
return rest_ensure_response(
array(
'forms' => array_values( $results_forms ),
'tags' => array_values( $results_tags ),
'products' => array_values( $results_products ),
)
Expand Down
8 changes: 5 additions & 3 deletions includes/class-convertkit-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,11 @@ public function enqueue_scripts() {
'convertkit-gutenberg',
'convertkit_gutenberg',
array(
'ajaxurl' => rest_url( 'kit/v1/blocks' ),
'block_api_version' => $this->get_block_api_version(),
'get_blocks_nonce' => wp_create_nonce( 'wp_rest' ),
'ajaxurl' => rest_url( 'kit/v1/blocks' ),
'block_api_version' => $this->get_block_api_version(),
'get_blocks_nonce' => wp_create_nonce( 'wp_rest' ),
'refresh_resources_url' => rest_url( 'kit/v1/resources/refresh/' ),
'refresh_resources_nonce' => wp_create_nonce( 'wp_rest' ),
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,33 +194,37 @@ public function get_fields() {

return array(
'form' => array(
'label' => __( 'Form', 'convertkit' ),
'type' => 'select',
'description' => array(
'label' => __( 'Form', 'convertkit' ),
'type' => 'select',
'description' => array(
__( 'Default', 'convertkit' ) . ': ' . __( 'Uses the form specified on the settings page.', 'convertkit' ),
__( 'None', 'convertkit' ) . ': ' . __( 'do not display a form.', 'convertkit' ),
__( 'Any other option will display that form after the main content.', 'convertkit' ),
),
'values' => $forms,
'values' => $forms,
'resource_type' => 'forms',
),
'landing_page' => array(
'label' => __( 'Landing Page', 'convertkit' ),
'type' => 'select',
'description' => __( 'Select a landing page to make it appear in place of this page.', 'convertkit' ),
'values' => $landing_pages,
'post_type' => 'page',
'label' => __( 'Landing Page', 'convertkit' ),
'type' => 'select',
'description' => __( 'Select a landing page to make it appear in place of this page.', 'convertkit' ),
'values' => $landing_pages,
'post_type' => 'page',
'resource_type' => 'landing_pages',
),
'tag' => array(
'label' => __( 'Tag', 'convertkit' ),
'type' => 'select',
'description' => __( 'Select a tag to apply to visitors of this page who are subscribed. A visitor is deemed to be subscribed if they have clicked a link in an email to this site which includes their subscriber ID, or have entered their email address in a Kit Form on this site.', 'convertkit' ),
'values' => $tags,
'label' => __( 'Tag', 'convertkit' ),
'type' => 'select',
'description' => __( 'Select a tag to apply to visitors of this page who are subscribed. A visitor is deemed to be subscribed if they have clicked a link in an email to this site which includes their subscriber ID, or have entered their email address in a Kit Form on this site.', 'convertkit' ),
'values' => $tags,
'resource_type' => 'tags',
),
'restrict_content' => array(
'label' => __( 'Restrict Content', 'convertkit' ),
'type' => 'select',
'description' => __( 'Select the Kit form, tag or product that the visitor must be subscribed to, permitting them access to view this member-only content.', 'convertkit' ),
'values' => $restrict_content,
'label' => __( 'Restrict Content', 'convertkit' ),
'type' => 'select',
'description' => __( 'Select the Kit form, tag or product that the visitor must be subscribed to, permitting them access to view this member-only content.', 'convertkit' ),
'values' => $restrict_content,
'resource_type' => 'restrict_content',
),
);

Expand Down
Loading
Loading