-
Author
-
November 1, 2013 at 19:34 #5645JohnDoeParticipant
i was wondering if this would work, to paste the following code in bp-custom.php
function bp_add_custom_city_list() {if ( !xprofile_get_field_id_from_name('City') && 'bp-profile-setup' == $_GET['page'] ) {
$city_list_args = array(
'field_group_id' => 1,
'name' => 'City',
'description' => 'Please select your city',
'can_delete' => false,
'field_order' => 1,
'is_required' => false,
'type' => 'selectbox',
'order_by' => 'default');
$city_list_id = xprofile_insert_field( $city_list_args );
if ( $city_list_id ) {
$cities = array(
"city",
"city",foreach ( $cities as $i => $city ) {
xprofile_insert_field( array(
'field_group_id' => 1,
'parent_id' => $city_list_id,
'type' => 'selectbox',
'name' => $city,
'option_order' => $i+1
));
}
}
}}
add_action('bp_init', 'bp_add_custom_city_list');November 1, 2013 at 20:27 #5650JohnDoeParticipantUpdated Code to :
//Custom City list
function bp_add_custom_city_list() {if ( !xprofile_get_field_id_from_name($bp_fields['city']) && 'bp-profile-setup' == $_GET['page'] ) {
$city_list_args = array(
'field_group_id' => 1,
'name' => $bp_fields['city'],
'description' => 'Please select your city',
'can_delete' => false,
'field_order' => 6,
'is_required' => true,
'type' => 'selectbox',
'order_by' => 'default');
$city_list_id = xprofile_insert_field( $city_list_args );
if ( $city_list_id ) {
$cities = array(
"city",
"city",
);foreach ( $cities as $i => $city ) {
xprofile_insert_field( array(
'field_group_id' => 1,
'parent_id' => $city_list_id,
'type' => 'selectbox',
'name' => $city,
'option_order' => $i+1
));
}
}
}}
add_action('bp_init', 'bp_add_custom_city_list');
November 1, 2013 at 23:59 #5682SQadminKeymasterSee how we did it for the countries in wp-content/themes/sweetdate/custom_buddypress/bp-functions.php lines: 290 – 518
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionNovember 2, 2013 at 22:24 #5748SQadminKeymasterWe will have something like that in next update.. so maybe is best to wait for it 😉
it will be released this monthHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.