Hi.
I have been customizing RC for a big university and I've stumbled upon a problem that I can't seem to get rid of.
So the reason for this plugin is that we need to lock down the ability to edit the name field in the identity form. It gets overwritten after every logon anyway.
The plugin I made is very simple and works as intended. However, as a consequence, every time I try to edit any identity field, I get the formincomplete error (The form was not completely filled out).
<?php
/* Lock the name field in the identity edit form.
*
* @author: Markus Arro
* @version: 31.07.2012
*/
class identity_disable_name extends rcube_plugin
{
public $task = 'settings';
function init()
{
$this->add_hook('identity_form', array($this, 'disable_name'));
}
function disable_name($form) {
$form['form']['addressing']['content']['name']['disabled'] = true;
$form['form']['addressing']['content']['name']['class'] = 'disabled';
return $form;
}
}
The same problem occurs if I make the change directly to program/steps/settings/edit_identity.inc.
I'm guessing the cause is the input validation in program/steps/settings/save_identity.inc:
// check input
if (empty($_POST['_name']) || (empty($_POST['_email']) && IDENTITIES_LEVEL != 1 && IDENTITIES_LEVEL != 3))
{
$OUTPUT->show_message('formincomplete', 'warning');
rcmail_overwrite_action('edit-identity');
return;
}
However, I don't know how to get around it. Ideally, I would like to refrain from making changes to the RC code and implement any new functionality with plugins, as this will simplify future upgrades.
I'd very much appreciate any advice You can give me.