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

PunBB 1.3 constants

The forum uses constants to define some values, which are used in the code. The values of the constants can be:

  • Flag (Is debug mode enabled, etc.)
  • String value (file path, etc.)
  • Numeric (group id, etc.)

The forum has two groups of constants:

  • Pre-defined constants
  • User-defined constants.

Here is the description of most used constants.

Pre-defined constants

Constant Default value Shot description
FORUM_UNVERIFIED 0 The group ID for users before verification of user's e-mail address.
FORUM_ADMIN 1 The group ID for administrators.
FORUM_GUEST 2 The group ID for the Guest user.
FORUM_MAX_POSTSIZE_BYTES 65535 Maximum size of post in bytes.

User-defined constants

FORUM_DEBUG

  • Enables the debug mode, which provides detailed output of error messages, shows script generation times, number of queries executed in the footer. The debug mode should be disabled on a production server.
  • Example:
define('FORUM_DEBUG', 1);

FORUM_SHOW_QUERIES

  • All executed SQL queries will be shown in the footer if this constant is defined. Use this constant only for development purposes, it must not be used on a production server.
  • Example:
define('FORUM_SHOW_QUERIES', 1);

FORUM_VERSION

  • The version a code is written for. It is used only during installation and update processes. You can get the version of the forum from $forum_config['o_cur_version'].

FORUM_DB_REVISION

  • The database revision a code is written for. It is used only during installation and update processes. You can get the DB reversion of the forum from $forum_config['o_database_revision'].

FORUM_NO_SET_NAMES

  • If this constant is defined, the database layer will not to send SET NAMES 'utf8'; query to the database. This constant is used only to allow the update script to access non UTF-8 data.

FORUM_ROOT

  • The relative path from a current folder to the forum's folder. This constant is defined on every forum page. If you create a new forum page, you should define it manually.
  • Example:
define('FORUM_ROOT', './');

FORUM_IGNORE_REQUEST_URI

  • When a user requests a forum page, PunBB try to automatically fix $_SERVER['REQUEST_URI'], if it isn't valid. Defining this constant will prevent the forum from doing this. Use this constant for integration, if you have some problems with URI.
  • Example:
define('FORUM_IGNORE_REQUEST_URI', 1);

FORUM_DISABLE_HOOKS

  • If this constant is defined, the code of installed extensions will not be executed.
  • Example:
define('FORUM_DISABLE_HOOKS', 1);

FORUM_DISABLE_CSRF_CONFIRM

  • Defining this constant stops the forum's CSRF protection. It is strongly not recommended to do this.
  • Example:
define('FORUM_DISABLE_CSRF_CONFIRM', 1);

FORUM_TURN_OFF_MAINT

  • Define this constant if all administrators are logged out of the forum, to turn off the maintenance mode.
  • Example:
define('FORUM_TURN_OFF_MAINT', 1);

FORUM_CACHE_DIR

  • The path to the cache directory (by default it is set to FORUM_ROOT.'cache/' ).
  • Example:
define('FORUM_CACHE_DIR', '/tmp/punbb_cache');

FORUM_PAGE

  • The name of the forum page which is currently running. This constant is defined on every forum page. If you create a new forum page, you should define it manually.
  • Example:
define('FORUM_PAGE', 'viewtopic');

Personal Tools