Thursday 08 June 2006 2:34:04 am
Just make a new table in your database where attributes are:
Example
sender_user_id (int)
reciver_user_id (int)
message (text or varchar) date (date or timestamp) Then write new module with view for sending messages and second view for browsing. Fetch only messages for currently logged in user: Quick example which you need to extend for browsing:
<?php
$db =& eZDB::instance();
$tpl =& templateInit();
$user =& eZUser:currentuser();
$rs = $db->arrayQuery( "SELECT * FROM messages WHERE reciver_user_id='" . $user->attribute('contentobject_id') . "'" );
$tpl->setVariable( 'messages', $rs );
$Result['content'] = $tpl->fetch( 'design:myext/messages.tpl' );
?>
Then use foreach for $messages and display sender name, date, and message in template. I did not test the code, it is just quick suggestion which needs to be extended. Proper way is to use eZ publish persisting object and fetch functions for database communication instead of direct SQL queries. Good luck. Let's us know when you make this "private messages" extension ;)
Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog
|