コード例 #1
0
ファイル: bp-friends-screens.php プロジェクト: eresyyl/mk
/**
 * Catch and process the Requests page.
 */
function friends_screen_requests()
{
    if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_accept_friendship');
        if (friends_accept_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship accepted', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_reject_friendship');
        if (friends_reject_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship rejected', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('cancel', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_withdraw_friendship');
        if (friends_withdraw_friendship(bp_loggedin_user_id(), bp_action_variable(1))) {
            bp_core_add_message(__('Friendship request withdrawn', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship request could not be withdrawn', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    }
    do_action('friends_screen_requests');
    bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
コード例 #2
0
function friends_screen_requests()
{
    if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_accept_friendship');
        if (friends_accept_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship accepted', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
        }
        bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
    } elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_reject_friendship');
        if (friends_reject_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship rejected', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
        }
        bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
    }
    do_action('friends_screen_requests');
    if (isset($_GET['new'])) {
        bp_core_delete_notifications_by_type(bp_loggedin_user_id(), 'friends', 'friendship_request');
    }
    bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
コード例 #3
0
function bp_course_add_js()
{
    global $bp;
    if (!function_exists('vibe_logo_url')) {
        return;
    }
    // Checks if WPLMS is active in current site in WP Multisite
    wp_enqueue_script('bp-extras-js', plugins_url('/vibe-course-module/includes/js/course-module-js.min.js'), array('jquery'), bp_course_version(), true);
    if (function_exists('vibe_get_option')) {
        if (is_singular('unit') || is_singular('question') || is_singular('quiz') || is_singular('wplms-assignment') || is_page(vibe_get_option('take_course_page')) || is_page(vibe_get_option('create_course')) || isset($_GET['edit'])) {
            wp_enqueue_script('jquery-ui-core');
            wp_enqueue_script('jquery-ui-sortable');
            wp_enqueue_script('jquery-ui-droppable');
            wp_enqueue_script('jquery-ui-datepicker');
            wp_enqueue_script('knob-js', plugins_url('/vibe-course-module/includes/js/jquery.knob.min.js'));
        }
    }
    if (function_exists('bp_is_directory')) {
        if (bp_is_directory() && bp_current_component() == 'course') {
            wp_enqueue_script('jquery-ui-datepicker');
        }
    }
    $action = bp_current_action();
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
    }
    if (in_array($action, array('admin', 'submissions', 'stats'))) {
        wp_enqueue_script('knob-js', plugins_url('/vibe-course-module/includes/js/jquery.knob.min.js'));
    }
    wp_enqueue_script('bp-course-js', plugins_url('/vibe-course-module/includes/js/course.js'), array('jquery', 'wp-mediaelement', 'buddypress-js'), bp_course_version(), true);
    $color = bp_wplms_get_theme_color();
    $single_dark_color = bp_wplms_get_theme_single_dark_color();
    $translation_array = array('too_fast_answer' => _x('Too Fast or Answer not marked.', 'Quiz answer being marked very fast', 'vibe'), 'answer_saved' => _x('Answer Saved.', 'Save answer on every question, confirmation message', 'vibe'), 'processing' => _x('Processing...', 'Quiz question anwer save under progress', 'vibe'), 'saving_answer' => _x('Saving Answer...please wait', 'Saving quiz answers under progress', 'vibe'), 'remove_user_text' => __('This step is irreversible. Are you sure you want to remove the User from the course ?', 'vibe'), 'remove_user_button' => __('Confirm, Remove User from Course', 'vibe'), 'confirm' => _x('Confirm', 'Confirm button for various popup confirmation messages', 'vibe'), 'cancel' => _x('Cancel', 'Cancel button for various popup confirmation messages', 'vibe'), 'reset_user_text' => __('This step is irreversible. All Units, Quiz results would be reset for this user. Are you sure you want to Reset the Course for this User?', 'vibe'), 'reset_user_button' => __('Confirm, Reset Course for this User', 'vibe'), 'quiz_reset' => __('This step is irreversible. All Questions answers would be reset for this user. Are you sure you want to Reset the Quiz for this User? ', 'vibe'), 'quiz_reset_button' => __('Confirm, Reset Quiz for this User', 'vibe'), 'marks_saved' => __('Marks Saved', 'vibe'), 'quiz_marks_saved' => __('Quiz Marks Saved', 'vibe'), 'submit_quiz' => __('Submit Quiz', 'vibe'), 'sending_messages' => __('Sending Messages ...', 'vibe'), 'adding_students' => __('Adding Students to Course ...', 'vibe'), 'successfuly_added_students' => __('Students successfully added to Course', 'vibe'), 'unable_add_students' => __('Unable to Add students to Course', 'vibe'), 'select_fields' => __('Please select fields to download', 'vibe'), 'download' => __('Download', 'vibe'), 'timeout' => __('TIMEOUT', 'vibe'), 'theme_color' => $color, 'single_dark_color' => $single_dark_color, 'for_course' => __('for Course', 'vibe'), 'active_filters' => __('Active Filters', 'vibe'), 'clear_filters' => __('Clear all filters', 'vibe'), 'remove_comment' => __('Are you sure you want to remove this note?', 'vibe'), 'remove_comment_button' => __('Confirm, remove note', 'vibe'), 'private_comment' => __('Make Private', 'vibe'), 'add_comment' => __('Add your note', 'vibe'), 'submit_quiz_error' => __('Please add questions or retake the quiz !', 'vibe'), 'remove_announcement' => __('Are you sure you want to remove this Annoucement?', 'vibe'), 'start_quiz_notification' => __('You\'re about to start the Quiz. Please click confirm to begin the quiz.', 'vibe'), 'submit_quiz_notification' => __('Are you sure you want to submit the quiz. Submitting the quiz will freeze all your answers, you can not change them.  Please confirm.', 'vibe'), 'check_results' => __('Check results', 'vibe'), 'correct' => __('Correct', 'vibe'), 'incorrect' => __('Incorrect', 'vibe'), 'confirm_apply' => _x('Are you sure you want to apply for this Course ?', 'confirmation message when user clicks on apply for course', 'vibe'), 'instructor_uncomplete_unit' => _x('Are you sure you want mark this unit "uncomplete" for the user ?', 'Popup confirmation message when instructor marks the unit uncomplete for the user.', 'vibe'), 'instructor_complete_unit' => _x('Are you sure you want to mark this unit "complete" for the user ?', 'Popup confirmation message ', 'vibe'), 'unanswered_questions' => __('You have few unanswered questions. Are you sure you want to continue ?', 'vibe'));
    wp_localize_script('bp-course-js', 'vibe_course_module_strings', $translation_array);
}
 /**
  * Verify access to the current content.
  *
  * Related:
  * A reference of available BuddyPress template tags
  * https://codex.buddypress.org/developer/template-tag-reference/
  *
  * @since  1.0.0
  *
  * @param int $id The content post ID to verify access.
  * @return bool|null True if has access, false otherwise.
  *     Null means: Rule not relevant for current page.
  */
 public function has_access($id, $admin_has_access = true)
 {
     global $bp;
     $has_access = null;
     if (!function_exists('bp_current_component')) {
         return null;
     }
     if (is_buddypress()) {
         // Check if access to *all* BuddyPress pages is restricted
         $has_access = parent::has_access(MS_Addon_BuddyPress_Rule::PROTECT_ALL, $admin_has_access);
     }
     if ($has_access) {
         // General BuddyPress access is either *allowed* or *not denied*
         $component = bp_current_component();
         if (!empty($component)) {
             if ('members' == $component || bp_is_user()) {
                 // Member listing or member profile access.
                 $has_access = parent::has_access(MS_Addon_BuddyPress_Rule::PROTECT_MEMBERS, $admin_has_access);
             } elseif ('messages' == $component) {
                 // Private messaging direct access.
                 if ('compose' == $bp->current_action) {
                     $has_access = parent::has_access(MS_Addon_BuddyPress_Rule::PROTECT_PRIVATE_MSG, $admin_has_access);
                 }
             } elseif ('messages' == $component) {
                 // Don't modify, handled by MS_Addon_Buddypress_Rule_Group
             } else {
                 // Other BP pages can be handled by other rules.
                 $has_access = null;
             }
         }
     }
     return apply_filters('ms_rule_buddypress_has_access', $has_access, $id, $this);
 }
コード例 #5
0
function bp_media_delete_button_handler($link)
{
    if (bp_current_component() == 'media') {
        $link = str_replace('delete-activity ', 'delete-activity-single ', $link);
    }
    return $link;
}
コード例 #6
0
function tie_register()
{
    ## Register Main style.css file
    wp_register_style('tie-style', get_stylesheet_uri(), array(), '', 'all');
    wp_enqueue_style('tie-style');
    ## Register All Scripts
    wp_register_script('tie-scripts', get_template_directory_uri() . '/js/tie-scripts.js', array('jquery'), false, true);
    wp_register_script('tie-tabs', get_template_directory_uri() . '/js/tabs.min.js', array('jquery'), false, true);
    wp_register_script('tie-cycle', get_template_directory_uri() . '/js/jquery.cycle.all.js', array('jquery'), false, true);
    wp_register_script('tie-validation', get_template_directory_uri() . '/js/validation.js', array('jquery'), false, true);
    wp_register_script('tie-flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'), false, true);
    ## Get Global Scripts
    wp_enqueue_script('tie-scripts');
    ## Register WooCommerce css file
    wp_register_style('tie-woocommerce', get_template_directory_uri() . '/css/woocommerce.css', array(), '', 'all');
    if (class_exists('Woocommerce')) {
        wp_enqueue_style('tie-woocommerce');
    }
    ## Get Validation Script
    if (tie_get_option('comment_validation') && (is_page() || is_single()) && comments_open()) {
        wp_enqueue_script('tie-validation');
    }
    ## For facebook & Google + share
    if (is_singular() && tie_get_option('post_og_cards') && (!function_exists('bp_current_component') || function_exists('bp_current_component') && !bp_current_component())) {
        tie_og_data();
    }
}
コード例 #7
0
ファイル: conditionals.php プロジェクト: baden03/mediapress
/**
 * Are we on component gallery
 * 
 * Is gallery associated to a component(groups/events etc)
 * 
 * @return boolean
 */
function mpp_is_component_gallery()
{
    $is_gallery = false;
    if (bp_is_current_action(MPP_GALLERY_SLUG) && mpp_is_active_component(bp_current_component())) {
        $is_gallery = true;
    }
    return apply_filters('mpp_is_component_gallery', $is_gallery);
}
コード例 #8
0
function tie_register()
{
    ## Register Main style.css file
    wp_register_style('tie-style', get_stylesheet_uri(), array(), '', 'all');
    wp_enqueue_style('tie-style');
    ## Register All Scripts
    wp_register_script('tie-scripts', get_template_directory_uri() . '/js/tie-scripts.js', array('jquery'), false, true);
    wp_register_script('tie-tabs', get_template_directory_uri() . '/js/tabs.min.js', array('jquery'), false, true);
    wp_register_script('tie-cycle', get_template_directory_uri() . '/js/jquery.cycle.all.js', array('jquery'), false, true);
    wp_register_script('tie-validation', get_template_directory_uri() . '/js/validation.js', array('jquery'), false, true);
    wp_register_script('tie-masonry', get_template_directory_uri() . '/js/isotope.js', array('jquery'), false, true);
    wp_register_script('tie-ilightbox', get_template_directory_uri() . '/js/ilightbox.packed.js', array('jquery'), false, true);
    ## Get Global Scripts
    wp_enqueue_script('tie-scripts');
    wp_enqueue_script('tie-ilightbox');
    ## Register WooCommerce css file
    wp_register_style('tie-woocommerce', get_template_directory_uri() . '/css/woocommerce.css', array(), '', 'all');
    if (class_exists('Woocommerce')) {
        wp_enqueue_style('tie-woocommerce');
    }
    ## Register bbPress css file
    wp_register_style('tie-bbpress', get_template_directory_uri() . '/css/bbpress.css', array(), '', 'all');
    if (class_exists('bbpress')) {
        wp_enqueue_style('tie-bbpress');
    }
    ## Register buddyPress css file
    wp_register_style('tie-buddypress', get_template_directory_uri() . '/css/buddypress.css', array(), '', 'all');
    if (class_exists('buddypress')) {
        wp_enqueue_style('tie-buddypress');
    }
    ## Get Validation Script
    if (tie_get_option('comment_validation') && is_singular() && comments_open()) {
        wp_enqueue_script('tie-validation');
    }
    $lightbox_skin = 'dark';
    if (tie_get_option('lightbox_skin')) {
        $lightbox_skin = tie_get_option('lightbox_skin');
    }
    wp_enqueue_style('tie-ilightbox-skin', get_template_directory_uri() . '/css/ilightbox/' . $lightbox_skin . '-skin/skin.css');
    ## For facebook & Google + share
    if (is_singular() && tie_get_option('post_og_cards') && (!function_exists('bp_current_component') || function_exists('bp_current_component') && !bp_current_component())) {
        tie_og_data();
    }
    ## Sticky Sidebars
    $sticky_sidebar = false;
    if (tie_get_option('sticky_sidebar')) {
        $sticky_sidebar = true;
        if ((is_home() || is_front_page()) && tie_get_option('sticky_sidebar_disable_homepage') || is_page() && tie_get_option('sticky_sidebar_disable_pages') || is_single() && tie_get_option('sticky_sidebar_disable_posts') || is_tag() && tie_get_option('sticky_sidebar_disable_tag') || is_category() && tie_get_option('sticky_sidebar_disable_cat')) {
            $sticky_sidebar = false;
        }
    }
    ## Inline Vars
    $tie_js_vars = array("mobile_menu_active" => tie_get_option('mobile_menu_active'), "mobile_menu_top" => tie_get_option('mobile_menu_top'), "lightbox_all" => tie_get_option('lightbox_all'), "lightbox_gallery" => tie_get_option('lightbox_gallery'), "woocommerce_lightbox" => get_option('woocommerce_enable_lightbox'), "lightbox_skin" => $lightbox_skin, "lightbox_thumb" => tie_get_option('lightbox_thumbs'), "lightbox_arrows" => tie_get_option('lightbox_arrows'), "sticky_sidebar" => $sticky_sidebar, "is_singular" => is_singular(), "reading_indicator" => tie_get_option('reading_indicator'), "lang_no_results" => __ti('No Results'), "lang_results_found" => __ti('Results Found'));
    wp_localize_script('tie-scripts', 'tie', $tie_js_vars);
}
コード例 #9
0
/**
 * Determine whether you are viewing a BuddyPress Docs page
 *
 * @package BuddyPress Docs
 * @since 1.0-beta
 *
 * @return bool
 */
function bp_docs_is_bp_docs_page()
{
    global $bp;
    $is_bp_docs_page = false;
    // This is intentionally ambiguous and generous, to account for BP Docs is different
    // components. Probably should be cleaned up at some point
    if ($bp->bp_docs->slug == bp_current_component() || $bp->bp_docs->slug == bp_current_action()) {
        $is_bp_docs_page = true;
    }
    return apply_filters('bp_docs_is_bp_docs_page', $is_bp_docs_page);
}
コード例 #10
0
ファイル: test-sample.php プロジェクト: socialray/surfied-2-0
 /**
  * @group invite_anyone_group_invite_access_test
  */
 public function test_group_access_test_no_group_during_group_creation()
 {
     $cc = bp_current_component();
     $ca = bp_current_action();
     buddypress()->current_component = buddypress()->groups->id;
     buddypress()->current_action = 'create';
     $u = $this->factory->user->create();
     $this->assertSame('anyone', invite_anyone_group_invite_access_test(0, $u));
     buddypress()->current_component = $cc;
     buddypress()->current_action = $ca;
 }
コード例 #11
0
 /**
  * Setup globals
  *
  * The BP_MEMBERS_SLUG constant is deprecated, and only used here for
  * backwards compatibility.
  *
  * @since 1.5
  * @global obj $bp
  */
 function setup_globals()
 {
     global $bp, $current_user, $displayed_user_id;
     // Define a slug, if necessary
     if (!defined('BP_MEMBERS_SLUG')) {
         define('BP_MEMBERS_SLUG', $this->id);
     }
     $globals = array('path' => BP_PLUGIN_DIR, 'slug' => BP_MEMBERS_SLUG, 'root_slug' => isset($bp->pages->members->slug) ? $bp->pages->members->slug : BP_MEMBERS_SLUG, 'has_directory' => true, 'search_string' => __('Search Members...', 'buddypress'));
     parent::setup_globals($globals);
     /** Logged in user ****************************************************/
     // Fetch the full name for the logged in user
     $bp->loggedin_user->fullname = bp_core_get_user_displayname(bp_loggedin_user_id());
     // Hits the DB on single WP installs so get this separately
     $bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin(bp_loggedin_user_id());
     // The domain for the user currently logged in. eg: http://domain.com/members/andy
     $bp->loggedin_user->domain = bp_core_get_user_domain(bp_loggedin_user_id());
     // The core userdata of the user who is currently logged in.
     $bp->loggedin_user->userdata = bp_core_get_core_userdata(bp_loggedin_user_id());
     /** Displayed user ****************************************************/
     // The domain for the user currently being displayed
     $bp->displayed_user->domain = bp_core_get_user_domain(bp_displayed_user_id());
     // The core userdata of the user who is currently being displayed
     $bp->displayed_user->userdata = bp_core_get_core_userdata(bp_displayed_user_id());
     // Fetch the full name displayed user
     $bp->displayed_user->fullname = bp_core_get_user_displayname(bp_displayed_user_id());
     /** Profiles Fallback *************************************************/
     if (!bp_is_active('xprofile')) {
         $bp->profile->slug = 'profile';
         $bp->profile->id = 'profile';
     }
     /** Default Profile Component *****************************************/
     if (!defined('BP_DEFAULT_COMPONENT')) {
         if (bp_is_active('activity') && isset($bp->pages->activity)) {
             $bp->default_component = bp_get_activity_slug();
         } else {
             $bp->default_component = 'xprofile' == $bp->profile->id ? 'profile' : $bp->profile->id;
         }
     } else {
         $bp->default_component = BP_DEFAULT_COMPONENT;
     }
     if (!bp_current_component() && bp_displayed_user_id()) {
         /**
          * BuddyPress will attempt to resolve to the most specific URL possible,
          * to avoid search-engine-unfriendly content reduplication. Filter
          * bp_guarantee_unique_uris (and return false) to avoid this behavior
          */
         if (apply_filters('bp_guarantee_unique_uris', true)) {
             bp_core_redirect(bp_displayed_user_domain() . $bp->default_component);
         } else {
             $bp->current_component = $bp->default_component;
         }
     }
 }
コード例 #12
0
ファイル: buddypress.php プロジェクト: christocmp/bingopaws
 public function __construct(&$plugin)
 {
     $this->p =& $plugin;
     $this->p->debug->mark();
     if (is_admin() || bp_current_component()) {
         $this->p->util->add_plugin_filters($this, array('post_types' => 3));
         // load sharing buttons code if sharing features exist and are enabled
         if (array_key_exists('ssb', $this->p->is_avail) && $this->p->is_avail['ssb'] === true) {
             $classname = __CLASS__ . 'Sharing';
             $this->sharing = new $classname($this->p);
         }
     }
 }
コード例 #13
0
ファイル: bp.php プロジェクト: kubens/Snippets
function breadcrumb_bp_current_item($item)
{
    $params = array('bp_component' => bp_current_component(), 'bp_item' => bp_current_item(), 'bp_action' => bp_current_action(), 'bp_action_variables' => bp_action_variables());
    switch (bp_current_component()) {
        case false:
            return $item;
            break;
        case 'groups':
            return new Breadcrumb_BP_Component_Group($item, $params);
            break;
        default:
            return new Breadcrumb_BP_Component($item, $params);
    }
}
コード例 #14
0
ファイル: utils.php プロジェクト: namnguyen2312/spa
function dt_theme_bbpress_title(){
	global $bp;
	$doctitle = "";
	$separator = dttheme_option ( 'seo', 'title-delimiter' );
	$id = 0;

	if ( !empty( $bp->displayed_user->fullname ) ) {
		
		$blog_title = preg_replace ( "~(?:\[/?)[^/\]]+/?\]~s", '', get_option ( 'blogname' ));
		$title =  bp_current_component() === "profile" ? __("Profile","dt_themes") : __("Member","dt_themes");
		$subtitle = strip_tags( $bp->displayed_user->fullname );
		$doctitle = $blog_title.' '.$separator.' '.$title.' '.$separator.' '.$subtitle.' '.$separator;

	} elseif( bp_is_members_component() ) {
		$id = $bp->pages->members->id;
	}elseif( bp_is_activity_component() ){
		$id = $bp->pages->activity->id;
	}elseif( bp_current_component() === "groups" ) {
		$id = $bp->pages->groups->id;
	}elseif( bp_current_component() === "register" ) {
		$id = $bp->pages->register->id;
	}elseif( bp_current_component() === "activate" ) {
		$id = $bp->pages->activate->id;
	}
	if( $id > 0 ){
		global $post;
		$args = array (
			"blog_title" => preg_replace ( "~(?:\[/?)[^/\]]+/?\]~s", '', get_option ( 'blogname' ) ),
			"blog_description" => get_bloginfo ( 'description' ),
			"post_title" => ! empty ( $post ) ? $post->post_title : NULL,
			"post_author_nicename" => ! empty ( $nickname ) ? ucwords ( $nickname ) : NULL,
			"post_author_firstname" => ! empty ( $first_name ) ? ucwords ( $first_name ) : NULL,
			"post_author_lastname" => ! empty ( $last_name ) ? ucwords ( $last_name ) : NULL,
			"post_author_dsiplay" => ! empty ( $display_name ) ? ucwords ( $display_name ) : NULL );
		$args = array_filter ( $args );

		$doctitle = get_post_meta ( $id, '_seo_title', true );
		if (empty ( $doctitle )) :
			$options = is_array ( dttheme_option ( 'seo', 'page-title-format' ) ) ? dttheme_option ( 'seo', 'page-title-format' ) : array ();
			foreach ( $options as $option ) :
				if (array_key_exists ( $option, $args ))
					$doctitle .= $args [$option] . ' ' . $separator . ' ';
			endforeach;
		endif;

	}	
	
	return $doctitle;
}
コード例 #15
0
ファイル: buddypress.php プロジェクト: leotaillard/btws2016
 public function __construct(&$plugin)
 {
     $this->p =& $plugin;
     if ($this->p->debug->enabled) {
         $this->p->debug->mark();
     }
     if (is_admin() || bp_current_component()) {
         if (!empty($this->p->is_avail['ssb'])) {
             $classname = __CLASS__ . 'Sharing';
             if (class_exists($classname)) {
                 $this->sharing = new $classname($this->p);
             }
         }
     }
 }
コード例 #16
0
function gmw_sweetdate_geolocation_init()
{
    define('GMW_SD_PATH', GMW_PATH . '/plugins/sweetdate-geolocation/');
    define('GMW_SD_URL', GMW_URL . '/plugins/sweetdate-geolocation/');
    //admin settings
    if (is_admin() && !defined('DOING_AJAX')) {
        include 'includes/admin/geo-my-wp-sd-admin.php';
        new GMW_SD_Admin();
    }
    //include members query only on members page
    if (bp_current_component() == 'members') {
        include 'includes/geo-my-wp-sd-class.php';
        new GMW_SD_Class_Query();
    }
}
コード例 #17
0
function sith_register()
{
    ## Register Main style.css file
    wp_register_style('sith-style', get_stylesheet_uri(), array(), '', 'all');
    wp_enqueue_style('sith-style');
    ## Register All Scripts
    wp_register_script('sith-scripts', get_template_directory_uri() . '/js/sith-scripts-frontend.js', array('jquery'), false, true);
    wp_register_script('fnp-nav', get_template_directory_uri() . '/js/fnp-nav.js', array('jquery'), false, true);
    ## Get Global Scripts
    wp_enqueue_script('sith-scripts');
    wp_enqueue_script('fnp-nav');
    ## For facebook & Google + share
    if (is_singular() && sith_get_option('post_og_cards') && (!function_exists('bp_current_component') || function_exists('bp_current_component') && !bp_current_component())) {
        sith_og_data();
    }
}
コード例 #18
0
/**
 * Catch and process the Requests page.
 */
function friends_screen_requests()
{
    if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_accept_friendship');
        if (friends_accept_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship accepted', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_reject_friendship');
        if (friends_reject_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship rejected', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('cancel', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_withdraw_friendship');
        if (friends_withdraw_friendship(bp_loggedin_user_id(), bp_action_variable(1))) {
            bp_core_add_message(__('Friendship request withdrawn', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship request could not be withdrawn', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    }
    /**
     * Fires before the loading of template for the friends requests page.
     *
     * @since BuddyPress (1.0.0)
     */
    do_action('friends_screen_requests');
    /**
     * Filters the template used to display the My Friends page.
     *
     * @since BuddyPress (1.0.0)
     *
     * @param string $template Path to the friends request template to load.
     */
    bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
コード例 #19
0
ファイル: filters.php プロジェクト: nikitansk/devschool
 function remove_wpseo_from_buddypress($title)
 {
     global $bp, $post;
     if (empty($this->bp_pages)) {
         $this->bp_pages = get_option('bp-pages');
     }
     if (function_exists('bp_is_directory') && bp_is_directory() || in_array($post->ID, $this->bp_pages)) {
         $title = sprintf(_x('%s Directory - %s', 'Directory Title format', 'vibe'), ucfirst(bp_current_component()), get_bloginfo('name'));
     }
     if (function_exists('bp_is_user') && bp_is_user()) {
         //$title = sprintf(_x('%1s group - %2s','Member Name',ucfirst(bp_get_displayed_user_fullname()),get_bloginfo('name')));
         $title = ucfirst(bp_get_displayed_user_fullname()) . ' - ' . get_bloginfo('name');
     }
     if (function_exists('bp_is_group') && bp_is_group()) {
         //$title = sprintf(_x('%1s group - %2s','Group Name',ucfirst(bp_get_current_group_name()),get_bloginfo('name')));
         $title = ucfirst(bp_get_current_group_name()) . ' - ' . get_bloginfo('name');
     }
     return $title;
 }
 /**
  * Add template hierarchy to theme compat for registration/activation pages.
  *
  * This is to mirror how WordPress has
  * {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
  *
  * @since 1.8.0
  *
  * @param string $templates The templates from bp_get_theme_compat_templates().
  * @return array $templates Array of custom templates to look for.
  */
 public function template_hierarchy($templates)
 {
     $component = sanitize_file_name(bp_current_component());
     /**
      * Filters the template hierarchy for theme compat and registration/activation pages.
      *
      * This filter is a variable filter that depends on the current component
      * being used.
      *
      * @since 1.8.0
      *
      * @param array $value Array of template paths to add to hierarchy.
      */
     $new_templates = apply_filters("bp_template_hierarchy_{$component}", array("members/index-{$component}.php"));
     // Merge new templates with existing stack
     // @see bp_get_theme_compat_templates().
     $templates = array_merge((array) $new_templates, $templates);
     return $templates;
 }
コード例 #21
0
/**
 * Load the template loop for the current object.
 *
 * @return string Prints template loop for the specified object
 * @since BuddyPress (1.2)
 */
function bp_legacy_theme_object_template_loader()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    // Bail if no object passed
    if (empty($_POST['object'])) {
        return;
    }
    // Sanitize the object
    $object = sanitize_title($_POST['object']);
    // Bail if object is not an active component to prevent arbitrary file inclusion
    if (!bp_is_active($object)) {
        return;
    }
    /**
     * AJAX requests happen too early to be seen by bp_update_is_directory()
     * so we do it manually here to ensure templates load with the correct
     * context. Without this check, templates will load the 'single' version
     * of themselves rather than the directory version.
     */
    if (!bp_current_action()) {
        bp_update_is_directory(true, bp_current_component());
    }
    $template_part = $object . '/' . $object . '-loop';
    // The template part can be overridden by the calling JS function
    if (!empty($_POST['template'])) {
        $template_part = sanitize_option('upload_path', $_POST['template']);
    }
    // Locate the object template
    bp_get_template_part($template_part);
    exit;
}
コード例 #22
0
/**
 *  buddypress default forum topic tags widget to show forum tags on the forums directory
 *
 * @package Custom Community
 * @since 1.8.3
 */
function forum_tags_widget()
{
    /* Show forum tags on the forums directory */
    if (BP_FORUMS_SLUG == bp_current_component() && bp_is_directory()) {
        ?>
		<div id="forum-directory-tags" class="widget tags">

			<h3 class="widgettitle"><?php 
        _e('Forum Topic Tags', 'cc');
        ?>
</h3>
			<?php 
        if (function_exists('bp_forums_tag_heat_map')) {
            ?>
				<div id="tag-text"><?php 
            bp_forums_tag_heat_map();
            ?>
</div>
			<?php 
        }
        ?>
		</div>
<?php 
    }
}
コード例 #23
0
 function wds_metadesc()
 {
     if (is_admin()) {
         return false;
     }
     global $post, $wp_query;
     //global $wds_options;
     $wds_options = get_wds_options();
     if (is_singular()) {
         if (function_exists('groups_get_current_group') && 'groups' == bp_current_component() && ($group = groups_get_current_group())) {
             // BP group?
             $optvar = !empty($wds_options['metadesc-bp_groups']) ? $wds_options['metadesc-bp_groups'] : '';
             $metadesc = wds_replace_vars($optvar, array('name' => $group->name, 'description' => $group->description));
         } else {
             if (function_exists('bp_current_component') && 'profile' == bp_current_component()) {
                 $optvar = !empty($wds_options['metadesc-bp_profile']) ? $wds_options['metadesc-bp_profile'] : '';
                 $metadesc = wds_replace_vars($optvar, array('full_name' => bp_get_displayed_user_fullname(), 'username' => bp_get_displayed_user_username()));
             } else {
                 $metadesc = wds_get_value('metadesc');
                 if (empty($metadesc)) {
                     $optvar = !empty($wds_options['metadesc-' . $post->post_type]) ? $wds_options['metadesc-' . $post->post_type] : '';
                     $metadesc = wds_replace_vars($optvar, (array) $post);
                 }
             }
         }
     } else {
         if (function_exists('is_shop') && is_shop() && function_exists('woocommerce_get_page_id')) {
             // WooCommerce shop page
             $post_id = woocommerce_get_page_id('shop');
             $metadesc = wds_get_value('metadesc', $post_id);
             if (empty($metadesc)) {
                 $optvar = !empty($wds_options['metadesc-' . $post->post_type]) ? $wds_options['metadesc-' . $post->post_type] : '';
                 $metadesc = wds_replace_vars($optvar, (array) $post);
             }
         } else {
             if (is_home() && 'posts' == get_option('show_on_front') && isset($wds_options['metadesc-home'])) {
                 $metadesc = wds_replace_vars($wds_options['metadesc-home'], array());
             } else {
                 if (is_home() && 'posts' != get_option('show_on_front')) {
                     $post = get_post(get_option('page_for_posts'));
                     $metadesc = wds_get_value('metadesc');
                     if (($metadesc == '' || !$metadesc) && isset($wds_options['metadesc-' . $post->post_type])) {
                         $metadesc = wds_replace_vars($wds_options['metadesc-' . $post->post_type], (array) $post);
                     }
                 } else {
                     if (is_category() || is_tag() || is_tax()) {
                         $term = $wp_query->get_queried_object();
                         $metadesc = wds_get_term_meta($term, $term->taxonomy, 'wds_desc');
                         if (!$metadesc && isset($wds_options['metadesc-' . $term->taxonomy])) {
                             $metadesc = wds_replace_vars($wds_options['metadesc-' . $term->taxonomy], (array) $term);
                         }
                     } else {
                         if (is_author()) {
                             $author_id = get_query_var('author');
                             $metadesc = get_the_author_meta('wds_metadesc', $author_id);
                         } else {
                             if (function_exists('groups_get_current_group') && 'groups' == bp_current_component() && ($group = groups_get_current_group())) {
                                 // BP group?
                                 $optvar = !empty($wds_options['metadesc-bp_groups']) ? $wds_options['metadesc-bp_groups'] : '';
                                 $metadesc = wds_replace_vars($optvar, array('name' => $group->name, 'description' => $group->description));
                             } else {
                                 if (function_exists('bp_current_component') && 'profile' == bp_current_component()) {
                                     $optvar = !empty($wds_options['metadesc-bp_profile']) ? $wds_options['metadesc-bp_profile'] : '';
                                     $metadesc = wds_replace_vars($optvar, array('full_name' => bp_get_displayed_user_fullname(), 'username' => bp_get_displayed_user_username()));
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!empty($metadesc)) {
         echo "\t" . '<meta name="description" content="' . esc_attr(strip_tags(stripslashes(apply_filters('wds_metadesc', $metadesc)))) . '" />' . "\n";
     }
 }
コード例 #24
0
ファイル: hooks-functions.php プロジェクト: jun200/wordpress
function meso_schema_breadcrumbs()
{
    global $post;
    $schema_on = '';
    $schema_link = '';
    $schema_prop_url = '';
    $schema_prop_title = '';
    $showOnHome = 1;
    // 1 - show breadcrumbs on the homepage, 0 - don't show
    $delimiter = ' &raquo; ';
    // delimiter between crumbs
    $home = __('Home', 'mesocolumn');
    // text for the 'Home' link
    $showCurrent = 1;
    // 1 - show current post/page title in breadcrumbs, 0 - don't show
    $before = '<span class="current">';
    // tag before the current crumb
    $after = '</span>';
    // tag after the current crumb
    $schema_breadcrumb_on = get_theme_mod('schema_breadcrumb_on');
    if ($schema_breadcrumb_on == 'enable') {
        $schema_link = ' itemscope itemtype="http://data-vocabulary.org/Breadcrumb"';
        $schema_prop_url = ' itemprop="url"';
        $schema_prop_title = ' itemprop="title"';
    }
    $homeLink = home_url();
    if (is_home() || is_front_page()) {
        if ($showOnHome == 1) {
            echo '<div id="breadcrumbs"><div class="innerwrap">';
            echo __('You are here: ', 'mesocolumn');
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . $homeLink . '">' . '<span' . $schema_prop_title . '>' . $home . '</span>' . '</a></span>';
            echo '</div></div>';
        }
    } else {
        echo '<div id="breadcrumbs"><div class="innerwrap">';
        if (!is_single()) {
            echo __('You are here: ', 'mesocolumn');
        }
        echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . $homeLink . '">' . '<span' . $schema_prop_title . '>' . $home . '</span>' . '</a></span>' . $delimiter . ' ';
        if (is_category()) {
            $thisCat = get_category(get_query_var('cat'), false);
            if ($thisCat->parent != 0) {
                $category_link = get_category_link($thisCat->parent);
                echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . $category_link . '">' . '<span' . $schema_prop_title . '>' . get_cat_name($thisCat->parent) . '</span>' . '</a></span>' . $delimiter . ' ';
            }
            $category_id = get_cat_ID(single_cat_title('', false));
            $category_link = get_category_link($category_id);
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . $category_link . '">' . '<span' . $schema_prop_title . '>' . single_cat_title('', false) . '</span>' . '</a></span>';
        } elseif (is_search()) {
            echo __('Search results for', 'mesocolumn') . ' "' . get_search_query() . '"';
        } elseif (is_day()) {
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_year_link(get_the_time('Y')) . '">' . '<span' . $schema_prop_title . '>' . get_the_time('Y') . '</span>' . '</a></span>' . $delimiter . ' ';
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . '<span' . $schema_prop_title . '>' . get_the_time('F') . '</span>' . '</a></span>' . $delimiter . ' ';
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_day_link(get_the_time('Y'), get_the_time('m'), get_the_time('d')) . '">' . '<span' . $schema_prop_title . '>' . get_the_time('d') . '</span>' . '</a></span>';
        } elseif (is_month()) {
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_year_link(get_the_time('Y')) . '">' . '<span' . $schema_prop_title . '>' . get_the_time('Y') . '</span>' . '</a></span>' . $delimiter . ' ';
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . '<span' . $schema_prop_title . '>' . get_the_time('F') . '</span>' . '</a></span>';
        } elseif (is_year()) {
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_year_link(get_the_time('Y')) . '">' . '<span' . $schema_prop_title . '>' . get_the_time('Y') . '</span>' . '</a></span>';
        } elseif (is_single() && !is_attachment()) {
            if (get_post_type() != 'post') {
                $post_type = get_post_type_object(get_post_type());
                $slug = $post_type->rewrite;
                echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . $homeLink . '/' . $slug['slug'] . '">' . '<span' . $schema_prop_title . '>' . $post_type->labels->singular_name . '</span>' . '</a></span>';
                // get post type by post
                $post_type = $post->post_type;
                // get post type taxonomies
                $taxonomies = get_object_taxonomies($post_type, 'objects');
                if ($taxonomies) {
                    foreach ($taxonomies as $taxonomy_slug => $taxonomy) {
                        // get the terms related to post
                        $terms = get_the_terms($post->ID, $taxonomy_slug);
                        if (!empty($terms)) {
                            foreach ($terms as $term) {
                                $taxlist .= ' ' . $delimiter . ' ' . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_term_link($term->slug, $taxonomy_slug) . '">' . '<span' . $schema_prop_title . '>' . ucfirst($term->name) . '</span>' . '</a></span>';
                            }
                        }
                    }
                    if ($taxlist) {
                        echo $taxlist;
                    }
                }
                echo ' ' . $delimiter . ' ' . __('You are reading &raquo;', 'mesocolumn');
            } else {
                $category = get_the_category();
                if ($category) {
                    foreach ($category as $cat) {
                        echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_category_link($cat->term_id) . '">' . '<span' . $schema_prop_title . '>' . $cat->name . '</span>' . '</a></span>' . $delimiter . ' ';
                    }
                }
                echo __('You are reading &raquo;', 'mesocolumn');
            }
        } elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404()) {
            $post_type = get_post_type_object(get_post_type());
            echo $before . $post_type->labels->singular_name . $after;
        } elseif (is_attachment()) {
            $parent = get_post($post->post_parent);
            $cat = get_the_category($parent->ID);
            $cat = $cat[0];
            if ($cat) {
                echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
            }
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink($parent) . '">' . '<span' . $schema_prop_title . '>' . $parent->post_title . '</span>' . '</a></span>';
            if ($showCurrent == 1) {
                echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after;
            }
        } elseif (is_page() && !$post->post_parent) {
            if (class_exists('buddypress')) {
                global $bp;
                if (bp_is_groups_component()) {
                    echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('groups') . '</span>' . '</a></span>';
                    if (!bp_is_directory()) {
                        echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '/' . bp_current_item() . '">' . '<span' . $schema_prop_title . '>' . bp_current_item() . '</span>' . '</a></span>';
                        if (bp_current_action()) {
                            echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '/' . bp_current_item() . '/' . bp_current_action() . '">' . '<span' . $schema_prop_title . '>' . bp_current_action() . '</span>' . '</a></span>';
                        }
                    }
                } else {
                    if (bp_is_members_directory()) {
                        echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('members') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('members') . '</span>' . '</a></span>';
                    } else {
                        if (bp_is_user()) {
                            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('members') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('members') . '</span>' . '</a></span>';
                            echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . bp_core_get_user_domain($bp->displayed_user->id) . '">' . '<span' . $schema_prop_title . '>' . bp_get_displayed_user_username() . '</span>' . '</a></span>';
                            if (bp_current_action()) {
                                echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . bp_core_get_user_domain($bp->displayed_user->id) . bp_current_component() . '">' . '<span' . $schema_prop_title . '>' . bp_current_component() . '</span>' . '</a></span>';
                            }
                        } else {
                            if (bp_is_directory()) {
                                echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . bp_current_component() . '</span>' . '</a></span>';
                            } else {
                                echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . the_title_attribute('echo=0') . '</span>' . '</a></span>';
                            }
                        }
                    }
                }
            } else {
                echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . the_title_attribute('echo=0') . '</span>' . '</a></span>';
            }
        } elseif (is_page() && $post->post_parent) {
            $parent_id = $post->post_parent;
            $breadcrumbs = array();
            while ($parent_id) {
                $page = get_page($parent_id);
                $breadcrumbs[] = '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink($page->ID) . '">' . '<span' . $schema_prop_title . '>' . get_the_title($page->ID) . '</span>' . '</a></span>';
                $parent_id = $page->post_parent;
            }
            $breadcrumbs = array_reverse($breadcrumbs);
            for ($i = 0; $i < count($breadcrumbs); $i++) {
                echo $breadcrumbs[$i];
                if ($i != count($breadcrumbs) - 1) {
                    echo ' ' . $delimiter . ' ';
                }
            }
            echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . the_title_attribute('echo=0') . '</span>' . '</a></span>';
        } elseif (is_tag()) {
            $tag_id = get_term_by('name', single_cat_title('', false), 'post_tag');
            if ($tag_id) {
                $tag_link = get_tag_link($tag_id->term_id);
            }
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . $tag_link . '">' . '<span' . $schema_prop_title . '>' . single_cat_title('', false) . '</span>' . '</a></span>';
        } elseif (is_author()) {
            global $author;
            $userdata = get_userdata($author);
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_author_posts_url($userdata->ID) . '">' . '<span' . $schema_prop_title . '>' . $userdata->display_name . '</span>' . '</a></span>';
        } elseif (is_404()) {
            echo ' ' . $delimiter . ' ' . __('Error 404', 'mesocolumn');
        }
        if (get_query_var('paged')) {
            if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) {
                echo ' (';
            }
            echo ' ' . $delimiter . ' ' . __('Page', 'mesocolumn') . ' ' . get_query_var('paged');
            if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) {
                echo ')';
            }
        }
        echo '</div></div>';
    }
}
コード例 #25
0
ファイル: home.php プロジェクト: quyip8818/wps
do_action('bp_member_options_nav');
?>

                  </ul>
              </div>
          </div>
          <!-- #item-nav -->
      </div>


      <div id="item-body" role="main" class="col-sm-12">


          <?php 
do_action('bp_before_member_body');
if (bp_is_user_activity() || !bp_current_component()) {
    bp_get_template_part('members/single/activity');
} elseif (bp_is_user_blogs()) {
    bp_get_template_part('members/single/blogs');
} elseif (bp_is_user_friends()) {
    bp_get_template_part('members/single/friends');
} elseif (bp_is_user_groups()) {
    bp_get_template_part('members/single/groups');
} elseif (bp_is_user_messages()) {
    bp_get_template_part('members/single/messages');
} elseif (bp_is_user_profile()) {
    bp_get_template_part('members/single/profile');
} elseif (bp_is_user_forums()) {
    bp_get_template_part('members/single/forums');
} elseif (bp_is_user_notifications()) {
    bp_get_template_part('members/single/notifications');
コード例 #26
0
 /**
  * Set up canonical stack for this component.
  *
  * @since BuddyPress (2.1.0)
  */
 public function setup_canonical_stack()
 {
     $bp = buddypress();
     /** Default Profile Component *****************************************/
     if (defined('BP_DEFAULT_COMPONENT') && BP_DEFAULT_COMPONENT) {
         $bp->default_component = BP_DEFAULT_COMPONENT;
     } else {
         if (bp_is_active('activity') && isset($bp->pages->activity)) {
             $bp->default_component = bp_get_activity_slug();
         } else {
             $bp->default_component = 'xprofile' === $bp->profile->id ? 'profile' : $bp->profile->id;
         }
     }
     /** Canonical Component Stack *****************************************/
     if (bp_displayed_user_id()) {
         $bp->canonical_stack['base_url'] = bp_displayed_user_domain();
         if (bp_current_component()) {
             $bp->canonical_stack['component'] = bp_current_component();
         }
         if (bp_current_action()) {
             $bp->canonical_stack['action'] = bp_current_action();
         }
         if (!empty($bp->action_variables)) {
             $bp->canonical_stack['action_variables'] = bp_action_variables();
         }
         // Looking at the single member root/home, so assume the default
         if (!bp_current_component()) {
             $bp->current_component = $bp->default_component;
             // The canonical URL will not contain the default component
         } elseif (bp_is_current_component($bp->default_component) && !bp_current_action()) {
             unset($bp->canonical_stack['component']);
         }
         // if we're on a spammer's profile page, only users with the 'bp_moderate' cap
         // can view subpages on the spammer's profile
         //
         // users without the cap trying to access a spammer's subnav page will get
         // redirected to the root of the spammer's profile page.  this occurs by
         // by removing the component in the canonical stack.
         if (bp_is_user_spammer(bp_displayed_user_id()) && !bp_current_user_can('bp_moderate')) {
             unset($bp->canonical_stack['component']);
         }
     }
 }
コード例 #27
0
/**
 * Set the "is_item_mod" global.
 *
 * @param bool $is_item_mod Optional. Default: false.
 * @param string $component Optional. Component name. Default: the current
 *        component.
 */
function bp_update_is_item_mod($is_item_mod = false, $component = '')
{
    if (empty($component)) {
        $component = bp_current_component();
    }
    buddypress()->is_item_mod = apply_filters('bp_update_is_item_mod', $is_item_mod, $component);
}
コード例 #28
0
ファイル: ajax.php プロジェクト: nxtclass/NXTClass-Plugin
function bp_dtheme_object_template_loader()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    /**
     * AJAX requests happen too early to be seen by bp_update_is_directory()
     * so we do it manually here to ensure templates load with the correct
     * context. Without this check, templates will load the 'single' version
     * of themselves rather than the directory version.
     */
    if (!bp_current_action()) {
        bp_update_is_directory(true, bp_current_component());
    }
    // Sanitize the post object
    $object = esc_attr($_POST['object']);
    // Locate the object template
    locate_template(array("{$object}/{$object}-loop.php"), true);
}
コード例 #29
0
ファイル: core.php プロジェクト: CompositeUK/clone.BuddyPress
 function test_wordpress_page()
 {
     $this->go_to('/');
     $this->assertEmpty(bp_current_component());
 }
コード例 #30
0
ファイル: buddypress.php プロジェクト: luskyj89/mt-wordpress
<?php

get_header();
$cb_user_page = $cb_group_creator = $cb_title_prefix = $cb_bp_class = $cb_breadcrumbs_override = NULL;
global $bb_current_user;
$cb_breadcrumbs = ot_get_option('cb_breadcrumbs', 'on');
$cb_theme_style = ot_get_option('cb_theme_style', 'cb_boxed');
$cb_buddypress_sidebar = ot_get_option('cb_buddypress_sidebar', 'sidebar');
$cb_buddypress_global_color = ot_get_option('cb_buddypress_global_color', '#eb9812');
$cb_current_user = bp_displayed_user_id();
$cb_title = get_the_title();
$cb_bp_current_component = bp_current_component();
$cb_bp_current_action = bp_current_action();
if (($cb_bp_current_component == 'activity' || $cb_bp_current_component == 'profile') && bp_is_directory() == false && $cb_bp_current_action != NULL) {
    $cb_title_prefix = '<span>' . __('Member', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
}
if ($cb_bp_current_component == 'groups' && $cb_bp_current_action != NULL) {
    $cb_title_prefix = '<span>' . __('Group', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
}
if ($cb_bp_current_component == 'groups' && ($cb_bp_current_action == 'my-groups' || $cb_bp_current_action == 'invites')) {
    $cb_title_prefix = NULL;
    $cb_title = __('Groups', 'cubell');
}
if ($cb_bp_current_component == 'settings') {
    $cb_title_prefix = '<span>' . __('Settings', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
}
if ($cb_bp_current_component == 'forums') {
    $cb_title_prefix = '<span>' . __('Forums', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
}
if ($cb_bp_current_component == 'activity' && $cb_bp_current_action == NULL) {
    $cb_title = __('Latest Activity', 'cubell');