/**
  * Register the xProfile metabox on Community Profile admin page.
  *
  * @since 2.0.0
  *
  * @param int         $user_id       ID of the user being edited.
  * @param string      $screen_id     Screen ID to load the metabox in.
  * @param object|null $stats_metabox Context and priority for the stats metabox.
  */
 public function register_metaboxes($user_id = 0, $screen_id = '', $stats_metabox = null)
 {
     // Set the screen ID if none was passed.
     if (empty($screen_id)) {
         $screen_id = buddypress()->members->admin->user_page;
     }
     // Setup a new metabox class if none was passed.
     if (empty($stats_metabox)) {
         $stats_metabox = new StdClass();
     }
     // Moving the Stats Metabox.
     $stats_metabox->context = 'side';
     $stats_metabox->priority = 'low';
     // Each Group of fields will have his own metabox.
     $profile_args = array('fetch_fields' => false, 'user_id' => $user_id);
     if (!bp_is_user_spammer($user_id) && bp_has_profile($profile_args)) {
         // Loop through field groups and add a metabox for each one.
         while (bp_profile_groups()) {
             bp_the_profile_group();
             add_meta_box('bp_xprofile_user_admin_fields_' . sanitize_key(bp_get_the_profile_group_slug()), esc_html(bp_get_the_profile_group_name()), array($this, 'user_admin_profile_metaboxes'), $screen_id, 'normal', 'core', array('profile_group_id' => absint(bp_get_the_profile_group_id())));
         }
         // If member is already a spammer, show a generic metabox.
     } else {
         add_meta_box('bp_xprofile_user_admin_empty_profile', _x('User marked as a spammer', 'xprofile user-admin edit screen', 'buddypress'), array($this, 'user_admin_spammer_metabox'), $screen_id, 'normal', 'core');
     }
     if (buddypress()->avatar->show_avatars) {
         // Avatar Metabox.
         add_meta_box('bp_xprofile_user_admin_avatar', _x('Profile Photo', 'xprofile user-admin edit screen', 'buddypress'), array($this, 'user_admin_avatar_metabox'), $screen_id, 'side', 'low');
     }
 }
 /**
  * Adds Custom Fields to BuddyPress Profiles in public view.
  *
  * @package s2Member\Custom_Reg_Fields
  * @since 110524RC
  *
  * @attaches-to ``add_action("bp_profile_field_item");``
  *
  * @return null
  */
 public static function custom_profile_field_items_4bp()
 {
     global $bp;
     static $processed = false;
     do_action("ws_plugin__s2member_before_custom_profile_field_items_4bp", get_defined_vars());
     if (!$processed && in_array("profile-view", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"])) {
         if (apply_filters("ws_plugin__s2member_custom_profile_field_items_4bp_display", true, get_defined_vars())) {
             if (bp_is_user_profile() && (function_exists("bp_is_user_profile_edit") && !bp_is_user_profile_edit() || function_exists("bp_is_profile_edit") && !bp_is_profile_edit()) && (int) bp_get_the_profile_group_id() === 1) {
                 if (isset($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id)) {
                     if ($processed = true) {
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_custom_profile_field_items_4bp_before", get_defined_vars());
                         unset($__refs, $__v);
                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) {
                             if (($level = c_ws_plugin__s2member_user_access::user_access_level(new WP_User($user_id))) >= 0) {
                                 if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($level, "profile-view")) {
                                     $fields = get_user_option("s2member_custom_fields", $user_id);
                                     foreach (json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field) {
                                         foreach (array_keys(get_defined_vars()) as $__v) {
                                             $__refs[$__v] =& ${$__v};
                                         }
                                         do_action("ws_plugin__s2member_during_custom_profile_field_items_4bp_before_custom_fields", get_defined_vars());
                                         unset($__refs, $__v);
                                         if (in_array($field["id"], $fields_applicable)) {
                                             $field_var = preg_replace("/[^a-z0-9]/i", "_", strtolower($field["id"]));
                                             $field_id_class = preg_replace("/_/", "-", $field_var);
                                             foreach (array_keys(get_defined_vars()) as $__v) {
                                                 $__refs[$__v] =& ${$__v};
                                             }
                                             if (apply_filters("ws_plugin__s2member_during_custom_profile_field_items_4bp_during_custom_fields_display", true, get_defined_vars())) {
                                                 if (!empty($field["section"]) && $field["section"] === "yes") {
                                                     echo '<tr class="ws-plugin--s2member-profile-field-4bp-divider-section">' . "\n";
                                                     echo '<td colspan="2"><div class="ws-plugin--s2member-profile-field-4bp-divider-section' . (!empty($field["sectitle"]) ? '-title' : '') . '">' . (!empty($field["sectitle"]) ? $field["sectitle"] : '') . '</div></td>' . "\n";
                                                     echo '</tr>' . "\n";
                                                 }
                                                 echo '<tr class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . '">' . "\n";
                                                 echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . ' label"><span>' . $field["label"] . '</span></td>' . "\n";
                                                 echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . ' data">' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, "ws_plugin__s2member_profile_4bp_", "ws-plugin--s2member-profile-4bp-", "ws-plugin--s2member-profile-field-4bp", "", "", "", $fields, $fields[$field_var], "profile-view") . '</td>' . "\n";
                                                 echo '</tr>' . "\n";
                                             }
                                             unset($__refs, $__v);
                                         }
                                         foreach (array_keys(get_defined_vars()) as $__v) {
                                             $__refs[$__v] =& ${$__v};
                                         }
                                         do_action("ws_plugin__s2member_during_custom_profile_field_items_4bp_after_custom_fields", get_defined_vars());
                                         unset($__refs, $__v);
                                     }
                                 }
                             }
                         }
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_custom_profile_field_items_4bp_after", get_defined_vars());
                         unset($__refs, $__v);
                     }
                 }
             }
         }
     }
     do_action("ws_plugin__s2member_after_custom_profile_field_items_4bp", get_defined_vars());
     return;
 }
