Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * Similar to the post_class() function, but for BP. This is NOT used by core Suffusion, but is useful for child themes using BP.
  * This might be defined by the Suffusion BuddyPress Pack for BP users of Suffusion, but is included conditionally here so
  * that the theme and the plugin can be used independently of each other and so that one version of Suffusion can work with an older
  * version of the BP pack.
  *
  * @since 3.6.7
  * @param bool $custom
  * @param bool $echo
  * @return bool|string
  */
 function suffusion_bp_content_class($custom = false, $echo = true)
 {
     if (!function_exists('bp_is_group')) {
         return false;
     }
     $css = array();
     $css[] = 'post';
     if (function_exists('bp_is_profile_component') && bp_is_profile_component()) {
         $css[] = 'profile-component';
     }
     if (function_exists('bp_is_activity_component') && bp_is_activity_component()) {
         $css[] = 'activity-component';
     }
     if (function_exists('bp_is_blogs_component') && bp_is_blogs_component()) {
         $css[] = 'blogs-component';
     }
     if (function_exists('bp_is_messages_component') && bp_is_messages_component()) {
         $css[] = 'messages-component';
     }
     if (function_exists('bp_is_friends_component') && bp_is_friends_component()) {
         $css[] = 'friends-component';
     }
     if (function_exists('bp_is_groups_component') && bp_is_groups_component()) {
         $css[] = 'groups-component';
     }
     if (function_exists('bp_is_settings_component') && bp_is_settings_component()) {
         $css[] = 'settings-component';
     }
     if (function_exists('bp_is_member') && bp_is_member()) {
         $css[] = 'member';
     }
     if (function_exists('bp_is_user_activity') && bp_is_user_activity()) {
         $css[] = 'user-activity';
     }
     if (function_exists('bp_is_user_friends_activity') && bp_is_user_friends_activity()) {
         $css[] = 'user-friends-activity';
     }
     if (function_exists('bp_is_activity_permalink') && bp_is_activity_permalink()) {
         $css[] = 'activity-permalink';
     }
     if (function_exists('bp_is_user_profile') && bp_is_user_profile()) {
         $css[] = 'user-profile';
     }
     if (function_exists('bp_is_profile_edit') && bp_is_profile_edit()) {
         $css[] = 'profile-edit';
     }
     if (function_exists('bp_is_change_avatar') && bp_is_change_avatar()) {
         $css[] = 'change-avatar';
     }
     if (function_exists('bp_is_user_groups') && bp_is_user_groups()) {
         $css[] = 'user-groups';
     }
     if (function_exists('bp_is_group') && bp_is_group()) {
         $css[] = 'group';
     }
     if (function_exists('bp_is_group_home') && bp_is_group_home()) {
         $css[] = 'group-home';
     }
     if (function_exists('bp_is_group_create') && bp_is_group_create()) {
         $css[] = 'group-create';
     }
     if (function_exists('bp_is_group_admin_page') && bp_is_group_admin_page()) {
         $css[] = 'group-admin-page';
     }
     if (function_exists('bp_is_group_forum') && bp_is_group_forum()) {
         $css[] = 'group-forum';
     }
     if (function_exists('bp_is_group_activity') && bp_is_group_activity()) {
         $css[] = 'group-activity';
     }
     if (function_exists('bp_is_group_forum_topic') && bp_is_group_forum_topic()) {
         $css[] = 'group-forum-topic';
     }
     if (function_exists('bp_is_group_forum_topic_edit') && bp_is_group_forum_topic_edit()) {
         $css[] = 'group-forum-topic-edit';
     }
     if (function_exists('bp_is_group_members') && bp_is_group_members()) {
         $css[] = 'group-members';
     }
     if (function_exists('bp_is_group_invites') && bp_is_group_invites()) {
         $css[] = 'group-invites';
     }
     if (function_exists('bp_is_group_membership_request') && bp_is_group_membership_request()) {
         $css[] = 'group-membership-request';
     }
     if (function_exists('bp_is_group_leave') && bp_is_group_leave()) {
         $css[] = 'group-leave';
     }
     if (function_exists('bp_is_group_single') && bp_is_group_single()) {
         $css[] = 'group-single';
     }
     if (function_exists('bp_is_user_blogs') && bp_is_user_blogs()) {
         $css[] = 'user-blogs';
     }
     if (function_exists('bp_is_user_recent_posts') && bp_is_user_recent_posts()) {
         $css[] = 'user-recent-posts';
     }
     if (function_exists('bp_is_user_recent_commments') && bp_is_user_recent_commments()) {
         $css[] = 'user-recent-commments';
     }
     if (function_exists('bp_is_create_blog') && bp_is_create_blog()) {
         $css[] = 'create-blog';
     }
     if (function_exists('bp_is_user_friends') && bp_is_user_friends()) {
         $css[] = 'user-friends';
     }
     if (function_exists('bp_is_friend_requests') && bp_is_friend_requests()) {
         $css[] = 'friend-requests';
     }
     if (function_exists('bp_is_user_messages') && bp_is_user_messages()) {
         $css[] = 'user-messages';
     }
     if (function_exists('bp_is_messages_inbox') && bp_is_messages_inbox()) {
         $css[] = 'messages-inbox';
     }
     if (function_exists('bp_is_messages_sentbox') && bp_is_messages_sentbox()) {
         $css[] = 'messages-sentbox';
     }
     if (function_exists('bp_is_notices') && bp_is_notices()) {
         $css[] = 'notices';
     }
     if (function_exists('bp_is_messages_compose_screen') && bp_is_messages_compose_screen()) {
         $css[] = 'messages-compose-screen';
     }
     if (function_exists('bp_is_single_item') && bp_is_single_item()) {
         $css[] = 'single-item';
     }
     if (function_exists('bp_is_activation_page') && bp_is_activation_page()) {
         $css[] = 'activation-page';
     }
     if (function_exists('bp_is_register_page') && bp_is_register_page()) {
         $css[] = 'register-page';
     }
     $css[] = 'fix';
     if (is_array($custom)) {
         foreach ($custom as $class) {
             if (!in_array($class, $css)) {
                 $css[] = esc_attr($class);
             }
         }
     } else {
         if ($custom != false) {
             $css[] = $custom;
         }
     }
     $css_class = implode(' ', $css);
     if ($echo) {
         echo ' class="' . $css_class . '" ';
     }
     return ' class="' . $css_class . '" ';
 }
