4 * Sample plugin that adds a new tab to the settings section
5 * to display some information about the current user
7 class userinfo extends rcube_plugin
9 public $task = 'settings';
13 $this->add_texts('localization/', array('userinfo'));
14 $this->register_action('plugin.userinfo', array($this, 'infostep'));
15 $this->include_script('userinfo.js');
20 $this->register_handler('plugin.body', array($this, 'infohtml'));
21 rcmail::get_instance()->output->send('plugin');
26 $rcmail = rcmail::get_instance();
27 $user = $rcmail->user;
29 $table = new html_table(array('cols' => 2, 'cellpadding' => 3));
31 $table->add('title', 'ID');
32 $table->add('', Q($user->ID));
34 $table->add('title', Q($this->gettext('username')));
35 $table->add('', Q($user->data['username']));
37 $table->add('title', Q($this->gettext('server')));
38 $table->add('', Q($user->data['mail_host']));
40 $table->add('title', Q($this->gettext('created')));
41 $table->add('', Q($user->data['created']));
43 $table->add('title', Q($this->gettext('lastlogin')));
44 $table->add('', Q($user->data['last_login']));
46 $identity = $user->get_identity();
47 $table->add('title', Q($this->gettext('defaultidentity')));
48 $table->add('', Q($identity['name'] . ' <' . $identity['email'] . '>'));
50 return html::tag('h4', null, Q('Infos for ' . $user->get_username())) . $table->show();