Navigation: Start Documentation Examples Download Troubleshooting Changelog FORUM

Coding Help

Working with a foreign class might be hard for some people. This is why the MyBB Integrator class is very well documented, helping the programming beginners to find out how the functions work and what every code bit's purpose really is.
Furthermore, a tutorial for each function will be provided on this webpage, including a description of the function itself and how to work with the result it gives you.

Using the MyBB Integration class in your script

In order to get the MyBB Integration class to work, your script required four initial lines. These lines include the core of your forum and the class itself. Furthermore, we need to make the forum believe that we are within its code by defining the constant IN_MYBB. If we do not define this constant, the script will not work. The class needs some of MyBB's major variables to be passed during its creation. If you do not do it as shown in the code, the class cannot provide the functionalities. define('IN_MYBB'NULL);
require_once 
'relative/path/to/the/forum/global.php';
require_once 
'relative/path/to/the/MyBB Integrator class';
$MyBBI = new MyBBIntegrator($mybb$db$cache$plugins$lang$config); 

Note: Throughout the documentation, the initialized object of the MyBB Integrator class will be referenced as $MyBBI

Class Architecture

The class contains the following functions to work with your board:

checkForumPassword($forum_id, $password = '') Examples for this function

This function enables you to authorise access for a specific forum, by defining a password. Return value is the boolean status of the auth process.

closeThread($thread_id, $forum_id = 0) Examples for this function

You may use this function to close one or more threads. Pass a single integer value as $thread_id if you want to close only one thread. If you want to close multiple threads, pass an array of Thread-IDs. The paramater $forum_id is not necessary at all. You may pass the Forum-ID of the thread(s), so you have a nice moderator log entry. Therefore, the second parameter is only for the log entry.
The function returns false, when you are missing permission to close threads. Otherwise it will return true.

createCategory($data, $permissions = array(), $default_permissions = array()) Examples for this function

This function allows you to create a category, which will contain forums. It expects max. 3 parameters. $data is the most important parameter and is required to be passed to the function. Information about the allowed and existing array keys can be taken from the table below.$permissions can be passed and contains an array with the permissions you want to apply to the category. The array needs to have a strict structure.
Following keys are required: canview, canpostthreads, canpostreplys, canpostpolls, canpostattachments.
Furthermore, the next level of the array contains the usergroup-IDs. Here is an example:
$permissions['canview'][3] = 1 would mean that the Usergroup with the ID 3 has the permission to view the category. According to this scheme, every group should be covered with every type of permission. The parameter $default_permissions defines, if the Default Permissions of a user group shall be used. Again, there is a strict structure, which is required for this parameter. The array keys are the group IDs. If true or 1 is assigned to an array item, it will mean that this group shall use the default permissions. Here is an example:
$default_permissions[2] = 1 means that the group having the id = 2 will get the default permissions

Array key in $data Options Description
name String Category Name
description String Description of the category
linkto String Does the category link somewhere?
pid Integer Number ID of the parent category or forum
disporder Integer Number Display order / Position of the category
active Boolean Is this category active?
open Boolean Is this category open?
allowhtml Boolean Allow HTML in this category?
allowmycode Boolean Allow MyCode in this category?
allowsmilies Boolean Allow smilies in this category?
allowimgcode Boolean Allow image codes in this category?
allowpicons Boolean Allow post icons in this category?
allowtratings Boolean Allow thread reatings in this category?
usepostcounts Boolean Count Posts?
password String If the category shall be passworded, you can define a password
showinjump Boolean Shall the category be displayed in the Quickjump menu?
modposts Boolean Enable moderation options for posts?
modthreads Boolean Enable moderation options for threads?
mod_edit_posts Boolean Enable possibility of editing posts?
modattachments Boolean Enable moderation options for attachments
style Integer Number Which style is this category using?
overridestyle Boolean Is the category style overriding the global style?
rulestype Char Type of rules
rulestitle String Title of the forum rules
rules String Forum rules
defaultdatecut Integer Number ID of the thread, where the post shall be located
defaultsortby String Default column, after which the content of a category is sorted
defaultsortorder String Default sort order

createForum($data, $permissions = array(), $default_permissions = array()) Examples for this function

See createCategory for a detailed explanation, since there are no differences (documentation-wise)

createPoll($thread_id, $data) Examples for this function

