bp_ps_xprofile_setup( $fields )

Setup BuddyBoss Profile Search Extended fields.

Description

Source

File: bp-core/profile-search/bps-xprofile.php

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
function bp_ps_xprofile_setup ($fields)
{
    global $group, $field;
 
    $args = array ('hide_empty_fields' => false, 'member_type' => bp_get_member_types ());
    if (bp_has_profile ($args))
    {
        while (bp_profile_groups ())
        {
            bp_the_profile_group ();
            $group_name = str_replace ('&', '&', stripslashes ($group->name));
 
            while (bp_profile_fields ())
            {
                bp_the_profile_field ();
                $f = new stdClass;
 
                $f->group = $group_name;
                $f->id = $field->id;
                $f->code = 'field_'. $field->id;
                $f->name = str_replace ('&', '&', stripslashes ($field->name));
                $f->name = $f->name;
                $f->description = str_replace ('&', '&', stripslashes ($field->description));
                $f->description = $f->description;
                $f->type = $field->type;
 
                $f->format = bp_ps_xprofile_format ($field->type, $field->id);
                $f->search = 'bp_ps_xprofile_search';
                $f->sort_directory = 'bp_ps_xprofile_sort_directory';
                $f->get_value = 'bp_ps_xprofile_get_value';
 
                $f->options = bp_ps_xprofile_options ($field->id);
                foreach ($f->options as $key => $label)
                    $f->options[$key] = $label;
 
                if ($f->format == 'custom')
                    /**
                     * @todo add title/description
                     *
                     * @since BuddyBoss 1.0.0
                     */
                    do_action ('bp_ps_custom_field', $f);
 
                if ($f->format == 'set')
                    unset ($f->sort_directory, $f->get_value);
 
                $fields[] = $f;
            }
        }
    }
 
    return $fields;
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.