From 8762cf82ca6017015e92aebefd261c5f3ef1c31d Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 24 Apr 2016 19:40:01 -0700 Subject: [PATCH] PM Message limits. --- e107_plugins/pm/admin_config.php | 2 +- e107_plugins/pm/languages/English_admin.php | 2 ++ e107_plugins/pm/pm_shortcodes.php | 14 +++++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/e107_plugins/pm/admin_config.php b/e107_plugins/pm/admin_config.php index 86d8786b1..ce1f05fb6 100644 --- a/e107_plugins/pm/admin_config.php +++ b/e107_plugins/pm/admin_config.php @@ -142,7 +142,7 @@ class private_msg_ui extends e_admin_ui 'attach_size' => array('title'=> ADLAN_PM_28, 'tab'=>1, 'type' => 'number', 'data' => 'int', 'help'=>'', 'writeParms'=>'tdClassRight=form-inline&post=Kb'), 'pm_max_send' => array('title'=> ADLAN_PM_81, 'tab'=>1, 'type' => 'number', 'data' => 'int', 'help'=>''), 'perpage' => array('title'=> ADLAN_PM_24, 'tab'=>0, 'type' => 'number', 'data' => 'int', 'help'=>''), - + 'maxlength' => array('title'=> ADLAN_PM_84, 'tab'=>1, 'type' => 'number', 'data' => 'int', 'help'=>ADLAN_PM_85, 'writeParms'=>array('post'=>'chars.')), ); diff --git a/e107_plugins/pm/languages/English_admin.php b/e107_plugins/pm/languages/English_admin.php index 14f5c6f4e..9c39661f6 100644 --- a/e107_plugins/pm/languages/English_admin.php +++ b/e107_plugins/pm/languages/English_admin.php @@ -76,6 +76,8 @@ define("ADLAN_PM_80", "Preference formats updated"); define("ADLAN_PM_81", "Maximum number of PMs to send immediately"); define("ADLAN_PM_82", "If sending more than this, they are added to a queue and sent out using the cron task"); define("ADLAN_PM_83", "Users may only send messages to users in this class"); +define("ADLAN_PM_84", "Maximum message length"); +define("ADLAN_PM_85", "0 = unlimited"); ?> \ No newline at end of file diff --git a/e107_plugins/pm/pm_shortcodes.php b/e107_plugins/pm/pm_shortcodes.php index 76965567d..27f4428bd 100644 --- a/e107_plugins/pm/pm_shortcodes.php +++ b/e107_plugins/pm/pm_shortcodes.php @@ -245,6 +245,9 @@ if(!class_exists('plugin_pm_pm_shortcodes')) public function sc_pm_form_message() { $value = ''; + $maxlength = ''; + $placeholder = ''; + if(vartrue($this->var['pm_text'])) { if(isset($_POST['quote'])) @@ -253,7 +256,16 @@ if(!class_exists('plugin_pm_pm_shortcodes')) $value = "\n\n\n\n\n\n\n[quote{$t}={$this->var['from_name']}]\n".trim($this->var['pm_text'])."[/quote{$t}]"; } } - return ""; + + + if(!empty($this->pmPrefs['maxlength'])) + { + $length = intval($this->pmPrefs['maxlength']); + $maxlength = "maxlength=".$length; + $placeholder = "placeholder='Max. ".$length." chars.'"; // TODO LAN + } + + return ""; }