/**
 * Load the Activity directory.
 *
 * @since BuddyPress (1.5)
 *
 * @uses bp_displayed_user_id()
 * @uses bp_is_activity_component()
 * @uses bp_current_action()
 * @uses bp_update_is_directory()
 * @uses do_action() To call the 'bp_activity_screen_index' hook.
 * @uses bp_core_load_template()
 * @uses apply_filters() To call the 'bp_activity_screen_index' hook.
 */
function bp_activity_screen_index()
{
    if (bp_is_activity_directory()) {
        bp_update_is_directory(true, 'activity');
        do_action('bp_activity_screen_index');
        bp_core_load_template(apply_filters('bp_activity_screen_index', 'activity/index'));
    }
}
Example #2
0
/**
 * Redirect to user's Profile
 *
 * @return void
 */
function newwriting_child_redirect()
{
    // bail if not logged in
    if (!is_user_logged_in()) {
        return;
    }
    // bail if not BP root site
    if (!bp_is_root_blog()) {
        return;
    }
    // bail if POST
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        return;
    }
    // if restricted pages requested
    if (bp_is_activity_directory() or bp_is_members_directory()) {
        // get profile URL
        $home = bp_core_get_user_domain(bp_loggedin_user_id()) . 'groups/';
        // redirect to member's profile
        wp_redirect($home);
        exit;
    }
    // groups directory
    if (bp_is_groups_directory()) {
        // bail if admin
        if (!is_super_admin()) {
            // get profile URL
            $home = bp_core_get_user_domain(bp_loggedin_user_id()) . 'groups/';
            // redirect to member's profile
            wp_redirect($home);
            exit;
        }
    }
    // groups directory
    if (is_front_page()) {
        // bail if admin
        if (!is_super_admin()) {
            // get profile URL
            $home = bp_core_get_user_domain(bp_loggedin_user_id()) . 'groups/';
            // redirect to member's profile
            wp_redirect($home);
            exit;
        }
    }
}
/**
 * Load the Activity directory.
 *
 * @since 1.5.0
 *
 * @uses bp_displayed_user_id()
 * @uses bp_is_activity_component()
 * @uses bp_current_action()
 * @uses bp_update_is_directory()
 * @uses do_action() To call the 'bp_activity_screen_index' hook.
 * @uses bp_core_load_template()
 * @uses apply_filters() To call the 'bp_activity_screen_index' hook.
 */
function bp_activity_screen_index()
{
    if (bp_is_activity_directory()) {
        bp_update_is_directory(true, 'activity');
        /**
         * Fires right before the loading of the Activity directory screen template file.
         *
         * @since 1.5.0
         */
        do_action('bp_activity_screen_index');
        /**
         * Filters the template to load for the Activity directory screen.
         *
         * @since 1.5.0
         *
         * @param string $template Path to the activity template to load.
         */
        bp_core_load_template(apply_filters('bp_activity_screen_index', 'activity/index'));
    }
}
Example #4
0
/**
 * Should we use Heartbeat to refresh activities?
 *
 * @since BuddyPress (2.0.0)
 *
 * @uses bp_is_activity_heartbeat_active() to check if heatbeat setting is on.
 * @uses bp_is_activity_directory() to check if the current page is the activity
 *       directory.
 * @uses bp_is_active() to check if the group component is active.
 * @uses bp_is_group_activity() to check if on a single group, the current page
 *       is the group activities.
 * @uses bp_is_group_home() to check if the current page is a single group home
 *       page.
 *
 * @return bool True if activity heartbeat is enabled, otherwise false.
 */
function bp_activity_do_heartbeat()
{
    $retval = false;
    if (!bp_is_activity_heartbeat_active()) {
        return $retval;
    }
    if (bp_is_activity_directory()) {
        $retval = true;
    }
    if (bp_is_active('groups')) {
        // If no custom front, then activities are loaded in group's home
        $has_custom_front = bp_locate_template(array('groups/single/front.php'), false, true);
        if (bp_is_group_activity() || !$has_custom_front && bp_is_group_home()) {
            $retval = true;
        }
    }
    return $retval;
}
 function x_buddypress_is_component_with_landmark_header()
 {
     if (bp_is_activity_directory() || bp_is_groups_directory() || bp_is_members_directory() || bp_is_blogs_directory() || bp_is_current_component('register') || bp_is_current_component('activate')) {
         return true;
     } else {
         return false;
     }
 }
/**
 * Should we use Heartbeat to refresh activities?
 *
 * @since 2.0.0
 *
 * @uses bp_is_activity_heartbeat_active() to check if heartbeat setting is on.
 * @uses bp_is_activity_directory() to check if the current page is the activity
 *       directory.
 * @uses bp_is_group_activity() to check if on a single group, the current page
 *       is the group activities.
 *
 * @return bool True if activity heartbeat is enabled, otherwise false.
 */
