[EXTENSION]: private-messaging This Yii Framework module allows you to add quickly private messaging
#2
Posted 04 July 2012 - 05:26 AM
I'm fairly new to Yii but have years of PHP experience so I'm not finding it too tricky to run with it and implement some of the addons people have created.
I am however confused on how to implement the private-messaging module, which is a shame as it looks really cool from what I've read/seen.
Do you have any additional information not available here on Github.
Ideally a more step-by-step process on adding it to an existing Yii Project or even an example project running this module.
Thanks in advance for your time.
Cade
Weavora Team, on 24 November 2011 - 05:44 AM, said:
#3
Posted 04 July 2012 - 05:46 AM
Cade, on 04 July 2012 - 05:26 AM, said:
I'm fairly new to Yii but have years of PHP experience so I'm not finding it too tricky to run with it and implement some of the addons people have created.
I am however confused on how to implement the private-messaging module, which is a shame as it looks really cool from what I've read/seen.
Do you have any additional information not available here on Github.
Ideally a more step-by-step process on adding it to an existing Yii Project or even an example project running this module.
Thanks in advance for your time.
Cade
I use this extension by following the instructions on the extension page, so they re complete and on step by step basis. But could you perhaps tell us where things goes wrong? any errors?any part you dont understand what It means?
#4
Posted 04 July 2012 - 07:45 AM
Sampa, on 04 July 2012 - 05:46 AM, said:
Hi Sampa,
I loaded all of the files into my project/protected directory however I wasn't sure where the file "MessageModule.php" was meant to be loaded.
When trying to open one of the Controllers, say Inbox I got the following error:
Trying to get property of non-object
$this->userModel = Yii::app()->getModule('message')->userModel;This appears to relate to the calling of the MessageModule.php file and specifically userModel variable, which appears to get assigned during the construct of the class and I assume I need to use something like the following mentioned in the Extension:
return array(
'modules' => array(
'message' => array(
'userModel' => 'User',
'getNameMethod' => 'getFullName',
'getSuggestMethod' => 'getSuggest',
),
),
);
My problem is I'm not sure where to store MessageModule.php or how to load it. I thought maybe it needs to be put into the /config/main.php, but I'm really not sure.
I would really appreciate any information you can give me on this and any corrections to any of my observations I have mentioned above.
#5
Posted 04 July 2012 - 11:45 AM
There you also put the view/controller/models/data folders.
'modules'=>array(
....
'message' => array(
'userModel' => 'User', //make sure this is the same as the user model you use
'getNameMethod' => 'getFullName',
'getSuggestMethod' => 'getSuggest',
),
....
),
#6
Posted 05 July 2012 - 05:31 AM
Sampa, on 04 July 2012 - 11:45 AM, said:
There you also put the view/controller/models/data folders.
'modules'=>array(
....
'message' => array(
'userModel' => 'User', //make sure this is the same as the user model you use
'getNameMethod' => 'getFullName',
'getSuggestMethod' => 'getSuggest',
),
....
),
Yep, that did the trick.
Thanks for all your help
Just to recap for anyone else who is very new to Yii and wants to use this.
Step 1
Extract the contents of the ZIP to /protected/modules/message/
NOTE: the MessageModule.php file should be directly under this directory
Step 2
Modify the protected/config/main.php file and add the following in 'modules' (same location as 'gii'=>array):
'message' => array( 'userModel' => 'User', 'getNameMethod' => 'getFullName', 'getSuggestMethod' => 'getSuggest', 'viewPath' => '/message/fancy', ),
NOTE: The viewPath line at the end is optional and uses the fancy style rather than default
Step 3
Create the database as per the /protected/modules/message/data/message.sql
Step 4
Update your User module (or what module you specify in step 2 to include a getFullName and getSuggest module
examples for this are in the Private Messaging Extension
Step 5
Access the module via: ..../index.php/message
The above will depend on your URL structure
Issues
I did get 1 issue at step 5 where it complained it couldn't find the database {{messages}}.
I had to edit the protected/modules/message/models/Message.php and change the line:
return '{{messages}}';
To
return 'messages';
#7
Posted 05 July 2012 - 04:48 PM
Cade, on 05 July 2012 - 05:31 AM, said:
Thanks for all your help
Just to recap for anyone else who is very new to Yii and wants to use this.
.........
wow, I'm glad it solved it for you and amazing you wrote that "How-to". Thats the spirit.
I think you can have helped some beginners.
#8
Posted 25 July 2012 - 04:17 PM
Extract the contents of the ZIP to /protected/modules/message/
NOTE: the MessageModule.php file should be directly under this directory
Step 2
Modify the protected/config/main.php file and add the following in 'modules' (same location as 'gii'=>array):
'message' => array( 'userModel' => 'User', 'getNameMethod' => 'getFullName', 'getSuggestMethod' => 'getSuggest', 'viewPath' => '/message/fancy', ),
...
It is real step-by-step explanation.Thank you Cade.
#9
Posted 28 February 2013 - 02:33 PM
thanks for this extension. worked out of box
can you suggest how to customize name-suggestions feature to show names near the text-field rather than at the top corner of the page ?
thanks again.

Help












