-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# RoundCube New User Dialog Plugin | ||
When a new user is created, this plugin checks the default identity and sets a session flag in case it is incomplete. An overlay box will appear on the screen until the user has reviewed/completed his identity. | ||
|
||
## Configuration | ||
Optional you can specify the default signature, `@EMAIL@` is replaced by the user email. | ||
|
||
``` | ||
$config['new_user_dialog_signature_text'] = ' | ||
Your Name | ||
E-Mail : @EMAIL@ | ||
Website: some.domain | ||
Phone: 01234/567890 | ||
'; | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,12 @@ class new_user_dialog extends rcube_plugin | |
|
||
function init() | ||
{ | ||
$rcmail = rcmail::get_instance(); | ||
$this->load_config(); | ||
$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 commentThe 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 commentThe 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(). |
||
)); | ||
|
||
|
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().