BuddyDev

Search

Uploading Language List for multi select box in Buddy press

  • Participant
    Level: Initiated
    Posts: 1
    Marius on #18699

    Can you please comment and check where I went wrong. This is for Bp-cutom.php to upload a multi select box content.

    (‘<?php
    // hacks and mods will go here
    ?>

    /**
    * If you are using BP 2.1+, this will insert a Language Multi Select Box.
    * Add the function to bp-custom.php and then visit …/wp-admin/users.php?page=bp-profile-setup
    */
    <?php
    function bp_add_custom_language_list() {

    if ( !xprofile_get_field_id_from_name(‘language’) && ‘bp-profile-setup’ == $_GET[‘page’] ) {

    $language_list_args = array(
    ‘field_group_id’ => 1,
    ‘name’ => ‘Language’,
    ‘description’ => ‘Please select your Language’,
    ‘can_delete’ => false,
    ‘field_order’ => 2,
    ‘is_required’ => false,
    ‘type’ => ‘Multi Select Box’,
    ‘order_by’ => ‘custom’

    );

    $language_list_id = xprofile_insert_field( $language_list_args );

    if ( $language_list_id ) {

    $languages = array(
    “Acholi”,
    “Afrikaans”,
    “Akan”,
    “Albanian”,
    “Amharic”,
    “Arabic”,
    “Ashante”,
    “Asl”,
    “Assyrian”,
    “Azerbaijani”,
    “Azeri”,
    “Bajuni”,
    “Basque”,
    “Behdini”,
    “Belorussian”,
    “Bengali”,
    “Berber”,
    “Bosnian”,
    “Bravanese”,
    “Bulgarian”,
    “Burmese”,
    “Cakchiquel”,
    “Cambodian”,
    “Cantonese”,
    “Catalan”,
    “Chaldean”,
    “Chamorro”,
    “Chao-chow”,
    “Chavacano”,
    “Chin”,
    “Chuukese”,
    “Cree”,
    “Croatian”,
    “Czech”,
    “Dakota”,
    “Danish”,
    “Dari”,
    “Dinka”,
    “Diula”,
    “Dutch”,
    “Edo”,
    “English”,
    “Estonian”,
    “Ewe”,
    “Fante”,
    “Farsi”,
    “Fijian Hindi”,
    “Finnish”,
    “Flemish”,
    “French”,
    “French Canadian”,
    “Fukienese”,
    “Fula”,
    “Fulani”,
    “Fuzhou”,
    “Ga”,
    “Gaddang”,
    “Gaelic”,
    “Gaelic-irish”,
    “Gaelic-scottish”,
    “Georgian”,
    “German”,
    “Gorani”,
    “Greek”,
    “Gujarati”,
    “Haitian Creole”,
    “Hakka”,
    “Hakka-chinese”,
    “Hausa”,
    “Hebrew”,
    “Hindi”,
    “Hmong”,
    “Hungarian”,
    “Ibanag”,
    “Ibo”,
    “Icelandic”,
    “Igbo”,
    “Ilocano”,
    “Indonesian”,
    “Inuktitut”,
    “Italian”,
    “Jakartanese”,
    “Japanese”,
    “Javanese”,
    “Kanjobal”,
    “Karen”,
    “Karenni”,
    “Kashmiri”,
    “Kazakh”,
    “Kikuyu”,
    “Kinyarwanda”,
    “Kirundi”,
    “Korean”,
    “Kosovan”,
    “Kotokoli”,
    “Krio”,
    “Kurdish”,
    “Kurmanji”,
    “Kyrgyz”,
    “Lakota”,
    “Laotian”,
    “Latvian”,
    “Lingala”,
    “Lithuanian”,
    “Luganda”,
    “Luo”,
    “Maay”,
    “Macedonian”,
    “Malay”,
    “Malayalam”,
    “Maltese”,
    “Mandarin”,
    “Mandingo”,
    “Mandinka”,
    “Marathi”,
    “Marshallese”,
    “Mien”,
    “Mina”,
    “Mirpuri”,
    “Mixteco”,
    “Moldavan”,
    “Mongolian”,
    “Montenegrin”,
    “Navajo”,
    “Neapolitan”,
    “Nepali”,
    “Nigerian Pidgin”,
    “Norwegian”,
    “Oromo”,
    “Pahari”,
    “Papago”,
    “Papiamento”,
    “Pashto”,
    “Patois”,
    “Pidgin English”,
    “Polish”,
    “Portug.creole”,
    “Portuguese”,
    “Pothwari”,
    “Pulaar”,
    “Punjabi”,
    “Putian”,
    “Quichua”,
    “Romanian”,
    “Russian”,
    “Samoan”,
    “Serbian”,
    “Shanghainese”,
    “Shona”,
    “Sichuan”,
    “Sicilian”,
    “Sinhalese”,
    “Slovak”,
    “Somali”,
    “Sorani”,
    “Sotho Southern”,
    “Spanish”,
    “Sudanese Arabic”,
    “Sundanese”,
    “Susu”,
    “Swahili”,
    “Swedish”,
    “Sylhetti”,
    “Tagalog”,
    “Taiwanese”,
    “Tajik”,
    “Tamil”,
    “Telugu”,
    “Thai”,
    “Tibetan”,
    “Tigre”,
    “Tigrinya”,
    “Toishanese”,
    “Tongan”,
    “Toucouleur”,
    “Trique”,
    “Tshiluba”,
    “Turkish”,
    “Tswana”,
    “Twi”,
    “Ukrainian”,
    “Urdu”,
    “Uyghur”,
    “Uzbek”,
    “Vietnamese”,
    “Visayan”,
    “Welsh”,
    “Wolof”,
    “Xhosa”,
    “Yiddish”,
    “Yoruba”,
    “Yupik”,
    “Zulu”
    );
    $i = 1; //
    foreach ( $languages as $language ) {

    xprofile_insert_field( array(
    ‘field_group_id’ => 1,
    ‘parent_id’ => $language_list_id,
    ‘type’ => ‘option’,
    ‘name’ => $language,
    ‘option_order’ => $i++
    ));

    }

    }
    }
    }
    add_action(‘bp_init’, ‘bp_add_custom_language_list’);’)

  • Keymaster
    (BuddyDev Team)
    Posts: 24712
    Brajesh Singh on #18707

    Hi Marius ,
    Welcome to BuddyDev.

    The code seems correct. Please make sure you are putting it in wp-content/plugins/bp-custom.php. The name of the file is all lowercase ‘bp-custom.php’

    After that, Please visit Dashboard->Users->Profile Fields and this field will get created.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 1
    Marius on #18730
    This reply has been marked as private.

You must be logged in to reply to this topic.

This topic is: not resolved