Function Naming 
Custom function names should (as far as possible) describe what they are going to do, so that a person reading the code would have a good idea of how to use and what to expect from a function simply by looking at the name.

Custom function names should be all lower-case and should use underscores to separate words.
$var2 = issomething($var1);

$var2 = isSomething($var2);

$var2 = is_something($var1);
Custom function names should adhere to the following standards
Group PrefixGroup ExplanationExample Functions
print_Functions that directly print out code to the browser or output buffer via echo or print statements.
  • print_input_row
  • print_standard_error
  • print_cp_header
construct_Functions that return variables containing HTML for later printing.
  • construct_edit_toolbar
  • construct_forum_jump
Functions that return true/false based on conditions.
  • is_valid_email
  • is_wysiwyg_compatible
  • contains_bbcode_img_tags
can_Functions that return true/false based on permissions.
  • can_moderate
  • can_administer
  • can_announce
verify_Functions that check conditions and directly drop out to an error message if certain conditions are met.
  • verify_ip_ban
  • verify_post_errors
  • verify_word_allowed
convert_Functions that convert the input variable from one data format to another.
  • convert_kb_to_mb
  • convert_html_to_bbcode
  • convert_bits_to_array
cache_Functions that read data from the database (usually) and create PHP cache variables to lighten the SQL load.
  • cache_templates
  • cache_forums
  • cache_birthdays
fetch_Functions that return arrays / strings / integers etc. If the data type to be returned is not explicit in the function name (such as fetch_template, fetch_userinfo etc.) then specify the type of data in the function name, such as fetch_template_update_sql, fetch_replaced_session_url, fetch_reminders_array etc.
  • fetch_template
  • fetch_user_search_sql
  • fetch_user_location_array
process_Functions that perform actions upon an array in order to prepare it for later reference.
  • process_thread_array
  • process_post_preview
  • process_online_location
build_Functions that save data back to the database for later retrieval, such as caching birthdays into the datastore, rebuilding the style table etc.
  • build_bbcode_cache
  • build_new_post
  • build_attachment
delete_Functions that delete something from the database.
  • delete_thread
  • delete_post_index
  • delete_user_pms
undelete_Functions that reverse a soft deletion.
  • undelete_thread
  • undelete_post
import_Functions from the bbimport system that take an array of data and insert it as a post/thread/user (etc.) record into the database.
  • import_thread
  • import_post
  • import_user
sanitize_Functions that make perform actions on the input parameters in order to make them safe for the next step, such as removing illegal characters, checking that a date is valid, that a $perpage value makes sense etc.
  • sanitize_perpage
  • sanitize_url
  • sanitize_reminder_date
parse_Functions that initialize the bbcode parsing process in some way.
  • parse_bbcode
  • parse_usernote_bbcode
  • parse_pm_bbcode
handle_Functions that are called by the bbcode parser to deal with a particular bbcode type.
  • handle_bbcode_img
  • handle_bbcode_list
  • handle_bbcode_parameter
file_Functions that deal directly with the filesystem.
  • file_read
  • file_download
  • file_append
log_Functions that append to one of vBulletin's logs.
  • log_admin_action
  • log_vbulletin_error
  • log_upgrade_step
exec_Functions that actually perform an action rather than returning something.
  • exec_shutdown
  • exec_queries
  • exec_cron
sort_Functions that sort data.
  • sort_search_items
  • sort_threaded_posts
strip_Functions that strip elements from strings
  • strip_bbcode
  • strip_blank_ascii
  • strip_empty_bbcode
xml_Functions that work to read or output XML.
  • xml_import_style
  • xml_parse_language_otag
  • xml_escape_cdata
Functions that replace built-in PHP functions with vBulletin replacements designed to extend functionality or otherwise alter the behavior of the built-in function. If the original function name contains underscores, prefix with 'vb_' otherwise prefix with 'vb'.
  • vbmail
  • vb_number_format
  • vbsetcookie
js_Javascript functions defined within the PHP code (rather than being in one of the .js files).
  • js_dots
  • js_confirm_clear_db
  • js_forum_jump
Copyright © 2023 MH Sub I, LLC dba vBulletin. All rights reserved. vBulletin® is a registered trademark of MH Sub I, LLC dba vBulletin.