Skip to content

Commit

Permalink
Merge pull request #25 from mt-support/fix/EXT-283-settings-link-update
Browse files Browse the repository at this point in the history
Update settings links for Authorization, Disconnect, and Notices
  • Loading branch information
jesseeproductions authored May 24, 2022
2 parents ec1e917 + b60f5b0 commit 3ac62d8
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 50 deletions.
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"events",
"tickets"
],
"homepage": "http://tri.be/shop/wordpress-events-calendar/",
"homepage": "https://theeventscalendar.com/extensions/hubspot-extension/",
"license": "GPL-2.0",
"require-dev": {
"bordoni/phpass": "0.3.5",
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
"wp-coding-standards/wpcs": "^2.1",
"automattic/vipwpcs": "^2.0",
Expand All @@ -27,15 +28,15 @@
},
"repositories": [
{
"name": "moderntribe/tribe-testing-facilities",
"name": "the-events-calendar/tec-testing-facilities",
"type": "github",
"url": "https://github.com/moderntribe/tribe-testing-facilities",
"url": "https://github.com/the-events-calendar/tec-testing-facilities",
"no-api": true
},
{
"name": "moderntribe/TribalScents",
"name": "the-events-calendar/TribalScents",
"type": "github",
"url": "https://github.com/moderntribe/TribalScents",
"url": "https://github.com/the-events-calendar/TribalScents",
"no-api": true
}
],
Expand Down
3 changes: 2 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
* Whee.
*/
var gulp = require( 'gulp' );
var pkg = require( './package.json' );

require( 'product-taskmaster' )( gulp );
require( '@the-events-calendar/product-taskmaster' )( gulp, pkg );
2 changes: 0 additions & 2 deletions package-whitelist.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"license.txt",
"readme.txt",
"vendor/autoload.php",
"vendor/autoload_commands.php",
"vendor/autoload_framework.php",
"vendor/composer/*",
"vendor/guzzlehttp/**/*",
"vendor/hubspot/**/*",
Expand Down
13 changes: 3 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tribe-ext-hubspot",
"version": "1.0.1",
"version": "1.0.2",
"repository": "git@github.com/mt-support/tribe-ext-hubspot",
"_zipname": "tribe-ext-hubspot",
"_zipfoldername": "tribe-ext-hubspot",
Expand All @@ -19,15 +19,8 @@
"minimum_percentage": 30,
"waiting_strings": false
},
"engines": {
"node": "0.10.30",
"npm": "1.4.23"
},
"engines": { "node": "16.6.1", "npm": "7.20.3" },
"devDependencies": {
"archiver": "^0.10.1",
"glob": "~4.0.5",
"gulp": "^3.9.1",
"product-taskmaster": "git+https://github.com/moderntribe/product-taskmaster.git",
"require-dir": "^0.3.0"
"@the-events-calendar/product-taskmaster": "2.1.1"
}
}
20 changes: 12 additions & 8 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
=== Event Tickets HubSpot Integration ===
Contributors: ModernTribe, brianjessee
Donate link: http://m.tri.be/29
Contributors: theeventscalendar, brianjessee
Donate link: https://evnt.is/29
Tags: events, calendar
Requires at least: 4.7
Tested up to: 5.9
Requires PHP: 5.6
Stable tag: 1.0.1
License: GPL version 3 or any later version
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Requires at least: 5.6
Stable tag: 1.0.2
Tested up to: 5.9.3
Requires PHP: 7.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

[Extension Description]

Expand Down Expand Up @@ -37,6 +37,10 @@ We're always interested in your feedback and our [Help Desk](https://support.the

== Changelog ==

= [1.0.2] 2022-05-23 =

* Tweak - Utilize new settings class to link to the integration tab for authorization, disconnect, and notices. [EXT-283]

= [1.0.1] 2022-03-15 =

* Fix - Prevent authorization error by changing to the crm.schemas.contacts.read and crm.schemas.contacts.write scopes. [EXT-246]
Expand Down
3 changes: 2 additions & 1 deletion src/Tribe/API/Oauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tribe\HubSpot\API;

use Tribe\Events\Admin\Settings as TEC_Settings;
use Tribe\HubSpot\Process\Setup_Queue;

/**
Expand Down Expand Up @@ -69,7 +70,7 @@ public function handle_request( $wp ) {
*/
do_action( 'tribe_hubspot_authorize_site' );

wp_safe_redirect( \Tribe__Settings::instance()->get_url( [ 'tab' => 'addons' ] ) );
wp_safe_redirect( tribe( TEC_Settings::class )->get_url( [ 'tab' => 'addons' ] ) );

tribe_exit();
}
Expand Down
20 changes: 6 additions & 14 deletions src/Tribe/Admin/Notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tribe\HubSpot\Admin;

use Tribe__Admin__Notices;
use \Tribe\Events\Admin\Settings as TEC_Settings;

