Support only during business hours : Monday to friday, from 8:30 am – 5:30 pm CEST

Due to the decrease in our staff due to vacations, our response time may be longer.

Be sure we're doing our best to manage your topic as soon as possible.

Profile registration data

This topic is resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • SiX Informatics
    Participant
    • 22 Topics
    • 66 Posts
    @xailaes

    One question, I downloaded the demo data and all the countries are in the profile data.

    We will work only in one country, but we have different populations. Do you have any automatic way to put all the populations/cities?

    Thanks

    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    Hi SiX Informatics,

    There is no real automatic way of putting all cities in a field. However you can add a large number of options more easily by creating the field with PHP code.

    As an example, here is a code snippet to add a “Location” field in BuddyPress profiles:

    $field_name = 'Location';
    if ( function_exists( 'xprofile_get_field_id_from_name' ) && ! xprofile_get_field_id_from_name( $field_name ) ) {
    	$field_id = xprofile_insert_field( array(
    		'field_group_id' => 1,
    		'name'           => $field_name,
    		'field_order'    => 200,
    		'is_required'    => true,
    		'type'           => 'selectbox',
    		'can_delete'     => 1,
    	) );
    
    	if ( $field_id ) {
    		$options = array(
    			'New York City',
    			'Los Angeles',
    			'Chicago',
    			'Houston',
    			'Philadelphia',
    		);
    
    		foreach ( $options as $i => $option ) {
    			xprofile_insert_field( array(
    				'field_group_id' => 1,
    				'parent_id'      => $field_id,
    				'type'           => 'selectbox',
    				'name'           => $option,
    				'option_order'   => $i + 1,
    			) );
    		}
    	}
    }

    With this example, you only need to change 'Location' with the name of the field you want to add. Then you can easily change the list of $options with your own list of cities.

    If you want to add this code snippet to your website, we advise that you use the Code Snippets plugin (https://wordpress.org/plugins/code-snippets/). You can also refer to this article of our documentation for more information about Code Snippets:

    Adding Custom PHP Without Changing Your Child Theme

    We hope this can help you with your setup.

    Best regards,

    SiX Informatics
    Participant
    • 22 Topics
    • 66 Posts
    @xailaes

    perfect

    Thank you very much

    Themosaurus
    Keymaster
    Themosaurus Support
    • 1 Topics
    • 1675 Posts
    @themosaurus

    You’re welcome 🙂

    Best regards,

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

The topic ‘Profile registration data’ is closed to new replies.

Troubleshooting Demo Imports

You're trying to setup your theme but you're experiencing errors when importing the demo content? Or you've just followed the setup guide but your website doesn't look exactly like our demo? These are common issues for which you can find easy and quick fixes.

Happy With our Support So Far?

Feel free to review our theme on Themeforest! It helps us making our products more known to new potential customers, which allow us more time to improve the quality and develop new features. #SharingIsCaring ❤️

Discover MatchPress

Skip • Like • Super-Like

Add powerful matching features like Member likes, skips, super likes, conditional private messaging and much more.

Setup Your Cera or Gwangi powered Community Website and Turn it into an iOS and Android App

15% discount for Cera users

To unleash the full power of your Cera or Gwangi theme, we have partnered with the Zipline team. Your community website can now be fully setup and turned into your very own custom app for iOS and Android.

Whether you've newly acquired the theme or already got your site up and running, Zipline got you covered. And we got you an incredible discount.

Holiday, Weather & Festive effects
to pimp your WordPress Site