diff --git a/phpBB/install/schemas/schema.json b/phpBB/install/schemas/schema.json index b7c67de7fe..e7c43e40ec 100644 --- a/phpBB/install/schemas/schema.json +++ b/phpBB/install/schemas/schema.json @@ -2088,6 +2088,10 @@ "UINT", 0 ], + "pf_phpbb_twitter": [ + "VCHAR", + "" + ], "pf_phpbb_facebook": [ "VCHAR", "" diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 7ed2ec76fa..1888e79cf7 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -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, ''); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 976feef234..e8d02a288f 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -772,6 +772,7 @@ $lang = array_merge($lang, array( 2 => 'Total members %d', ), '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.', diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php index 341c1620b7..9e01d396fd 100644 --- a/phpBB/language/en/memberlist.php +++ b/phpBB/language/en/memberlist.php @@ -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', )); diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php b/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php new file mode 100644 index 0000000000..68d038f609 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php @@ -0,0 +1,60 @@ + +* @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', + ); +} diff --git a/tests/functional/ucp_profile_test.php b/tests/functional/ucp_profile_test.php index 2cc279eccc..8003640e76 100644 --- a/tests/functional/ucp_profile_test.php +++ b/tests/functional/ucp_profile_test.php @@ -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()); } }