class Notices {

Expand Down Expand Up @@ -48,7 +49,7 @@ public function show_missing_application_credentials_notice() {
}

// Bail if previously dismissed this notice.
if ( Tribe__Admin__Notices::instance()->has_user_dimissed( $this->slug( 'missing-application-credentials' ) ) ) {
if ( Tribe__Admin__Notices::instance()->has_user_dismissed( $this->slug( 'missing-application-credentials' ) ) ) {
return;
}

Expand Down Expand Up @@ -93,11 +94,7 @@ public function show_missing_application_credentials_notice() {
*/
public function render_missing_application_credentials_notice( $settings ) {

// Get link to APIs Tab.
$url = $settings->get_url( [
'page' => 'tribe-common',
'tab' => 'addons',
] );
$url = tribe( TEC_Settings::class )->get_url( [ 'tab' => 'addons' ] );

$message = sprintf( '<div><p>%s, <a href="%s" target="_blank">%s</a>.</p></div>',
esc_html_x( 'HubSpot is missing the Credentials necessary to authorize your application. Please', 'First part of notice there is no settings saved for HubSpot.', 'tribe-ext-hubspot' ),
Expand All @@ -124,7 +121,7 @@ public function show_missing_access_token_notice() {
}

// Bail if previously dismissed this notice.
if ( Tribe__Admin__Notices::instance()->has_user_dimissed( $this->slug( 'missing-access-token' ) ) ) {
if ( Tribe__Admin__Notices::instance()->has_user_dismissed( $this->slug( 'missing-access-token' ) ) ) {
return;
}

Expand Down Expand Up @@ -180,14 +177,9 @@ public function show_missing_access_token_notice() {
*/
public function render_missing_access_token_notice( $settings ) {

// Get link to APIs Tab.
$url = $settings->get_url( [
'page' => 'tribe-common',
'tab' => 'addons',
] );
$url = tribe( TEC_Settings::class )->get_url( [ 'tab' => 'addons' ] );


$message = sprintf( '<div><p>%s, <a href="%s" target="_blank">%s</a>.</p></div>',
$message = sprintf( '<div><p>%s <a href="%s" target="_blank">%s</a>.</p></div>',
esc_html_x( 'HubSpot is not authorized.', 'First part of notice there is no connection with HubSpot.', 'tribe-ext-hubspot' ),
esc_url( $url ),
esc_html_x( 'Please authorize or refresh your connection.', 'Link text of notice there is no connection with HubSpot.','tribe-ext-hubspot' )
Expand Down
7 changes: 4 additions & 3 deletions src/Tribe/Admin/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tribe\HubSpot\Admin;

use Tribe\Events\Admin\Settings as TEC_Settings;
use Tribe\HubSpot\Process\Setup_Queue;
use Tribe__Settings_Manager;

Expand Down Expand Up @@ -330,7 +331,7 @@ private function get_authorize_fields() {
} else {
$hubspot_button_label = __( 'Refresh your connection to HubSpot', 'tribe-ext-hubspot' );
$hubspot_disconnect_label = __( 'Disconnect', 'tribe-ext-hubspot' );
$current_url = \Tribe__Settings::instance()->get_url( [ 'tab' => 'addons' ] );
$current_url = tribe( TEC_Settings::class )->get_url( [ 'tab' => 'addons' ] );
$hubspot_disconnect_url = $this->build_disconnect_hubspot_url( $current_url );
}
?>
Expand Down Expand Up @@ -375,7 +376,7 @@ private function get_authorize_fields() {
* @param WP_Screen $screen
*/
public function maybe_clear_hubspot_credentials( $screen ) {
if ( 'tribe_events_page_tribe-common' !== $screen->base ) {
if ( 'tribe_events_page_tec-events-settings' !== $screen->base ) {
return;
}

Expand All @@ -397,7 +398,7 @@ public function maybe_clear_hubspot_credentials( $screen ) {
$this->clear_hubspot_credentials();

wp_redirect(
\Tribe__Settings::instance()->get_url( [ 'tab' => 'addons' ] )
tribe( TEC_Settings::class )->get_url( [ 'tab' => 'addons' ] )
);
die;
}
Expand Down
1 change: 0 additions & 1 deletion src/Tribe/Service_Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function register() {

$this->container->singleton( 'tickets.hubspot.admin.settings', Admin\Settings::class );
$this->container->singleton( 'tickets.hubspot.admin.notices', Admin\Notices::class, array( 'hook' ) );
$this->container->singleton( 'tickets.hubspot.admin.messages', Admin\Messages::class, array( 'hook' ) );

$this->container->singleton( 'tickets.hubspot.api', API\Connection::class );
$this->container->singleton( 'tickets.hubspot.setup', API\Setup::instance() );
Expand Down
7 changes: 3 additions & 4 deletions src/Tribe/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tribe\HubSpot;

use Tribe\HubSpot\Main;
use Tribe__Autoloader;
use Tribe__Extension;

Expand All @@ -29,9 +28,9 @@ class Setup extends Tribe__Extension {
*/
public function construct() {

$this->add_required_plugin( 'Tribe__Tickets__Main', '4.11' );
$this->add_required_plugin( 'Tribe__Tickets_Plus__Main', '4.11' );
$this->add_required_plugin( 'Tribe__Events__Main', '5.4' );
$this->add_required_plugin( 'Tribe__Tickets__Main', '5.4' );
$this->add_required_plugin( 'Tribe__Tickets_Plus__Main', '5.5' );
$this->add_required_plugin( 'Tribe__Events__Main', '5.15' );

// Connect into Queue Filter, if done later it does not add the handler.
add_action( 'tribe_process_queues', [ $this, 'queue_handlers' ] );
Expand Down
2 changes: 1 addition & 1 deletion tribe-ext-hubspot.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: http://m.tri.be/hubspot
* GitHub Plugin URI: https://github.com/mt-support/tribe-ext-hubspot
* Description: Event Tickets and Event Tickets Plus HubSpot Integration
* Version: 1.0.1
* Version: 1.0.2
* Extension Class: Tribe\HubSpot\Setup
* Author: Modern Tribe, Inc.
* Author URI: http://m.tri.be/1971
Expand Down

0 comments on commit 3ac62d8

Please sign in to comment.