1itouch
Forum Replies Created
-
Hi Gabriel,
First Thank you so much for your reply, I was waiting for you to reply, I tried the above method i am getting error saying that [ Fatal error: Call to undefined function wp_remote_post() ], if i include [ include_once ‘../wp-load.php’; ] by putting this file in wordpress its not showing any error but its not displaying points, output is like this when i run this code ( Your Site B Balance is: )
This is the way i used it
<?php
include_once ‘../wp-load.php’;
$remote_url = ‘https://b.localhost/api/’;
$request = array(
‘method’ => ‘POST’,
‘body’ => array(
‘action’ => ‘GET’,
‘account’ => ‘[email protected]’,
‘token’ => ‘md5 hash’,
‘host’ => ‘https://a.localhost/woo’
)
);$raw_response = wp_remote_post( $remote_url, $request );
// The secret key
$secret_key = ‘*********’;// The remote URL
$remote_url = ‘https://b.localhost/api/’;// Action we want to take
$action = ‘GET’;// The account in question
$account = ‘[email protected]’;// Site A’s URL
$host = get_bloginfo( ‘url’ );// Host + action + key hashed
$token = md5( $host . $action . $secret_key );// Construct the request
$request = array(
‘method’ => ‘POST’,
‘body’ => array(
‘action’ => $action,
‘account’ => $account,
‘token’ => $token,
‘host’ => $host
)
);// Let WordPress do it’s magic
$raw_response = wp_remote_post( $remote_url, $request );// Parse response
$response = ”;
if ( ! is_wp_error( $raw_response ) && ( $raw_response[‘response’][‘code’] == 200 ) )
$response = maybe_unserialize( $raw_response[‘body’] );echo ‘Your Site B Balance is: ‘ . $response;
?>Am i using the code in wrong way? Need your help to get it done.
Hi Gabriel,
Thanks for your reply, I have enabled remote api in wordpress, Could you please give an example for creating callbacks, encode callbacks to include secret key and display the users balance in other site as well as updating points from other site.Hi Gabriel,
Thank you so much for the reply, i’ll use the above code you have given.
Hi Gabriel,
Could you please help me out on this..
Hi Gabriel,
I am using woocommerce with mycred and i am using mycred as the only payment gateway, what i wanted is, for example customer has 10 points but the product values is 30, so the customer should not be able to add this product into the cart, when he tries to add this product into the cart a error message should be displayed in shop itself saying not enough points instead of taking the customer to checkout page.
Hi,
I have created a custom menu and pointed to a page by giving url, it is redirecting to the given url as expected, but how to add icon to this custom menu??Thanks for the quick response, i’ll check with the gateway options which you have mentioned.