function bp_activity_do_heartbeat()
{
    $retval = false;
    if (!bp_is_activity_heartbeat_active()) {
        return $retval;
    }
    if (bp_is_activity_directory() || bp_is_group_activity()) {
        $retval = true;
    }
    return $retval;
}
Example #7
0
 /**
  * Fake post type activities in order to add custom options
  * to BuddyPress activity dropdowns
  *
  * Make sure the Groups/blogs activity actions appears as one component > IdeaStream
  * in the Activity Administration screen.
  *
  * @package WP Idea Stream
  * @subpackage buddypress/activity
  *
  * @since 2.1.0
  *
  * @uses    buddypress() to get BuddyPress main instance
  * @return  array        new tracking args
  */
 public function dropdown_filters($tracking_args)
 {
     if (!isset($tracking_args['new_' . $this->post_type])) {
         return;
     }
     if (is_admin() && function_exists('get_current_screen')) {
         $current_screen = get_current_screen();
         if (!empty($current_screen->id) && strpos('toplevel_page_bp-activity', $current_screen->id) !== false) {
             $component = buddypress()->ideastream->id;
         }
     }
     if (empty($component) && !bp_is_activity_directory() && !bp_is_user_activity() && !bp_is_group_home()) {
         return $tracking_args;
     }
     $position = 50;
     foreach ($this->activity_actions as $key_action => $action) {
         if ('new_' . $this->post_type == $key_action) {
             if (!empty($component)) {
                 $tracking_args[$key_action]->component_id = $component;
             }
             continue;
         }
         $position += 1;
         $tracking_args[$key_action] = new stdClass();
         $tracking_args[$key_action]->component_id = !empty($component) ? $component : $action->component;
         $tracking_args[$key_action]->action_id = $action->type;
         $tracking_args[$key_action]->admin_filter = $action->admin_caption;
         $tracking_args[$key_action]->front_filter = $action->front_caption;
         $tracking_args[$key_action]->contexts = $action->contexts;
         $tracking_args[$key_action]->activity_comment = false;
         $tracking_args[$key_action]->format_callback = $action->action_callback;
         $tracking_args[$key_action]->position = $position;
     }
     /**
      * Used internally to disallow activity dropdowns on groups not supporting ideastream
      */
     return apply_filters('wp_idea_stream_buddypress_activity_filters', $tracking_args);
 }
/**
 * Should we use Heartbeat to refresh activities?
 *
 * @since 2.0.0
 *
 * @return bool True if activity heartbeat is enabled, otherwise false.
 */
function bp_activity_do_heartbeat()
{
    $retval = false;
    if (bp_is_activity_heartbeat_active() && (bp_is_activity_directory() || bp_is_group_activity())) {
        $retval = true;
    }
    /**
     * Filters whether the heartbeat feature in the activity stream should be active.
     *
     * @since 2.8.0
     *
     * @param bool $retval Whether or not activity heartbeat is active.
     */
    return (bool) apply_filters('bp_activity_do_heartbeat', $retval);
}
Example #9
0
function x_is_buddypress_activity_directory()
{
    if (function_exists('bp_is_activity_directory') && bp_is_activity_directory()) {
        return true;
    } else {
        return false;
    }
}
Example #10
0
/**
 * Filter site activity stream if scope is "groups".
 *
 * @since 1.0.3
 *
 * @param array $r The activity arguments.
 * @return array
 */
function bp_mute_filter_site_activity_scope_groups($r)
{
    if (!is_user_logged_in()) {
        return $r;
    }
    if (!bp_is_activity_directory()) {
        return $r;
    }
    if ($r['scope'] !== "groups") {
        return $r;
    }
    $r['scope'] = '';
    $muted_ids = Mute::get_muting(bp_loggedin_user_id());
    $groups = groups_get_user_groups(bp_loggedin_user_id());
    $filter_query[] = array(array('column' => 'component', 'value' => buddypress()->groups->id));
    $filter_query[] = array(array('column' => 'item_id', 'value' => $groups['groups'], 'compare' => 'IN'));
    $filter_query[] = array(array('column' => 'user_id', 'value' => $muted_ids, 'compare' => 'NOT IN'));
    $r['filter_query'] = $filter_query;
    return $r;
}
Example #11
0
function kleo_bp_get_component_id()
{
    $current_page_id = NULL;
    $page_array = get_option('bp-pages');
    if (bp_is_register_page()) {
        /* register page */
        $current_page_id = $page_array['register'];
    } elseif (bp_is_members_component() || bp_is_user()) {
        /* members component */
        $current_page_id = $page_array['members'];
    } elseif (bp_is_activity_directory()) {
        /* activity directory */
        $current_page_id = $page_array['activity'];
    } elseif (bp_is_groups_directory() || bp_is_group_single()) {
        /* groups directory */
        $current_page_id = $page_array['groups'];
    } elseif (bp_is_activation_page()) {
        /* activation page */
        $current_page_id = $page_array['activate'];
    }
    return $current_page_id;
}