MyBB
Get preview of messages.
I like to trim long messages to show only a portion of it to the front end user. I do this directly in my forum or as a feature while coding multiple plugins. Here I will explain to you how to do it directly within your theme.
Requirements
- []Upload Template Conditionals plugin by Yumi and activate it (v1.7.7 as of this).
[]Upload the following plugin file to your plugin directory and activate it.
Steps
After installing both plugins.
- Go to your FTP, inside your plugins directory, find and open the “phptpl_allowed_funcs.txt” file.
Find:
Code:validate_email_format
Add after:
Code:ougc_getpreview
You should now be able to use any of the following within your templates to strip any message down.
You can use something like:
Code:
<?=ougc_getpreview($post['message'])?>
<?=ougc_getpreview($post['message'], 100)?>
<?=ougc_getpreview($post['message'], 50, false)?>
<?=ougc_getpreview($post['message'], 0, true, false)?>I hope it is of some use for you.