BP_XProfile_Group::render_admin_form()

Output the admin area field group form.


Description Description


Source Source

File: bp-xprofile/classes/class-bp-xprofile-group.php

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
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
public function render_admin_form() {
    global $message;
 
    // Users Admin URL
    $users_url = bp_get_admin_url( 'users.php' );
 
    // URL to cancel to
    $cancel_url = add_query_arg( array(
        'page' => 'bp-profile-setup'
    ), $users_url );
 
    // New field group.
    if ( empty( $this->id ) ) {
        $title  = __( 'Add New Field Group', 'buddypress' );
        $button = __( 'Save',                'buddypress' );
        $action = add_query_arg( array(
            'page' => 'bp-profile-setup',
            'mode' => 'add_group'
        ), $users_url );
 
    // Existing field group.
    } else {
        $title  = __( 'Edit Field Group', 'buddypress' );
        $button = __( 'Update',           'buddypress' );
        $action = add_query_arg( array(
            'page'     => 'bp-profile-setup',
            'mode'     => 'edit_group',
            'group_id' => (int) $this->id
        ), $users_url );
    } ?>
 
    <div class="wrap">
 
        <h1><?php echo esc_html( $title ); ?></h1>
 
        <?php if ( ! empty( $message ) ) : ?>
 
            <div id="message" class="error fade">
                <p><?php echo esc_html( $message ); ?></p>
            </div>
 
        <?php endif; ?>
 
        <form id="bp-xprofile-add-field-group" action="<?php echo esc_url( $action ); ?>" method="post">
            <div id="poststuff">
                <div id="post-body" class="metabox-holder columns-<?php echo ( 1 == get_current_screen()->get_columns() ) ? '1' : '2'; ?>">
                    <div id="post-body-content">
                        <div id="titlediv">
                            <div class="titlewrap">
                                <label id="title-prompt-text" for="title"><?php esc_html_e( 'Field Group Name (required)', 'buddypress') ?></label>
                                <input type="text" name="group_name" id="title" value="<?php echo esc_attr( $this->name ); ?>" autocomplete="off" />
                            </div>
                        </div>
                        <div class="postbox">
                            <h2><?php esc_html_e( 'Field Group Description', 'buddypress' ); ?></h2>
                            <div class="inside">
                                <label for="group_description" class="screen-reader-text"><?php
                                    /* translators: accessibility text */
                                    esc_html_e( 'Add description', 'buddypress' );
                                ?></label>
                                <textarea name="group_description" id="group_description" rows="8" cols="60"><?php echo esc_textarea( $this->description ); ?></textarea>
                            </div>
                        </div>
 
                        <?php
 
                        /**
                         * Fires after the XProfile group description field is rendered in wp-admin.
                         *
                         * @since 2.6.0
                         *
                         * @param BP_XProfile_Group $this Current XProfile group.
                         */
                        do_action( 'xprofile_group_admin_after_description', $this ); ?>
 
                    </div><!-- #post-body-content -->
 
                    <div id="postbox-container-1" class="postbox-container">
 
                        <?php
 
                        /**
                         * Fires before XProfile Group submit metabox.
                         *
                         * @since 2.1.0
                         *
                         * @param BP_XProfile_Group $this Current XProfile group.
                         */
                        do_action( 'xprofile_group_before_submitbox', $this ); ?>
 
                        <div id="submitdiv" class="postbox">
                            <h2><?php _e( 'Submit', 'buddypress' ); ?></h2>
                            <div class="inside">
                                <div id="submitcomment" class="submitbox">
                                    <div id="major-publishing-actions">
 
                                        <?php
 
                                        // Nonce fields
                                        wp_nonce_field( 'bp_xprofile_admin_group', 'bp_xprofile_admin_group' );
 
                                        /**
                                         * Fires at the beginning of the XProfile Group publishing actions section.
                                         *
                                         * @since 2.1.0
                                         *
                                         * @param BP_XProfile_Group $this Current XProfile group.
                                         */
                                        do_action( 'xprofile_group_submitbox_start', $this ); ?>
 
                                        <input type="hidden" name="group_order" id="group_order" value="<?php echo esc_attr( $this->group_order ); ?>" />
                                        <div id="publishing-action">
                                            <input type="submit" name="save_group" value="<?php echo esc_attr( $button ); ?>" class="button-primary"/>
                                        </div>
                                        <div id="delete-action">
                                            <a href="<?php echo esc_url( $cancel_url ); ?>" class="deletion"><?php _e( 'Cancel', 'buddypress' ); ?></a>
                                        </div>
                                        <div class="clear"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
 
                        <?php
 
                        /**
                         * Fires after XProfile Group submit metabox.
                         *
                         * @since 2.1.0
                         *
                         * @param BP_XProfile_Group $this Current XProfile group.
                         */
                        do_action( 'xprofile_group_after_submitbox', $this ); ?>
 
                    </div>
                </div>
            </div>
        </form>
    </div>
 
<?php
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.