Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke / Raven CMS CMS Wiki
Author Message
Lucifix
Regular
Regular



Joined: Mar 11, 2005
Posts: 67

PostPosted: Sat Feb 12, 2011 1:49 pm Reply with quote

Did anyone try to integrated Facebook connect in Ravennuke yet? So that guest could register to Ravennuke from Facebook account?
 
View user's profile Send private message
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Sat Feb 12, 2011 1:56 pm Reply with quote

i have a mod that uses the Janrain Engage api to allow your users to use several different social network sites to register as a member to your site. You can download it here [ Only registered users can see links on this board! Get registered or login! ] and see it in action on my site.

_________________
Tricked Out News 
View user's profile Send private message Send e-mail Visit poster's website
Lucifix







PostPosted: Sat Feb 12, 2011 4:05 pm Reply with quote

Hmm... this looks promising, but I can't register on your site to download plugin. After hitting button Continue nothing happened. (Firefox, Chrome or IE)

Edit: I succeded by disabling java script
 
nuken







PostPosted: Sun Feb 13, 2011 12:37 am Reply with quote

Sorry about that. I updated my jQuery version and it had a conflict with the validate plugin. All is fixed now.
 
Lucifix







PostPosted: Sun Feb 13, 2011 3:23 am Reply with quote

As I can see this MOD will only insert in register form informations based on Facebook or other account. User will still have to activate account from activation email which is on of the most important reason why I would like to activate Facebook connect.
 
nuken







PostPosted: Sun Feb 13, 2011 7:01 am Reply with quote

No, they do not have to activate the account by email. It should auto activate the account and log them in once they confirm the information.
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Mon Feb 21, 2011 7:43 am Reply with quote

Any chance this is making its way into an upcoming RN release nuken? I'd love that to be an option within the core.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
Lucifix







PostPosted: Mon Feb 21, 2011 7:59 am Reply with quote

I've successfully integrated Facebook Connect to RavenNuke. I've used Facebook PHP SDK and some javascript: [ Only registered users can see links on this board! Get registered or login! ]

If you're interesting I can post tutorial here?
 
prekill
Worker
Worker



Joined: Oct 22, 2005
Posts: 201

PostPosted: Mon Feb 21, 2011 5:14 pm Reply with quote

Lucifix, this will be great!
 
View user's profile Send private message
prekill







PostPosted: Sat Apr 23, 2011 12:37 pm Reply with quote

<bump>

Any new with this?
 
prekill







PostPosted: Thu May 12, 2011 2:45 am Reply with quote

Embarassed
 
prekill







PostPosted: Sat Jun 04, 2011 7:40 am Reply with quote

Lucifix ?
 
prekill







PostPosted: Wed Jul 13, 2011 1:59 pm Reply with quote

Blonde Moment ...lol this is a sad case already!
 
kenno
Worker
Worker



Joined: Jul 26, 2009
Posts: 117
Location: Scunthorpe, UK

PostPosted: Mon Jul 18, 2011 4:18 pm Reply with quote

Have you tried contacting him on his site ?, this is listed in his postings in his forum profile [ Only registered users can see links on this board! Get registered or login! ]

Let us know how you get on

Mark
 
View user's profile Send private message
jlajax
Ardent RavenCMS Supporter



Joined: Oct 12, 2006
Posts: 244
Location: Jacksonville, Florida

PostPosted: Thu Apr 17, 2014 10:22 am Reply with quote

nuken wrote:
i have a mod that uses the Janrain Engage api to allow your users to use several different social network sites to register as a member to your site. You can download it here [ Only registered users can see links on this board! Get registered or login! ] and see it in action on my site.


This link led to a dead link. I am very interested in social integration and login. I obviously have not spent enough time in these forums of late.
 
View user's profile Send private message
nuken







PostPosted: Thu Apr 17, 2014 10:26 am Reply with quote

Janrain changed their code so the mod stopped working. I had intentions of making a new one just never found the spare time. Someone else had a working facebook login for RavenNuke. It should be somewhere in the forums.
 
rovshan
Hangin' Around