The function createPoll allows you to attach a poll to an existing thread. Of course, you will have to pass an integer thread ID as the first parameter $thread_id. The second parameter is $data, which holds all the information you will have to pass in order to get a working poll. The array keys of $data can be taken from the table below.

Array key in $data Datatype Description
options Array This contains the options, from which you can chose an answer. It expects an array with the options as values - no special keys needed.
postoptions Array Further settings associated with the poll:
  • multiple: Poll is multiple-choice?
  • public: Public display of "Which users voted for which option"?
In order to take effect, any of these settings must be set to 1 or true
question String The question the poll is about

createPost($data, $inline_errors = true) Examples for this function

The function createPost enables you to create a new post in a specified thread. $data holds the values you want the post to have. For more info about the possible values, see the table below. If an error occures during the post creation, this function will return a formatted error message, if $inline_errors is set to true. Otherwise, it will return you an array, with the single error messages. If no problems occur, the function returns an array, with information about the new post: postID and status of being visible or not

Array key in $data Datatype Description
tid Integer ID of the thread, where the post shall be located
replyto Integer Is the new post a reply to an existing post?
fid Integer ID of the forum, where the thread of the post is located in
subject String The subject of the post (in the forum it is either the threadname or RE: threadname)
icon Integer If the post has a specific icon, you can define it here
uid Integer User-ID of the poster
username String Username of the poster
message String Content of the post
ipaddress String IP-Address of the poster - you can use the function get_ip() here
posthash String This is used for identifying a post before sending it (for instance, if you are adding an attachment) - see this thread on MyBBoard.net
savedraft Boolean Save this post as a draft? (The post will be saved later)
options Array The options array contains further settings, which can be assigned to the post
Existing keys:
  • signature: include signature? (boolean)
  • disablesmilies: Disable Smilies in post? (boolean)
  • subscriptionmethod: Either left empty, "none" for no email notification or "instant" for subscribing with email notification (string)
modoptions Array The modoptions array contains further settings, which are applied to the post after it is created
Existing keys:
  • closethread: Close thread after it is created? (boolean)
  • stickthread: Sticky thread after it is created? (boolean)

createThread($data, $inline_errors = true) Examples for this function

The function createThread enables you to create a new thread in a specified forum. $data holds the values you want the thread to have. For more info about the possible values, see the table below. If an error occures during the thread creation, this function will return a formatted error message, if $inline_errors is set to true. Otherwise, it will return you an array, with the single error messages. If no problems occur, the function returns an array, with information about the new thread: threadID, postID and status of being visible or not

Array key in $data Options Description
fid Integer Number ID of the forum, where the thread shall be located
subject String Title of the Thread
icon Integer Number Defines, if an icon is wanted, which icon it shall be
uid Integer Number User-ID of the thread creator
username String Username of the thread creator
message String Content of the thread post
ipaddress String IP-Address of the thread creator - you can use the function get_ip() here
posthash String This is used for identifying a post before sending it (for instance, if you are adding an attachment) - see this thread on MyBBoard.net
savedraft Boolean Shall the thread be saved as a draft? It will be visible once the user decides to finally send it!
options Array The options array contains further settings, which can be assigned to the thread
Existing keys:
  • signature: include signature? (boolean)
  • disablesmilies: Disable Smilies in post? (boolean)
  • subscriptionmethod: Either left empty, "none" for no email notification or "instant" for subscribing with email notification (string)
modoptions Array The modoptions array contains further settings, which are applied to the thread after it is created
Existing keys:
  • closethread: Close thread after it is created? (boolean)
  • stickthread: Sticky thread after it is created? (boolean)

createUser($data, $inline_errors = true) Examples for this function

You can use createUser to add a new user to the database. This is not the same like register - it is rather comparable with the creation of users in the Admin Panel!
$data contains all values you want to apply to the new user. Information about the possible array keys can be taken from the table below

Array key in $data Options Description
uid Integer Number User-ID
username String Name of the new user
password String Password of the user
password2 String Password confirmation
email String Email address
email2 String Email address confirmation
usergroup Integer Number ID of the primary user group
additionalgroups String Further groups, separated by comma (example: "2,3,5" - "2, 3, 5" should be legitimate as well)
displaygroup Integer Number Display group ID
profile_fields Integer Number ID of the forum, where the thread shall be located
profile_fields_editable Integer Number ID of the forum, where the thread shall be located
regdate Integer Number Timestamp of the date, when the user registered

