1
danvarey
Facebook Connect
  • 2010/5/8 18:17

  • danvarey

  • Just popping in

  • Posts: 10

  • Since: 2008/9/5 9


Hi
Can you please add Facebook connect to xoops. It will surely be a nice one for the users.
I saw a module like that. but it's not logging in to the core.
I would like to know whether any development is going on for Facebook connect or it is available now.

Regards and thanks

2
mariane
Re: Facebook Connect
  • 2010/5/9 6:58

  • mariane

  • Theme Designer

  • Posts: 649

  • Since: 2008/1/11


in this post
https://xoops.org/modules/newbb/viewtopic.php?start=0&topic_id=71176&viewmode=flat&order=ASC&type=&mode=0
there is an important code to share between xoops and fb
the road of success is always under construction

3
danvarey
Re: Facebook Connect
  • 2010/5/12 14:52

  • danvarey

  • Just popping in

  • Posts: 10

  • Since: 2008/9/5 9


Sharing is not my problem. I want the visitors be able to log into my site with their facebook ID. Like in zynga forums (http://forums.zynga.com/) where you are registered in the website with facebook logins.

The main important thing in this is, that the users don't have to create a separate credentials for the site. If they have a facebook account, they can login and use as a site registered member.

4
iHackCode
Re: Facebook Connect

this?

https://xoops.org/modules/news/article.php?storyid=5161
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

5
danvarey
Re: Facebook Connect
  • 2010/5/13 10:12

  • danvarey

  • Just popping in

  • Posts: 10

  • Since: 2008/9/5 9


No. That module does not log you into xoops. It only logs in to the module.
What I'm asking is to log into the xoops core. Just like a registered user. And when you first visit and log in, it asks how to store the user name and all. ( This is for the database )

Please checkhttp://forums.zynga.com/ to see how that works works.

Regards

6
ghia
Re: Facebook Connect
  • 2010/5/13 10:45

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


If you want this for all your users, you could write an authenticate plugin (see /class/auth/). In the preferences you can then choose for XOOPS, LDAP and FaceBook.
If you need also regular XOOPS login, you must provide a fallback in the verify login.

7
aitor
Re: Facebook Connect
  • 2010/5/19 16:45

  • aitor

  • Not too shy to talk

  • Posts: 148

  • Since: 2002/1/2 2


I am also interested on it, as i see what is needed that when a user connects with fbconnect a xoops user must be created and logged automatically so it can be a xoops user without needing to validate his data.

I think that this could make xoops websites more easy to have users as they didn´t need to register and validate email.

8
aitor
Re: Facebook Connect
  • 2010/5/19 19:47

  • aitor

  • Not too shy to talk

  • Posts: 148

  • Since: 2002/1/2 2


i am trying to change te fbconnect to allow create a user as it is logged in fbconnect, i am getting error while traying to create,

Hope that someone could help me to see where is the error so i can continue with it.

What i want is to create like,
/modules/profile/admin/user.php
but that it would be created automatically, with for example random pass and mail.

I am getting the error message _AM_CNRNU


in modules/fbconnect/index.php

if ($user->fbc_is_facebook_user()) {

echo "<br>uid " . $user->fbc_uid;
echo "<br>User " . $user->fbc_name ;
echo "<br>Name " . $user->fbc_first_name ;
echo "<br>Surname " . $user->fbc_last_name ;
$uid = $user->fbc_uid;
$username = $user->fbc_name;
$name = $user->fbc_name;
$password = "aitor";
$pass2 = "aitor";
$email = "usuario@mail.com";

if (!$username || !$email || !$password) {
$adduser_errormsg = _AM_YMCACF;
} else {
$member_handler =& xoops_gethandler('member');
// make sure the username doesnt exist yet
if ($member_handler->getUserCount(new Criteria('uname', $uid)) > 0) {
$adduser_errormsg = 'User name '.$uid.' already exists';
} else {
$newuser =& $member_handler->createUser();
if (isset($user_viewemail)) {
$newuser->setVar("user_viewemail",$user_viewemail);
}
if (isset($attachsig)) {
$newuser->setVar("attachsig",$attachsig);
}
$newuser->setVar("name", $username);
$newuser->setVar("uname", $uid);
$newuser->setVar("email", $email);
$newuser->setVar("url", formatURL($url));
$newuser->setVar("user_avatar",'blank.gif');
$newuser->setVar('user_regdate', time());
$newuser->setVar("user_icq", $user_icq);
$newuser->setVar("user_from", $user_from);
$newuser->setVar("user_sig", $user_sig);
$newuser->setVar("user_aim", $user_aim);
$newuser->setVar("user_yim", $user_yim);
$newuser->setVar("user_msnm", $user_msnm);
if ($pass2 != "") {
if ( $password != $pass2 ) {
xoops_cp_header();
echo "<strong>" . _AM_STNPDNM . "</strong>";
xoops_cp_footer();
exit();
}
$newuser->setVar("pass", md5($password));
}
$newuser->setVar("timezone_offset", $timezone_offset);
$newuser->setVar("uorder", $uorder);
$newuser->setVar("umode", $umode);
// RMV-NOTIFY
$newuser->setVar("notify_method", $notify_method);
$newuser->setVar("notify_mode", $notify_mode);
$newuser->setVar("bio", $bio);
$newuser->setVar("rank", $rank);
$newuser->setVar("level", 1);
$newuser->setVar("user_occ", $user_occ);
$newuser->setVar("user_intrest", $user_intrest);
$newuser->setVar('user_mailok', $user_mailok);
if (!$member_handler->insertUser($newuser)) {
$adduser_errormsg = _AM_CNRNU;
} else {
$groups_failed = array();
foreach ($groups as $group) {
if (!$member_handler->addUserToGroup($group, $newuser->getVar('uid'))) {
$groups_failed[] = $group;
}
}
if (!empty($groups_failed)) {
$group_names = $member_handler->getGroupList(new Criteria('groupid', "(".implode(", ", $groups_failed).")", 'IN'));
$adduser_errormsg = sprintf(_AM_CNRNU2, implode(", ", $group_names));
} else {
xoops_load('XoopsUserUtility');
XoopsUserUtility::sendWelcome($newuser);
redirect_header("admin.php?fct=users", 1, _AM_DBUPDATED);
exit();
}
}
}
}


echo "<br>" . $adduser_errormsg . "<br>";

the error message is
define("_AM_CNRNU","Could not register new user.");

9
ghia
Re: Facebook Connect
  • 2010/5/20 0:23

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Check the code in /register.php
Probably you missed to fill in some required variables.
$member_handler =& xoops_gethandler('member');
            
$newuser =& $member_handler->createUser();
            
$newuser->setVar('user_viewemail'$user_viewemailtrue);
            
$newuser->setVar('uname'$unametrue);
            
$newuser->setVar('email'$emailtrue);
            if (
$url != '') {
                
$newuser->setVar('url'formatURL($url), true);
            }
            
$newuser->setVar('user_avatar''blank.gif'true);
            
$actkey substr(md5(uniqid(mt_rand(), 1)), 08);
            
$newuser->setVar('actkey'$actkeytrue);
            
$newuser->setVar('pass'md5($pass), true);
            
$newuser->setVar('timezone_offset'$timezone_offsettrue);
            
$newuser->setVar('user_regdate'time(), true);
            
$newuser->setVar('uorder'$xoopsConfig['com_order'], true);
            
$newuser->setVar('umode'$xoopsConfig['com_mode'], true);
            
$newuser->setVar('user_mailok'$user_mailoktrue);
            if (
$xoopsConfigUser['activation_type'] == 1) {
                
$newuser->setVar('level'1true);
            } else {
                
$newuser->setVar('level'0true);
            }
            if (!
$member_handler->insertUser($newuser)) {
                echo 
_US_REGISTERNG;
                include 
$GLOBALS['xoops']->path('footer.php');
                exit();
            }

10
aitor
Re: Facebook Connect
  • 2010/5/20 7:41

  • aitor

  • Not too shy to talk

  • Posts: 148

  • Since: 2002/1/2 2


I have little more advanced now, i force registration and registered to user group directly.

Now i need to make how to loggin automatically and create a random password etc.

<?php
/**
 * ****************************************************************************
 * Module généré par TDMCreate de la TDM "http://www.tdmxoops.net"
 * ****************************************************************************
 * fbconnect - MODULE FOR XOOPS AND IMPRESS CMS
 * Copyright (c) waqar (http://www.fluidfusion.net)
 *
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code
 * which is considered copyrighted (c) material of the original comment or credit authors.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright       waqar (http://www.fluidfusion.net)
 * @license         GPL
 * @package         fbconnect
 * @author             waqar (http://www.fluidfusion.net)
 *
 * Version : 1.00:
 * ****************************************************************************
 */

 
if (isset($_POST)) {
    foreach ( 
$_POST as $k => $v ) {
        ${
$k} = $v;
    }
}
if (isset(
$_GET['op'])) {
    
$op trim($_GET['op']);
    if (isset(
$_GET['uid'])) {
        
$uid intval($_GET['uid']);
    }
}

 
 
 
include 
"../../mainfile.php";
include_once 
XOOPS_ROOT_PATH."/header.php";
include_once 
'lib/config.php';

$user User::fbc_getLoggedIn();
(
$user) ? $fb_active_session $user->fbc_is_session_active() : $fb_active_session FALSE;
global 
$xoopsConfig$xoopsDB;
    
if (!
$user) {
    include_once 
XOOPS_ROOT_PATH."/header.php";
    
// DISPLAY PAGE WHEN USER IS NOT LOGGED IN TO FB CONNECT
    
echo render_header($user);
    echo 
render_logged_out_index();
    echo 
render_footer();
    include_once 
XOOPS_ROOT_PATH."/footer.php";    
    exit;
}

// USER CONNECTED TO APPLICATION
if ($user->fbc_is_facebook_user()) {

    echo 
"<br>uid " $user->fbc_uid;
    echo 
"<br>User " $user->fbc_name ;
    echo 
"<br>Name " $user->fbc_first_name ;
    echo 
"<br>Surname " $user->fbc_last_name ;
    
$uid $user->fbc_uid;
    
$username $user->fbc_name;
    
$name $user->fbc_name;
    
$password "aitor";
    
$pass2 "aitor";
    
$email "usuario@mail.com";
    
$url "http://www.getxo2.es";
    
    if (!
$username || !$email || !$password) {
        
$adduser_errormsg _AM_YMCACF;
    } else {
        
$member_handler =& xoops_gethandler('member');
        
// make sure the username doesnt exist yet
        
if ($member_handler->getUserCount(new Criteria('uname'$uid)) > 0) {
            
$adduser_errormsg 'User name '.$uid.' already exists';
        } else {
            
$newuser =& $member_handler->createUser();
            if (isset(
$user_viewemail)) {
                
$newuser->setVar("user_viewemail",$user_viewemail);
            }
            if (isset(
$attachsig)) {
                
$newuser->setVar("attachsig",$attachsig);
            }
            
$newuser->setVar("name"$username);
            
$newuser->setVar("uname"$uid);
            
$newuser->setVar("email"$email);
            
$newuser->setVar("url"formatURL($url));
            
$newuser->setVar("user_avatar",'blank.gif');
            
$newuser->setVar('user_regdate'time());
            
$newuser->setVar("user_icq""");
            
$newuser->setVar("user_from""");
            
$newuser->setVar("user_sig""");
            
$newuser->setVar("user_aim""");
            
$newuser->setVar("user_yim""");
            
$newuser->setVar("user_msnm""");
            if (
$pass2 != "") {
                if ( 
$password != $pass2 ) {
                    
xoops_cp_header();
                    echo 
"<strong>" _AM_STNPDNM "</strong>";
                    
xoops_cp_footer();
                    exit();
                }
                
$newuser->setVar("pass"md5($password));
            }
            
$newuser->setVar("timezone_offset"$xoopsConfig['default_TZ']);
            
$newuser->setVar("uorder"$xoopsConfig['com_order']);
            
$newuser->setVar("umode",$xoopsConfig['com_mode']);
            
// RMV-NOTIFY
            
$newuser->setVar("notify_method"1);
            
$newuser->setVar("notify_mode"1);
            
$newuser->setVar("bio""");
            
$newuser->setVar("rank"1);
            
$newuser->setVar("level"1);
            
$newuser->setVar("user_occ""");
            
$newuser->setVar("user_intrest""");
            
$newuser->setVar('user_mailok'true);
            if (!
$member_handler->insertUser($newuser1)) {
                echo 
_AM_CNRNU;
            } 

            
$sql "INSERT INTO " $xoopsDB->prefix('groups_users_link') . "  (groupid, uid) VALUES  (2, " $newuser->getVar('uid') . ")"
            
$result $xoopsDB->queryF($sql);    
        }
    }

    
    

    if (
$_POST["comment"] != "") {
        
// PUBLISH STORY TO PROFILE FEED
        
$template_data = array(
            
'post-title'=>idx($GLOBALS'sample_post_title'), 
            
'post-url'=>idx($GLOBALS'sample_post_url'), 
            
'post'=>$_POST["comment"]);            
        
$target_ids = array();
        
$body_general '';
        
$publish_success $user->fbc_publishFeedStory(idx($GLOBALS'feed_bundle_id'), $template_data);
        if (
$publish_success) { $publish_result "Published story via PHP to your profile feed!"; } else { $publish_result "Error publishing story!"; }
    }

    if (
$_POST["status"] != "") {
        
// PUBLISH STORY TO PROFILE FEED
        
$status_success $user->fbc_setStatus($_POST["status"]);
        if (
$status_success) { $status_result "Updated your status via PHP!"; } else { $status_result "Error updating your status!"; }
    }

    echo 
render_header($user);

    
    
// SHOW FACEBOOK STATUS
    
echo render_status($user$status_result);

    
// POST FEED TO PROFILE
    
echo render_feed_form($user$publish_result);

    
// SHOW ALL FRIENDS
    
$friends $user->fbc_get_all_friends(TRUE);
    echo 
render_friends_table_html($friends010"fbconnect_friend""All Friends");

    
// SHOW ALL CONNECTED FRIENDS TO APPLICATION
    
$friends $user->fbc_get_connected_friends(FALSE);
    echo 
render_friends_table_html($friends010"fbconnect_friend""Connected Friends");

    
// SHOW ALL UNCONNECTED FRIENDS TO APPLICATION
    
$friends $user->fbc_get_unconnected_friends_xfbml(TRUE);
    echo 
render_friends_table_xfbml($friends35"fbconnect_friend""Unconnected Friends");
    
    echo 
render_footer();
} else {
    echo 
render_header($user);
    echo 
render_footer();
}

include_once 
XOOPS_ROOT_PATH."/footer.php";    
?>

Login

Who's Online

181 user(s) are online (94 user(s) are browsing Support Forums)


Members: 0


Guests: 181


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits