MyBB Community Forums

Full Version: PM notification: How to limit the message length
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Dear MyBB Community,

I found there is a setting Amount of Characters for Subscription Previews in the Posting settings to limit the size of the content being sent for new posts.

Is there a similar setting for the PM notifications, so I can limit the number of characters for these emails?

You can open inc/datahandlers/pm.php , find:
$pm['message'] = $parser->text_parse_message($pm['message'], array('me_username' => $pm['sender']['username'], 'filter_badwords' => 1, 'safe_html' => 1));
and add after:
$email_pm = my_substr($pm['message'], 0, 50); // 50 = character limit

And change:
$emailmessage = $lang->sprintf($emailmessage, $recipient['username'], $pm['sender']['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $pm['message']);
$emailmessage = $lang->sprintf($emailmessage, $recipient['username'], $pm['sender']['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $email_pm);