dbEscape($value) Examples for this function

The function dbEscape uses MyBB's escape routine for working with strings in database queries. This function comes in handy, if you somehow decide to use MyBB's database handler to run database routine yourself.

deletePoll($poll_id) Examples for this function

Deleting a poll can be done with help of the function deletePoll. The function expects one parameter - the ID of the poll, which shall be removed.

deletePollOfThread($thread_id) Examples for this function

If you don't know the exact poll-ID to remove a poll, you can also remove a poll with the function deletePollOfThread. The parameter it expects is the thread ID.

deletePrivateMessage($pm_id) Examples for this function

The function deletePrivateMessage allows you to either delete a single or multiple private messages - depending on the parameter you pass to the function.
If you pass a single integer value as $pm_id, only one private message will be deleted. If you pass an array with many integer values, all private messages - defined by their IDs of course - will be removed.

deletePrivateMessagesOfUser($user_id) Examples for this function

You can remove all private messages of a user by calling the function deletePrivateMessagesOfUser. The expected parameter is the User-ID of the user.

generateCaptcha()

By using the function generateCaptcha, a captcha entry will be stored in the captcha table (in the database). The function returns an array, which allows you to validate the given captcha. This array consists of 4 keys:

function generatePosthash($user_id = 0) Examples for this function

MyBB uses posthashes to identify a post before it is actually saved in the database. Otherwise it would not be able to save attachments before posting a thread.
The function generatePosthash generates you such a hash. A posthash depends on the user ID. If you decide not to pass a parameter to this function, it will use the user ID of the current User - otherwise you can define a special ID.

getBusyThreadsWithinTimespan($timespan = 86400, $post_sort_order = 'DESC', $postamount_sort_order = 'DESC') Examples for this function

If you want to fetch the hottest topics of a certain period of time, then the function getBusyThreadsWithinTimespan is definitely what you are looking for. It does not only return hot threads, but also the posts, which have been posted within the defined timespan. $timespan is of course the timespan you want to specify for the hot threads (in seconds). The default value is 24 hours.
$post_sort_order defines in which sort order you want to receive the posts. Either the posts start with the newest or with the oldest posts.
$postamount_sort_order is another parameter to control the sorting. This time, however, it has an effect on the threads. By default, the busiest threads are being returned. Setting this parameter to "ASC" will give you an array, where the "unbusiest" threads are at the front of the array.

getForum($forum_id) Examples for this function

getForum returns data of a forum according to a specified ID. Returned variable will be an array.

Important:  This function takes forum permissions into consideration since Version 1.1


getForumStaff() Examples for this function

The function getForumStaff returns an array containing all administrative usergroups. Each usergroup is an own array item, whose key is the usergroup ID. The members of each usergroup are located in the associative array item user_list.

getLatestActiveThreads($forum_id, $limit = 7, $exclude_invisible = true) Examples for this function

getLatestActiveThreads returns an array with the latest threads, where posts have been posted. Besides defining the forum ID of the threads, you can also define how many threads you would like to have ($limit) and if you want to get invisible threads as well ($exclude_invisible)

Important:  This function takes forum permissions into consideration since Version 1.1


getLatestThreads($forum_id, $fields = '*', $limit = 7, $exclude_invisible = true, $join_forums = true, $join_first_post = true) Examples for this function

You can return the latest threads by using getLatestThreads. This function will return you threads, regardless of when the last post was posted - only the time of the thread creation matters.

Important:  This function takes forum permissions into consideration since Version 1.1


Parameter Default Value Options Description
$forum_id 0 Integer Number Threads will be taken from the defined forum
Forum ID = 0 will return latest threads of all forums
$fields * String (fields separated by comma) If you want to have certain table fields from the database, specify a string containing them.
Example: "tid, fid, subject, dateline"
$limit 7 Integer Number How many threads shall be returned?
$exclude_invisible TRUE boolean (true or false) Get invisible threads as well?
$join_forums TRUE boolean (true or false) Return forum information as well or only the threads?
True = Return forum information as well
$join_first_post TRUE boolean (true or false) Setting this option to yes will return the information of the first post (= the post of the thread creator)

getLatestPosts($thread_id, $fields = '*', $limit = 7, $exclude_invisible = true) Examples for this function

