Forum driver class.

package core_forum_drivers
inherited_from \Forum_driver_base

 Methods

Check the connected DB is valid for this forum driver.

check_db() : boolean

Returns

booleanWhether it is valid

If we can't get a list of admins via a usergroup query, we have to disable the staff filter - else the staff filtering can cause disaster at the point of being turned on (because it can't automatically sync).

disable_staff_filter() : boolean
Inherited

Returns

booleanWhether the staff filter is disabled

Get the topic ID from a topic identifier in the specified forum. It is used by comment topics, which means that the unique-topic-name assumption holds valid.

find_topic_id_for_topic_identifier(string $forum, \SHORT_TEXT $topic_identifier) : \?integer

Parameters

$forum

string

The forum name / ID

$topic_identifier

\SHORT_TEXT

The topic identifier

Returns

\?integerThe topic ID (null: not found)

Attempt to to find the member's language from their forum profile. It converts between language-identifiers using a map (lang/map.ini).

forum_get_lang(\MEMBER $member) : \?LANGUAGE_NAME

Parameters

$member

\MEMBER

The member who's language needs to be fetched

Returns

\?LANGUAGE_NAMEThe member's language (null: unknown)

Get the forum ID from a forum name.

forum_id_from_name(\SHORT_TEXT $forum_name) : integer

Parameters

$forum_name

\SHORT_TEXT

The forum name

Returns

integerThe forum ID

Get a URL to a forum.

forum_url(integer $id, boolean $tempcode_okay = false) : mixed
Inherited

Parameters

$id

integer

The ID of the forum

$tempcode_okay

boolean

Whether it is okay to return the result using Tempcode (more efficient)

Returns

mixedThe URL

Get the forums' table prefix for the database.

get_drivered_table_prefix() : string

Returns

stringThe forum database table prefix

Get an emoticon chooser template.

get_emoticon_chooser(string $field_name = 'post') : \Tempcode

Parameters

$field_name

string

The ID of the form field the emoticon chooser adds to

Returns

\TempcodeThe emoticon chooser template

Find the usergroup ID of the forum guest member.

get_guest_group() : \GROUP
Inherited

Returns

\GROUPThe usergroup ID of the forum guest member

Find the member ID of the forum guest member.

get_guest_id() : \MEMBER

Returns

\MEMBERThe member ID of the forum guest member

Get a member's e-mail address.

get_member_email_address(\MEMBER $id) : \SHORT_TEXT
Inherited

Parameters

$id

\MEMBER

The member

Returns

\SHORT_TEXTThe e-mail address (blank: not known)

Find if this member may have e-mails sent to them

get_member_email_allowed(\MEMBER $member) : boolean

Parameters

$member

\MEMBER

The member ID

Returns

booleanWhether the member may have e-mails sent to them

Get a first known IP address of the given member.

get_member_ip(\MEMBER $member) : \IP

Parameters

$member

\MEMBER

The member ID

Returns

\IPThe IP address

Get the timestamp of a member's join date.

get_member_join_timestamp(\MEMBER $member) : \TIME

Parameters

$member

\MEMBER

The member ID

Returns

\TIMEThe timestamp

Get the photo thumbnail URL for the specified member ID.

get_member_photo_url(\MEMBER $member) : \URLPATH

Parameters

$member

\MEMBER

The member ID

Returns

\URLPATHThe URL (blank: none)

Gets a named field of a member row from the database.

get_member_row_field(\MEMBER $member, string $field) : mixed

Parameters

$member

\MEMBER

The member ID

$field

string

The field identifier

Returns

mixedThe field

Get a list of usergroups a member is in.

get_members_groups(\MEMBER $id, boolean $skip_secret = false, boolean $handle_probation = true) : array
Inherited

Parameters

$id

\MEMBER

The member

$skip_secret

boolean

Whether to skip looking at secret usergroups.

$handle_probation

boolean

Whether to take probation into account

Returns

arrayThe list of usergroups

Get a list of the moderator usergroups.

get_moderator_groups() : array
Inherited

Returns

arrayThe list of usergroups

Get the member ID of the next member after the given one, or NULL.

get_next_member(\MEMBER $member) : \?MEMBER

It cannot be assumed there are no gaps in member IDs, as members may be deleted.

Parameters

$member

\MEMBER

The member ID to increment

Returns

\?MEMBERThe next member ID (null: no next member)

Get the number of new forum posts on the system in the last 24 hours.

get_num_new_forum_posts() : integer
Inherited

Returns

integerNumber of forum posts

Get the number of members currently online on the forums.

get_num_users_forums() : integer

Returns

integerThe number of members

Get the given member's post count.

get_post_count(\MEMBER $member) : integer

Parameters

$member

\MEMBER

The member ID

Returns

integerThe post count

Load extra details for a list of posts. Does not need to return anything if forum driver doesn't support partial post loading (which is only useful for threaded topic partial-display).

get_post_remaining_details(\AUTO_LINK $topic_id, array $post_ids) : array
Inherited

