function bphelp_pbpp_redirect()
{
    global $bp;
    //IMPORTANT: Do not alter the following line.
    $bphelp_my_redirect_slug = get_option('bphelp-my-redirect-slug', 'register');
    if (bp_is_activity_component() || bp_is_groups_component() || bp_is_group_forum() || bbp_is_single_forum() || bbp_is_single_topic() || bp_is_forums_component() || bp_is_blogs_component() || bp_is_members_component() || bp_is_profile_component()) {
        if (!is_user_logged_in()) {
            bp_core_redirect(get_option('home') . '/' . $bphelp_my_redirect_slug);
        }
    }
}
function bp_reshare_add_reshare_button()
{
    global $bp;
    if (!is_user_logged_in()) {
        return false;
    }
    $activity_types_resharable = bp_reshare_activity_types();
    if (!in_array(bp_get_activity_type(), $activity_types_resharable)) {
        return false;
    }
    if (bp_reshare_activity_is_hidden()) {
        return false;
    }
    if (bp_reshare_is_user_profile_reshares() && $bp->displayed_user->id != $bp->loggedin_user->id) {
        return false;
    }
    $activity_first_id = bp_get_activity_id();
    if ('reshare_update' == bp_get_activity_type()) {
        $activity_first_id = bp_get_activity_secondary_item_id();
    }
    $rs_count = bp_activity_get_meta($activity_first_id, 'reshared_count');
    $rs_count = !empty($rs_count) ? $rs_count : 0;
    if ($bp->loggedin_user->id == bp_get_activity_user_id() || bp_reshare_user_did_reshared($activity_first_id)) {
        $reshared_class = 'reshared';
    }
    $action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/?to_reshare=' . $activity_first_id, '_reshare_update');
    if ($_POST['scope'] == 'reshares' || bp_reshare_is_user_profile_reshares() || bp_is_activity_component() && !bp_displayed_user_id() && $_COOKIE['bp-activity-scope'] == 'reshares') {
        $extra_class = 'unshare';
        $action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/?delete_reshare=' . bp_get_activity_id(), '_reshare_delete');
    }
    ?>
	
	<a href="<?php 
    echo $action_url;
    ?>
" class="button bp-primary-action bp-agu-reshare" id="bp-agu-reshare-<?php 
    bp_activity_id();
    ?>
" rel="<?php 
    echo $activity_first_id;
    ?>
"><span class="bp-agu-reshare-img <?php 
    echo $reshared_class . ' ' . $extra_class;
    ?>
"></span><span class="rs-count"><?php 
    echo $rs_count;
    ?>
</span></a>
	<?php 
}
 function register_plugin_scripts()
 {
     if (bp_is_activity_component() || bp_is_group_home()) {
         wp_enqueue_script('bp-reshare-js', BP_RESHARE_PLUGIN_URL_JS . '/reshare.js', array('jquery'), 0, 1);
         BP_Reshare::localize_script();
     }
 }
Example #4
0
function bebop_feeds()
{
    global $bp, $wp_query, $this_bp_feed;
    if (bp_is_activity_component()) {
        $active_extensions = bebop_extensions::bebop_get_active_extension_names();
        $active_extensions[] = 'all_oers';
        foreach ($active_extensions as $extension) {
            if (bp_current_action() == $extension) {
                if ($extension == 'all_oers') {
                    $this_bp_feed = $extension;
                } else {
                    if (bebop_tables::check_option_exists('bebop_' . $extension . '_rss_feed')) {
                        if (bebop_tables::get_option_value('bebop_' . $extension . '_rss_feed') == 'on') {
                            $this_bp_feed = $extension;
                        }
                    }
                }
            }
        }
    }
    if (empty($this_bp_feed)) {
        return false;
    }
    $wp_query->is_404 = false;
    status_header(200);
    include_once 'templates/user/bebop-feed-template.php';
    die;
}
/**
 * Filter the activity loop when we're on a "Following" page
 *
 * This is done:
 *   - On the activity directory and clicking on the "Following" tab
 *   - On a user's "Activity > Following" page
 *
 * @since 1.0.0
 *
 * @param string|array Current activity querystring
 * @param string $object The current object or component
 * @return array
 */