getLatestPosts returns the latest posted posts of your MyBB forum. $thread_id is the ID of the thread containing the posts you want to fetch. If $thread_id is set to 0, posts of all forums and threads will be taken into consideration.The amount of posts to be fetched can be defined using the parameter $limit. If you want to fetch invisible posts as well, $exclude_invisible should be set to false.

Important:  This function does not take the forum permissions into consideration.


getMembers($data = array()) Examples for this function

In order to display a list of your registered members, the function getMembers comes in very handy. You can pass many parameters to fetch members, which match certain criteria. Below is a list of possible keys of the $data parameter.
Array Key Datatype Default Value Description
aim String   Fetch members, whose AIM begins with given value
icq String   Fetch members, whose ICQ begins with given value
letter Integer   Only read members from database starting with a specific letter? Define "0", when members shall start with number
msn String   Fetch members, whose MSN begins with given value
orderby String u.`username` List will be sorted by given database table field
orderdir String (ASC or DESC) ASC Order direction of the list
page Integer 1 Which page of the list will we be fetching?
perpage Integer Taken from MyBB Settings Order direction of the list
username String   Fetch members starting with a complete string. If this parameter is set to "Mar", userlist will contain names like "Marc", "Marcus", "Marina" and other users starting with "mar" (not case-sensitive)
username_match String begins This parameter refers to the "username" parameter (the one above this one). Any other value than "begins" will be interpreted as "contains"
website String   Fetch members, whose websites begin with given value
yahoo String   Fetch members, whose Yahoo Address begins with given value

getPoll($poll_id) Examples for this function

The function getPoll returns information about a poll according to the given Poll-ID.
The array it returns contains

getPost($post_id, $parsed = false, $override_forum_parse_options = array()) Examples for this function

If you want to return a particular post, use getPost to get the contents and information of a post referring to the $post_id. Additionally, you can set $parsed to true, if you want to run the MyBB Parser over the message of the post. That way, MyCode / BBCode will be transfered into the specific html code. If you should chose to parse the message, you should be aware of the fact that MyBB has own parsing options. With $override_forum_parse_options, you are given the opportunity to set your own options on how the parser should work with the codes. Possible options are: allow_html, allow_mycode, allow_smilies, allow_imgcode, filter_badwords. Set the specific option to true, if you want this option to be taken care of. By default, every option is set to true/yes.

Important:  This function takes forum permissions into consideration since Version 1.1


getPosts($params = array('fields' => '*', 'order_by' => 'dateline', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => 0, 'where' => '')) Examples for this function

Return an array of multiple posts by using the getPosts function. You will have to pass an array containing the parameters for the database query, so you don't get just any posts. Array keys are quite self-explanatory.

Important:  This function does not take the forum permissions into consideration.


Example

