Skip to content

Commit bef8518

Browse files
author
Marco Pereirinha
committed
Update the submit a request URL
1 parent d017ab4 commit bef8518

3 files changed

Lines changed: 34 additions & 40 deletions

File tree

php/class-special-offer.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,12 @@ public function filtered_settings( $settings ) {
7373
'type' => 'link',
7474
'content' => __( 'Get started', 'cloudinary' ),
7575
'url' => static function () {
76-
$current_user = wp_get_current_user();
77-
$plugin = get_plugin_instance();
78-
$cloud_name = $plugin->components['connect']->get_cloud_name();
79-
80-
return add_query_arg(
81-
array(
82-
'tf_anonymous_requester_email' => $current_user->user_email,
83-
'tf_22246877' => $current_user->display_name,
84-
'tf_360007219560' => $cloud_name,
85-
'tf_360017815680' => 'help_with_plans',
86-
'tf_subject' => __( 'Request to Purchase the Small Plan', 'cloudinary' ),
87-
'tf_description' => __( "Hello,\n\nI'm interested in purchasing the Small plan for $29. Could you please provide me with the next steps to complete the purchase?\n\nThank you!", 'cloudinary' ),
88-
),
89-
'https://support.cloudinary.com/hc/en-us/requests/new'
76+
$args = array(
77+
'tf_360017815680' => 'help_with_plans',
78+
'tf_subject' => __( 'Request to Purchase the Small Plan', 'cloudinary' ),
79+
'tf_description' => __( "Hello,<br><br>I'm interested in purchasing the Small plan for $29. Could you please provide me with the next steps to complete the purchase?<br><br>Thank you!", 'cloudinary' ),
9080
);
81+
return Utils::get_support_link( $args );
9182
},
9283
'target' => '_blank',
9384
),

php/class-utils.php

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -449,35 +449,31 @@ public static function upgrade_3_1_9() {
449449
/**
450450
* Gets the URL for opening a Support Request.
451451
*
452-
* @param string $reason The reason option slug.
453-
* @param string $subject The subject for the request.
452+
* @param array $args The arguments.
454453
*
455454
* @return string
456455
*/
457-
public static function get_support_link( $reason = '', $subject = '' ) {
456+
public static function get_support_link( $args = array() ) {
458457
$user = wp_get_current_user();
459458
$plugin = get_plugin_instance();
460459
$url = 'https://support.cloudinary.com/hc/en-us/requests/new';
461460

462-
if ( empty( $reason ) ) {
463-
$reason = 'other_help_needed';
464-
}
465-
466-
if ( empty( $subject ) ) {
467-
$subject = sprintf(
468-
// translators: The plugin version.
461+
$default_args = array(
462+
'tf_anonymous_requester_email' => $user->user_email,
463+
'tf_22246877' => $user->display_name,
464+
'tf_360007219560' => $plugin->components['connect']->get_cloud_name(),
465+
'tf_360017815680' => 'other_help_needed',
466+
'tf_subject' => sprintf(
467+
// translators: The plugin version.
469468
__( 'I need help with Cloudinary WordPress plugin version %s', 'cloudinary' ),
470469
$plugin->version
471-
);
472-
}
470+
),
471+
'tf_description' => __( 'Please, provide more details on your request, and if possible, attach a System Report', 'cloudinary' ),
472+
);
473473

474-
$args = array(
475-
'request_anonymous_requester_email' => $user->display_name,
476-
'request_custom_fields_22246877' => $user->user_email,
477-
'request_custom_fields_360007219560' => $plugin->components['connect']->get_cloud_name(),
478-
'request_custom_fields_360017815680' => $reason,
479-
'request_subject' => $subject,
480-
'request_description' => __( 'Please, provide more details on your request, and if possible, attach a System Report', 'cloudinary' ),
474+
$args = wp_parse_args(
475+
$args,
476+
$default_args
481477
);
482478

483479
return add_query_arg( array_filter( $args ), $url );

ui-definitions/settings-pages.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,12 @@
333333
'type' => 'tag',
334334
'element' => 'a',
335335
'attributes' => array(
336-
'href' => Utils::get_support_link( '-' ),
336+
'href' => static function () {
337+
$args = array(
338+
'tf_360017815680' => '-',
339+
);
340+
return Utils::get_support_link( $args );
341+
},
337342
'target' => '_blank',
338343
'rel' => 'noopener noreferrer',
339344
'class' => array(
@@ -451,12 +456,14 @@
451456
'type' => 'panel',
452457
'title' => __( "I'm having an incompatibility issue with a theme, plugin, or hosting environment, what can I do?", 'cloudinary' ),
453458
'collapsible' => 'closed',
454-
'content' => sprintf(
455-
// translators: The HTML markup.
456-
__( 'We’re compatible with most other plugins so we expect it to work absolutely fine. If you do have any issues, please %1$scontact our support team%2$s who will help resolve your issue.', 'cloudinary' ),
457-
'<a href="' . Utils::get_support_link() . '" target="_blank" rel="noopener noreferrer">',
458-
'</a>'
459-
),
459+
'content' => static function () {
460+
return sprintf(
461+
// translators: The HTML markup.
462+
__( 'We’re compatible with most other plugins so we expect it to work absolutely fine. If you do have any issues, please %1$scontact our support team%2$s who will help resolve your issue.', 'cloudinary' ),
463+
'<a href="' . Utils::get_support_link() . '" target="_blank" rel="noopener noreferrer">',
464+
'</a>'
465+
);
466+
},
460467
),
461468
array(
462469
'type' => 'panel',

0 commit comments

Comments
 (0)