SHARE
TWEET

Egypt Cities Profile Field Add To bp-custom.php

bphelp May 3rd, 2013 157 Never
  1. <?php
  2. function bp_add_custom_city_list() {
  3.  
  4. if ( !xprofile_get_field_id_from_name('City') && 'bp-profile-setup' == $_GET['page'] ) {
  5.  
  6. $city_list_args = array(
  7. 'field_group_id' => 1,
  8. 'name' => 'City',
  9. 'description' => 'Please select your city',
  10. 'can_delete' => false,
  11. 'field_order' => 1,
  12. 'is_required' => false,
  13. 'type' => 'selectbox',
  14. 'order_by' => 'default'
  15.  
  16. );
  17.  
  18. $city_list_id = xprofile_insert_field( $city_list_args );
  19.  
  20. if ( $city_list_id ) {
  21.  
  22. $cities = array(
  23. "Cairo",
  24. "6th of October City",
  25. "Abu Qurqas",
  26. "Abu Tig",
  27. "Akhmim",
  28. "Thna mountain",
  29. "El Alamein",
  30. "Alexandria",
  31. "Arish",
  32. "Aswan",
  33. "Assiut",
  34. "Baliana",
  35. "Bani Hassan, Egypt",
  36. "Beni Mazar",
  37. "Beni Suef",
  38. "Qusih",
  39. "Dayrout",
  40. "Dakhla",
  41. "Damanhur",
  42. "Damietta",
  43. "Deir Mawas",
  44. "Dendera",
  45. "Desouk",
  46. "Fayoum",
  47. "Jirga",
  48. "Giza",
  49. "Helwan",
  50. "Hurghada",
  51. "Adwa",
  52. "Ismailia",
  53. "Kafr El Dawar",
  54. "Emerging",
  55. "Kom Ombo",
  56. "Luxor",
  57. "Maghagha",
  58. "Mahalla El Kobra",
  59. "Malawi",
  60. "Manfalot",
  61. "Mansoura",
  62. "Maragha",
  63. "Matay",
  64. "Marsa Matrouh",
  65. "Minya",
  66. "Mit Ghamr",
  67. "Nag Hammadi",
  68. "Nubaria",
  69. "Safaga",
  70. "Port Said",
  71. "Rashid",
  72. "St. Catherine",
  73. "Samalut",
  74. "Sdva",
  75. "Siwa",
  76. "Sinbillawain",
  77. "Sharm el-Sheikh",
  78. "Shebin El Koum",
  79. "Shebin El Qanater",
  80. "Shubra Al Khaimah",
  81. "Sohag",
  82. "Suez",
  83. "Tahta",
  84. "Tanta",
  85. "Tama",
  86. "Zagazig",
  87. "Zifta"
  88. );
  89.  
  90. foreach ( $cities as $i => $city ) {
  91. xprofile_insert_field( array(
  92. 'field_group_id' => 1,
  93. 'parent_id' => $city_list_id,
  94. 'type' => 'selectbox',
  95. 'name' => $city,
  96. 'option_order' => $i+1
  97. ));
  98. }
  99. }
  100. }
  101.  
  102.  
  103.  
  104.  
  105. }
  106. add_action('bp_init', 'bp_add_custom_city_list');
  107. ?>
RAW Paste Data
Top