// Following code displays authors of posts beginning with "n"
$params = array(
    
'fields' => 'uid, username',
    
'order_by' => 'username',
    
'order_dir' => 'ASC',
    
'limit_start' => 0,
    
'limit' => 10,
    
'where' => 'username LIKE \'n%\''
);
$posts $MyBBI->getPosts($params);
foreach (
$posts as $post)
{
    echo 
$post['username'].'<br />';

getPostsOfThread($thread_id, $fields = '*', $options = array()) Examples for this function

getPostsOfThread returns the thread post and its replies. $thread_id needs to be specified, otherwise the function does not know with which thread it should deal with. If you want to fetch certain fields only, define those in $fields. An options array $option can be passed, if you want to change the order or the limitation of the database result. Possible options / array keys: order_by, order_dir, limit_start, limit

Important:  This function takes forum permissions into consideration since Version 1.1


getPrivateMessagesOfUser($user_id, $params = array('orderby' => 'pm.dateline', 'sort' => 'DESC'), $translate_folders = true) Examples for this function

In order to get the private messages of a user, use getPrivateMessagesOfUser. The only thing, which has to be defined for sure is $user_id. The rest, if not wanted diffently, is predefined. You can specify a particular order of the returned messages. The array key orderby requires an existing table field, while the array key sort requires either ASC or DESC. $translate_folders might seem a little weird in this context. I shall enlighten you my dear uneducated reader. MyBB's private messaging system consists of several folders. At this moment, there are four different folders: Inbox, Sent Items, Drafts, Trash Can. In the database, private messages refer to these folders by IDs. 1 = Inbox, 2 = Sent Items, 3 = Drafts, 4 = Trash Can. Now, the function getPrivateMessagesOfUser will return you a comfortable array, which stores the private messges into sub arrays - the folders. By setting $translate_folders to true, these sub arrays will have the normal readable name, according to your language settings.

Note: The function returns only folders, where private messages actually exist in. Empty folders are not returned!


getThread($thread_id) Examples for this function

This function will return you thread data. It requires an integer ID.

Important:  This function takes forum permissions into consideration since Version 1.1

getUnreadThreadsOfForum($forum_id) Examples for this function

The function getUnreadThreadsOfForum returns an array with unread threads. The parameter is the ID of the forum, you want to fetch the threads from.

getThreads($forum_id, $fields = '*', $where = '', $query_params = array('order_by' => 't.`subject`', 'order_dir' => 'ASC'), $exclude_invisible = true, $join_forums = false, $join_first_post = false) Examples for this function

If you want to get multiple threads, use getThreads to do so. $forum_id is the forum you want to fetch the threads from. It is also possible to fetch threads from more than one forum. You will have to create an array containing the forum IDs (see example). $query_params are options designated to give you the flexibilty to influence the order of the returning threads (the array keys should be quite self-explanatory). If you want to fetch invisible threads, set $exclude_invisible to true. By default, the information of the forum, in which the threads are composed in is not returned. If you want to fetch the information of that forum / the forums as well, set this parameter to true. Last but not least, you might want to fetch the data of the very first post (e.g. if you want to show a part of the thread start). If you want to do so, set $join_first_post to true.

Important:  This function does not take the forum permissions into consideration.

getUser($user_id = 0) Examples for this function

Fetching one's user data might be one of the most important things for forum integration. Return the data by using the function getUser. Only one parameter is required, $user_id. If this parameter is set to 0, the information of the own user will be returned. Otherwise it is the information of the user which matches the given user ID.

getWhoPosted($thread_id, $sort_by_posts = true) Examples for this function

The function getWhoPosted returns members, who have posted in a thread. The first parameter - $thread_id - is the ID of the thread. If the second parameter - $sort_by_posts - is set to true, the returned array will be sorted by the amount of posts by a member.

getWhoVoted($poll_id) Examples for this function

The function getWhoVoted returns members in an array, who have voted in a poll. It expects one parameter - the ID of the poll.

getWhoIsOnline($colored_usernames = true) Examples for this function

A list of current visitors of your site can be fetched by using the function getWhoIsOnline. The function returns an array containing various groups and statistics. For explanation purposes, $array will be the returned array. By setting the parameter $colored_usernames to true, the username of the logged in members will be formatted according to their group color and style.
Array key Datatype Description
$array['bots'] Array Contains arrays which contain information about the bots / spiders / crawlers
$array['count_anonymous'] Integer The amount of visitors who chose not to be displayed by their username but rather to stay anonymous
$array['count_bots'] Integer The amount of bots / spiders / crawlers on your site
$array['count_guests'] Integer The amount of unregistered and non-logged in visitors
$array['count_members'] Integer The amount of logged in users
$array['members'] Array Contains arrays with the member data of logged in members

incViews($thread_id) Examples for this function

This function increases the amount of views of a thread. Only parameter needed is the ID of the thread.

isLoggedIn() Examples for this function

isLoggedIn returns the boolean status (true or false) of the current user, whether he is logged in or not.

function isModerator($forum_id = 0, $action = '', $user_id = 0) Examples for this function

This function returns if a particular user has moderator rights for a defined action and a defined forum. If $user_id is set to 0, the function will check if the current / the own user has the rights for the action. Leave $action an empty string, if you don't want to check for a particular action.

isSuperAdmin($user_id = 0) Examples for this function

isSuperAdmin returns if a user has Super Admin privilege. if $user_id is set to 0, the function will check for the own user, if he has Super Admin rights.

login($username, $password) Examples for this function

Now one of the most important functionalities to take over from a board - the login routine! The two required parameters are the obvious ones: $username expects the username of the user, while $password expects the password. The function will not return a particular error message, but only whether it succeeded (returned value = true) or whether it failed (returned value = false).

Note: The login might not work on your site when using the MyBB Integrator. You have to make sure that the cookies are accessable for the MyBB Integrator. Therefore, double check your cookie domain!


logout() Examples for this function

This function logs a user out. There is no parameter expected, since we do not want to be able to log other users out (e.g. expecting a variable like $user_id). logout returns the boolean status. If logout succeeds, it returns true, otherwise false.
However, in order to logout, you need to add either a GET or POST parameter.
sid: Adding the sid as GET-Parameter - example.com?sid=THE_SID_OF_THE_USER
You can access the sid (session_id) with $MyBBI->mybb->session->sid.

logoutkey: Adding the logoutkey as GET-Parameter - example.com?logoutkey=THE_LOGOUTKEY_OF_THE_USER
You can access the logoutkey with $MyBBI->mybb->user['logoutkey']

markRead($id = 0, $redirect_url = '') Examples for this function

The function markRead sets the status of a forum to "marked". $id specifies which forum there is to be marked as read. If $id is set to 0, all forums will be marked as read. Additionally, there is the option to redirect the user to a defined URL. If you want to do so, pass a second parameter $redirect_url with a string being the URL to be redirected to. The redirection will be performed with MyBB's redirection.

openThread($thread_id, $forum_id = 0) Examples for this function

You may use this function to open one or more threads. Pass a single integer value as $thread_id if you want to open only one thread. If you want to open multiple threads, pass an array of Thread-IDs. The paramater $forum_id is not necessary at all. You may pass the Forum-ID of the thread(s), so you have a nice moderator log entry. Therefore, the second parameter is only for the log entry.
The function returns false, when you are missing permission to open threads. Otherwise it will return true.

parseString($message, $options = array()) Examples for this function

Since MyBB (and various other bulletin boards) store post messages by using BBCodes (or MyCodes), a function would come in handy, which parses these "raw" posts and transforms the BBCodes into the appropriate html code for correct and intended message display. This is the purpose of the function parseString. parseString expects at least one parameter, which is the message / string, which shall be transformed into a more readable text. Therefore $message is the text, which contains the BBCodes. The second parameter you can pass is an array containing the parsing options. For further information about the parsing options, see the table below.
Array key Description
$options['allow_html'] Determines whether HTML code shall be allowed or ignored
$options['allow_mycode'] If this is not set to 1, MyCode / BBCode will not be transformed!
$options['allow_smilies'] Shall smilies be displayed? If yes, set this option to 1
$options['me_username'] If set to 1, /me will be transformed into the own username
$options['nl2br'] Each line break will be transformed into a html line break (<br />), if this option is set to 1
Array key must be set to 1 (or true) in order to take effect.

register($info = array()) Examples for this function

The register function creates a new user in the database of your MyBB forum. The function expects the parameter $info, which should contain as much information about the new user as possible. Required array keys are: username, email, email2. Depending on the setting of user authentification, the array key password and password2 can be a required field as well (only not required, when a random password is sent to the email given). For further information on the possible array keys of $info, see the table below.
The function register returns either an array containing the error messages (if registering fails) or a string, which notifies the user of further actions (e.g. mail will be dispatches containing a random password .... etc)
Array key Description
$info['username'] Username of the new user
$info['password'] The password of the new user
$info['password2'] Confirmation of the password
$info['email'] Email address of the new user
$info['email2'] Confirmation of the email address
$info['referrer'] Username of the user, who referred the new user to your board
$info['language'] Language settings of the new user
$info['profile_fields'] No idea what this does. If anybody does know, please tell me :)
$info['allownotices'] Allow notices? What are notices? Tell me if someone knows :)
$info['hideemail'] Does the new user want to hide his email from other users?
$info['subscriptionmethod'] It obviously has something to do with subscriptions, but what are the possible values? Please tell me :(
$info['receivepms'] Does the user want to be able to receive private messages?
$info['pmnotice'] Does the user want to be notified in case of a new private message?
$info['emailpmnotify'] Does the new user want to receive emails if a new private message arrives?
$info['invisible'] Hide the user from online list?
$info['dstcorrection'] Automatically detect summer time?

removeForumOrCategory($forum_id) Examples for this function

The function removeForumOrCategory allows you to remove a forum or a category in your bulletin board. If you remove a forum, all informatino related to this forum will be deleted as well (threads, posts, subforums etc.)

removePost($post_id) Examples for this function

What is there to say? Removes a post obviously - parameter is the post ID. Returns false if lack of permissions - otherwise it's true.

removeThread($thread_id) Examples for this function

See removePost and replace post with thread :)