function bp_follow_add_activity_scope_filter($qs, $object)
{
    global $bp;
    // not on the activity object? stop now!
    if ($object != 'activity') {
        return $qs;
    }
    $set = false;
    // activity directory
    // can't use bp_is_activity_directory() yet since that's a BP 2.0 function
    if (!bp_displayed_user_id() && bp_is_activity_component() && !bp_current_action()) {
        // check if activity scope is following before manipulating
        if (isset($_COOKIE['bp-activity-scope']) && 'following' === $_COOKIE['bp-activity-scope']) {
            $set = true;
        }
        // user's activity following page
    } elseif (bp_is_user_activity() && bp_is_current_action('following')) {
        $set = true;
    }
    // not on a user page? stop now!
    if (!$set) {
        return $qs;
    }
    // set internal marker noting that our activity scope is applied
    $bp->follow->activity_scope_set = 1;
    $qs = wp_parse_args($qs);
    $following_ids = bp_get_following_ids(array('user_id' => bp_displayed_user_id() ? bp_displayed_user_id() : bp_loggedin_user_id()));
    // if $following_ids is empty, pass a negative number so no activity can be found
    $following_ids = empty($following_ids) ? -1 : $following_ids;
    $qs['user_id'] = $following_ids;
    return apply_filters('bp_follow_add_activity_scope_filter', $qs, false);
}
Example #6
0
/**
 * Forces the BP Profile Pages to be 1 Column
 * 
 * @package lsx
 * @subpackage jetpack
 * @category infinite scroll
 */
function lsx_buddypress_page_columns($layout)
{
    if (bp_is_profile_component() || bp_is_settings_component() || bp_is_activity_component() || bp_is_group() || bp_is_messages_component() || bp_is_members_directory() || bp_is_groups_directory() || bp_is_groups_component() || bp_is_members_component()) {
        $layout = '1c';
    }
    return $layout;
}
Example #7
0
 function load_scripts()
 {
     wp_enqueue_script('gwa-user', AGM_PLUGIN_URL . '/js/gwa-user.js');
     if (bp_is_activity_component()) {
         add_thickbox();
     }
 }
function bp_reshare_is_user_profile_reshares()
{
    if (bp_is_activity_component() && bp_displayed_user_id() && bp_is_current_action('reshares')) {
        return true;
    } else {
        return false;
    }
}
Example #9
0
 public function test_member_activity_page()
 {
     $url = home_url($this->u->user_nicename) . '/' . bp_get_activity_slug();
     $this->go_to($url);
     $this->assertTrue(bp_is_user());
     $this->assertTrue(bp_is_my_profile());
     $this->assertEquals($this->u->ID, bp_displayed_user_id());
     $this->assertTrue(bp_is_activity_component());
 }
/**
 * Should BuddyPress load the mentions scripts and related assets, including results to prime the
 * mentions suggestions?
 *
 * @since 2.1.0
 *
 * @return bool True if mentions scripts should be loaded.
 */
