[Module] Yii User Management Module

Try this snippet:




$fbconfig = Yum::module()->facebookConfig;

if ($fbconfig) {

    Yii::import('application.modules.user.vendors.facebook.*');

	require_once('Facebook.php');

    $facebook = new Facebook($fbconfig);

    $fb_session = $facebook->getSession();

    if($fb_session && Yii::app()->user->isGuest)

		if($this->action->id != 'login')

			$this->redirect($this->createUrl('/user/auth/login'));

}



Tell me if it works for you so I can change the Wiki page.

‘facebookConfig’ is a subarray of ‘user’.

i set it up like that, it tells me cant find facebookConfig,




$fbconfig = Yum::module()->facebookConfig;

if ($fbconfig) {

    Yii::import('application.modules.user.vendors.facebook.*');

        require_once('Facebook.php');

    $facebook = new Facebook($fbconfig);

    $fb_session = $facebook->getSession();

    if($fb_session && Yii::app()->user->isGuest)

                if($this->action->id != 'login')

                        $this->redirect($this->createUrl('/user/auth/login'));

}




	'modules'=>array(

	'user' => array(

        'debug' => true,

        'facebookConfig'=>array(

        'appId'=>'xxxxxx',

        'secret'=>'xxxxxx',

        'domain'=>'localhost',

        'status'=>true,

        'xfbml'=>true,

        'cookie'=>true,

        'lang'=>'en_US', //es_LA, de_DE, cz_CZ, etc.

		),

		'modules' => array(

        'role',

        'profiles',

        'messages',

        ),

   

			),



@mithereal, I fixed the documentation. My apologies for not being specific with the location of ‘facebookConfig’ in ‘user’ array.

when i use

$fbconfig = Yum::module()->facebookConfig; still returns null

$fbconfig = Yum::module()->facebook;

echo $fbconfig;

it returns true, as in the yum modules config $facebook=true;

so how can i pass that to new facebook() when the value is true and facebook class expets an array?

The variable $facebookConfig is set by default to ‘false’ so Yum throw a exception if it is not set as array() in config/main.php.

$facebook is not in UserModule anymore. I don’t know why you get ‘true’ when you access it, because it’s not there.

I’m copying here the relevant lines of my configuration so you can compare against yours and check what’s going on:




	'modules'=>array(

		//Yii User Module

		'user'=>array(

			'debug'=>true,

			//Routing params

			'returnUrl' => '/',

			'returnLogoutUrl' => '/',

			//Layout params

			'loginLayout'=>'//layouts/tgp_simple',

			'layout'=>'//layouts/tgp_singlecol',

			'loginView'=>'//custom/login',

			//Tables def. Necesary to call Yum Models from outside.

			'usersTable'=>'users',

			'profileTable'=>'profiles',

			'profileFieldsTable'=>'profile_fields',

			'rolesTable'=>'roles',

			'userRoleTable'=>'user_has_role',

			//Other params

			'facebookConfig'=>array(

				'appId'=>'000000000000000',

				'secret'=>'00000000000000000000000000000000',

				'domain'=>'example.com',

				'status'=>true,

				'xfbml'=>true,

				'cookie'=>true,

				'lang'=>'es_LA',

			),

			'activationPasswordSet'=>true,

			'autoLogin'=>true,

			'activateFromWeb'=>false,

			'recoveryFromWeb'=>true,

			'recoveryEmail'=>'info@example.com',

			'mailer'=>'PHPMailer',

			'phpmailer'=>array(

				'transport'=>'smtp',

				'html'=>true,

				'properties'=>array(

					'CharSet' => 'UTF-8',

					'Host' => 'mail.example.com',

					'SMTPDebug' => false,

					'SMTPAuth' => true,

					'SMTPSecure' => 'tls',

					'Host' => 'smtp.gmail.com',

					'Port' => 587,

					'Username' => 'info@example.com',

					'Password' => '00000000',

				),

				'msgOptions'=>array(

					'fromName'=>'Sistema de Registro',

					'toName'=>'Usuario',

				),

			),

		), //here closes 'user'

	), //here closes 'modules'



This is wrong. Yum::module() access all the variables defined in UserModule.php, and the assignation of $facebookConfig is trivial in code. Never had issues here with it. Please double check that the location in your config is effectively ‘modules’->‘user’->‘facebookConfig’.

This should not happen. IMHO, you should get fresh sources from SVN and try again if the problem actually is not the location of ‘facebookConfig’.

You don’t. $facebook doesn’t exists anymore as a configuration option. The module expects an array, the config array.

Does anyone here besides me or mithereal are trying to put to work FacebookConnect? We need feedback.

yup, that workd, thanks,

now the button is visible, when i click it i get the error Given URL is not allowed by the Application configuration.

now im not entirely sure on this, it could be my end,im developing on me websever, but i am on cox, so : 80 i blockd i use :88 and zoneedit to forward a domain name to my ip:88 could this be why im getting the error

i also got url is not valid for this appication

i tried to use localhost in the devel.facebook.com/whatever modules config, any ideas on how to solve this vague problem

Cool. Now you have to properly configure Facebook to let your app in. The port you use is not a problem. You have to say to facebook that you own ‘example.com’ somewhere in the app config interface. The machine you use must be declared in your zone ‘example.com’ DNS either by a ‘IN A’ registry (in case you have a certified static public ip address) or a ‘IN CNAME’ registry (in case your ip address changes over time and you use a service like DynDNS to have a DNS name).

Once you solve that detail, you’re in.

ok well my friends can access my website by going to www.example.com:88

i set up facebook devel like :




Restrictions

* Sandbox Mode


Application ID

    168586754513948

API Key

    xxxx

Application Secret

    xxxxxx

Site URL

    http://example.com/test/

Site Domain

    examlpe.com

Canvas Page

    http://apps.facebook.com/appname/

Canvas URL

    http://example.com/test/

Canvas FBML/iframe

    FBML

Sandbox Mode

    On

Contact Email

    mithereal@xxx.com

Support Email

    mithereal@xxx.com

Sample Code

    Get started quickly with some example code!



and it goves me the error:


 API Error Code: 191

API Error Description: The specified URL is not owned by the application

Error Message: redirect_uri is not owned by the application.



but why then can outsiders access my site via port 88

Now the question is only Facebook related. That’s good because it means Yum FacebookConnect works. ;)

