xprofile_admin_field( BP_XProfile_Field $admin_field, object $admin_group, string $class = '' )
Handles the WYSIWYG display of each profile field on the edit screen.
Description
Parameters
- $admin_field
-
(Required) Admin field.
- $admin_group
-
(Required) Admin group object.
- $class
-
(Optional) Classes to append to output.
Default value: ''
Source
File: bp-xprofile/bp-xprofile-admin.php
817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | function xprofile_admin_field( $admin_field , $admin_group , $class = '' ) { global $field ; $field = $admin_field ; // Users admin URL $url = bp_get_admin_url( 'admin.php' ); // Edit $field_edit_url = add_query_arg( array ( 'page' => 'bp-profile-setup' , 'mode' => 'edit_field' , 'group_id' => (int) $field ->group_id, 'field_id' => (int) $field ->id ), $url ); // Delete if ( $field ->can_delete ) { $field_delete_url = add_query_arg( array ( 'page' => 'bp-profile-setup' , 'mode' => 'delete_field' , 'field_id' => (int) $field ->id ), $url . '#tabs-' . (int) $field ->group_id ); } $fieldset_class = [ $field ->type ]; // sortable class $fieldset_class [] = in_array( $field ->id, array_filter ( [ bp_xprofile_firstname_field_id(), bp_xprofile_lastname_field_id(), bp_xprofile_nickname_field_id() ] ) )? 'primary_field' : 'sortable' ; $fieldset_class [] = ! empty ( $class )? $class : '' ; $fieldset_class = array_filter ( $fieldset_class ); ?> <fieldset id= "draggable_field_<?php echo esc_attr( $field->id ); ?>" class = "<?php echo implode( ' ', $fieldset_class ); ?>" > <legend> <span> <span class = "field-name" ><?php bp_the_profile_field_name(); ?></span> <?php if ( empty ( $field ->can_delete ) ) : ?><?php esc_html_e( '(Signup)' , 'buddyboss' ); endif ; ?> <?php bp_the_profile_field_required_label(); ?> <?php if ( bp_xprofile_get_meta( $field ->id, 'field' , 'signup_position' ) ) : ?><?php esc_html_e( '(Signup)' , 'buddyboss' ); endif ; ?> <?php if ( bp_get_member_types() ) : echo $field ->get_member_type_label(); endif ; ?> <?php /** * Fires at end of legend above the name field in base xprofile group. * * @since BuddyPress 2.2.0 * * @param BP_XProfile_Field $field Current BP_XProfile_Field * object being rendered. */ do_action( 'xprofile_admin_field_name_legend' , $field ); ?> </span> </legend> <div class = "field-wrapper" > <?php if ( $field ->description ) : ?> <p class = "description" ><?php echo esc_attr( $field ->description ); ?></p> <?php endif ; ?> <div class = "actions" > <a class = "button edit" href= "<?php echo esc_url( $field_edit_url ); ?>" ><?php _e( 'Edit' , 'buddyboss' ); ?></a> <?php if ( $field ->can_delete ) : ?> <div class = "delete-button" > <a class = "confirm submit-delete deletion" href= "<?php echo esc_url( $field_delete_url ); ?>" ><?php _e( 'Delete' , 'buddyboss' ); ?></a> </div> <?php endif ; ?> <?php /** * Fires at end of field management links in xprofile management admin. * * @since BuddyPress 2.2.0 * * @param BP_XProfile_Group $group BP_XProfile_Group object * for the current group. */ do_action( 'xprofile_admin_field_action' , $field ); ?> </div> </div> </fieldset> <?php } |
Changelog
Version | Description |
---|---|
BuddyPress 1.5.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.