Hi and thanks for reporting.
I have a new personal project involving yum in the next week, so i will fix all things sooner or later. At the moment i just need to waste my time with a non-yii project But customer is customer
Hi and thanks for reporting.
I have a new personal project involving yum in the next week, so i will fix all things sooner or later. At the moment i just need to waste my time with a non-yii project But customer is customer
fixed up the friends module mostly done, all the methods work and are accessable to the user.
added fixes mentioned above.
also added so user can select weather or not to display frinds on user viewable profile.
updated sql tables
mithereal, is this a stand-alone extension or part of the YUM extension?
thx,
–iM
its just a patch for the 1.68 svn revision that fixes various bugs
mithereal ane me just negotiated that patches will be committed by mithereal directly into the repository from now on. with that, we welcome a new developer at yum that has already done good patches, and will help to make yum even better.
that’s awesome! congrats.
when can we expect a new release?
(I know you guys are busy, just askin’
–iM
hi folks, good work, trying out release 177.
still see this error when using custom table names -
CDbException
Description
The table "friendship" for active record class "YumFriendship" cannot be found in the database.
Source File
/var/www/yii/framework/db/ar/CActiveRecord.php(2168)
02156: private $_model;
02157:
02158: /**
02159: * Constructor.
02160: * @param CActiveRecord $model the model instance
02161: */
02162: public function __construct($model)
02163: {
02164: $this->_model=$model;
02165:
02166: $tableName=$model->tableName();
02167: if(($table=$model->getDbConnection()->getSchema()->getTable($tableName))===null)
02168: throw new CDbException(Yii::t('yii','The table "{table}" for active record class "{class}" cannot be found in the database.',
02169: array('{class}'=>get_class($model),'{table}'=>$tableName)));
02170: if($table->primaryKey===null)
02171: $table->primaryKey=$model->primaryKey();
02172: $this->tableSchema=$table;
02173: $this->columns=$table->columns;
02174:
02175: foreach($table->columns as $name=>$column)
02176: {
02177: if(!$column->isPrimaryKey && $column->defaultValue!==null)
02178: $this->attributeDefaults[$name]=$column->defaultValue;
02179: }
02180:
Stack Trace
#0 /var/www/yii/framework/db/ar/CActiveRecord.php(353): CActiveRecordMetaData->__construct(Object(YumFriendship))
#1 /var/www/vams/protected/modules/user/models/YumFriendship.php(11): CActiveRecord::model('YumFriendship')
#2 /var/www/vams/protected/modules/user/models/YumUser.php(226): YumFriendship::model()
#3 /var/www/vams/protected/modules/user/controllers/YumUserController.php(193): YumUser->getFriends()
#4 /var/www/yii/framework/web/actions/CInlineAction.php(57): YumUserController->actionProfile()
#5 /var/www/yii/framework/web/CController.php(300): CInlineAction->run()
#6 /var/www/yii/framework/web/filters/CFilterChain.php(133): CController->runAction(Object(CInlineAction))
#7 /var/www/yii/framework/web/filters/CFilter.php(41): CFilterChain->run()
#8 /var/www/yii/framework/web/CController.php(1084): CFilter->filter(Object(CFilterChain))
#9 /var/www/yii/framework/web/filters/CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain))
#10 /var/www/yii/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter(Object(CFilterChain))
#11 /var/www/yii/framework/web/CController.php(283): CFilterChain->run()
#12 /var/www/yii/framework/web/CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)
#13 /var/www/yii/framework/web/CWebApplication.php(324): CController->run('profile')
#14 /var/www/yii/framework/web/CWebApplication.php(121): CWebApplication->runController('user/user/profi...')
#15 /var/www/yii/framework/base/CApplication.php(135): CWebApplication->processRequest()
#16 /var/www/vams/index.php(13): CApplication->run()
#17 {main}
logging in as admin user, statistics view not found -
CException
Description
YumStatisticsController cannot find the requested view "statistics".
Source File
/var/www/yii/framework/web/CController.php(842)
00830: {
00831: if(($viewFile=$this->getViewFile($view))!==false)
00832: {
00833: $output=$this->renderFile($viewFile,$data,true);
00834: if($processOutput)
00835: $output=$this->processOutput($output);
00836: if($return)
00837: return $output;
00838: else
00839: echo $output;
00840: }
00841: else
00842: throw new CException(Yii::t('yii','{controller} cannot find the requested view "{view}".',
00843: array('{controller}'=>get_class($this), '{view}'=>$view)));
00844: }
00845:
00846: /**
00847: * Renders dynamic content returned by the specified callback.
00848: * This method is used together with {@link COutputCache}. Dynamic contents
00849: * will always show as their latest state even if the content surrounding them is being cached.
00850: * This is especially useful when caching pages that are mostly static but contain some small
00851: * dynamic regions, such as username or current time.
00852: * We can use this method to render these dynamic regions to ensure they are always up-to-date.
00853: *
00854: * The first parameter to this method should be a valid PHP callback, while the rest parameters
Stack Trace
#0 /var/www/yii/framework/web/CController.php(746): CController->renderPartial('statistics', Array, true)
#1 /var/www/vams/protected/modules/user/controllers/YumStatisticsController.php(38): CController->render('statistics', Array)
#2 /var/www/yii/framework/web/actions/CInlineAction.php(57): YumStatisticsController->actionIndex()
#3 /var/www/yii/framework/web/CController.php(300): CInlineAction->run()
#4 /var/www/yii/framework/web/filters/CFilterChain.php(133): CController->runAction(Object(CInlineAction))
#5 /var/www/yii/framework/web/filters/CFilter.php(41): CFilterChain->run()
#6 /var/www/yii/framework/web/CController.php(1084): CFilter->filter(Object(CFilterChain))
#7 /var/www/yii/framework/web/filters/CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain))
#8 /var/www/yii/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter(Object(CFilterChain))
#9 /var/www/yii/framework/web/CController.php(283): CFilterChain->run()
#10 /var/www/yii/framework/web/CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)
#11 /var/www/yii/framework/web/CWebApplication.php(324): CController->run('index')
#12 /var/www/yii/framework/web/CWebApplication.php(121): CWebApplication->runController('user/statistics...')
#13 /var/www/yii/framework/base/CApplication.php(135): CWebApplication->processRequest()
#14 /var/www/vams/index.php(13): CApplication->run()
#15 {main}
bug when updating user info (release 177)
CException
Description
Property "YumUser.users" is not defined.
Source File
/var/www/yii/framework/db/ar/CActiveRecord.php(126)
00114: * PHP setter magic method.
00115: * This method is overridden so that AR attributes can be accessed like properties.
00116: * @param string $name property name
00117: * @param mixed $value property value
00118: */
00119: public function __set($name,$value)
00120: {
00121: if($this->setAttribute($name,$value)===false)
00122: {
00123: if(isset($this->getMetaData()->relations[$name]))
00124: $this->_related[$name]=$value;
00125: else
00126: parent::__set($name,$value);
00127: }
00128: }
00129:
00130: /**
00131: * Checks if a property value is null.
00132: * This method overrides the parent implementation by checking
00133: * if the named attribute is null or not.
00134: * @param string $name the property name or the event name
00135: * @return boolean whether the property value is null
00136: * @since 1.0.1
00137: */
00138: public function __isset($name)
Stack Trace
#0 /var/www/yii/framework/db/ar/CActiveRecord.php(126): CComponent->__set('users', Array)
#1 /var/www/vams/protected/modules/user/controllers/YumUserController.php(329): CActiveRecord->__set('users', Array)
#2 /var/www/yii/framework/web/actions/CInlineAction.php(57): YumUserController->actionUpdate()
#3 /var/www/yii/framework/web/CController.php(300): CInlineAction->run()
#4 /var/www/yii/framework/web/filters/CFilterChain.php(133): CController->runAction(Object(CInlineAction))
#5 /var/www/yii/framework/web/filters/CFilter.php(41): CFilterChain->run()
#6 /var/www/yii/framework/web/CController.php(1084): CFilter->filter(Object(CFilterChain))
#7 /var/www/yii/framework/web/filters/CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain))
#8 /var/www/yii/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter(Object(CFilterChain))
#9 /var/www/yii/framework/web/CController.php(283): CFilterChain->run()
#10 /var/www/yii/framework/web/CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)
#11 /var/www/yii/framework/web/CWebApplication.php(324): CController->run('update')
#12 /var/www/yii/framework/web/CWebApplication.php(121): CWebApplication->runController('user/user/updat...')
#13 /var/www/yii/framework/base/CApplication.php(135): CWebApplication->processRequest()
#14 /var/www/vams/index.php(13): CApplication->run()
#15 {main}
Just co’ed release 182.
Please add the following:
'es' => Yii::t('app', 'es') ,
in views/textsettings/_form.php, line 17.
Also, apply this to the DB schema:
[sql]
ALTER TABLE yumtextsettings
CHANGE COLUMN language
language
ENUM(‘en_us’,‘de’,‘fr’,‘pl’,‘ru’,‘es’) NOT NULL DEFAULT ‘en_us’ ;
[/sql]
Finally, the create action in YumTextSettingController.php is broken. When I have some free time I’ll try to fix it.
Regards,
Is there any reason for a user to have multiple profiles?
The only case I see this useful is if my name happens to be Jason Bourne.
Now seriously, if it is intended to have this multiple profiles schema then I suggest the following:
Adding a ‘activeprofile_id’ field to {{users}} that references the current user profile.
put a public $profile; in models/YumUser.php and create the loadActiveProfile() action. Set this up to autoload the profile on class instantiation.
rename the ‘profile’ relation in YumUser::relations().
alter the user update view to let change its profile.
Doing this modification we can make the code more readable, i.e.
$user->profile->email
instead of
$user->profile[0]->email
to get the mail of his current active profile, and
$user->profiles
instead of
$user->profile
to get them all.
The other approach is to make the relation user<>profile 1:1. Easier. Simpler. KISS.
I’d like to hear other developers opinions about these toughts.
Regards,
The initial thought why a user can have multiple profiles is, that i needed a module that keeps track of data a user changes. today i think it would be better if the relationship between profile and user is 1:1. The Profile table would act as a ‘custom field’ container in which project-specific data can be saved.
Changing the method profiles are handled are relatively easy to be changed, i think. Just make the relation a ONE to ONE and replace all profile[0]-> with profile-> . After that we should remove the now deprecated option "keep Profile History".
If a log needs to be taken, one can use the Audit Trail extension available somewhere in the extension repository.
What do you think about it? Since i start a new Project using yum in the near future (to be exact - today) i would keep care of that change and commit it in one of the next releases…
edit: and yes, i will add the es language in the next commit. Good to hear that Yum has found a user in spain
Just to let you know, I modified the code of sendRegistrationEmail() on YumRegistrationController.php to use also PHPMailer. All the config is written under the module=>user=>phpmailer key in config/main.php.
If you’re interested I will post the code I wrote.
110% agree. The change on the code can be made using the ‘refactor’ option on the IDE you use - unless you use notepad for coding, but wait, who doesn’t!
edit: I think the actual schema you use is really good. Using profile_fields as a dynamic model loaded into profile is just perfect. 100% scalable.
Interesting. Didn’t know about the extension. When I finish the 1st deliverable I’m doing I’m going to check it out.
Ok, just announce when you’re going to make the big commit. I’m also thinking of prepare a diff file against v182. This is a little digest of things I’ve made. Let me tell you, I’ve been messing with your code. A lot.
Some things I did by now:
Modified the YumRegistration::REG_NO_PASSWORD registration logic to let the user change the password when activating the account.
Added support for PHPMailer when sending mails to the user, supporting every single parameter and most public functions of the lib.
Added support for autologin the user after finish the registration process.
Make the generic view/user/message.php to render partials with or without parameters, to make it more flexible.
Removed the dependencies of $profile->firstName and $profile->LastName in the administration interface since those profile fields my not be necesary (as in my case). I know this can be considered evil or mean, but I think it makes the module more generic and KISS-oriented. YMMV.
Fixed ‘fixable’ redirects in the administration interface. I’m sure you already did that either.
All of this stuff can be enabled/disabled/(mis)configured with keys in config/main.php that you can access via Yum::module()->key.
I’m also studying the possibility of integrating FBConnect support to it. But don’t fall off your chair, I have to study it first.
Great. I can make the translations once it gets fairly stable. Actually you already have some ‘es’ translations there but I think they should be more spanish-neutral rather than regionalized (I think those are regionalized, Latin American maybe).
P.D.: I’m from the new continent, from Venezuela. Beautiful land, evil president. sigh
When I try to delete the "demo" user I get something like this:
<title>Object not found!</title>
<link rev="made" href="mailto:postmaster@localhost" />
<style type="text/css"><!–/–><![CDATA[/><!–*/
body { color: #000000; background-color: #FFFFFF; }
a:link { color: #0000CC; }
p, address {margin-left: 3em;}
span {font-size: smaller;}
/]]>/–></style>
</head>
<body>
<h1>Object not found!</h1>
<p>
The requested URL was not found on this server.
The link on the
<a href="http://localhost/testdrive/web/index.php%3fr=user/user/admin">referring
page</a> seems to be wrong or outdated. Please inform the author of
<a href="http://localhost/testdrive/web/index.php%3fr=user/user/admin">that page</a>
about the error.
</p>
<p>
If you think this is a server error, please contact
the <a href="mailto:postmaster@localhost">webmaster</a>.
</p>
What could be wrong?
Try to use the latest SVN version. Maybe in there the error is already fixed.
As I promised, I’ve made a patch for YUM v182 (with some mixes of v186, my bad, no broken code left) with the changes I’ve made for a project I’m working into.
CONTENTS OF THE PATCH:
=====================
A review of what YUM can do applying this patch:
Facebook connect auth support. Requires facebook.php API in dir protected/vendors/facebook/.
Preliminary support for PHPMailer. It can be activated setting Yum::module()->mailer to ‘PHPMailer’ in config/main.cf. It requires the PHPMailer extension.
Modified a bit the registration REG_NO_PASSWORD logic to allow the user change their password inmediately after account activation.
User autologin after registration completion.
User must use the link provided by mail (No web "Insert activation key" stuff).
Removed the firstname and lastname profile fields in code.
View user/message.php now support partials sent from controller (see code for examples).
If a user didn’t activate their account for any reason and attemps to re-register, the option of ‘resend activativation’ appears.
Switches that activates/deactivates all this stuff:
(switch = default_value format below):
activationPasswordSet = false
autoLogin = false
facebook = false
activateFromWeb = true
mailer = ‘yum’ (already existed in previous versions of YUM)
EXAMPLE YUM MODULE CONFIG:
=========================
//Yii User Module
'user'=>array(
'debug'=>true,
'returnUrl' => '/',
'returnLogoutUrl' => '/',
'loginLayout'=>'//layouts/tgp_singlecol',
'layout'=>'//layouts/tgp_singlecol',
'usersTable'=>'users',
'profileTable'=>'profiles',
'profileFieldsTable'=>'profile_fields',
'activationPasswordSet'=>true,
'autoLogin'=>true,
'activateFromWeb'=>true,
'mailer'=>'PHPMailer',
'phpmailer'=>array(
'transport'=>'smtp',
'html'=>true,
'properties'=>array(
'CharSet' => 'UTF-8',
'Host' => 'mail.example.com', // SMTP server
'SMTPDebug' => false, // enables SMTP debug information (for testing)
'SMTPAuth' => true, // enable SMTP authentication
'SMTPSecure' => 'tls', // sets the prefix to the servier
'Host' => 'smtp.gmail.com', // sets GMAIL as the SMTP server
'Port' => 587, // set the SMTP port for the GMAIL server
'Username' => 'info@example.com', // GMAIL username
'Password' => 'icannottell', // GMAIL password
),
'msgOptions'=>array(
'fromName'=>'Registration System',
'toName'=>'You doomed user',
),
),
'facebook'=>array(
'appId'=>'1234567890123456', //not real
'secret'=>'f820ee4d69a126322bb0e97ccafea8e7', //not real
'domain'=>'example.com',
'status'=>true,
'xfbml'=>true,
'cookie'=>true,
'lang'=>'en_US',
),
),
FACEBOOK CONNECT: Yes, yes, la prima donna, die schönste Frau hier, la chica más bonita, красивая женшина.
================
I have to thank the user mech7 for his post in the Creating Facebook Connect thread. This implementation was heavily based on his work.
Said that, let’s go to the point. For Facebook Connect, put this at the very begining of your main layout:
<?php
$fbconfig = Yum::module()->facebook;
if ($fbconfig) {
Yii::import('application.vendors.facebook.*');
require_once('facebook.php');
$facebook = new Facebook($fbconfig);
$fb_session = $facebook->getSession();
if($fb_session)
{
if(Yii::app()->user->isGuest)
{
$action = $this->action->id;
if($action != 'facebook')
{
$this->redirect($this->createUrl('/user/user/facebook'));
}
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
And this just after the <body> tag:
<?php if ($fbconfig): ?>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $facebook->getAppId(); ?>',
session : <?php echo json_encode($fb_session); ?>, // don't refetch the session when PHP already has it
status : <?php echo $fbconfig['status']; ?>, // check login status
cookie : <?php echo $fbconfig['cookie']; ?>, // enable cookies to allow the server to access the session
xfbml : <?php echo $fbconfig['xfbml']; ?> // parse XFBML
});
// whenever the user logs in, we refresh the page
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/<?php echo $fbconfig['lang']; ?>/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<?php endif; ?>
Login/Logout stuff. In your login view put this in the place you think is prettier to show to your neighbours:
<?php if (!Yii::app()->user->isGuest): ?>
<a href="<?php echo $this->createUrl('/user/user/logout'); ?>">
Logout
</a>
<?php else: ?>
<fb:login-button perms="email,user_birthday,publish_stream"></fb:login-button>
<?php endif;>
As alternative to the above login fbmltag, you can use straigh PHP/HTML markup:
<a href="<?php echo $facebook->getLoginUrl(); ?>">
<img style="margin-left: 10px; margin-top: 4px;"
src="<?php echo Yii::app()->baseUrl;?>>/images/signin/facebook.png" /> <!-- Google the image! -->
</a>
DISCLAIMER NOTE: Hell! I love that sentence,
================
I tested the code enough to claim that it is fairly stable and functional. However, I can’t give you any warranties that this stuff will work for you. But, if you have the guts and want to try new features then patch your sources! Feel free to test/hack/improve anything you see either in patch or in YUM module. The entire YUM community will truly appreciate that.
By now, the only documentation for this is the code itself and this post. Please read both before ask ‘how I do this/that in/out there’. Read it twice. Maybe you will find ugly stuff in there. Maybe you’ll say “hell I could do this better”. I’m not a pro. I’m an enthusiast with cool ideas and the need of these ideas to be implemented. Feel free to improve the code, as (I think) I did.
Finally, thyseus please try the patch. I didn’t commit it to the repository because I need to know if you’re agree with all these stuff I wrote. If you like what I did and you’re Ok with it, please commit it by yourself and I promise that I will commit the next improvements I make with no hesitation. At the end, YUM is your baby.
As this code was written for YUM, it adopt the YUM’s license, GLPv3.
Enjoy,
Chirvo.
1023
Nice!but i am unable to apply the patch
Steps to patch the file on Unix/Linux/MacOSX (believe it or not, dunno Windows):
Open a console.
Download the patch file.
wget http://www.yiiframework.com/forum/index.php?app=core&module=attach§ion=attach&attach_id=1023
svn -r 182 checkout http://yii-user-management.googlecode.com/svn/trunk/ yii-user-management-read-only
cd yii-user-management-read-only
zcat ../yum-on-steroids-patch-v182.patch.gz | patch -p1
The final output should be:
patching file user//components/YumUserIdentity.php
patching file user//components/YumWebUser.php
patching file user//controllers/YumActivityController.php
patching file user//controllers/YumInstallController.php
patching file user//controllers/YumProfileController.php
patching file user//controllers/YumRegistrationController.php
patching file user//controllers/YumUserController.php
patching file user//models/YumProfile.php
patching file user//models/YumUser.php
patching file user//UserModule.php
patching file user//views/profile/admin.php
patching file user//views/textsettings/_form.php
patching file var/www/sites/tgc/protected/modules/user//views/user/_activation_passwordform.php
patching file user//views/user/admin.php
patching file user//views/user/menu.php
patching file user//views/user/message.php
patching file user//views/user/registration.php
patching file var/www/sites/tgc/protected/modules/user//views/user/_resend_activation_partial.php
patching file user//views/user/resend_activation.php
patching file user//views/user/view.php
Hope this helps.
About extracting Yii::t and Yum::t for translations, I created a config.php file on protected/messages/ with the following contents:
return array(
'sourcePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'messagePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'messages',
'languages'=>array('es'),
'fileTypes'=>array('php'),
'translator'=>'Yum::t', // <-- Also Yii:t
'exclude'=>array(
'.svn',
'yiilite.php',
'yiit.php',
'/i18n/data',
'/messages',
'/vendors',
'/web/js',
),
);
The translations extracted when using Yii::t seems to be incomplete. It blows up when I use Yum::t
Command used:
php ../../../yiic message config.php
Any guide on how to do this would be enlightening.
Hey, chirvo
yum may be my ‘baby’ cause i started it - but now that is has grown that huge and it is no longer my single project! I have no problems with anyone contributing into trunk/.
I tried to apply your patch to the r189, but, obviously, it says 1 out of 1 hunk FAILED – saving rejects to file […] because your patch belongs to r182. Now there are two ways how to integrate your nice contribution.
Either i patch the r182 and do the 182->189 features again (much work) or you integrate your patch into the r189 (svn or with a r189 compatible patch - much work too, but not as much in my opinion)
anyway: thanks for that work, i really would like to have that into SVN! Let me know what’s better for you.