removeUser($user) Examples for this function

This function enables you to remove a registered user from your forum. You can either pass the User-ID or the username to specify the user you want to delete.

sendPrivateMessage($data) Examples for this function

The MyBBIntegrator provides you with a function, which can send private messages to one or more users. The parameter it expects is an array with information about receiver, subject, message (so all the data you need for sending a private message). The possible array keys can be taken from the table below.
Array key in $data Datatype Description
bcc String Username(s) of BCC recipients. You may send a private message to more than one BCC member. Multiple member names have to be separated by comma (example: Member1, Member2, Member3, Member152)
fromid Integer Number User-ID of sender
icon Integer If you want to assign an icon to the message, you must pass the number of the icon
message String The message
options Array Possible options to pass to the function / array:
  • signature: Append signature to your message?
  • disablesmilies: Disallowing parsing of smilies in your message?
  • savecopy: Shall a copy of that message be saved in your drafts?
  • readreceipt: Receive a notification when your message has been read?

If you want any of the settings to take effect, the array value needs to be set to 1 or true.
For example: If you want the option signature to take effect, you will have to set $data['options']['signature'] = 1
subject String Subject of the message
to_username String Username(s) of the recipient(s). You may send a private message to more than one member. Multiple member names have to be separated by comma (example: Member1, Member2, Member3, Member152)

