Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

CvH
Copy link

@CvH CvH commented Apr 19, 2023

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.

@CvH CvH force-pushed the pr_new_userdialog branch from 38bcd20 to 3908d5c Compare April 20, 2023 15:43
@Neustradamus
Copy link

@CvH: Interesting!

@alecpl: What do you think?

@@ -19,9 +19,12 @@ class new_user_dialog extends rcube_plugin

function init()
{
$rcmail = rcmail::get_instance();
$this->load_config();
Copy link
Member

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');
Copy link
Member

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']
Copy link
Member

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().

Copy link

github-actions bot commented Dec 4, 2024

@pabzm, @alecpl
🛎️ This PR has had no activity in two weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants