[solved] yi-user installation problem

Hi guys,

i have setup the yi-user extension as described. Now i am getting an error:


Call to a member function t() on a non-object in D:\dev\ciprojects\oya_yii\protected\views\layouts\main.php on line 36


// main.php line 36 ff:

array('url'=>Yii::app()->getModule('user')->loginUrl, 'label'=>Yii::app()->getModule('user')->t("Login"), 'visible'=>Yii::app()->user->isGuest),

array('url'=>Yii::app()->getModule('user')->registrationUrl, 'label'=>Yii::app()->getModule('user')->t("Register"), 'visible'=>Yii::app()->user->isGuest),

array('url'=>Yii::app()->getModule('user')->profileUrl, 'label'=>Yii::app()->getModule('user')->t("Profile"), 'visible'=>!Yii::app()->user->isGuest),

array('url'=>Yii::app()->getModule('user')->logoutUrl, 'label'=>Yii::app()->getModule('user')->t("Logout").' ('.Yii::app()->user->name.')', 'visible'=>!Yii::app()->user->isGuest),



I tried hardcoding the labels, but the ‘url’ is also not working. So it seems to me the module is not loaded correctly.

My config:


<?php


// uncomment the following to define a path alias

// Yii::setPathOfAlias('local','path/to/local-folder');


// This is the main Web application configuration. Any writable

// CWebApplication properties can be configured here.

return array(

		'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',

		

		'name' => 'Testpage - powered by Yii',


		// preloading 'log' component

		'preload' => array('log'),


		// autoloading model and component classes

		'import' => array(

				'application.models.*',

				'application.components.*',

				'application.modules.user.models.*',

				'application.modules.user.components.*',

		),

		

		'modules' => array(

				// uncomment the following to enable the Gii tool


				'gii' => array(

						'class' => 'system.gii.GiiModule',

						'password' => 'admin',

				),


				'modules' => array(

						'user',

				),

		),


		// application components

		'components' => array(

				'user' => array(

						// enable cookie-based authentication

						'allowAutoLogin' => true,

						'loginUrl' => array('/user/login'),

				),

				// uncomment the following to enable URLs in path-format


				'urlManager' => array(

						'urlFormat' => 'path',

						'rules' => array(

								'<controller:\w+>/<id:\d+>' => '<controller>/view',

								'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',

								'<controller:\w+>/<action:\w+>' => '<controller>/<action>',

						),

				),

				// uncomment the following to use a MySQL database


				'db' => array(

						'connectionString' => 'mysql:host=localhost;dbname=oya_yii',

						'emulatePrepare' => true,

						'username' => 'root',

						'password' => 'root',

						'charset' => 'utf8',

				),

				'errorHandler' => array(

						// use 'site/error' action to display errors

						'errorAction' => 'site/error',

				),

				'log' => array(

						'class' => 'CLogRouter',

						'routes' => array(

								array(

										'class' => 'CFileLogRoute',

										'levels' => 'error, warning',

								),

								// uncomment the following to show log messages on web pages


								array(

										'class' => 'CWebLogRoute',

								),

						),

				),

		),

		// application-level parameters that can be accessed

		// using Yii::app()->params['paramName']

		'params' => array(

				// this is used in contact page

				'adminEmail' => 'webmaster@example.com',

		),

);

I have searched for the topic and had a look at the yii-user wiki but could not find anything.

Probably i missed something very easy / stupid, as this is my first try using yii :)

Can you give me some hints, please?

TIA,

Marco

I can see what’s wrong:


                                'modules' => array(

                                                'user',

                                ),



You have a ‘modules’ array inside of a modules array. :)

If you move the ‘user’ entry out of it and into the main ‘modules’ array, it should work.

Thank you so much, of course it works now.

Marco

How to mark this thread as solved? i cannot edit the thread name. Marco

I think you can change the title of the topic by editing the first post. :)

You need to switch to using Full Editor, though.