Plugin Directory

Changeset 3457244


Ignore:
Timestamp:
02/09/2026 03:55:24 PM (8 weeks ago)
Author:
rankauthority
Message:

Update: Added new connection check endpoint

Location:
rank-authority
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • rank-authority/trunk/rank-authority.php

    r3450744 r3457244  
    44 * Plugin URI: https://rankauthority.com/plugins/rankauthority
    55 * Description: Secure API connector to publish posts / overwrite posts from the RA Dashboard to WordPress. Token reset now available to all administrators.
    6  * Version: 1.0.14
     6 * Version: 1.0.15
    77 * Author: Rank Authority
    88 * Author URI: https://rankauthority.com
     
    673673        $website_id = get_option($this->option_website_id);
    674674        $token = get_option($this->option_token);
    675         $plugin_version = get_file_data(__FILE__, array('Version' => 'Version'), false)['Version'] ?? '1.0.14';
     675        $plugin_version = get_file_data(__FILE__, array('Version' => 'Version'), false)['Version'] ?? '1.0.15';
    676676
    677677        ?>
     
    875875        ]);
    876876
     877        register_rest_route('ra/v1', '/check', [
     878            'methods'  => 'POST',
     879            'callback' => [$this, 'check_connection'],
     880            'permission_callback' => [$this, 'authenticate'],
     881        ]);
     882
    877883        register_rest_route('ra/v1', '/post', [
    878884            'methods'  => 'POST',
     
    958964            'wp_version' => get_bloginfo('version'),
    959965            'website_id' => get_option($this->option_website_id) ?: null
     966        ];
     967    }
     968
     969    /** Check connection - verify only, no registration */
     970    public function check_connection($request) {
     971        // Get website_id from request body
     972        $params = $request->get_json_params();
     973        $requested_website_id = !empty($params['website_id']) ? sanitize_text_field($params['website_id']) : null;
     974       
     975        // Get current website_id
     976        $current_website_id = get_option($this->option_website_id);
     977       
     978        // Check if website_id matches
     979        $is_connected = false;
     980        if ($requested_website_id && $current_website_id) {
     981            $is_connected = ($requested_website_id === $current_website_id);
     982        }
     983       
     984        return [
     985            'status'     => $is_connected ? 'connected' : 'not_connected',
     986            'site_name'  => get_bloginfo('name'),
     987            'site_url'   => get_site_url(),
     988            'wp_version' => get_bloginfo('version'),
     989            'website_id' => $current_website_id ?: null,
     990            'requested_website_id' => $requested_website_id,
     991            'match' => $is_connected
    960992        ];
    961993    }
  • rank-authority/trunk/readme.txt

    r3450744 r3457244  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 1.0.14
     7Stable tag: 1.0.15
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    137137
    138138== Changelog ==
     139
     140= 1.0.15 =
     141* Added new `/ra/v1/check` REST API endpoint for connection verification
     142* Connection check endpoint validates website_id without registration
     143* Improved connection verification workflow - can now check if a site is connected without modifying settings
     144* Enhanced API functionality with dedicated connection verification endpoint
    139145
    140146= 1.0.14 =
     
    233239== Upgrade Notice ==
    234240
     241= 1.0.15 =
     242Added new connection check endpoint (`/ra/v1/check`) that allows you to verify if a website_id is connected without modifying any settings. This provides better workflow for connection verification.
     243
    235244= 1.0.14 =
    236245Token reset functionality is now available to all administrators. Any user with manage_options capability can regenerate the connection token, providing better flexibility for team environments.
Note: See TracChangeset for help on using the changeset viewer.