can you help me writing this lines of code for grab in a EE template the information about a logged_in user, using php.
I'm using Vanilla Forum, and i want to use the JsConnect to pass the logged_in user information to the Vanilla Log in. Here's the guide:
Implementing Vanilla jsConnect Single-Signon on your Site
I found that libraries to include in system
And the code to include in my page template is this:
<?php
require_once dirname(__FILE__).'/functions.jsconnect.php';
// 1. Get your client ID and secret here. These must match those in your jsConnect settings.
$clientID = "1234";
$secret = "1234";
// 2. Grab the current user from your session management system or database here.
$signedIn = true; // this is just a placeholder
// YOUR CODE HERE.
// 3. Fill in the user information in a way that Vanilla can understand.
$user = array();
if ($signedIn) {
// CHANGE THESE FOUR LINES.
$user['uniqueid'] = '123';
$user['name'] = 'John PHP';
$user['email'] = '[email protected]';
$user['photourl'] = '';
}
// 4. Generate the jsConnect string.
// This should be true unless you are testing.
// You can also use a hash name like md5, sha1 etc which must be the name as the connection settings in Vanilla.
$secure = true;
WriteJsConnect($user, $_GET, $clientID, $secret, $secure);
How can i call the logged_in user info here
// 2. Grab the current user from your session management system or database here.
$signedIn = true; // this is just a placeholder
// YOUR CODE HERE.
with this
{if logged_in}
UniqueID={member_id}
Name={username}
Email={email}
PhotoUrl={photo_url}{photo_filename}
{/if}
And assign that the variables to pass to
// 3. Fill in the user information in a way that Vanilla can understand.
$user = array();
if ($signedIn) {
// CHANGE THESE FOUR LINES.
$user['uniqueid'] = '123';
$user['name'] = 'John PHP';
$user['email'] = '[email protected]';
$user['photourl'] = '';
}
To generate a json file that vanilla JsConnect can read?
I think also
<?php
require_once dirname(__FILE__).'/functions.jsconnect.php';
return error in ExpressionEngine
Please somebody can tell me how can solve this.
Thank you in advance Alessio