View nslExcludeUrlFromFixedRedirect.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function excludeUrlFromFixedRedirect($fixedRedirectUrl, $provider) { | |
$pageWhereButtonWasClicked = NSL\Persistent\Persistent::get('redirect'); | |
$excluded_url = 'https://example.com/checkout'; | |
if ($pageWhereButtonWasClicked && strpos($pageWhereButtonWasClicked, $excluded_url) !== false) { | |
return false; | |
} | |
return $fixedRedirectUrl; |
View curl-test.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'https://example.com/wp-json/nextend-social-login/v1/facebook/get_user'; | |
$access_token = array( | |
'access_token' => '{"access_token":"EAAKdOKespJMBAKKanbl7q4vnqvGS6JpJE1IkLIlklxkBtBjIG1u0piAQLby6fwZAj0NGtOSJqY4A6PTfpzWhx77Pci0joIb01RChGO6sMgxShXZBcfnSDBdwTLopyHrtxnCqM7OLvhCCMOaJ2RxFKSAPdqCbhWrZCMxh5w1GIPAZCGxJCKr4jVl43Ig8oCQZD","token_type":"bearer","expires_in":5108158}' | |
); | |
$ch = curl_init($url); | |
$postQuery = http_build_query($access_token); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $postQuery); |
View nsl-rest-api-test.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
<form method="post" action="https://****/wp-json/nextend-social-login/v1/google/get_user"> | |
<input type="text" name="access_token" value=""/> | |
<button type="submit">Submit</button> |
View nslLoginRedirectOnRoleMatch.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function redirectWhenRoleMatches($user_id, $provider) { | |
$user = get_userdata($user_id); | |
$user_roles = $user->roles; | |
if (in_array('subscriber', $user_roles, true)) { | |
add_filter($provider->getId() . '_login_redirect_url', function () { | |
return 'https://example.com/page-for-subscribers'; | |
}); |