Roundcube Community Forum
SVN Releases => Requests => Topic started by: mortezaipo on February 12, 2013, 01:01:41 PM
-
Hi!
I wrote a simple code that can shows online users.
But I don't know exactly how to add it in roundcube plugins.
has roundcube this plugin that can shows who is online in my contact list?
I didn't find anything.
Thank you.
-
I don't currently know of any RoundCube plugin that does that.
-
So I made that plugin , but I don't know how can I check and control $_GET & $_POST in plugins.
I used Ajax for sending and receiving data.
Please guide me.
Thanks.
-
I'm not sure what you mean, you can read $_GET and $_POST in plugins.
-
I don't know exactly url addressing!
is this correct? $.get('?get_all_user_list',function(back){ ??
-
The url format is:
./?_task=<task>&_action=<action>
So for example:
./?_task=mail&_action=get_all_user_list
-
try "node.js" for library for showing online users & chat options.
-
For v0.8.4 i did it like this:
program/include/rcube_user.php
modify function __construct:
####
function __construct($id = null, $sql_arr = null)
{
$this->rc = rcmail::get_instance();
$this->db = $this->rc->get_dbh();
if ($id && !$sql_arr) {
$sql_result = $this->db->query(
"SELECT * FROM ".get_table_name('users')." WHERE user_id = ?", $id);
$sql_arr = $this->db->fetch_assoc($sql_result);
$sql_loggedusers_result = $this->db->query(
"SELECT count(sess_id) as logged from session");
$sql_loggedusers_arr = $this->db->fetch_assoc($sql_loggedusers_result);
}
if (!empty($sql_arr)) {
$this->ID = $sql_arr['user_id'];
$this->data = $sql_arr;
$this->language = $sql_arr['language'];
$this->loggedusers = $sql_loggedusers_arr['logged'];
}
}
####
program/include/rcube_template.php, add function current_users
public function current_users()
{
$currentusers = $this->app->user->get_loggedusers();
return 'Users online: ' . $currentusers;
}
and modify function __construct (add common UI object):
$this->add_handlers(array(
'loginform' => array($this, 'login_form'),
'preloader' => array($this, 'preloader'),
'username' => array($this, 'current_username'),
'message' => array($this, 'message_container'),
'charsetselector' => array($this, 'charset_selector'),
'aboutcontent' => array($this, 'about_content'),
'current_users' => array($this, 'current_users'),
));
Then in template skins/larry/includes/header.php add:
<div class="topleft">
<roundcube:button name="about" type="link" label="about" class="about-link" onclick="UI.show_about(this);return false" />
<roundcube:if condition="config:support_url" />
<a href="<roundcube:var name='config:support_url' />" target="_blank" class="support-link" id="supportlink"><roundcube:label name="support" /></a>
<roundcube:endif />
<roundcube:object name="current_users" />
</div>
I know this is lame, but I'm not a programmer and this just works!
Regards!