Exemplo n.º 3
0
 /**
  *
  */
 function miss_is_bp()
 {
     if (function_exists('bp_is_group') && (bp_is_blog_page() || bp_is_my_profile() || bp_is_my_profile() || is_front_page() || bp_is_component_front_page('activity') || bp_is_directory() || bp_is_profile_component() || bp_is_activity_component() || bp_is_blogs_component() || bp_is_messages_component() || bp_is_friends_component() || bp_is_groups_component() || bp_is_settings_component() || bp_is_user_activity() || bp_is_user_friends_activity() || bp_is_activity_permalink() || bp_is_user_profile() || bp_is_profile_edit() || bp_is_change_avatar() || bp_is_user_groups() || bp_is_group() || bp_is_group_home() || bp_is_group_create() || bp_is_group_admin_page() || bp_is_group_forum() || bp_is_group_activity() || bp_is_group_forum_topic() || bp_is_group_forum_topic_edit() || bp_is_group_members() || bp_is_group_invites() || bp_is_group_membership_request() || bp_is_group_leave() || bp_is_group_single() || bp_is_user_blogs() || bp_is_user_recent_posts() || bp_is_user_recent_commments() || bp_is_create_blog() || bp_is_user_friends() || bp_is_friend_requests() || bp_is_user_messages() || bp_is_messages_inbox() || bp_is_messages_sentbox() || bp_is_notices() || bp_is_messages_compose_screen() || bp_is_activation_page() || bp_is_register_page())) {
         return true;
     }
     return false;
 }
