Skip to content
Open
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
6 changes: 4 additions & 2 deletions includes/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ public static function addRoutesSocialify($path)
public static function add_routes()
{
register_rest_route(
'socialify/',
route: sprintf('%s-auth', static::getProviderKey()),
'socialify',
route: sprintf('/%s-auth', static::getProviderKey()),
args: [
'methods' => 'GET',
'callback' => [static::class, 'actionAuth'],
Expand All @@ -209,9 +209,11 @@ public static function getProviderDataFromUserMeta($user_id)
public static function authenticateByProviderProfile($providerProfile)
{
$user = self::getUserByIdFromProvider($providerProfile->identifier);

if (empty($user)) {
$user = self::tryRegisterUserByProviderProfile($providerProfile);
}

if ($user) {
self::setCurrentUser($user);
return $user;
Expand Down
8 changes: 2 additions & 6 deletions includes/Endpoints.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<?php


// function htmxer_url($route)
// {
// $route = sanitize_text_field($route);
// return home_url(user_trailingslashit('htmxer/'.ltrim($route, '/')));
// }


// function htmxer_hook($route)
// {
Expand All @@ -26,7 +22,7 @@ public static function init()
}

public static function getUrl($path){
return home_url(user_trailingslashit(Plugin::$slug) . $path);
return home_url(trailingslashit(Plugin::$slug) . $path);
}

public static function getHook($path){
Expand Down
3 changes: 1 addition & 2 deletions includes/YandexProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ final class YandexProvider extends AbstractProvider
{
public static $key = 'yandex';



public static function init(): void
{
add_action('admin_init', [self::class, 'additionalSettings']);
Expand Down Expand Up @@ -76,6 +74,7 @@ public static function actionAuth()

//second step - get token and profile
$userProfile = self::getUserProfile();

$user = self::authenticateByProviderProfile($userProfile);

self::redirectAfterAuth();
Expand Down
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Domain Path: /languages/
* GitHub Plugin URI: aiiddqd/socialify
* Requires PHP: 8.0
* Version: 0.9.250925
* Version: 0.9.251012
*/

namespace Socialify;
Expand Down