MilesJ的论坛插件和CakeDC的用户插件

时间:2012-05-04 18:18:23

标签: cakephp cakephp-2.0 cakephp-appmodel cakedc

如何使用CakeDC的用户插件实现MilesJ的论坛插件?

  • CakeDC用户插件工作正常。
  • MilesJ的论坛插件曾经使用过以前自编的用户系统(不使用插件)

http://milesj.me/code/cakephp/forum#user-setup实施论坛插件的说明。但是,它并不期望用户系统使用插件。

这是模型“AppUser”(CakeDC强制命名的名称):

App::uses('User', 'Users.Model');

class AppUser extends User {
    public $useTable = 'users';
    public $hasOne = array('Forum.Profile');    
    public $hasMany = array('Forum.Access','Forum.Moderator'));

}

我继续收到以下错误......

Warning (512): Model "User" is not associated with model "Profile" [CORE\Cake\Model\Behavior\ContainableBehavior.php, line 339]
Warning (512): Model "User" is not associated with model "Access" [CORE\Cake\Model\Behavior\ContainableBehavior.php, line 339]
Warning (512): Model "User" is not associated with model "Profile" [CORE\Cake\Model\Behavior\ContainableBehavior.php, line 339]
Warning (512): Model "User" is not associated with model "Access" [CORE\Cake\Model\Behavior\ContainableBehavior.php, line 339]

我如何确保论坛和用户插件之间有正确的关系?

1 个答案:

答案 0 :(得分:0)

  1. 下载插件并放入插件文件夹 - > app/Plugin/
  2. 将文件夹名称重命名为“论坛”。
  3. 现在转到app/Plugin/Forum/Config/Schema

    文件夹并将所有sql文件放入数据库,前缀为“forum _”

  4. 如果您正在使用auth组件,那么它将自动运行,完成上述步骤后转到http://example.com/forum/ 5.然后在(项目的)用户模型中添加以下关系

    public $ hasOne = array('Profile'=> array(

            'className' => 'Profile',
    
            'foreignKey' => 'user_id',
    
            'dependent' => true,
    
            'conditions' => '',
    
            'fields' => '',
    
            'order' => '',
    
            'limit' => '',
    
            'offset' => '',
    
            'exclusive' => '',
    
            'finderQuery' => '',
    
            'counterQuery' => ''
    
        ),
       )
    
  5. 然后同样适用于Access in Many Relations ship
  6. 然后你会收到错误Fatal error: Call to a member function image() on a non-object in /var/www/projectname/app/Plugin/Utils/View/Helper/GravatarHelper.php on line 89
  7. 这些将你的HTML助手放在app / Plugin / Utils / View / Helper /

    最后一切都需要工作..刚才我开始实现这个..如果你遇到任何错误让我知道