/** * Output the main XProfile management screen * * @since 2.3.0 * * @param string $message Feedback message. * @param string $type Feedback type. * * @todo Improve error message output */ function xprofile_admin_screen($message = '', $type = 'error') { // Validate type. $type = preg_replace('|[^a-z]|i', '', $type); // Get all of the profile groups & fields. $groups = bp_xprofile_get_groups(array('fetch_fields' => true)); ?> <div class="wrap"> <h1> <?php _ex('Profile Fields', 'Settings page header', 'buddypress'); ?> <a id="add_group" class="add-new-h2" href="users.php?page=bp-profile-setup&mode=add_group"><?php _e('Add New Field Group', 'buddypress'); ?> </a> </h1> <form action="" id="profile-field-form" method="post"> <?php wp_nonce_field('bp_reorder_fields', '_wpnonce_reorder_fields'); wp_nonce_field('bp_reorder_groups', '_wpnonce_reorder_groups', false); if (!empty($message)) { $type = $type == 'error' ? 'error' : 'updated'; ?> <div id="message" class="<?php echo $type; ?> fade"> <p><?php echo esc_html($message); ?> </p> </div> <?php } ?> <div id="tabs"> <ul id="field-group-tabs"> <?php if (!empty($groups)) { foreach ($groups as $group) { ?> <li id="group_<?php echo esc_attr($group->id); ?> "> <a href="#tabs-<?php echo esc_attr($group->id); ?> " class="ui-tab"> <?php /** This filter is documented in bp-xprofile/bp-xprofile-template.php */ echo esc_html(apply_filters('bp_get_the_profile_group_name', $group->name)); ?> <?php if (!$group->can_delete) { ?> <?php _e('(Primary)', 'buddypress'); ?> <?php } ?> </a> </li> <?php } } ?> </ul> <?php if (!empty($groups)) { foreach ($groups as $group) { ?> <noscript> <h3><?php /** This filter is documented in bp-xprofile/bp-xprofile-template.php */ echo esc_html(apply_filters('bp_get_the_profile_group_name', $group->name)); ?> </h3> </noscript> <div id="tabs-<?php echo esc_attr($group->id); ?> " class="tab-wrapper"> <div class="tab-toolbar"> <div class="tab-toolbar-left"> <a class="button-primary" href="users.php?page=bp-profile-setup&group_id=<?php echo esc_attr($group->id); ?> &mode=add_field"><?php _e('Add New Field', 'buddypress'); ?> </a> <a class="button edit" href="users.php?page=bp-profile-setup&mode=edit_group&group_id=<?php echo esc_attr($group->id); ?> "><?php _e('Edit Group', 'buddypress'); ?> </a> <?php if ($group->can_delete) { ?> <div class="delete-button"> <a class="confirm submitdelete deletion ajax-option-delete" href="users.php?page=bp-profile-setup&mode=delete_group&group_id=<?php echo esc_attr($group->id); ?> "><?php _e('Delete Group', 'buddypress'); ?> </a> </div> <?php } ?> <?php /** * Fires at end of action buttons in xprofile management admin. * * @since 2.2.0 * * @param BP_XProfile_Group $group BP_XProfile_Group object * for the current group. */ do_action('xprofile_admin_group_action', $group); ?> </div> </div> <?php if (!empty($group->description)) { ?> <p><?php /** This filter is documented in bp-xprofile/bp-xprofile-template.php */ echo esc_html(apply_filters('bp_get_the_profile_group_description', $group->description)); ?> </p> <?php } ?> <fieldset id="<?php echo esc_attr($group->id); ?> " class="connectedSortable field-group"> <legend class="screen-reader-text"><?php /** This filter is documented in bp-xprofile/bp-xprofile-template.php */ printf(esc_html__('Fields for "%s" Group', 'buddypress'), apply_filters('bp_get_the_profile_group_name', $group->name)); ?> </legend> <?php if (!empty($group->fields)) { foreach ($group->fields as $field) { // Load the field. $field = xprofile_get_field($field->id); $class = ''; if (empty($field->can_delete)) { $class = ' core nodrag'; } /** * This function handles the WYSIWYG profile field * display for the xprofile admin setup screen. */ xprofile_admin_field($field, $group, $class); } // end for } else { // !$group->fields ?> <p class="nodrag nofields"><?php _e('There are no fields in this group.', 'buddypress'); ?> </p> <?php } // End $group->fields. ?> </fieldset> <?php if (empty($group->can_delete)) { ?> <p><?php esc_html_e('* Fields in this group appear on the signup page.', 'buddypress'); ?> </p> <?php } ?> </div> <?php } } else { ?> <div id="message" class="error"><p><?php _e('You have no groups.', 'buddypress'); ?> </p></div> <p><a href="users.php?page=bp-profile-setup&mode=add_group"><?php _e('Add New Group', 'buddypress'); ?> </a></p> <?php } ?> </div> </form> </div> <?php }
/** * Handles all actions for the admin area for creating, editing and deleting * profile groups and fields. */ function xprofile_admin($message = '', $type = 'error') { global $bp; $type = preg_replace('|[^a-z]|i', '', $type); $groups = BP_XProfile_Group::get(array('fetch_fields' => true)); if (isset($_GET['mode']) && isset($_GET['group_id']) && 'add_field' == $_GET['mode']) { xprofile_admin_manage_field($_GET['group_id']); } else { if (isset($_GET['mode']) && isset($_GET['group_id']) && isset($_GET['field_id']) && 'edit_field' == $_GET['mode']) { xprofile_admin_manage_field($_GET['group_id'], $_GET['field_id']); } else { if (isset($_GET['mode']) && isset($_GET['field_id']) && 'delete_field' == $_GET['mode']) { xprofile_admin_delete_field($_GET['field_id'], 'field'); } else { if (isset($_GET['mode']) && isset($_GET['option_id']) && 'delete_option' == $_GET['mode']) { xprofile_admin_delete_field($_GET['option_id'], 'option'); } else { if (isset($_GET['mode']) && 'add_group' == $_GET['mode']) { xprofile_admin_manage_group(); } else { if (isset($_GET['mode']) && isset($_GET['group_id']) && 'delete_group' == $_GET['mode']) { xprofile_admin_delete_group($_GET['group_id']); } else { if (isset($_GET['mode']) && isset($_GET['group_id']) && 'edit_group' == $_GET['mode']) { xprofile_admin_manage_group($_GET['group_id']); } else { ?> <div class="wrap"> <?php screen_icon('buddypress'); ?> <h2> <?php _e('Extended Profile Fields', 'buddypress'); ?> <a id="add_group" class="button add-new-h2" href="admin.php?page=bp-profile-setup&mode=add_group"><?php _e('Add New Group', 'buddypress'); ?> </a> </h2> <p><?php _e('Your users will distinguish themselves through their profile page. You must give them profile fields that allow them to describe themselves in a way that is relevant to the theme of your social network.', 'buddypress'); ?> </p> <p><?php echo sprintf(__('NOTE: Any fields in the "%s" group will appear on the signup page.', 'buddypress'), esc_html(stripslashes(bp_get_option('bp-xprofile-base-group-name')))); ?> </p> <form action="" id="profile-field-form" method="post"> <?php nxt_nonce_field('bp_reorder_fields', '_nxtnonce_reorder_fields'); ?> <?php nxt_nonce_field('bp_reorder_groups', '_nxtnonce_reorder_groups', false); if (!empty($message)) { $type = $type == 'error' ? 'error' : 'updated'; ?> <div id="message" class="<?php echo $type; ?> fade"> <p><?php echo esc_html(esc_attr($message)); ?> </p> </div> <?php } ?> <div id="tabs"> <ul id="field-group-tabs"> <?php if (!empty($groups)) { foreach ($groups as $group) { ?> <li id="group_<?php echo $group->id; ?> "><a href="#tabs-<?php echo $group->id; ?> " class="ui-tab"><?php echo esc_attr($group->name); if (!$group->can_delete) { ?> <?php _e('(Primary)', 'buddypress'); } ?> </a></li> <?php } } ?> </ul> <?php if (!empty($groups)) { foreach ($groups as $group) { ?> <noscript> <h3><?php echo esc_attr($group->name); ?> </h3> </noscript> <div id="tabs-<?php echo $group->id; ?> " class="tab-wrapper"> <div class="tab-toolbar"> <div class="tab-toolbar-left"> <a class="button" href="admin.php?page=bp-profile-setup&group_id=<?php echo esc_attr($group->id); ?> &mode=add_field"><?php _e('Add New Field', 'buddypress'); ?> </a> <a class="button edit" href="admin.php?page=bp-profile-setup&mode=edit_group&group_id=<?php echo esc_attr($group->id); ?> "><?php _e('Edit Group', 'buddypress'); ?> </a> <?php if ($group->can_delete) { ?> <a class="submitdelete deletion" href="admin.php?page=bp-profile-setup&mode=delete_group&group_id=<?php echo esc_attr($group->id); ?> "><?php _e('Delete Group', 'buddypress'); ?> </a> <?php } ?> </div> </div> <fieldset id="<?php echo $group->id; ?> " class="connectedSortable field-group"> <?php if ($group->description) { ?> <legend><?php echo esc_attr($group->description); ?> </legend> <?php } if (!empty($group->fields)) { foreach ($group->fields as $field) { // Load the field $field = new BP_XProfile_Field($field->id); $class = ''; if (!$field->can_delete) { $class = ' core nodrag'; } /* This function handles the WYSIWYG profile field * display for the xprofile admin setup screen */ xprofile_admin_field($field, $group, $class); } // end for } else { // !$group->fields ?> <p class="nodrag nofields"><?php _e('There are no fields in this group.', 'buddypress'); ?> </p> <?php } // end $group->fields ?> </fieldset> </div> <?php } // End For ?> </div> <?php } else { ?> <div id="message" class="error"><p><?php _e('You have no groups.', 'buddypress'); ?> </p></div> <p><a href="admin.php?page=bp-profile-setup&mode=add_group"><?php _e('Add New Group', 'buddypress'); ?> </a></p> <?php } ?> <div id="tabs-bottom"> </div> </form> </div> <?php } } } } } } } }
/** * Handles all actions for the admin area for creating, editing and deleting * profile groups and fields. */ function xprofile_admin($message = '', $type = 'error') { $type = preg_replace('|[^a-z]|i', '', $type); $groups = bp_xprofile_get_groups(array('fetch_fields' => true)); if (isset($_GET['mode']) && isset($_GET['group_id']) && 'add_field' == $_GET['mode']) { xprofile_admin_manage_field($_GET['group_id']); } elseif (isset($_GET['mode']) && isset($_GET['group_id']) && isset($_GET['field_id']) && 'edit_field' == $_GET['mode']) { xprofile_admin_manage_field($_GET['group_id'], $_GET['field_id']); } elseif (isset($_GET['mode']) && isset($_GET['field_id']) && 'delete_field' == $_GET['mode']) { xprofile_admin_delete_field($_GET['field_id'], 'field'); } elseif (isset($_GET['mode']) && isset($_GET['option_id']) && 'delete_option' == $_GET['mode']) { xprofile_admin_delete_field($_GET['option_id'], 'option'); } elseif (isset($_GET['mode']) && 'add_group' == $_GET['mode']) { xprofile_admin_manage_group(); } elseif (isset($_GET['mode']) && isset($_GET['group_id']) && 'delete_group' == $_GET['mode']) { xprofile_admin_delete_group($_GET['group_id']); } elseif (isset($_GET['mode']) && isset($_GET['group_id']) && 'edit_group' == $_GET['mode']) { xprofile_admin_manage_group($_GET['group_id']); } else { ?> <div class="wrap"> <?php screen_icon('users'); ?> <h2> <?php _ex('Profile Fields', 'Settings page header', 'buddypress'); ?> <a id="add_group" class="add-new-h2" href="users.php?page=bp-profile-setup&mode=add_group"><?php _e('Add New Field Group', 'buddypress'); ?> </a> </h2> <p><?php echo sprintf(__('Fields in the "%s" group will appear on the signup page.', 'buddypress'), esc_html(stripslashes(bp_get_option('bp-xprofile-base-group-name')))); ?> </p> <form action="" id="profile-field-form" method="post"> <?php wp_nonce_field('bp_reorder_fields', '_wpnonce_reorder_fields'); wp_nonce_field('bp_reorder_groups', '_wpnonce_reorder_groups', false); if (!empty($message)) { $type = $type == 'error' ? 'error' : 'updated'; ?> <div id="message" class="<?php echo $type; ?> fade"> <p><?php echo esc_html(esc_attr($message)); ?> </p> </div> <?php } ?> <div id="tabs"> <ul id="field-group-tabs"> <?php if (!empty($groups)) { foreach ($groups as $group) { ?> <li id="group_<?php echo $group->id; ?> "><a href="#tabs-<?php echo $group->id; ?> " class="ui-tab"><?php echo esc_attr($group->name); if (!$group->can_delete) { ?> <?php _e('(Primary)', 'buddypress'); } ?> </a></li> <?php } } ?> </ul> <?php if (!empty($groups)) { foreach ($groups as $group) { ?> <noscript> <h3><?php echo esc_attr($group->name); ?> </h3> </noscript> <div id="tabs-<?php echo $group->id; ?> " class="tab-wrapper"> <div class="tab-toolbar"> <div class="tab-toolbar-left"> <a class="button-primary" href="users.php?page=bp-profile-setup&group_id=<?php echo esc_attr($group->id); ?> &mode=add_field"><?php _e('Add New Field', 'buddypress'); ?> </a> <a class="button edit" href="users.php?page=bp-profile-setup&mode=edit_group&group_id=<?php echo esc_attr($group->id); ?> "><?php _e('Edit Group', 'buddypress'); ?> </a> <?php if ($group->can_delete) { ?> <a class="confirm submitdelete deletion ajax-option-delete" href="users.php?page=bp-profile-setup&mode=delete_group&group_id=<?php echo esc_attr($group->id); ?> "><?php _e('Delete Group', 'buddypress'); ?> </a> <?php } ?> <?php /** * Fires at end of action buttons 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_group_action', $group); ?> </div> </div> <fieldset id="<?php echo $group->id; ?> " class="connectedSortable field-group"> <?php if ($group->description) { ?> <legend><?php echo esc_attr($group->description); ?> </legend> <?php } if (!empty($group->fields)) { foreach ($group->fields as $field) { // Load the field $field = new BP_XProfile_Field($field->id); $class = ''; if (!$field->can_delete) { $class = ' core nodrag'; } /* This function handles the WYSIWYG profile field * display for the xprofile admin setup screen */ xprofile_admin_field($field, $group, $class); } // end for } else { // !$group->fields ?> <p class="nodrag nofields"><?php _e('There are no fields in this group.', 'buddypress'); ?> </p> <?php } // end $group->fields ?> </fieldset> </div> <?php } } else { ?> <div id="message" class="error"><p><?php _e('You have no groups.', 'buddypress'); ?> </p></div> <p><a href="users.php?page=bp-profile-setup&mode=add_group"><?php _e('Add New Group', 'buddypress'); ?> </a></p> <?php } ?> <div id="tabs-bottom"> </div> </div> </form> </div> <?php } }