I’m installed Yii User Management (Yum) extension in my project. It’s ok when I’m using The User Module. But there is a error when I’m access Profile Modules as following link “../profile/profile/update/id/1”. It brought me a error page : Property “YumUser.profile” is not defined.
after review the error, I found it may be caused by the relations in YumUser. In YumUser model, there is a relation function which return an array of relations but it is cached? I have no idea for this type of relation because I’ve ever did it before:
// possible relations are cached because they depend on the active submodules
// and it takes many expensive milliseconds to evaluate them all the time
public function relations()
{
Yii::import('application.modules.profile.models.*');
$relations = Yii::app()->cache->get('yum_user_relations');
if($relations === false) {
$relations = array();
if (Yum::hasModule('role')) {
Yii::import('application.modules.role.models.*');
$relations['permissions'] = array(
self::HAS_MANY, 'YumPermission', 'principal_id');
$relations['managed_by'] = array(
self::HAS_MANY, 'YumPermission', 'subordinate_id');
$relations['roles'] = array(
self::MANY_MANY, 'YumRole',
Yum::module('role')->userRoleTable . '(user_id, role_id)');
}
if (Yum::hasModule('message')) {
Yii::import('application.modules.message.models.*');
$relations['messages'] = array(
self::HAS_MANY, 'YumMessage', 'to_user_id',
'order' => 'timestamp DESC');
$relations['unread_messages'] = array(
self::HAS_MANY, 'YumMessage', 'to_user_id',
'condition' => 'message_read = 0',
'order' => 'timestamp DESC');
$relations['sent_messages'] = array(
self::HAS_MANY, 'YumMessage', 'from_user_id');
}
if (Yum::hasModule('profile')) {
$relations['visits'] = array(
self::HAS_MANY, 'YumProfileVisit', 'visited_id');
$relations['visited'] = array(
self::HAS_MANY, 'YumProfileVisit', 'visitor_id');
$relations['profile'] = array(
self::HAS_ONE, 'YumProfile', 'user_id');
$relations['privacy'] = array(
self::HAS_ONE, 'YumPrivacySetting', 'user_id');
}
if (Yum::hasModule('friendship')) {
$relations['friendships'] = array(
self::HAS_MANY, 'YumFriendship', 'inviter_id');
$relations['friendships2'] = array(
self::HAS_MANY, 'YumFriendship', 'friend_id');
$relations['friendship_requests'] = array(
self::HAS_MANY, 'YumFriendship', 'friend_id',
'condition' => 'status = 1'); // 1 = FRIENDSHIP_REQUEST
}
if (Yum::hasModule('membership')) {
Yii::import('application.modules.membership.models.*');
$relations['memberships'] = array(
self::HAS_MANY, 'YumMembership', 'user_id');
}
Yii::app()->cache->set('yum_user_relations', $relations, 3600);
}
return $relations;
}
Do you have in your “[color=”#00BFFF"]main.php[/color]" ‘[color="#FF0000"]import [/color][color="#708090"]application.modules.user.models.*[/color]’ and the ‘[color="#FF0000"]modules [/color][color="#808080"]profile[/color]’?
You must have changed the default profile fields. The same thing happened to me when I removed the lastname field and changed the firstname field to name, in order to have a single profile field for name.
On the profile fields management page, it displays correctly and shows the new field(name), but the change is not reflected in the database. So you have to access your database table for profiles(profile in my case) and change the field firstname to name.
I’m installed Yii User Management (Yum) extension in my project. It’s ok when I’m using The User Module. But there is a error :Undefined variable: profile