Example #1
0
function phpbb_add_notification_options($user_notify_pm)
{
    global $convert_row, $db;
    $user_id = phpbb_user_id($convert_row['user_id']);
    if ($user_id == ANONYMOUS) {
        return;
    }
    $rows = array();
    $rows[] = array('item_type' => 'post', 'item_id' => 0, 'user_id' => (int) $user_id, 'notify' => 1, 'method' => 'email');
    $rows[] = array('item_type' => 'topic', 'item_id' => 0, 'user_id' => (int) $user_id, 'notify' => 1, 'method' => 'email');
    if ($user_notify_pm) {
        $rows[] = array('item_type' => 'pm', 'item_id' => 0, 'user_id' => (int) $user_id, 'notify' => 1, 'method' => 'email');
    }
    $sql = $db->sql_multi_insert(USER_NOTIFICATIONS_TABLE, $rows);
}
/**
* Obtain the folder_id for the custom folder created to replace the savebox from 2.0.x (used to store saved private messages)
*/
function phpbb_get_savebox_id($user_id)
{
	global $db;

	$user_id = phpbb_user_id($user_id);

	// Only one custom folder, check only one
	$sql = 'SELECT folder_id
		FROM ' . PRIVMSGS_FOLDER_TABLE . '
		WHERE user_id = ' . $user_id;
	$result = $db->sql_query_limit($sql, 1);
	$folder_id = (int) $db->sql_fetchfield('folder_id');
	$db->sql_freeresult($result);

	return $folder_id;
}
Example #3
0
function mybb_insert_zebra_rows($list, $friend, $user_id)
{
	global $db;

	if (!$list)
	{
		return;
	}
	$list = explode(',', $list);
	$insert_ary = array();

	foreach ($list as $zebra_id)
	{
		$insert_ary[] = array(
			'user_id'	=> $user_id,
			'zebra_id'	=> phpbb_user_id($zebra_id),
			'friend'	=> $friend,
			'foe'		=> !$friend,
		);
	}
	$db->sql_multi_insert(ZEBRA_TABLE, $insert_ary);
}