function bp_activity_maybe_load_mentions_scripts()
{
    $mentions_enabled = bp_activity_do_mentions() && bp_is_user_active();
    $load_mentions = $mentions_enabled && (bp_is_activity_component() || is_admin());
    /**
     * Filters whether or not BuddyPress should load mentions scripts and assets.
     *
     * @since 2.1.0
     *
     * @param bool $load_mentions    True to load mentions assets, false otherwise.
     * @param bool $mentions_enabled True if mentions are enabled.
     */
    return (bool) apply_filters('bp_activity_maybe_load_mentions_scripts', $load_mentions, $mentions_enabled);
}
Example #11
0
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;
}
function logged_out_redirect()
{
    global $bp;
    // BuddyPress components to lock
    if (bp_is_activity_component() || bp_is_groups_component() || bp_is_group_forum() || bp_is_forums_component() || bp_is_blogs_component() || bp_is_page(BP_MEMBERS_SLUG) || bp_is_profile_component()) {
        // Check if user is logged out
        if (!is_user_logged_in()) {
            // Check if a page was selected for redirection
            if (of_get_option('redirect')) {
                $redirect_page = get_permalink(of_get_option('redirect'));
                // If not redirect to login page
            } else {
                $redirect_page = site_url('/wp-login.php');
            }
            wp_redirect($redirect_page);
            exit;
        }
    }
}
function bp_checkins_is_activity_or_friends()
{
    if ((int) bp_get_option('bp-checkins-disable-activity-checkins') && (!(int) bp_get_option('bp-checkins-activate-component') || '' == bp_get_option('bp-checkins-activate-component'))) {
        return false;
    }
    if ((int) bp_get_option('bp-checkins-disable-activity-checkins') && bp_is_activity_component() && !bp_is_single_activity()) {
        return false;
    }
    if ((int) bp_get_option('bp-checkins-disable-activity-checkins') && bp_is_group_home()) {
        return false;
    }
    if (!bp_checkins_show_friends_checkins() && bp_displayed_user_id() && bp_is_friends_component()) {
        return false;
    }
    if (bp_is_group_home() || bp_is_activity_component() || bp_displayed_user_id() && bp_is_friends_component()) {
        return true;
    } else {
        return false;
    }
}
 /**
  * Set up the theme compatibility hooks, if we're looking at an activity page.
  *
  * @since 1.7.0
  */
 public function is_activity()
 {
     // Bail if not looking at a group.
     if (!bp_is_activity_component()) {
         return;
     }
     // Activity Directory.
     if (!bp_displayed_user_id() && !bp_current_action()) {
         bp_update_is_directory(true, 'activity');
         /** This action is documented in bp-activity/bp-activity-screens.php */
         do_action('bp_activity_screen_index');
         add_filter('bp_get_buddypress_template', array($this, 'directory_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'directory_content'));
         // Single activity.
     } elseif (bp_is_single_activity()) {
         add_filter('bp_get_buddypress_template', array($this, 'single_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'single_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'single_dummy_content'));
     }
 }
Example #15
0
 /**
  * @internal copied from bp-default/functions.php
  */
 public function init_scripts()
 {
     parent::init_scripts();
     // Enqueue various scripts
     wp_enqueue_script('bp-jquery-query');
     wp_enqueue_script('bp-jquery-cookie');
     // Enqueue scrollTo only on activity pages
     if (bp_is_activity_component()) {
         wp_enqueue_script('bp-jquery-scroll-to');
     }
     // Enqueue members widget JS just in case
     if (is_active_widget(false, false, 'bp_core_members_widget') && !is_admin() && !is_network_admin()) {
         wp_enqueue_script('bp-widget-members');
     }
     // Bump this when changes are made to bust cache
     $version = '20120110';
     // the global BuddyPress JS - Ajax will not work without it
     wp_enqueue_script('dtheme-ajax-js', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/global.js', array('jquery'), bp_get_version());
     // Add words that we need to use in JS to the end of the page so they can be translated and still used.
     $params = array('my_favs' => __('My Favorites', 'buddypress'), 'accepted' => __('Accepted', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_x_comments' => __('Show all %d comments', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'close' => __('Close', 'buddypress'), 'view' => __('View', 'buddypress'), 'mark_as_fav' => __('Favorite', 'buddypress'), 'remove_fav' => __('Remove Favorite', 'buddypress'), 'unsaved_changes' => __('Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress'));
     wp_localize_script('dtheme-ajax-js', 'BP_DTheme', $params);
 }
Example #16
0
 function tk_get_bp_page_type($page_type)
 {
     global $bp;
     if (is_page() && tk_is_buddypress() && $bp->current_component != '') {
         $slug = $bp->current_component;
         $component = tk_get_bp_component_by_slug($slug);
         $action = $bp->current_action;
         if ($component != '') {
             if ($action != '') {
                 if (bp_is_group_forum_topic()) {
                     $page_type = 'bp-component-' . $component . '-' . $action . '-topic';
                 } elseif (!bp_is_activity_front_page() && bp_is_activity_component() && $action != 'just-me') {
                     $page_type = 'bp-component-activity-activity';
                 } else {
                     $page_type = 'bp-component-' . $component . '-' . $action;
                 }
             } else {
                 $page_type = 'bp-component-' . $component;
             }
         }
     }
     return apply_filters('tk_get_bp_page_type', $page_type);
 }
Example #17
0
/**
 * Enqueues CSS files.
 *
 * @since 2.0
 * @global object $bp BuddyPress global settings
 */
function dpa_add_css()
{
    global $bp;
    if (is_active_widget(false, false, 'achievements-sitewide') || is_active_widget(false, false, 'achievements-available-achievements') || is_active_widget(false, false, 'achievements-member-achievements') || is_active_widget(false, false, 'achievements-featured-achievement') || is_active_widget(false, false, 'achievements-member-achievements-available') || is_active_widget(false, false, 'achievements-member-points')) {
        nxt_enqueue_style('achievements-widget', plugins_url('/css/widget.css', __FILE__), array(), ACHIEVEMENTS_VERSION);
    }
    if (!bp_is_current_component($bp->achievements->slug)) {
        if (bp_is_active('activity') && bp_is_activity_component() && !bp_is_blog_page() || bp_is_component_front_page('activity') && bp_is_front_page()) {
            nxt_enqueue_style('achievements-directory', plugins_url('/css/directory.css', __FILE__), array(), ACHIEVEMENTS_VERSION);
        }
        nxt_print_styles();
        return;
    }
    if (DPA_SLUG_CREATE == $bp->current_action && dpa_permission_can_user_create() || DPA_SLUG_ACHIEVEMENT_EDIT == $bp->current_action && dpa_permission_can_user_edit() || DPA_SLUG_ACHIEVEMENT_CHANGE_PICTURE == $bp->current_action && dpa_permission_can_user_change_picture() || DPA_SLUG_ACHIEVEMENT_GRANT == $bp->current_action && dpa_permission_can_user_grant()) {
        nxt_enqueue_style('achievements-admin', plugins_url('/css/admin.css', __FILE__), array(), ACHIEVEMENTS_VERSION);
    }
    if ($bp->is_single_item) {
        nxt_enqueue_style('achievements-detail', plugins_url('/css/detail.css', __FILE__), array(), ACHIEVEMENTS_VERSION);
    } else {
        nxt_enqueue_style('achievements-directory', plugins_url('/css/directory.css', __FILE__), array(), ACHIEVEMENTS_VERSION);
    }
    nxt_print_styles();
}
function rtmedia_modify_activity_upload_url($params)
{
    // return original params if BuddyPress multilingual plugin is not active
    include_once ABSPATH . 'wp-admin/includes/plugin.php';
    if (function_exists('is_plugin_active') && is_plugin_active('buddypress-multilingual/sitepress-bp.php')) {
        if (class_exists('BuddyPress')) {
            // change upload url only if it's activity page and if it's group page than it shouldn't group media page
            if (bp_is_activity_component() || bp_is_groups_component() && !is_rtmedia_page()) {
                if (function_exists('bp_get_activity_directory_permalink')) {
                    $params['url'] = bp_get_activity_directory_permalink() . 'upload/';
                }
            }
        }
    }
    return $params;
}
/**
 * Load the page for a single activity item.
 *
 * @since 1.2.0
 *
 * @uses bp_is_activity_component()
 * @uses bp_activity_get_specific()
 * @uses bp_current_action()
 * @uses bp_action_variables()
 * @uses bp_do_404()
 * @uses bp_is_active()
 * @uses groups_get_group()
 * @uses groups_is_user_member()
 * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_access' hook.
 * @uses do_action() To call the 'bp_activity_screen_single_activity_permalink' hook.
 * @uses bp_core_add_message()
 * @uses is_user_logged_in()
 * @uses bp_core_redirect()
 * @uses site_url()
 * @uses esc_url()
 * @uses bp_get_root_domain()
 * @uses bp_get_activity_root_slug()
 * @uses bp_core_load_template()
 * @uses apply_filters() To call the 'bp_activity_template_profile_activity_permalink' hook.
 */
function bp_activity_screen_single_activity_permalink()
{
    $bp = buddypress();
    // No displayed user or not viewing activity component.
    if (!bp_is_activity_component()) {
        return false;
    }
    if (!bp_current_action() || !is_numeric(bp_current_action())) {
        return false;
    }
    // Get the activity details.
    $activity = bp_activity_get_specific(array('activity_ids' => bp_current_action(), 'show_hidden' => true, 'spam' => 'ham_only'));
    // 404 if activity does not exist
    if (empty($activity['activities'][0]) || bp_action_variables()) {
        bp_do_404();
        return;
    } else {
        $activity = $activity['activities'][0];
    }
    // Default access is true.
    $has_access = true;
    // If activity is from a group, do an extra cap check.
    if (isset($bp->groups->id) && $activity->component == $bp->groups->id) {
        // Activity is from a group, but groups is currently disabled.
        if (!bp_is_active('groups')) {
            bp_do_404();
            return;
        }
        // Check to see if the group is not public, if so, check the
        // user has access to see this activity.
        if ($group = groups_get_group(array('group_id' => $activity->item_id))) {
            // Group is not public.
            if ('public' != $group->status) {
                // User is not a member of group.
                if (!groups_is_user_member(bp_loggedin_user_id(), $group->id)) {
                    $has_access = false;
                }
            }
        }
    }
    /**
     * Filters the access permission for a single activity view.
     *
     * @since 1.2.0
     *
     * @param array $access Array holding the current $has_access value and current activity item instance.
     */
    $has_access = apply_filters_ref_array('bp_activity_permalink_access', array($has_access, &$activity));
    /**
     * Fires before the loading of a single activity template file.
     *
     * @since 1.2.0
     *
     * @param BP_Activity_Activity $activity   Object representing the current activity item being displayed.
     * @param bool                 $has_access Whether or not the current user has access to view activity.
     */
    do_action('bp_activity_screen_single_activity_permalink', $activity, $has_access);
    // Access is specifically disallowed.
    if (false === $has_access) {
        // User feedback.
        bp_core_add_message(__('You do not have access to this activity.', 'buddypress'), 'error');
        // Redirect based on logged in status.
        if (is_user_logged_in()) {
            $url = bp_loggedin_user_domain();
        } else {
            $url = sprintf(site_url('wp-login.php?redirect_to=%s'), urlencode(esc_url_raw(bp_activity_get_permalink((int) bp_current_action()))));
        }
        bp_core_redirect($url);
    }
    /**
     * Filters the template to load for a single activity screen.
     *
     * @since 1.0.0
     *
     * @param string $template Path to the activity template to load.
     */
    bp_core_load_template(apply_filters('bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink'));
}
Example #20
0
 /**
  * Enqueue theme javascript safely
  *
  * @see http://codex.wordpress.org/Function_Reference/wp_enqueue_script
  * @since BuddyPress (1.5)
  */
 function bp_dtheme_enqueue_scripts()
 {
     // Enqueue various scripts
     wp_enqueue_script('bp-jquery-query');
     wp_enqueue_script('bp-jquery-cookie');
     // Enqueue scrollTo only on activity pages
     if (bp_is_activity_component()) {
         wp_enqueue_script('bp-jquery-scroll-to');
     }
     // A similar check is done in BP_Core_Members_Widget, but due to a load order
     // issue, we do it again here
     if (is_active_widget(false, false, 'bp_core_members_widget') && !is_admin() && !is_network_admin()) {
         wp_enqueue_script('bp-widget-members');
     }
     // Enqueue the global JS - Ajax will not work without it
     wp_enqueue_script('dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array('jquery'), bp_get_version());
     // Add words that we need to use in JS to the end of the page so they can be translated and still used.
     $params = array('my_favs' => __('My Favorites', 'buddypress'), 'accepted' => __('Accepted', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_x_comments' => __('Show all %d comments', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'close' => __('Close', 'buddypress'), 'view' => __('View', 'buddypress'), 'mark_as_fav' => __('Favorite', 'buddypress'), 'remove_fav' => __('Remove Favorite', 'buddypress'), 'unsaved_changes' => __('Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress'));
     wp_localize_script('dtheme-ajax-js', 'BP_DTheme', $params);
     // Maybe enqueue comment reply JS
     if (is_singular() && bp_is_blog_page() && get_option('thread_comments')) {
         wp_enqueue_script('comment-reply');
     }
 }
Example #21
0
/**
 * Should BuddyPress load the mentions scripts and related assets, including results to prime the
 * mentions suggestions?
 *
 * @return bool True if mentions scripts should be loaded.
 * @since BuddyPress (2.1.0)
 */
function bp_activity_maybe_load_mentions_scripts()
{
    $retval = bp_activity_do_mentions() && bp_is_user_active() && (bp_is_activity_component() || bp_is_blog_page() && is_singular() && comments_open() || is_admin());
    return (bool) apply_filters('bp_activity_maybe_load_mentions_scripts', $retval);
}
Example #22
0
 function tk_get_bp_page_type($page_type)
 {
     global $bp;
     if (is_page() && $this->tk_is_buddypress() && $bp->current_component != '') {
         $slug = $bp->current_component;
         $action = $bp->current_action;
         if (isset($bp) && property_exists($bp, 'displayed_user') && property_exists($bp->displayed_user, 'id') && $bp->displayed_user->id != 0 && $slug == 'activity' && $action == 'just-me') {
             $slug = 'profile';
         }
         $component = $this->tk_get_bp_component_by_slug($slug);
         if ($component != '') {
             if ($action != '') {
                 if (bp_is_group_forum_topic()) {
                     $page_type = 'bp-component-' . $component . '-' . $action . '-topic';
                 } elseif (!bp_is_component_front_page('activity') && bp_is_activity_component() && $action != 'just-me') {
                     $page_type = 'bp-component-activity-activity';
                 } else {
                     $page_type = 'bp-component-' . $component . '-' . $action;
                 }
             } else {
                 $page_type = 'bp-component-' . $component;
             }
         }
     }
     return apply_filters('tk_get_bp_page_type', $page_type);
 }
/**
 * Customizes the post CSS class according to BuddyPress content.
 *
 * Hooked to the 'post_class' filter.
 *
 * @since 2.1.0
 *
 * @param array $wp_classes The post classes coming from WordPress.
 * @return array
 */
function bp_get_the_post_class($wp_classes = array())
{
    // Don't do anything if we're not on a BP page.
    if (!is_buddypress()) {
        return $wp_classes;
    }
    $bp_classes = array();
    if (bp_is_user() || bp_is_single_activity()) {
        $bp_classes[] = 'bp_members';
    } elseif (bp_is_group()) {
        $bp_classes[] = 'bp_group';
    } elseif (bp_is_activity_component()) {
        $bp_classes[] = 'bp_activity';
    } elseif (bp_is_blogs_component()) {
        $bp_classes[] = 'bp_blogs';
    } elseif (bp_is_register_page()) {
        $bp_classes[] = 'bp_register';
    } elseif (bp_is_activation_page()) {
        $bp_classes[] = 'bp_activate';
    } elseif (bp_is_forums_component() && bp_is_directory()) {
        $bp_classes[] = 'bp_forum';
    }
    if (empty($bp_classes)) {
        return $wp_classes;
    }
    // Emulate post type css class.
    foreach ($bp_classes as $bp_class) {
        $bp_classes[] = "type-{$bp_class}";
    }
    // Okay let's merge!
    return array_unique(array_merge($bp_classes, $wp_classes));
}
Example #24
0
        ?>
<div class="blog-heading <?php 
        echo $topnav_style == 'light' ? 'heading-light' : '';
        ?>
">
    <div class="container">
        <h1><?php 
        echo $post->post_title;
        ?>
</h1>
        <?php 
        if (is_plugin_active('buddypress/bp-loader.php') && bp_current_component()) {
            //buddypress
            if (bp_is_directory()) {
                //sitewide
                if (bp_is_activity_component()) {
                    //activity
                } elseif (bp_is_groups_component()) {
                    //groups
                    ?>
        <div id="group-dir-search" class="dir-search pull-right" role="search">
            <?php 
                    bp_directory_groups_search_form();
                    ?>
        </div>
        <!-- #group-dir-search -->
        <?php 
                } elseif (bp_current_component('members')) {
                    //members
                    ?>
        <div id="members-dir-search" class="dir-search pull-right" role="search">
Example #25
0
 /**
  * Enqueues the js and css files only if BP Reshare needs it
  * 
  * @package BP Reshare
  * @since   1.0
  * 
  * @uses bp_is_active() to check if the plugin's component is active
  * @uses bp_is_activity_component() to check if we are in the Activity component area
  * @uses bp_is_group_home() to check if we are in a group home
  * @uses wp_enqueue_style() to safely add our style to WordPress queue
  * @uses wp_enqueue_script() to safely add our script to WordPress queue
  * @uses wp_localize_script() to attach some vars to it
  * @uses buddyreshare_js_vars() to get the js vars for the plugin
  */
 public function cssjs()
 {
     if (!bp_is_active($this->component_id)) {
         return;
     }
     if (bp_is_activity_component() || bp_is_active('groups') && bp_is_group_home()) {
         // CSS is Theme's territory, so let's help him to easily override our css.
         $css_datas = (array) $this->css_datas();
         wp_enqueue_style($css_datas['handle'], $css_datas['location'], false, $this->version);
         wp_enqueue_script('bp-reshare-js', $this->plugin_js . 'reshare.js', array('jquery'), $this->version, true);
         wp_localize_script('bp-reshare-js', 'bp_reshare_vars', buddyreshare_js_vars());
     }
 }
Example #26
0
/**
 * Filter all AJAX bp_activity_request() calls for the 'activity' object with the 'links' scope
 *
 * @param string $query_string
 * @param string $object
 * @param string $filter
 * @param string $scope
 * @param integer $page
 * @param string $search_terms
 * @param string $extras
 * @return string
 */
function bp_links_dtheme_activity_filter($query_string, $object, $filter, $scope, $page, $search_terms, $extras)
{
    global $bp;
    $do_filter = false;
    // only filter activity.
    if (bp_links_is_activity_enabled() && $bp->activity->id == $object) {
        if (bp_is_user()) {
            // handle filtering for profile pages
            // this nav does not use AJAX so don't rely on $scope
            if (bp_is_activity_component() && bp_links_slug() == $bp->current_action) {
                $do_filter = 'user';
            }
        } else {
            // handle filtering for all non-profile, non-links pages
            if (!bp_current_component() || bp_is_activity_component()) {
                // filter under 'activity' component with 'links' scope
                if (bp_links_id() == $scope) {
                    $do_filter = 'user';
                }
            } elseif (bp_is_links_component()) {
                // filter 'links' component home pages
                if ($bp->is_single_item) {
                    $do_filter = 'default';
                }
            }
        }
    }
    if ($do_filter) {
        // parse query string
        $args = array();
        parse_str($query_string, $args);
        switch ($do_filter) {
            case 'user':
                // override with links object
                $args['object'] = bp_links_id();
                // user_id must be empty to show OTHER user's actions for this user's links
                $args['user_id'] = false;
                // get recent link cloud ids for this user
                $recent_ids = bp_links_recent_activity_item_ids_for_user();
                // if there is activity, send the ids
                if (count($recent_ids)) {
                    $args['primary_id'] = join(',', $recent_ids);
                }
                break;
            case 'default':
                // override with links object
                $args['object'] = bp_links_id();
                // set primary id to current link id if applicable
                if ($bp->links->current_link) {
                    $args['primary_id'] = $bp->links->current_link->id;
                }
                break;
        }
        // return modified query string
        return http_build_query($args);
    }
    // no filtering
    return $query_string;
}
Example #27
0
				<div id="navigation-wrapper">
					<div id="navigation"><!-- start #navigation -->
						<?php 
wp_nav_menu(array('theme_location' => 'main_menu', 'menu_class' => 'nav', 'container' => ''));
?>
							<?php 
if ($bp_existed == 'true') {
    ?>
								<ul class="nav">
									<li><a href="">Community</a>
									<ul class="submenu">
									<?php 
    if ('activity' != bp_dtheme_page_on_front() && bp_is_active('activity')) {
        ?>
										<li<?php 
        if (bp_is_activity_component() && !bp_is_user_activity()) {
            ?>
 class="selected"<?php 
        }
        ?>
>
											<a href="<?php 
        echo site_url();
        ?>
/<?php 
        echo bp_get_activity_root_slug();
        ?>
/" title="<?php 
        _e('Activity', 'framemarket');
        ?>
"><?php 
Example #28
0
/**
 *  widget for the community navigation
 *
 * @package Custom Community
 * @since 1.8.3
 */
function widget_community_nav($sidebar_id = false)
{
    ?>
		<?php 
    global $cap;
    if ($sidebar_id == 'leftsidebar' && $cap->bg_leftsidebar_default_nav && $cap->bg_leftsidebar_default_nav == 'no') {
        return;
    }
    ?>
  		<div id="community-nav" class="widget widget-title" >
        	<h3 class="widgettitle"><?php 
    _e('Community', 'cc');
    ?>
</h3>
  				<ul class="item-list">
					
			  		<?php 
    if ('activity' != bp_dtheme_page_on_front() && bp_is_active('activity')) {
        ?>
                                        <li<?php 
        if (bp_is_activity_component()) {
            ?>
 class="selected"<?php 
        }
        ?>
>
							<a href="<?php 
        echo site_url();
        ?>
/<?php 
        echo BP_ACTIVITY_SLUG;
        ?>
/" title="<?php 
        _e('Activity', 'cc');
        ?>
"><?php 
        _e('Activity', 'cc');
        ?>
</a>
						</li>
					<?php 
    }
    ?>

                                        <li<?php 
    if (bp_is_members_component() || bp_is_user()) {
        ?>
 class="selected"<?php 
    }
    ?>
>
                                                <a href="<?php 
    echo site_url();
    ?>
/<?php 
    echo BP_MEMBERS_SLUG;
    ?>
/" title="<?php 
    _e('Members', 'cc');
    ?>
"><?php 
    _e('Members', 'cc');
    ?>
</a>
                                        </li>
			
                                    <?php 
    if (bp_is_active('groups')) {
        ?>
                                            <li<?php 
        if (bp_is_groups_component() || bp_is_group()) {
            ?>
 class="selected"<?php 
        }
        ?>
>
                                                    <a href="<?php 
        echo site_url();
        ?>
/<?php 
        echo BP_GROUPS_SLUG;
        ?>
/" title="<?php 
        _e('Groups', 'cc');
        ?>
"><?php 
        _e('Groups', 'cc');
        ?>
</a>
                                            </li>
			
                                        <?php 
        if (bp_is_active('forums') && (function_exists('bp_forums_is_installed_correctly') && !(int) bp_get_option('bp-disable-forum-directory')) && bp_forums_is_installed_correctly()) {
            ?>
                                                <li<?php 
            if (bp_is_forums_component()) {
                ?>
 class="selected"<?php 
            }
            ?>
>
                                                        <a href="<?php 
            echo site_url();
            ?>
/<?php 
            echo BP_FORUMS_SLUG;
            ?>
/" title="<?php 
            _e('Forums', 'cc');
            ?>
"><?php 
            _e('Forums', 'cc');
            ?>
</a>
                                                </li>
                                        <?php 
        }
        ?>
					<?php 
    }
    ?>
					<?php 
    if (bp_is_active('blogs') && is_multisite()) {
        ?>
                                                        <li<?php 
        if (bp_is_blogs_component()) {
            ?>
 class="selected"<?php 
        }
        ?>
>
							<a href="<?php 
        echo site_url();
        ?>
/<?php 
        echo BP_BLOGS_SLUG;
        ?>
/" title="<?php 
        _e('Blogs', 'cc');
        ?>
"><?php 
        _e('Blogs', 'cc');
        ?>
</a>
						</li>
					<?php 
    }
    ?>
  				</ul>
				
   <?php 
    if (bp_is_single_item() || bp_is_user()) {
        ?>
	   	<?php 
        if (bp_is_group()) {
            ?>
		<div id="community-single-nav" class="widget-title" >
		  <ul class="item-list">
		  <h3 class="widgettitle"><?php 
            _e('@ Group', 'cc');
            ?>
</h3>
				<?php 
            bp_get_options_nav();
            ?>
				<?php 
            do_action('bp_group_options_nav');
            ?>
			</ul>
		
		</div>	
		<?php 
        }
        ?>

		<?php 
        if (bp_is_user()) {
            ?>
		<div id="community-single-nav" class="widget-title" >
		  <ul class="item-list">
		  <h3 class="widgettitle"><?php 
            _e('@ Member', 'cc');
            ?>
</h3>
		  <?php 
            bp_get_displayed_user_nav();
            ?>
				<?php 
            do_action('bp_group_options_nav');
            ?>
			</ul>
		
		</div>	
		<?php 
        }
        ?>
  	<?php 
    }
    ?>
  	</div>
<?php 
}
Example #29
0
 function miss_bp_document_title()
 {
     global $page, $paged, $wp_query;
     /* Set up some default variables. */
     $domain = MISS_TEXTDOMAIN;
     $doctitle = get_bloginfo('name');
     $separator = ' | ';
     $description = get_bloginfo('description', 'display');
     /* bp */
     if (function_exists('bp_is_user_friends') && bp_is_user_friends()) {
         $prefix = __('Friends', MISS_TEXTDOMAIN);
     } elseif (function_exists('bp_is_user_profile_edit') && bp_is_user_profile_edit()) {
         $prefix = __('Edit Profile', MISS_TEXTDOMAIN);
     } elseif (function_exists('bp_is_user_profile') && bp_is_user_profile()) {
         $prefix = __('User Profile', MISS_TEXTDOMAIN);
     } elseif (function_exists('bp_is_activity_component') && bp_is_activity_component() && is_numeric($bp->current_action)) {
         $activity = bp_activity_get_specific(array('activity_ids' => $bp->current_action));
         if ($activity = $activity['activities'][0]) {
             if (!empty($activity->content)) {
                 $prefix = mb_strimwidth(preg_replace("/[^A-Za-z0-9\\s\\s+\\-]/", "", strip_tags($activity->content)), 0, 70 - 3 - 3 - strlen($blog_title), '...');
             }
         }
     }
     /* If the current page is a paged page. */
     if ((($page = $wp_query->get('paged')) || ($page = $wp_query->get('page'))) && $page > 1) {
         $prefix = sprintf(__('%1$sPage %2$s', MISS_TEXTDOMAIN), $prefix . $separator, number_format_i18n($page));
     }
     $doctitle = $prefix . $separator . $doctitle;
     /* Apply the wp_title filters so we're compatible with plugins. */
     //	$doctitle = apply_filters( 'bp_page_title', $doctitle, '', '' );
     //	echo apply_atomic( 'bp_page_title', esc_attr( $doctitle ) );
     return $doctitle;
 }
 /**
  * Action handler when a follow activity button is clicked.
  */
 public function action_listener()
 {
     if (!bp_is_activity_component()) {
         return;
     }
     if (!bp_is_current_action('follow') && !bp_is_current_action('unfollow')) {
         return false;
     }
     if (empty($activity_id) && bp_action_variable(0)) {
         $activity_id = (int) bp_action_variable(0);
     }
     // Not viewing a specific activity item.
     if (empty($activity_id)) {
         return;
     }
     $action = bp_is_current_action('follow') ? 'follow' : 'unfollow';
     // Check the nonce.
     check_admin_referer("bp_follow_activity_{$action}");
     $save = bp_is_current_action('follow') ? 'bp_follow_start_following' : 'bp_follow_stop_following';
     $follow_type = bp_follow_activity_get_type($activity_id);
     // Failure on action
     if (!$save(array('leader_id' => $activity_id, 'follower_id' => bp_loggedin_user_id(), 'follow_type' => $follow_type))) {
         $message_type = 'error';
         if ('follow' === $action) {
             $message = __('You are already following that item.', 'bp-follow');
         } else {
             $message = __('You were not following that item.', 'bp-follow');
         }
         // Success!
     } else {
         $message_type = 'success';
         if ('follow' === $action) {
             $message = __('You are now following that item.', 'bp-follow');
         } else {
             $message = __('You are no longer following that item.', 'bp-follow');
         }
     }
     /**
      * Dynamic filter for the message displayed after the follow button is clicked.
      *
      * Default filter name is 'bp_follow_activity_message_activity'.
      *
      * Handy for plugin devs.
      *
      * @since 1.3.0
      *
      * @param string $message      Message that gets displayed after a follow action.
      * @param string $action       Either 'follow' or 'unfollow'.
      * @param int    $activity_id  Activity ID.
      * @param string $message_type Either 'success' or 'error'.
      */
     $message = apply_filters("bp_follow_activity_message_{$follow_type}", $message, $action, $activity_id, $message_type);
     bp_core_add_message($message, $message_type);
     // Redirect
     $redirect = wp_get_referer() ? wp_get_referer() : bp_get_activity_directory_permalink();
     bp_core_redirect($redirect);
     die;
 }