示例#3
0
<?php do_action( 'bp_before_profile_loop_content' ) ?>

<?php if ( function_exists('xprofile_get_profile') ) : ?>

	<?php if ( bp_has_profile() ) : ?>

		<?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

			<?php if ( bp_profile_group_has_fields() ) : ?>

				<?php do_action( 'bp_before_profile_field_content' ) ?>

				<div class="bp-widget <?php bp_the_profile_group_slug() ?>">
					<?php if ( 1 != bp_get_the_profile_group_id() ) : ?>
						<h4><?php bp_the_profile_group_name() ?></h4>
					<?php endif; ?>

					<table class="profile-fields zebra">
						<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>

							<?php if ( bp_field_has_data() ) : ?>
								<tr<?php bp_field_css_class() ?>>

									<td class="label">
										<?php bp_the_profile_field_name() ?>
									</td>

									<td class="data">
										<?php bp_the_profile_field_value() ?>
									</td>
function bp_the_profile_group_id()
{
    echo bp_get_the_profile_group_id();
}
示例#5
0
            ?>

            <?php 
            if (bp_profile_group_has_fields()) {
                ?>

                <?php 
                do_action('bp_before_profile_field_content');
                ?>

                <div class="bp-widget <?php 
                bp_the_profile_group_slug();
                ?>
">
                    <?php 
                if (1 != bp_get_the_profile_group_id()) {
                    ?>
                        <h4><?php 
                    bp_the_profile_group_name();
                    ?>
</h4>
                    <?php 
                }
                ?>

                    <table class="profile-fields">
                        <?php 
                while (bp_profile_fields()) {
                    bp_the_profile_field();
                    ?>
示例#6
0
/**
 * Output the fields inputs on user screen
 * @since 1.0
 **/
function buddyboss_user_social_fields($user_id = false)
{
    if (!$user_id) {
        $user_id = bp_displayed_user_id();
    }
    /* field will only shown on base. 
     * so if in case we are on somewhere else then skip it ! 
     * 
     * It's safe enough to assume that 'base' profile group will always be there and its id will be 1,
     * since there's no apparent way of deleting this field group.
     */
    if (!function_exists('bp_get_the_profile_group_id') || function_exists('bp_get_the_profile_group_id') && bp_get_the_profile_group_id() != 1) {
        return;
    }
    $socials = (array) get_user_meta($user_id, "user_social_links", true);
    if ('edit' == bp_current_action()) {
        ?>
		<div class="buddyboss-user-social">

		<input type="hidden" name="buddyboss_user_social" value="1">    

		<?php 
        foreach (buddyboss_get_user_social_array() as $social => $name) {
            ?>

		<div class="bp-profile-field editfield field_type_textbox field_<?php 
            echo $social;
            ?>
">
		<label for="buddyboss_<?php 
            echo $social;
            ?>
"><?php 
            echo $name;
            ?>
</label>
		<input id="buddyboss_<?php 
            echo $social;
            ?>
" name="buddyboss_<?php 
            echo $social;
            ?>
" type="text" value="<?php 
            echo esc_attr(@$socials[$social]);
            ?>
" />
		</div>

		<?php 
        }
        ?>
		</div>
		<?php 
    } else {
        if (buddyboss_array_not_all_empty($socials)) {
            ?>
		<div class="bp-widget social">
			<h4><?php 
            _e('Social', 'boss');
            ?>
</h4>
			<table class="profile-fields">
				<tbody>
               
                <?php 
            foreach (buddyboss_get_user_social_array() as $social => $name) {
                ?>

                <?php 
                $field_value = @$socials[$social];
                if (empty($field_value)) {
                    continue;
                }
                $field_value = make_clickable($field_value);
                ?>
                    <tr class="field_type_textbox field_<?php 
                echo $social;
                ?>
">
                        <td class="label"><?php 
                echo $name;
                ?>
</td>
                        <td class="data"><?php 
                echo $field_value;
                ?>
</td>
                    </tr>

                <?php 
            }
            ?>
				</tbody>
			</table>
		</div>
		<?php 
        }
    }
}
 /**
  * Adds Custom Fields to BuddyPress Profiles in public view.
  *
  * @package s2Member\Custom_Reg_Fields
  * @since 110524RC
  *
  * @attaches-to ``add_action('bp_profile_field_item');``
  */
 public static function custom_profile_field_items_4bp()
 {
     global $bp;
     // Global reference to the BuddyPress object.
     static $processed = FALSE;
     // Process this routine only one time.
     do_action('ws_plugin__s2member_before_custom_profile_field_items_4bp', get_defined_vars());
     if (!$processed && in_array('profile-view', $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields_4bp'])) {
         if (apply_filters('ws_plugin__s2member_custom_profile_field_items_4bp_display', TRUE, get_defined_vars())) {
             if (bp_is_user_profile() && !bp_is_user_profile_edit() && (int) bp_get_the_profile_group_id() === 1) {
                 if (isset($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id) && ($processed = TRUE)) {
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_before', get_defined_vars());
                     unset($__refs, $__v);
                     if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields']) {
                         if (($level = c_ws_plugin__s2member_user_access::user_access_level(new WP_User($user_id))) >= 0) {
                             if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($level, 'profile-view')) {
                                 $fields = get_user_option('s2member_custom_fields', $user_id);
                                 foreach (json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field) {
                                     foreach (array_keys(get_defined_vars()) as $__v) {
                                         $__refs[$__v] =& ${$__v};
                                     }
                                     do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_before_custom_fields', get_defined_vars());
                                     unset($__refs, $__v);
                                     if (in_array($field['id'], $fields_applicable)) {
                                         $field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
                                         $field_id_class = preg_replace('/_/', '-', $field_var);
                                         foreach (array_keys(get_defined_vars()) as $__v) {
                                             $__refs[$__v] =& ${$__v};
                                         }
                                         if (apply_filters('ws_plugin__s2member_during_custom_profile_field_items_4bp_during_custom_fields_display', TRUE, get_defined_vars())) {
                                             if (!empty($field['section']) && $field['section'] === 'yes') {
                                                 echo '<tr class="ws-plugin--s2member-profile-field-4bp-divider-section">' . "\n";
                                                 echo '<td colspan="2"><div class="ws-plugin--s2member-profile-field-4bp-divider-section' . (!empty($field['sectitle']) ? '-title' : '') . '">' . (!empty($field['sectitle']) ? $field['sectitle'] : '') . '</div></td>' . "\n";
                                                 echo '</tr>' . "\n";
                                             }
                                             echo '<tr class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . '">' . "\n";
                                             echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . ' label"><span>' . $field['label'] . '</span></td>' . "\n";
                                             echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . ' data">' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, 'ws_plugin__s2member_profile_4bp_', 'ws-plugin--s2member-profile-4bp-', 'ws-plugin--s2member-profile-field-4bp', '', '', '', $fields, @$fields[$field_var], 'profile-view') . '</td>' . "\n";
                                             echo '</tr>' . "\n";
                                         }
                                         unset($__refs, $__v);
                                     }
                                     foreach (array_keys(get_defined_vars()) as $__v) {
                                         $__refs[$__v] =& ${$__v};
                                     }
                                     do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_after_custom_fields', get_defined_vars());
                                     unset($__refs, $__v);
                                 }
                             }
                         }
                     }
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_after', get_defined_vars());
                     unset($__refs, $__v);
                 }
             }
         }
     }
     do_action('ws_plugin__s2member_after_custom_profile_field_items_4bp', get_defined_vars());
 }
 /**
  * Register the xProfile metabox on Community Profile admin page.
  *
  * @access public
  * @since BuddyPress (2.0.0)
  *
  * @param int $user_id ID of the user being edited.
  * @param string $screen_id Screen ID to load the metabox in.
  * @param object $stats_metabox Context and priority for the stats metabox.
  */
 public function register_metaboxes($user_id = 0, $screen_id = '', $stats_metabox = null)
 {
     if (empty($screen_id)) {
         $screen_id = buddypress()->members->admin->user_page;
     }
     if (empty($stats_metabox)) {
         $stats_metabox = new StdClass();
     }
     // Moving the Stats Metabox
     $stats_metabox->context = 'side';
     $stats_metabox->priority = 'low';
     // Each Group of fields will have his own metabox
     if (false == bp_is_user_spammer($user_id) && bp_has_profile(array('fetch_fields' => false))) {
         while (bp_profile_groups()) {
             bp_the_profile_group();
             add_meta_box('bp_xprofile_user_admin_fields_' . sanitize_key(bp_get_the_profile_group_slug()), esc_html(bp_get_the_profile_group_name()), array(&$this, 'user_admin_profile_metaboxes'), $screen_id, 'normal', 'core', array('profile_group_id' => absint(bp_get_the_profile_group_id())));
         }
         // if a user has been mark as a spammer, remove BP data
     } else {
         add_meta_box('bp_xprofile_user_admin_empty_profile', _x('User marked as a spammer', 'xprofile user-admin edit screen', 'buddypress'), array(&$this, 'user_admin_spammer_metabox'), $screen_id, 'normal', 'core');
     }
     // Avatar Metabox
     add_meta_box('bp_xprofile_user_admin_avatar', _x('Avatar', 'xprofile user-admin edit screen', 'buddypress'), array(&$this, 'user_admin_avatar_metabox'), $screen_id, 'side', 'low');
 }
            }
        }
        wp_reset_query();
    }
    ?>
 

	</div>

	<div role="tabpanel" class="tab-pane" id="social-networking">
		<?php 
    while (bp_profile_groups()) {
        bp_the_profile_group();
        ?>
			<?php 
        if (bp_get_the_profile_group_id() == 4) {
            ?>
				<?php 
            if (bp_profile_group_has_fields()) {
                ?>
					<?php 
                do_action('bp_before_profile_field_content');
                ?>
					<div class="bp-widget <?php 
                bp_the_profile_group_slug();
                ?>
">
						<table class="profile-fields">
							<?php 
                while (bp_profile_fields()) {
                    bp_the_profile_field();