Translations of this page: en bg cs de fi fr hu it ja pl ru tr zh

API for events registration (pun_admin_events)

PunBB 1.3 official extension

  • Status: under development
  • Current version: 0.8.2

General idea

Adds event logging and a GUI for browsing logs.



The extension allows to use API for registration of events.


  • Link “Events” in the “Management” tab in administration menu.
  • “Events page”:
    • On this page all registered events are shown.
    • Event filters:
      • By date from
      • By date to
      • By event's type
      • By IP
      • By username
      • By comment
      • Sort by
      • Sort direction
    • Fields of the event table:
      • IP
      • Event type
      • Event's comment
      • Event date
      • Username of the one who triggers the event


  • New table pun_admin_events
Field Type Default Description
ip VARCHAR(15) IP-address of user, who cause the event
type VARCHAR(64) Type of the event.
comment VARCHAR(255) Some comment about event.
user_id INT(10) NULL User id who cause the event.
user_name VARCHAR(255) NULL Username of user who cause the event.
date INT(10) UNSIGNED Date of the event.

API documentation



Registers an event.

void pun_admin_event(string $type, [string $comment = '', [bool $search_user = true]])

  • string $type: Type of registered events. (Example: “Topic”)
  • string $comment: Comments of registered events. (Example: “Topic under ID 100 has been deleted.”)
  • bool $search_user: If set to true, the function tries to determine the user, who caused the event.


Example 1

The first example shows how to register posts and topics deletion at your forum. Add this piece of code after line 92 of ”<FORUM_ROOT>/delete.php”.

include FORUM_ROOT.'extensions/pun_admin_events/pun_admin_events.php';
pun_admin_event('Topic', 'Topic under ID '.$cur_post['tid'].' has been deleted.', true);

Add this after line 102 of ”<FORUM_ROOT>/delete.php”.

include FORUM_ROOT.'extensions/pun_admin_events/pun_admin_events.php';
pun_admin_event('Post', 'Post under ID '.$cur_post['tid'].' has been deleted.', true);
Example 2

You can use this extension not only for registration of forum events, but also for other purposes. This example shows how to register file downloading using a php script:

define('FORUM_ROOT', './');
include FORUM_ROOT.'extensions/pun_admin_events/pun_admin_events.php';
function download($file, $content_type = 'text/html')
	if (is_readable($file))
		$fp = fopen($file, 'rb');
		header('Content-Type: '.$content_type);
		header('Content-Length: '.filesize($file));
		pun_admin_event('download', 'The file "'.$file.'" has been downloaded.');
		pun_admin_event('download_error', 'Error upon downloading file "'.$file.'"');
$downloads = array('documentation');
if (isset($_GET['id']) && is_scalar($_GET['id']) && in_array($_GET['id'], $downloads))


Personal Tools