Parameters

$topic_id

\AUTO_LINK

Topic the posts come from

$post_ids

array

List of post IDs

Returns

arrayExtra details

This is the opposite of the get_next_member function.

get_previous_member(\MEMBER $member) : \?MEMBER

Parameters

$member

\MEMBER

The member ID to decrement

Returns

\?MEMBERThe previous member ID (null: no previous member)

Get a list of the super admin usergroups.

get_super_admin_groups() : array
Inherited

Returns

arrayThe list of usergroups

Get the current member's theme identifier.

get_theme(\?ID_TEXT $zone_for = null) : \ID_TEXT
Inherited

Parameters

$zone_for

\?ID_TEXT

The zone we are getting the theme for (null: current zone)

Returns

\ID_TEXTThe theme identifier

Get the rows for the top given number of posters on the forum.

get_top_posters(integer $limit) : array

Parameters

$limit

integer

The limit to the number of top posters to fetch

Returns

arrayThe rows for the given number of top posters in the forum

Get the given member's topic count.

get_topic_count(\MEMBER $member) : integer

Parameters

$member

\MEMBER

The member ID

Returns

integerThe topic count

Get a map of forum usergroups (id=>name).

get_usergroup_list(boolean $hide_hidden = false, boolean $only_permissive = false, boolean $force_show_all = false, \?array $force_find = null, \?MEMBER $for_member = null, boolean $skip_hidden = false) : array
Inherited

Parameters

$hide_hidden

boolean

Whether to obscure the name of hidden usergroups

$only_permissive

boolean

Whether to only grab permissive usergroups

$force_show_all

boolean

Do not limit things even if there are huge numbers of usergroups

$force_find

\?array

Usergroups that must be included in the results (null: no extras must be)

$for_member

\?MEMBER

Always return usergroups of this member (null: current member)

$skip_hidden

boolean

Whether to completely skip hidden usergroups

Returns

arrayThe map

Get a member's username.

get_username(\MEMBER $id, boolean $use_displayname = false) : \?SHORT_TEXT
Inherited

Parameters

$id

\MEMBER

The member

$use_displayname

boolean

Whether to use the displayname rather than the username (if we have them)

Returns

\?SHORT_TEXTThe username (null: deleted member)

Add the specified custom field to the forum (some forums implemented this using proper custom profile fields, others through adding a new field).

install_delete_custom_field(string $name) 
Inherited

Parameters

$name

string

The name of the new custom field

Get an array of attributes to take in from the installer. Almost all forums require a table prefix, which the requirement there-of is defined through this function.

install_specifics() : array

The attributes have 4 values in an array

  • name, the name of the attribute for _config.php
  • default, the default value (perhaps obtained through autodetection from forum config)
  • description, a textual description of the attributes
  • title, a textual title of the attribute

Returns

arrayThe attributes for the forum

Escape a value for HTML embedding, IPB style.

ipb_escape(string $val) : string

Parameters

$val

string

The value to escape

Returns

stringThe escaped value

Unescape from IPB escaping.

ipb_unescape(string $val) : string

Parameters

$val

string

The value to unescape

Returns

stringThe unescaped value

Find out if the given member ID is banned.

is_banned(\MEMBER $member) : boolean

Parameters

$member

\MEMBER

The member ID

Returns

booleanWhether the member is banned

Find if login cookie is md5-hashed.

is_hashed() : boolean

Returns

booleanWhether the login cookie is md5-hashed

Find whether a member is staff.

is_staff(\MEMBER $id, boolean $skip_staff_filter = false) : boolean
Inherited

Parameters

$id

\MEMBER

The member

$skip_staff_filter

boolean

