1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-22 02:50:00 +01:00

Merge pull request #2612 from Dragooon/ticket/12733

[ticket/12733] Add Twitter custom profile field

* Dragooon/ticket/12733:
  [ticket/12733] Add functional test for twitter profile field
  [ticket/12733] Values needn't be escaped for schema_data.sql
  [ticket/12733] Set field_active to 1 for Twitter
  [ticket/12733] Convert spaces to tabs
  [ticket/12733] Fix spacing for block header in profilefield_twitter.php
  [ticket/12733] Update schema.json
  [ticket/12733] Add Twitter custom profile field

Conflicts:
	phpBB/install/schemas/schema.json
	phpBB/install/schemas/schema_data.sql
	phpBB/language/en/memberlist.php
	tests/functional/ucp_profile_test.php
This commit is contained in:
Joas Schilling 2014-06-20 23:37:51 +02:00
commit b9890c6a4c
6 changed files with 73 additions and 2 deletions

View File

@ -2088,6 +2088,10 @@
"UINT",
0
],
"pf_phpbb_twitter": [
"VCHAR",
""
],
"pf_phpbb_facebook": [
"VCHAR",
""

View File

@ -807,6 +807,7 @@ INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_len
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_wlm', 'profilefields.type.string', 'phpbb_wlm', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 7, 1, '', '');
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_yahoo', 'profilefields.type.string', 'phpbb_yahoo', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 8, 1, 'SEND_YIM_MESSAGE', 'http://edit.yahoo.com/config/send_webmesg?.target=%s&.src=pg');
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_facebook', 'profilefields.type.string', 'phpbb_facebook', '20', '5', '50', '', '', '[\w.]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 9, 1, 'VIEW_FACEBOOK_PROFILE', 'http://facebook.com/%s/');
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_twitter', 'profilefields.type.string', 'phpbb_twitter', '20', '1', '15', '', '', '[\w_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 10, 1, 'VIEW_TWITTER_PROFILE', 'http://twitter.com/%s');
# User Notification Options (for first user)
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, '');

View File

@ -772,6 +772,7 @@ $lang = array_merge($lang, array(
2 => 'Total members <strong>%d</strong>',
),
'TRACKED_PHP_ERROR' => 'Tracked PHP errors: %s',
'TWITTER' => 'Twitter',
'UNABLE_GET_IMAGE_SIZE' => 'It was not possible to determine the dimensions of the image. Please verify that the URL you entered is correct.',
'UNABLE_TO_DELIVER_FILE'=> 'Unable to deliver file.',

View File

@ -145,4 +145,5 @@ $lang = array_merge($lang, array(
'VIEWING_PROFILE' => 'Viewing profile - %s',
'VIEW_FACEBOOK_PROFILE' => 'View Facebook Profile',
'VIEW_TWITTER_PROFILE' => 'View Twitter Profile',
));

View File

@ -0,0 +1,60 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\migration\data\v310;
class profilefield_twitter extends \phpbb\db\migration\profilefield_base_migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v310\profilefield_types',
'\phpbb\db\migration\data\v310\profilefield_show_novalue',
);
}
public function update_data()
{
return array(
array('custom', array(array($this, 'create_custom_field'))),
);
}
protected $profilefield_name = 'phpbb_twitter';
protected $profilefield_database_type = array('VCHAR', '');
protected $profilefield_data = array(
'field_name' => 'phpbb_twitter',
'field_type' => 'profilefields.type.string',
'field_ident' => 'phpbb_twitter',
'field_length' => '20',
'field_minlen' => '1',
'field_maxlen' => '15',
'field_novalue' => '',
'field_default_value' => '',
'field_validation' => '[\w_]+',
'field_required' => 0,
'field_show_novalue' => 0,
'field_show_on_reg' => 0,
'field_show_on_pm' => 1,
'field_show_on_vt' => 1,
'field_show_profile' => 1,
'field_hide' => 0,
'field_no_view' => 0,
'field_active' => 1,
'field_is_contact' => 1,
'field_contact_desc' => 'VIEW_TWITTER_PROFILE',
'field_contact_url' => 'http://twitter.com/%s',
);
}

View File

@ -25,15 +25,19 @@ class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case
$this->assertContainsLang('UCP_PROFILE_PROFILE_INFO', $crawler->filter('#cp-main h2')->text());
$form = $crawler->selectButton('Submit')->form(array(
'pf_phpbb_location' => 'Bertie´s Empire',
'pf_phpbb_facebook' => 'phpbb',
'pf_phpbb_location' => 'Bertie´s Empire',
'pf_phpbb_twitter' => 'phpbb_twitter',
));
$crawler = self::submit($form);
$this->assertContainsLang('PROFILE_UPDATED', $crawler->filter('#message')->text());
$crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=profile_info');
$form = $crawler->selectButton('Submit')->form();
$this->assertEquals('Bertie´s Empire', $form->get('pf_phpbb_location')->getValue());
$this->assertEquals('phpbb', $form->get('pf_phpbb_facebook')->getValue());
$this->assertEquals('Bertie´s Empire', $form->get('pf_phpbb_location')->getValue());
$this->assertEquals('phpbb_twitter', $form->get('pf_phpbb_twitter')->getValue());
}
}