Search code examples
phpmysqlphpbbphpbb3

Creating address_list array in phpBB?


Can someone explain how address_list works in phpBB? I'm attempting to create a small function for automatically inserting private messages and think I have it up to this point:

We'll say my current user array looks like this:

$users = array('100','150','77','94')

where each number is a user's ID.

current address_list looks like this:

'address_list' => array ('u' => array(2 => 'to'))

Yes, it has been taken directly from http://wiki.phpbb.com/Using_phpBB3%27s_Basic_Functions#1.4.7._Inserting_Posts_and_Private_Messages

As far as I can tell, the explanation is telling me that it uses a two-dimensional array, but I don't need to send to groups, and I'm not even sure how to stick a two-dimensional array into that equation. All I want to do is send to the first userid on that list, and the BCC all the others.

Then again, phpBB's documentation has always been near-impossible for me to follow.

Any and all help is appreciated.


Solution

  • The format is as follows:

    'address_list' => array(
        'u' => array(2 => 'to', 3 => 'bcc'),
        'g' => array(40 => 'to', 41 => 'bcc'),
    )
    
    • u contains a mapping of user_id => recipient_type.
    • g contains a mapping of group_id => recipient_type.

    A recipient type can be either to or bcc.

    This example will send the PM to user 2 and group 40, and also send a BCC to user 3 and group 41.