bbPress Plugin Browser »

bbPress Moderation Suite (0.1-rc2)

Ban Plus API

If a ban-plus.php file is found in the template directory, it will be loaded with a global variable $ban that includes:

  • type - So far this is always 'temp'
  • length - The duration of the ban in seconds
  • on - The unix timestamp of the ban starting
  • until - The unix timestamp of the ban ending
  • banned_by - The user ID of the person who started the ban
  • notes - Any notes left by the person who started the ban

Here's an example of what a ban-plus.php template might look like:

<?php bb_get_header(); ?>

<div class="notice error" id="message"><p>You have been blocked from the forum until 
<?php echo bb_datetime_format_i18n( $ban['until'] ); ?>, starting on <?php echo bb_datetime_format_i18n( $ban['on'] ); ?>. This ban will last <?php echo bb_since( time() - $ban['length'], true ); ?> in total. Your ban will end in <?php echo bb_since( time() * 2 - $ban['until'], true ); ?>. The reason for the ban was:</p><?php echo $ban['notes']; ?></div>

<?php bb_get_footer(); ?>

For IP bans, ban-plus-ip.php will be used if possible. The only difference is an additional global variable, $ban_ip which is the IP address or CIDR range that was banned.

Mod Log API

To log other actions - for example, those caused by an unrelated plugin - use bbmodsuite_modlog_log( $content, $type )

In order to define a new type, you will have to add a filter to bbmodsuite_modlog_get_type_description and return the user friendly version if the non-user friendly version is given. For example, you could return Topic deletion if the argument to the function is topic_delete, and otherwise just return the argument.