Customize MyBB admin log for your own plugins

If you create your own plugins for MyBB, and use admin log system, you will see the message like this in Administrator Logs page:

config-adsmanager - add(1,FingerSports)

It work, and full of information, but not much pretty as you want, right? I have a way to theming this message. ; )

My plugin's name: adsmanager and display its configuration in configuration page. This is a pattern:

{PluginConfigLocation}-{PluginName} - {CommandAndParameter}

You can customize that message as your desire by use edit your plugins.lang.php file in admin's language folder in this way:

$l['admin_log_config_adsmanager_add']    = 'Ads Manager - Added new Ads #{1}: {2}';

This is a pattern:

$l['admin_log_{PluginConfigLocation}_{PluginName}_{Command}'] = '{MessageAndParameterDelimiter}';

In {MessageAndParameterDelimiter} you can display parameter by use {1}, {2}, ..., this parameter come from log_admin_action(parameter1, parameter2, ...); function in your plugin file. And will display as raw text in Administrator Logs, if you didn't theming it.

Notice some thing? Yes!

config-adsmanager - add(1,FingerSports)

And

$l['admin_log_config_adsmanager_add']    = 'Ads Manager - Added new Ads #{1}: {2}';

admin_log is prefix, config is the first word in raw log, adsmanger is my plugin's name, add is command, {1} will replace with 1, and {2} will replace with FingerSports, After theming it, Administrator Logs will display like this:

Ads Manager - Added new Ads #1: FingerSports

That all, got it?

Tags:

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.