Phorum Developer Reference Manual

Maurice Makaay

Brian Moon

Thomas Seifert

Andy Taylor

Joe Curia


Table of Contents

Introduction
1. Templates
1.1. Introduction
1.2. Template structure
1.3. How to start your own template
1.4. The Phorum template language
1.4.1. Introduction
1.4.2. General syntax
1.4.3. Data types
1.4.3.1. Integers
1.4.3.2. Strings
1.4.3.3. PHP constants
1.4.3.4. Template variables
1.4.4. Statements
1.4.4.1. Display a variable
1.4.4.2. In line comments
1.4.4.3. DEFINE
1.4.4.4. VAR
1.4.4.5. IF .. ELSEIF .. ELSE ..
1.4.4.6. LOOP
1.4.4.7. INCLUDE
1.4.4.8. HOOK
1.4.5. Need the power of PHP?
2. Modules
2.1. Introduction
2.2. Terminology
2.2.1. Modules
2.2.2. Hacks
2.2.3. Add-ons
2.2.4. Hooks
2.2.5. Hook functions
2.3. Writing your own modules
2.3.1. Introduction
2.3.2. Module information
2.3.3. Module file structure
2.3.3.1. Introduction
2.3.3.2. Single file modules
2.3.3.3. Multiple file modules
2.3.4. Supporting multiple languages
2.3.5. Module data storage
2.3.5.1. Introduction
2.3.5.2. Storing data for messages
2.3.5.3. Storing data for users
2.3.6. Building URLs for Phorum
2.3.6.1. Introduction
2.3.6.2. Build URLs for Phorum PHP scripts: phorum_get_url()
2.3.6.3. Build URLs to files in the Phorum tree
2.3.7. Implementing a settings screen for your module
2.3.7.1. Building input forms
2.3.7.2. Error and success feedback messages
2.3.7.3. Saving module settings to the database
2.3.7.4. Prevent settings.php from being loaded directly
2.3.7.5. Full module settings page example
3. Module hooks
3.1. Introduction
3.2. Request initialization
3.2.1. parse_request
3.2.2. common_pre
3.2.3. common_no_forum
3.2.4. common_post_user
3.2.5. common
3.2.6. page_<phorum_page>
3.3. Page output
3.3.1. phorum_shutdown
3.3.2. get_template_file
3.3.3. start_output
3.3.4. start_output_<page>
3.3.5. after_header
3.3.6. after_header_<page>
3.3.7. output_templates
3.3.8. output_templates_<page>
3.3.9. before_footer_<page>
3.3.10. before_footer
3.3.11. end_output
3.3.12. end_output_<page>
3.4. Miscellaneous
3.4.1. database_error
3.4.2. ajax_<call>
3.4.3. external
3.4.4. scheduled
3.5. Login/Logout
3.5.1. before_logout
3.5.2. after_logout
3.5.3. password_reset
3.5.4. after_login
3.5.5. failed_login
3.6. Message handling
3.6.1. posting_init
3.6.2. posting_permissions
3.6.3. posting_custom_action
3.6.4. before_editor
3.6.5. check_post
3.6.6. before_post
3.6.7. after_message_save
3.6.8. after_post
3.6.9. after_post_redirect
3.6.10. posting_action_cancel_post
3.6.11. before_edit
3.6.12. after_edit
3.6.13. posting_action_edit_post
3.7. File storage
3.7.1. after_detach
3.7.2. before_attach
3.7.3. after_attach
3.7.4. file_retrieve
3.7.5. file_purge_stale
3.7.6. system_max_upload
3.8. User data handling
3.8.1. user_save
3.8.2. user_register
3.8.3. user_get
3.8.4. user_list
3.8.5. user_delete
3.8.6. user_save_groups
3.8.7. before_register
3.8.8. after_register
3.9. User authentication and session handling
3.9.1. user_authenticate
3.9.2. user_session_create
3.9.3. user_session_restore
3.9.4. user_session_destroy
3.10. Admin interface
3.10.1. admin_editforum_form_save_after_defaults
3.10.2. admin_editforum_form_save_inherit
3.10.3. admin_editforum_form_save_inherit_others
3.10.4. admin_editforum_section_edit_forum
3.10.5. admin_forum_delete
3.10.6. admin_css_file
3.10.7. admin_menu
3.10.8. admin_general
3.11. Moderation
3.11.1. email_user_start
3.11.2. send_mail
3.11.3. moderation
3.11.4. before_delete
3.11.5. delete
3.11.6. move_thread
3.11.7. close_thread
3.11.8. reopen_thread
3.11.9. after_approve
3.11.10. hide_thread
3.11.11. after_merge
3.11.12. after_split
3.12. Page data handling
3.12.1. index
3.13. Templating
3.13.1. javascript_register
3.13.2. javascript_filter
3.13.3. css_register
3.13.4. css_filter
3.14. Read messages
3.14.1. read
3.15. Module hooks
3.15.1. bbcode_register
3.16. Private message system
3.16.1. pm_delete_folder
3.16.2. pm_delete
3.16.3. pm_before_send
3.16.4. before_pm_list
3.16.5. pm_list
3.16.6. pm_read
3.16.7. pm_send_init
3.16.8. pm_before_editor
3.17. Buddies system
3.17.1. buddy_list
3.18. Feed
3.18.1. feed_sent
3.19. Message search
3.19.1. search_redirect
3.19.2. search_output
3.20. Control center
3.20.1. cc_panel
3.20.2. cc_save_user

List of Tables

2.1. Keys and values in module information

List of Examples

1.1. Template information file: $info.php
1.2. Template example
1.3. Integer values
1.4. Code using integer values
1.5. String values
1.6. Escaped quotes in string values
1.7. Code using string values
1.8. Code using a PHP constant definition
1.9. Code using built-in PHP constants
1.10. Template variables
1.11. Referencing elements in a template variable array
1.12. Code using template variables
1.13. Display a variable
1.14. Add in line comments
1.15. DEFINE statement usage
1.16. VAR statement usage
1.17. IF .. ELSEIF .. ELSE .. statement usage
1.18. LOOP statement usage
1.19. INCLUDE statement usage
1.20. HOOK statement usage
2.1. Module information
2.2. Single file module
2.3. Multi file module
2.4. Tree structure for a module that supports languages
2.5. Custom language file for a module
2.6. Filling custom profile fields for a user with data
2.7. Generating a profile URL using phorum_get_url()
2.8. Generating a custom script URL using phorum_get_url()
2.9. Generating an absolute URL for a file in a module directory
2.10. Storing settings for a module in the database
2.11. An example module settings.php script