-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add signature template to new_user_dialog plugin #8983
base: master
Are you sure you want to change the base?
Conversation
@@ -19,9 +19,12 @@ class new_user_dialog extends rcube_plugin | |||
|
|||
function init() | |||
{ | |||
$rcmail = rcmail::get_instance(); | |||
$this->load_config(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FOr better performance loading config file should be done only when it's needed, i.e. not in init().
$this->add_hook('identity_create', [$this, 'create_identity']); | ||
$this->add_hook('render_page', [$this, 'render_page']); | ||
$this->register_action('plugin.newusersave', [$this, 'save_data']); | ||
$this->signature_text = $rcmail->config->get('new_user_dialog_signature_text'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-existing property warning. This can be a normal variable if you move it to render_page().
@@ -89,6 +92,7 @@ function render_page($p) | |||
'name' => '_signature', | |||
'rows' => '5', | |||
], | |||
$out = str_replace('@EMAIL@', rcube_utils::idn_to_utf8($identity['email']) , $this->signature_text ?? ''), | |||
$identity['signature'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong. If signature already exists (which could be set by another plugin) it should be used. $out variable is not needed here.
Also, it was missing before, but I think the content need to be encoded with rcube::Q().
This adds the possibility to define a default signature. Additionally the signature email gets replaced with the user email if
@EMAIL@
get added at the signature.To configure the default signature add this to the
config/config.inc.php
$config['new_user_dialog_signature_text'] = ' ... ';
Just for full transparency, I have no PHP skills. So while it works perfectly for me I have no real idea if this is "properly" done.