This topic has 3 replies, 2 voices, and was last updated 7 years by Kieran_SQ.

  • Author
  • #176698
     rlarson87
    Participant

    Hi, how would I add required fields for “first name” and “last name” to the new user account registration page?

    Also, I would like another field for “company” where user selects from the list of company “listings” on the site? Is this possible too?

    #176715
     Kieran_SQ
    Moderator

    Hi,

    You can create, edit and delete profile fields by going to WP Admin > Users > Profile Fields > Select: Add New. Within this section you can create Field Groups or Fields, Field Groups are profile sections and Fields are what a user will input data into.

    I’ve attached some screenshots on how to create the fields you mentioned above, please let me know how this goes.

    Thanks,

    Kieran.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Custom development requests can be sent to dev@seventhqueen.com, one of the development team will be happy to discuss your needs.

    Attachments:
    You must be logged in to view attached files.
    #176730
     rlarson87
    Participant

    Hello, thanks for your response. This does not answer my question though.

    On the “Register” page (see screenshot), I would like to have “First Name” and “Last Name” fields instead of having a “Name” field.

    Also, on the “Register” page, I would like to add a new field for “Company” where a new user can select from a dropdown list of all the companies that are in the GeoLocator.

    Attachments:
    You must be logged in to view attached files.
    #176733
     Kieran_SQ
    Moderator

    Hi,

    This plugin will allow you to remove the name field from the registration form https://wordpress.org/plugins/advanced-xprofile-fields-for-buddypress/, however you cannot get rid of it completely as it is a core function of BuddyPress. You can also edit the name of the field ‘Name’ by going to WP Admin > Users > Profile Fields > Tab: ‘Base (Primary)’ > Edit: ‘Name (Primary). Once you have edited that you can add a field called Last Name and mark it as required following the steps above.

    It is possible to automatically populate a BuddyPress field with content stored from another plugin but this will require in-depth PHP knowledge and considerable time, therefore it is outside the scope of the support we offer for the theme via the forums. You can contact a developer to do this for you if you do not have intimate PHP knowledge or reach out to one of developers, with as much information as possible, for a quote – they can be reached by emailing dev@seventhqueen.com.

    You can do this manually in bulk by adapting the code below and adding it to your KLEO Child theme’s function.php file by going to WP Admin > Appearance > Editor > KLEO Child > Functions.php. This process is not automatic so if you add more fields (companies) in the future you will need to go to WP Admin > Users > Profile Fields > Desired Field > Edit to add the extra content.

    COPY CODE
    /*
    If you are using BP 2.1+, this will insert a Country selectbox.
    Add the function to bp-custom.php and then visit .../wp-admin/users.php?page=bp-profile-setup
    Remove this function after the field is created.
    */
    
    function bp_add_custom_country_list() {
     
      if ( !xprofile_get_field_id_from_name('Country') && 'bp-profile-setup' == $_GET['page'] ) {
     
    		$country_list_args = array(
    		       'field_group_id'  => 1,
    		       'name'            => 'Country',
    		       'description'	 => 'Please select your country',
    		       'can_delete'      => true,
    		       'field_order' 	 => 2,
    		       'is_required'     => false,
    		       'type'            => 'selectbox',
    		       'order_by'	 => 'custom'
     
    		);
     
    		$country_list_id = xprofile_insert_field( $country_list_args );
     
    		if ( $country_list_id ) {
     
    			$countries = array(
    				"United States",			
    				"Afghanistan",
    				"Albania",
    				"Algeria",
    				"Andorra",
    				"Angola",
    				"Antigua and Barbuda",
    				"Argentina",
    				"Armenia",
    				"Australia",
    				"Austria",
    				"Azerbaijan",
    				"Bahamas",
    				"Bahrain",
    				"Bangladesh",
    				"Barbados",
    				"Belarus",
    				"Belgium",
    				"Belize",
    				"Benin",
    				"Bhutan",
    				"Bolivia",
    				"Bosnia and Herzegovina",
    				"Botswana",
    				"Brazil",
    				"Brunei",
    				"Bulgaria",
    				"Burkina Faso",
    				"Burundi",
    				"Cambodia",
    				"Cameroon",
    				"Canada",
    				"Cape Verde",
    				"Central African Republic",
    				"Chad",
    				"Chile",
    				"China",
    				"Colombi",
    				"Comoros",
    				"Congo (Brazzaville)",
    				"Congo",
    				"Costa Rica",
    				"Cote d'Ivoire",
    				"Croatia",
    				"Cuba",
    				"Cyprus",
    				"Czech Republic",
    				"Denmark",
    				"Djibouti",
    				"Dominica",
    				"Dominican Republic",
    				"East Timor (Timor Timur)",
    				"Ecuador",
    				"Egypt",
    				"El Salvador",
    				"Equatorial Guinea",
    				"Eritrea",
    				"Estonia",
    				"Ethiopia",
    				"Fiji",
    				"Finland",
    				"France",
    				"Gabon",
    				"Gambia, The",
    				"Georgia",
    				"Germany",
    				"Ghana",
    				"Greece",
    				"Grenada",
    				"Guatemala",
    				"Guinea",
    				"Guinea-Bissau",
    				"Guyana",
    				"Haiti",
    				"Honduras",
    				"Hungary",
    				"Iceland",
    				"India",
    				"Indonesia",
    				"Iran",
    				"Iraq",
    				"Ireland",
    				"Israel",
    				"Italy",
    				"Jamaica",
    				"Japan",
    				"Jordan",
    				"Kazakhstan",
    				"Kenya",
    				"Kiribati",
    				"Korea, North",
    				"Korea, South",
    				"Kuwait",
    				"Kyrgyzstan",
    				"Laos",
    				"Latvia",
    				"Lebanon",
    				"Lesotho",
    				"Liberia",
    				"Libya",
    				"Liechtenstein",
    				"Lithuania",
    				"Luxembourg",
    				"Macedonia",
    				"Madagascar",
    				"Malawi",
    				"Malaysia",
    				"Maldives",
    				"Mali",
    				"Malta",
    				"Marshall Islands",
    				"Mauritania",
    				"Mauritius",
    				"Mexico",
    				"Micronesia",
    				"Moldova",
    				"Monaco",
    				"Mongolia",
    				"Morocco",
    				"Mozambique",
    				"Myanmar",
    				"Namibia",
    				"Nauru",
    				"Nepal",
    				"Netherlands",
    				"New Zealand",
    				"Nicaragua",
    				"Niger",
    				"Nigeria",
    				"Norway",
    				"Oman",
    				"Pakistan",
    				"Palau",
    				"Panama",
    				"Papua New Guinea",
    				"Paraguay",
    				"Peru",
    				"Philippines",
    				"Poland",
    				"Portugal",
    				"Qatar",
    				"Romania",
    				"Russia",
    				"Rwanda",
    				"Saint Kitts and Nevis",
    				"Saint Lucia",
    				"Saint Vincent",
    				"Samoa",
    				"San Marino",
    				"Sao Tome and Principe",
    				"Saudi Arabia",
    				"Senegal",
    				"Serbia and Montenegro",
    				"Seychelles",
    				"Sierra Leone",
    				"Singapore",
    				"Slovakia",
    				"Slovenia",
    				"Solomon Islands",
    				"Somalia",
    				"South Africa",
    				"Spain",
    				"Sri Lanka",
    				"Sudan",
    				"Suriname",
    				"Swaziland",
    				"Sweden",
    				"Switzerland",
    				"Syria",
    				"Taiwan",
    				"Tajikistan",
    				"Tanzania",
    				"Thailand",
    				"Togo",
    				"Tonga",
    				"Trinidad and Tobago",
    				"Tunisia",
    				"Turkey",
    				"Turkmenistan",
    				"Tuvalu",
    				"Uganda",
    				"Ukraine",
    				"United Arab Emirates",
    				"United Kingdom",
    				"Uruguay",
    				"Uzbekistan",
    				"Vanuatu",
    				"Vatican City",
    				"Venezuela",
    				"Vietnam",
    				"Yemen",
    				"Zambia",
    				"Zimbabwe"
    			);
    			
    			foreach (  $countries as $country ) {
    				
    				xprofile_insert_field( array(
    					'field_group_id'	=> 1,
    					'parent_id'		=> $country_list_id,
    					'type'			=> 'option',
    					'name'			=> $country,
    					'option_order'   	=> $i++
    				));
    				
    			}
     
    		}
    	}
    }
    add_action('bp_init', 'bp_add_custom_country_list');

    Once you have saved this code in your KLEO Child theme’s functions.php and confirm the field has been created you will need to delete the code.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Custom development requests can be sent to dev@seventhqueen.com, one of the development team will be happy to discuss your needs.

Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?