Exemplo n.º 4
0
	function bp_get_the_body_class( $wp_classes, $custom_classes = false ) {
		global $bp;

		if ( bp_is_front_page() )
			$bp_classes[] = 'home-page';

		if ( bp_is_directory() )
			$bp_classes[] = 'directory';

		if ( bp_is_user_profile() && !bp_is_blog_page() )
			$bp_classes[] = 'profile';

		if ( bp_is_activity_component() && !bp_is_blog_page() || ( bp_is_activity_front_page() && bp_is_front_page() ) )
			$bp_classes[] = 'activity';

		if ( bp_is_blogs_component() && !bp_is_blog_page()  )
			$bp_classes[] = 'blogs';

		if ( bp_is_messages_component() && !bp_is_blog_page()  )
			$bp_classes[] = 'messages';

		if ( bp_is_friends_component() && !bp_is_blog_page()  )
			$bp_classes[] = 'friends';

		if ( bp_is_groups_component() && !bp_is_blog_page()  )
			$bp_classes[] = 'groups';

		if ( bp_is_settings_component() && !bp_is_blog_page()  )
			$bp_classes[] = 'settings';

		if ( bp_is_single_item() )
			$bp_classes[] = 'single-item';

		if ( bp_is_messages_inbox() )
			$bp_classes[] = 'inbox';

		if ( bp_is_messages_sentbox() )
			$bp_classes[] = 'sentbox';

		if ( bp_is_messages_compose_screen() )
			$bp_classes[] = 'compose';

		if ( bp_is_notices() )
			$bp_classes[] = 'notices';

		if ( bp_is_friend_requests() )
			$bp_classes[] = 'friend-requests';

		if ( bp_is_user_friends() )
			$bp_classes[] = 'my-friends';

		if ( bp_is_create_blog() )
			$bp_classes[] = 'create-blog';

		if ( bp_is_user_recent_commments() )
			$bp_classes[] = 'recent-comments';

		if ( bp_is_user_recent_posts() )
			$bp_classes[] = 'recent-posts';

		if ( bp_is_user_blogs() && !bp_is_directory() )
			$bp_classes[] = 'my-blogs';

		if ( bp_is_user_groups() && !bp_is_directory() )
			$bp_classes[] = 'my-groups';

		if ( bp_is_group_leave() )
			$bp_classes[] = 'leave-group';

		if ( bp_is_group_invites() )
			$bp_classes[] = 'group-invites';

		if ( bp_is_group_members() )
			$bp_classes[] = 'group-members';

		if ( bp_is_group_forum_topic() )
			$bp_classes[] = 'group-forum-topic';

		if ( bp_is_group_forum_topic_edit() )
			$bp_classes[] = 'group-forum-topic-edit';

		if ( bp_is_group_forum() )
			$bp_classes[] = 'group-forum';

		if ( bp_is_group_admin_page() )
			$bp_classes[] = 'group-admin';

		if ( bp_is_group_create() )
			$bp_classes[] = 'group-create';

		if ( bp_is_group_home() )
			$bp_classes[] = 'group-home';

		if ( bp_is_change_avatar() )
			$bp_classes[] = 'change-avatar';

		if ( bp_is_profile_edit() )
			$bp_classes[] = 'profile-edit';

		if ( bp_is_user_friends_activity() )
			$bp_classes[] = 'friends-activity';

		if ( bp_is_user_activity() && !bp_is_directory() )
			$bp_classes[] = 'my-activity';

		if ( bp_is_activity_permalink() )
			$bp_classes[] = 'activity-permalink';

		if ( bp_is_register_page() )
			$bp_classes[] = 'registration';

		if ( bp_is_activation_page() )
			$bp_classes[] = 'activation';

		if ( is_user_logged_in() )
			$bp_classes[] = 'logged-in';

		/* Add the current_component, current_action into the bp classes */
		if ( !bp_is_blog_page() ) {
			if ( !empty( $bp->current_component ) )
				$bp_classes[] = $bp->current_component;

			if ( !empty( $bp->current_action ) )
				$bp_classes[] = $bp->current_action;
		}

		/* We don't want WordPress blog classes to appear on non-blog pages. */
		if ( !bp_is_blog_page() || is_home() ) {
			/* Preserve any custom classes already set */
			if ( !empty( $custom_classes ) )
				$wp_classes = (array) $custom_classes;
			else
				$wp_classes = array();
		}

		/* Merge WP classes with BP classes */
		$classes = array_merge( (array) $bp_classes, (array) $wp_classes );

		/* Remove any duplicates */
		$classes = array_unique( $classes );

		return apply_filters( 'bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes );
	}