updatePasswordOfUser($user_id, $password, $inline_error = true) Examples for this function

If you want to assign a new password to a user, the function updatePasswordOfUser should come in quite handy for you. The function expects at least 2 parameters, which are quite self-explanatory.
The first parameter is the user-ID, while the second parameter is the new password, which shall be applied to the user.

updatePost($data, $inline_errors) Examples for this function

When you want to update a post, you can use the function updatePost. For possible keys in $data, see createPost.

updateThread($data, $inline_errors) Examples for this function

When you want to update a thread, you can use the function updateThread. For possible keys in $data, see createThread.

updateUser($userdata = array(), $inline_error = true) Examples for this function

The function updateUser enables you to update data of a user. More information about the possible array keys and its values can be taken from the table below

Array key in $data Options Description
uid Integer Number User-ID
username String Username
password String Password
password2 String Password Confirmation
email String Email address
email2 String Email address confirmation
website String Homepage of the user
icq String ICQ UIN
aim String Aol Instant Messenger name
yahoo String Yahoo Instant Messenger name
msn String MSN Address
bday String Birthday
birthdayprivacy String Defines how the birthday shall be shown.
  • all: shows full birthday
  • age: shows age only
  • none: doesn't show anything birthday-related
away Boolean Is the user set to "away"?
profile_fields ??? ??? No idea - Give me a shout if somebody knows this!!
style Integer Number Default Forum Theme ID
dateformat String Format to show dates
timeformat String Format to show times
timezone String User's time zone
language String User's language
options Array The options array contains further settings, which can be assigned to the thread
Existing keys:
  • allownotices: Option to allow administrators to mass-email the user
  • hideemail: Option to hide email from members
  • subscriptionmethod:Ehhhh I guess the subscription method? ;)
  • invisible: Option to surf the forum invisibly
  • threadmode: Default thread mode
  • showsigs: Option to show/hide signatures
  • showavatars: Option to show/hide avatars
  • showquickreply: Option to show/hide quick reply
  • remember: Option to remember login details for future visits
  • receivepms: Option to use the PM system
  • pmnotice: ??? No idea - give me a shout if somebody knows this - is there a difference to pmnotify ???
  • daysprune: Default days cut-off for thread listings
  • showcodebuttons: Option to show the MyCode toolbar when posting threads/replies
  • pmnotify: Option to send an email alert when a PM is received
  • showredirect: Option to show/hide "friendly" redirect pages
  • classicpostbit: Probably an option to show the class style of postbits?

validateCaptcha($hash, $string)

In order to check for a correct captcha input, the Integrator provides the function validateCaptcha. The function needs two parameters to work. The function returns true if validation succeeded, returns false if it fails.

vote($poll_id, $user_id = 0, $option = NULL) Examples for this function

You can vote in a poll by using the function vote. The function expects three parameters.
$poll_id ID of the poll the user shall participate in
$user_id ID of the user, which is voting
$option Number of the option the user is voting for