Joined: Nov 26, 2005
Posts: 33

PostPosted: Fri Nov 20, 2015 9:45 am Reply with quote

http://hybridauth.sourceforge.net

I think hybridauth best solution to integrate in RN.
Here is I did something but did not finish yet, if someone interested in please publish your idea.

## Wrapper for the HybridAuth PHP library.
## See [ Only registered users can see links on this board! Get registered or login! ] for more info on HybridAuth.
Based on idea taken from https://github.com/ImpetusGames/cms-oauth

<?php
## Impetus Games OAuth Plugin.
## Wrapper for the HybridAuth PHP library.
## See [ Only registered users can see links on this board! Get registered or login! ] for more info on HybridAuth.

//session_start();
require_once 'mainfile.php';

include_once('hybridauth/Hybrid/Auth.php');
include_once('hybridauth/Hybrid/Logger.php');
include_once('hybridauth/Hybrid/Endpoint.php');
include_once('hybridauth/Hybrid/Exception.php');


//function smarty_function_oauth($params, &$template) {
$hybrid_auth_config = dirname(__FILE__) . '/hybridauth/config.php';

//$hybrid_auth_config = 'hybridauth/config.php';
// Clear session and return.
if(isset($_GET['clearsession'])) {
oauth_clear_session();
header('Location: ' . $_SERVER['HTTP_REFERER']);
exit();
}

// Init (clear session), then do login.
if(isset($_GET['initlogin'])) {

oauth_clear_session();
$_SESSION['oauth_return_to'] = $_SERVER['HTTP_REFERER'];

header('Location: ' . oauth_get_current_uri() . '?dologin=' . $_GET['initlogin']);
//echo 'Location: ' . oauth_get_current_uri() . '?dologin=' . $_GET['initlogin'].'';
//die ();
exit();
}

// Step 1: Start process, clear session, logout, check valid provider, etc.
// Step 3: After login, request user data and save to DB.
if(isset($_GET['dologin'])) {
$config = include($hybrid_auth_config);
$provider = $_GET['dologin'];
//echo '/ '.$hybrid_auth_config.' / '.$config.' /// '.$provider.'';
//die();
if(array_key_exists($provider, $config['providers']) && $config['providers'][$provider]['enabled']) {
try {
$_SESSION['oauth_provider'] = $provider;

// Authenticate with OAuth provider
$hybridauth = new Hybrid_Auth($hybrid_auth_config);
$adapter = $hybridauth->authenticate($provider);
// Get user data from OAuth provider and save it to DB
$user_profile = $adapter->getUserProfile();

$_SESSION['oauth_db_id'] = oauth_update_db($provider, $user_profile);

// save user data and redirect home
$_SESSION['oauth_user_id'] = $user_profile->identifier;
$_SESSION['oauth_user_name'] = $user_profile->displayName;
$_SESSION['oauth_first_name'] = $user_profile->firstName;
$_SESSION['oauth_last_name'] = '';
$_SESSION['oauth_display_name'] = $user_profile->firstName;
if(isset($user_profile->lastName) && !empty($user_profile->lastName)) {
$_SESSION['oauth_display_name'] .= " " . $user_profile->lastName;
$_SESSION['oauth_last_name'] = $user_profile->lastName;
}
oauth_redirect_home('signed-in');
}
catch(Exception $ex) {
oauth_redirect_home('auth-error', $ex->getMessage());
}
}

else {
$_SESSION['oauth_return_to'] = $_SERVER['HTTP_REFERER'];
oauth_redirect_home('auth-error', 'Invalid OAuth provider: ' . $provider);
}
}