Whether to avoid checking the staff filter (i.e. ignore M.S.N.'s)

Returns

booleanThe answer

Find whether a member is a super administrator.

is_super_admin(\MEMBER $id) : boolean
Inherited

Parameters

$id

\MEMBER

The member

Returns

booleanThe answer

Get a URL to a forum join page.

join_url() : mixed
Inherited

Returns

mixedThe URL

Get an array of members who are in at least one of the given array of usergroups.

member_group_query(array $groups, \?integer $max = null, integer $start = 0) : \?array

Parameters

$groups

array

The array of usergroups

$max

\?integer

Return up to this many entries for primary members and this many entries for secondary members (null: no limit, only use no limit if querying very restricted usergroups!)

$start

integer

Return primary members after this offset and secondary members after this offset

Returns

\?arrayThe array of members (null: no members)

Get a URL to the specified member's home (control panel).

member_home_url(\MEMBER $id) : \URLPATH

Parameters

$id

\MEMBER

The member ID

Returns

\URLPATHThe URL to the members home

Get a URL to send a forum member a PM.

member_pm_url(\MEMBER $id, boolean $tempcode_okay = false) : mixed
Inherited

Parameters

$id

\MEMBER

The forum member

$tempcode_okay

boolean

Whether it is okay to return the result using Tempcode (more efficient)

Returns

mixedThe URL

Get a URL to a forum member's member profile.

member_profile_url(\MEMBER $id, boolean $definitely_profile = false, boolean $tempcode_okay = false) : mixed
Inherited

Parameters

$id

\MEMBER

The forum member

$definitely_profile

boolean

Whether to be insistent that we go to the profile, rather than possibly starting an IM which can link to the profile

$tempcode_okay

boolean

Whether it is okay to return the result using Tempcode (more efficient, and allows keep_* parameters to propagate which you almost certainly want!)

Returns

mixedThe URL

From a member row, get the member's e-mail address.

mrow_email(array $r) : \SHORT_TEXT

Parameters

$r

array

The profile-row

Returns

\SHORT_TEXTThe member e-mail address

From a member row, get the member's primary usergroup.

mrow_group(array $r) : \GROUP

Parameters

$r

array

The profile-row

Returns

\GROUPThe member's primary usergroup

From a member row, get the member's member ID.

mrow_id(array $r) : \MEMBER

Parameters

$r

array

The profile-row

Returns

\MEMBERThe member ID

From a member row, get the member's last visit date.

mrow_lastvisit(array $r) : \TIME

Parameters

$r

array

The profile-row

Returns

\TIMEThe last visit date

Pin a topic.

pin_topic(\AUTO_LINK $id, boolean $pin = true

Parameters

$id

\AUTO_LINK

The topic ID

$pin

boolean

True: pin it, False: unpin it

Get a URL to the specified post ID.

post_url(integer $id, string $forum) : \URLPATH

Parameters

$id

integer

The post ID

$forum

string

The forum ID

Returns

\URLPATHThe URL to the post

Try to find a member with the given IP address

probe_ip(\IP $ip) : array

Parameters

$ip

\IP

The IP address

Returns

arrayThe distinct rows found

Find whether a forum is threaded.

topic_is_threaded(integer $topic_id) : boolean
Inherited

Parameters

$topic_id

integer

The topic ID

Returns

booleanWhether it is

Get a URL to the specified topic ID. Most forums don't require the second parameter, but some do, so it is required in the interface.

topic_url(integer $id, string $forum) : \URLPATH

Parameters

$id

integer

The topic ID

$forum

string

The forum ID

Returns

\URLPATHThe URL to the topic

preg callback.

unentity_1(array $matches) : string

Parameters

$matches

array

Matches

Returns

stringReplacement

preg callback.

unentity_2(array $matches) : string

Parameters

$matches

array

Matches

Returns

stringReplacement

Get a URL to a forum 'user online' list.

users_online_url(boolean $tempcode_okay = false) : mixed
Inherited

Parameters

$tempcode_okay

boolean

Whether it is okay to return the result using Tempcode (more efficient)

Returns

mixedThe URL

Get a URL to the specified forum.

_forum_url(integer $id) : \URLPATH

Parameters

$id

integer

The forum ID

Returns

\URLPATHThe URL to the specified forum

Get the e-mail address for the specified member ID.

_get_member_email_address(\MEMBER $member) : \SHORT_TEXT

Parameters

$member

\MEMBER

The member ID

Returns

\SHORT_TEXTThe e-mail address

Get the IDs of the moderator usergroups.

_get_moderator_groups() : array

It should not be assumed that a member only has one usergroup - this depends upon the forum the driver works for. It also does not take the staff site filter into account.

Returns

arrayThe moderator usergroup IDs

Get the number of new forum posts.

_get_num_new_forum_posts() : integer

Returns

integerThe number of posts

Get the IDs of the admin usergroups.

_get_super_admin_groups() : array

Returns

arrayThe admin usergroup IDs

Get the forum usergroup list.

_get_usergroup_list() : array

Returns

arrayThe usergroup list

Find if the specified member ID is marked as staff or not.

_is_staff(\MEMBER $member) : boolean

Parameters

$member

\MEMBER

The member ID

Returns

booleanWhether the member is staff

Find if the specified member ID is marked as a super admin or not.

_is_super_admin(\MEMBER $member) : boolean

Parameters

$member

\MEMBER

The member ID

Returns

booleanWhether the member is a super admin

Get a URL to the registration page (for people to create member accounts).

_join_url() : \URLPATH

Returns

\URLPATHThe URL to the registration page

Get a URL to send a private/personal message to the given member.

_member_pm_url(\MEMBER $id) : \URLPATH

Parameters

$id

\MEMBER

The member ID

Returns

\URLPATHThe URL to the private/personal message page

Get a URL to the specified member's profile.

_member_profile_url(\MEMBER $id) : \URLPATH

Parameters

$id

\MEMBER

The member ID

Returns

\URLPATHThe URL to the member profile

Get a URL to the members-online page.

_users_online_url() : \URLPATH

Returns

\URLPATHThe URL to the members-online page

 Properties

 

$EMOTICON_CACHE

$EMOTICON_CACHE 

Default

null
 

$MEMBER_ROWS_CACHED

$MEMBER_ROWS_CACHED 

Default

array()
 

$connection

$connection 

Default