About the message, that’s clear enough. You don’t own the redirect_uri. :) Are you the owner of the ‘example.com’ domain? Did you modified the zone as I suggested?

If you don’t own the zone it’s difficult that Facebook let you in. It is not about ports, its about zones.

I hope you can solve your problem so you can finish testing Yum’s FacebookConnect.

And finally please when you make it, document the process in our Wiki page so many others can benefit of your trial-and-error tests. :)

If you need help send me a PM and I will see how can I help you.

Why does this extension suddenly became inactive? :(

not inactive check the project page, last update was made ~2 days ago via svn

yum is not inactive, the opposide is the case. i do a lot for the project at the moment, because of a project that i have involving yum. But all my work only lands in the subversion repository.

I know it should be time to release the 0.8, maybe i shouldn´ t be so much a perfectionist as i am right now…

That’s really good news!:) My apologies if I hurt your feelings. I should have checked the SVN instead of just looking at the date of the last comment before mine.

I just downloaded the latest SVN, and I’m having trouble with managing profile fields. For example:


include(YumFieldsGroup.php): failed to open stream: No such file or directory

and what I did was I renamed the model YumProfileFieldsGroup.php to YumFieldsGroup.php and surprisingly it worked. Should the files and classname be just renamed? Is that okay?

interesting bug ;) i will take care of that, thank you

thyseus, answer, please:

  • when the expected release 0.8

  • what known problems in the current version from googlecode?

thanks.

Thanks for your interest in yum. I expect 0.8 for the beginning of february. There are too many new features that still need to be polished for a stable release.

The googlecode version should be as stable as possible, but sometimes here and there things may change and break. Just give it a try and report bugs to the issue tracker so i (or the other active yum developers, yes there are some of them!) can take care of that.

The registration process is actually broken. And the code in there sucks. I need to rewrite all this stuff. This is the last big release blocker at the moment, i think.

Hallo!

I’d like to say, this is a great module. Thank you for great job!!! I just started with Yii, btw it is first framework I use, and your extension help a lot.

I downloaded latest release from SVN (268), and I’ve found some problems.

I could create new user groups, but I’m not able to view any of them. After clicking View Group I got this error:

CException

Description

YumUsergroupController cannot find the requested view "_participant".

Source File

C:\xampp\framework\framework\web\CController.php(842)

Looks like "_participant" view is missing in SVN.

Regards

just for your information: yum now has experimental ldap support, so check it out ;)