// Step 2: Start the HybridAuth authentication "background process"
if(isset($_REQUEST['hauth_start']) || isset($_REQUEST['hauth_done'])) {
try {
Hybrid_Endpoint::process();
}
catch(Exception $ex) {
$_SESSION['oauth_status'] = 'auth-error';
$_SESSION['oauth_error_msg'] = 'Authentication process failed, trying to restart';
header('Location: ' . oauth_get_current_uri() . '?dologin=' . $_SESSION['oauth_provider']);
}
exit();
}
echo 'no way';
//die("You must not call this script directly without parameters.");
//}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* Clear all oauth_* values in session and globally logout via HybridAuth. */
function oauth_clear_session() {
global $hybrid_auth_config ;
/* clear OAuth session variables */

foreach($_SESSION as $k => $v) {
if(strpos($k, "oauth_") === 0) {
unset($_SESSION[$k]);
}
}

$_SESSION['oauth_session_cleared'] = true;
/* Clear HybridAuth */
$hybrid = new Hybrid_Auth($hybrid_auth_config);
$hybrid->logoutAllProviders();
}
/* Redirect to $_SESSION['return_to'], if set, or home (/) otherwise. */
function oauth_redirect_home($status, $error = null) {
$_SESSION['oauth_status'] = $status;
if($error)
$_SESSION['oauth_error_msg'] = $error;
else
unset($_SESSION['oauth_error_msg']);

header('Location: ' . (isset($_SESSION['oauth_return_to']) ? $_SESSION['oauth_return_to'] : '/'));
exit();
}
/* Update user info in database. */
function oauth_update_db($provider, $data) {
global $db ;
//$config = include($hybrid_auth_config);
$config = include('hybridauth/config.php');
if(!array_key_exists('db_table', $config) || empty($config['db_table']))
return;
$users_tab = $config['db_table'];
//echo ''.$users_tab.''; die();

//$db = cmsms()->GetDb();
// first check whether user exists in DB already
//echo ' /what// '.$data->identifier.' ///';

//$sql = "SELECT * FROM " . $users_tab . " WHERE provider = '$provider' AND uid = ?";
$sql = 'SELECT * FROM ' . $users_tab . ' WHERE provider = \'' .$provider. '\' AND uid = \'' .$data->identifier. '\' ';
$result = $db->sql_query($sql);
// $result = $db->Execute($sql, array($data->identifier));
if(!$result)
die("Failed to select record db ");
//echo 'NET'; die ();

if($db->sql_numrows($result) == 0) {
// insert new record into DB
// $sql = "INSERT INTO " . $users_tab . " (provider, uid, display_name, first_name, last_name, email) VALUES ('$provider', '$data->identifier', '$data->displayName', '$data->firstName', '$data->lastName', '$data->email')";
$db->sql_query('INSERT INTO ' . $users_tab . ' (provider, uid, display_name, first_name, last_name, email) VALUES (\'' . $provider . '\', \'' . $data->identifier . '\', \'' . $data->displayName . '\', \'' . $data->firstName . '\', \'' . $data->lastName . '\', \'' . $data->email . '\')');
// if(!$db->Execute($sql, array($data->identifier, $data->displayName, $data->firstName, $data->lastName, $data->email)))
if(!$db)
die("Failed to insert into db");
} else {
// update existing record in DB
$db->sql_query('UPDATE ' . $users_tab . ' SET display_name = \'' . $data->displayName . '\', \'' . $data->firstName . '\', last_name = \'' . $data->lastName . '\', email = \'' . $data->email . '\' WHERE provider = \'' .$provider. '\' AND uid = \'' .$data->identifier. '\' ');
//if(!$db->Execute($sql, array($data->displayName, $data->firstName, $data->lastName, $data->email, $data->identifier)))
if(!$db)
//die("Failed to update database: " . $db->ErrorMsg());
die("Failed to update db");
}

// query ID (primary key) of this DB record
$sql = 'SELECT id FROM ' . $users_tab . ' WHERE provider = \'' .$provider. '\' AND uid = \'' .$data->identifier. '\' ';
//$result = $db->Execute($sql, array($data->identifier));
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$fields = $row['id'];
if(!$result)
// die("Failed to select from database: " . $db->ErrorMsg());
die("Failed to select id from db ");
return $fields;
}
/* Build the full URI path to the currently requested page. */
function oauth_get_current_uri() {
return 'http' . (oauth_is_https() ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . strtok($_SERVER['REQUEST_URI'], '?');

}

?>
 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke / Raven CMS CMS Wiki

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©