User talk:Posey

Explanation

I personally find it hard to navigate through the Wiki, so I've listed my most used articles and written a few for my own personal reference..

Just found this gem: Area51 Docs: Developing Extensions

GitHub
How to use GitHub properly: Git

How to push from Desktop to Online: git push 'online_repository_link' master -f

Template IF Statements
Here is a list of available IF Statements for template files: Template IF Statements // If user is logged in (still counts for bots) // If user is a bot // If user is logged in and NOT a bot // If user can edit own content (profile) // If user is moderator // If user is administrator

Events
Here is a list of all available phpBB Events (PHP, Template, ACP) : Event List
 * 1) Event_List
 * 2) Event_List
 * 3) Event_List

Standard services.yml and listener.php
Note that the order of the dependencies must be the same in the arguments-list in services.yml and in the __construct of the listener.php !

The passing of dependencies in this way replaces the need of using  in most cases.

Here you can find an example and all possibilities: Dependency_list

Tables
Here is a list of all available phpBB Tables: Tables

Adding your own Table
Author: acme

Extension: demo

Table: tablename

config/tables.yml
parameters: acme.demo.tables.tablename: %core.table_prefix%tablename

config/services.yml
imports: - { resource: tables.yml } services: acme.demo.listener: class: acme\demo\event\main_listener arguments: - %acme.demo.tables.tablename%

event/main_listener.php
class main_listener implements EventSubscriberInterface {  /** @var string */ protected $tablename_table;

/**  * Constructor *  * @param string		$tablename_table	Acme Demo Tablename */

public function __construct($tablename_table) {     $this->tablename_table   = $tablename_table; }  ...

migrations/your_migration_file.php
namespace acme\demo\migrations;

class your_migration_file extends \phpbb\db\migration\migration {  public function update_schema {     return array(         'add_tables'   => array( $this->table_prefix. 'tablename'  => array(               'COLUMNS'   => array( 'column_one_id'   => array('UINT', NULL, 'auto_increment'), 'column_two_txt'  => array('VCHAR:250', ''), ),

'PRIMARY_KEY'  => 'column_one_id', ),        ),      );   }

public function revert_schema {     return array(         'drop_tables'   => array( $this->table_prefix. 'tablename', ),     );   } } Read more about: Umil.table_column_add  - | -  Or about the Database_Type_Map (VHCAR, UINT, etc..)

Custom Profile Fields
Adding profile field: pizza

migrations/profilefield_pizza.php
namespace acme\demo\migrations;

class profilefield_pizza extends \phpbb\db\migration\profilefield_base_migration {  public function update_data {     return array(         array('custom', array(array($this, 'create_custom_field'))),      ); }

protected $profilefield_name = 'phpbb_pizza'; protected $profilefield_database_type = array('VCHAR', ''); protected $profilefield_data = array(     'field_name'           => 'phpbb_pizza',      'field_type'           => 'profilefields.type.string',      'field_ident'          => 'phpbb_pizza',      'field_length'         => '40',      'field_minlen'         => '5',      'field_maxlen'         => '255',      'field_novalue'        => ,      'field_default_value'  => ,      'field_validation'     => '.*',      'field_required'       => 0,      'field_show_novalue'   => 0,      'field_show_on_reg'    => 0,      'field_show_on_pm'     => 1,      'field_show_on_vt'     => 1,      'field_show_on_ml'     => 0,      'field_show_profile'   => 1,      'field_hide'           => 0,      'field_no_view'        => 0,      'field_active'         => 1,      'field_is_contact'     => 1,      'field_contact_desc'   => ,      'field_contact_url'    => ,   ); protected $user_column_name = 'user_pizza'; } If you want to know all possibilities for the database_type, read here: Database_Type_Map

Template File
The custom profile field automatically shows up in the UCP and when filled in, in the places you've set it to show up in profilefield_pizza.php. If you want to use it in any other place in a template file: {custom_fields.FIELD_NAME}{L_COLON} {custom_fields.FIELD_VALUE}

Standard CPF's
Here is a list of all standard Custom Profile Fields. So you can also check what form of validation each type uses..

Parsing Text
If you want to insert and retrieve text from a database, and want to parse BBCode, Smilies, etc..

Here is the tutorial to read all about it: Tutorial.Parsing_text

Notifications
Everything about creating Notifications can be found here: Notifications Tutorial

Do note that all  have to use   infront in order to work.

List #2.1 public function get_type {    return 'acme.demo.notification.type.my_cool_notification'; }

List #3 $this->notification_manager->add_notifications(array( 'acme.demo.notification.type.my_cool_notification', ), $my_notification_data);

Adding Permissions
Adding Permissions through migration file: Migrations/Tools/Permission

More information on it by  VSE : (Dev-Change) Permissions

Checking Permissions
$this->auth->acl_get('u_view_portal') // Get one specific permission $this->auth->acl_gets('a_', 'm_') // Get multiple permissions $this->auth->acl_getf_global('m_'); // Get a forum global

Database Queries
Database_Abstraction_Layer

SQL Build Query (LEFT JOIN)
Dbal.sql_build_query

SQL Build Array
Dbal.sql_build_array

Functions
Here is a list of all documented functions: Functions Category

And here is a list of all Basic Functions: Using_phpBB3%27s_Basic_Functions

request_var
Now used instead of %_GET, $_POST, $_COOKIE and $_REQUEST (in most cases)

Used to get user input into php files.

You can read all about it here: Request_var

Standard
$something = request_var('name-attr', '') name-attr: Name attribute of a field '' : Default value and type identifier

Submit
$submit = (isset($_POST['submit-name'])) ? true : false; // submit-name: Name attribute of the submit button

if($submit) {  // Do something after submit }

Submit Protection
When using users' input, it's important to check for CSRF: Cross-site_request_forgery

Form Key
Add a form key to your form: Function.add_form_key

Check the form key: Function.check_form_key $form_key = 'MyFormName'; // The name attribute of your form add_form_key($form_key);

if (check_form_key($form_key, false, '', true)) {  // Continue with your form processing.. } else {  trigger_error($this->user->lang['FORM_INVALID']); }

Confirm Box
$submit = (isset($_POST['submit-name'])) ? true : false;

if ($submit) {  if (confirm_box(true)) {       // Process your form here // Process some more .. // Show success message and redirect to a given url // In this case we redirect them to /memberlist.php?mode=team after 3 seconds of displaying {L_SUCCESS_SUBMIT} $redirect_url = append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", "mode=team"); $message = $this->user->lang['SUCCESS_SUBMIT']. '

' . sprintf($this->user->lang['RETURN_TO'], '', ''); meta_refresh(3, $redirect_url); // After showing the messing for 3 sec, auto redirects trigger_error($message); // Shows message after successful 'Yes' confirmed }  else {     $s_hidden_fields = build_hidden_fields(array( 'submit'   => true,      // All hidden fields needed to come to a successful 'confirm_box(true)' 'msg_id'   => $msg_id,   // eg. the submit button name attr and a hidden msg_id ));

confirm_box(false, $this->user->['CONFIRM_SUBMIT'], $s_hidden_fields); } }

Creating Modules
Creating_modules

Example Modules