예제 #1
0
 /**
  * get_activity function.
  * 
  * @access public
  * @param mixed $filter
  * @return void
  */
 public function get_activity($filter)
 {
     $args = $filter;
     if (bp_has_activities($args)) {
         while (bp_activities()) {
             bp_the_activity();
             $activity = array('avatar' => bp_core_fetch_avatar(array('html' => false, 'item_id' => bp_get_activity_id())), 'action' => bp_get_activity_action(), 'content' => bp_get_activity_content_body(), 'activity_id' => bp_get_activity_id(), 'activity_username' => bp_core_get_username(bp_get_activity_user_id()), 'user_id' => bp_get_activity_user_id(), 'comment_count' => bp_activity_get_comment_count(), 'can_comment' => bp_activity_can_comment(), 'can_favorite' => bp_activity_can_favorite(), 'is_favorite' => bp_get_activity_is_favorite(), 'can_delete' => bp_activity_user_can_delete());
             $activity = apply_filters('bp_json_prepare_activity', $activity);
             $activities[] = $activity;
         }
         $data = array('activity' => $activities, 'has_more_items' => bp_activity_has_more_items());
         $data = apply_filters('bp_json_prepare_activities', $data);
     } else {
         return new WP_Error('bp_json_activity', __('No Activity Found.', 'buddypress'), array('status' => 200));
     }
     $response = new WP_REST_Response();
     $response->set_data($data);
     $response = rest_ensure_response($response);
     return $response;
 }
     $output .= ob_get_clean();
 }
 if (bp_has_activities($params)) {
     $output .= '<ul id="activity-stream" class="activity-list item-list">';
     while (bp_activities()) {
         bp_the_activity();
         $output .= '<li class="' . bp_get_activity_css_class() . '" id="activity-' . bp_get_activity_id() . '">';
         $output .= '<div class="activity-avatar rounded">';
         $output .= '<a class="kleo-activity-avatar" title="' . __('View Profile', 'kleo_framework') . '" href="' . bp_get_activity_user_link() . '">';
         $output .= bp_get_activity_avatar();
         $output .= '</a>';
         $output .= '</div>';
         // activity content
         $output .= '<div class="activity-content">';
         $output .= '<div class="activity-header">';
         $output .= bp_get_activity_action();
         $output .= '</div>';
         $output .= '<div class="activity-inner">';
         if (bp_activity_has_content()) {
             $output .= bp_get_activity_content_body();
         }
         $output .= '</div>';
         $output .= '<div class="activity-meta">';
         if (bp_get_activity_type() == 'activity_comment') {
             $output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'buddypress') . '">' . __('View Conversation', 'buddypress') . '</a>';
         }
         if (is_user_logged_in()) {
             if (bp_activity_can_favorite()) {
                 if (!bp_get_activity_is_favorite()) {
                     $output .= '<a href="' . bp_get_activity_favorite_link() . '" class="fav bp-secondary-action" title="' . esc_attr(__('Mark as Favorite', 'buddypress')) . '"></a>';
                 } else {
예제 #3
0
<div class="bboss_ajax_search_item bboss_ajax_search_item_activity">
	<a href='<?php 
echo esc_url(add_query_arg(array('no_frame' => '1'), bp_activity_thread_permalink()));
?>
'>
		<div class="item-avatar">
			<?php 
bp_activity_avatar(array('type' => 'thumb', 'height' => 50, 'width' => 50));
?>
		</div>

		<div class="item">
			<div class="item-title">
				<?php 
echo wp_strip_all_tags(bp_get_activity_action());
?>
			</div>

			<?php 
if (bp_activity_has_content()) {
    ?>
				<div class="item-desc">
					<?php 
    echo buddyboss_global_search_activity_intro(30);
    ?>
				</div>
			<?php 
}
?>
		</div>
	</a>
예제 #4
0
/**
 * Return the activity content
 *
 * @since 1.0.0
 * @deprecated 1.5.0
 *
 * @todo properly deprecate this function
 *
 * @global object $activities_template {@link BP_Activity_Template}
 * @uses bp_get_activity_action()
 * @uses bp_get_activity_content_body()
 * @uses apply_filters() To call the 'bp_get_activity_content' hook
 *
 * @return string The activity content
 */
function bp_get_activity_content()
{
    global $activities_template;
    /**
     * If you want to filter activity update content, please use
     * the filter 'bp_get_activity_content_body'
     *
     * This function is mainly for backwards comptibility.
     */
    $content = bp_get_activity_action() . ' ' . bp_get_activity_content_body();
    return apply_filters('bp_get_activity_content', $content);
}
예제 #5
0
 /**
  * @deprecated gears_get_activity_stream
  */
 function gears_get_activity_stream()
 {
     $output = '';
     $output .= '<li class="' . bp_get_activity_css_class() . '" id="activity-' . bp_get_activity_id() . '">';
     $output .= '<div class="activity-avatar">';
     $output .= '<a class="gears-activity-avatar" title="' . __('View Profile', 'gears') . '" href="' . bp_get_activity_user_link() . '">';
     $output .= bp_get_activity_avatar();
     $output .= '</a>';
     $output .= '</div>';
     // activity content
     $output .= '<div class="activity-content">';
     $output .= '<div class="activity-header">';
     $output .= bp_get_activity_action();
     $output .= '</div>';
     $output .= '<div class="activity-inner">';
     if (bp_activity_has_content()) {
         $output .= bp_get_activity_content_body();
     }
     $output .= '</div>';
     do_action('bp_activity_entry_content');
     $output .= '<div class="activity-meta">';
     if (bp_get_activity_type() == 'activity_comment') {
         $output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'gears') . '">' . __('View Conversation', 'gears') . '</a>';
     }
     if (is_user_logged_in()) {
         if (bp_activity_can_favorite()) {
             if (!bp_get_activity_is_favorite()) {
                 $output .= '<a href="' . bp_get_activity_favorite_link() . '" class="fav bp-secondary-action" title="' . esc_attr(__('Mark as Favorite', 'gears')) . '">' . __('Favorite', 'gears') . '</a>';
             } else {
                 $output .= '<a href="' . bp_get_activity_unfavorite_link() . '" class="unfav bp-secondary-action" title="' . esc_attr(__('Remove Favorite', 'gears')) . '">' . __('Remove Favorite', 'gears') . '</a>';
             }
         }
         if (bp_activity_user_can_delete()) {
             $output .= bp_get_activity_delete_link();
         }
         do_action('bp_activity_entry_meta');
     }
     $output .= '</div>';
     if (bp_get_activity_type() == 'activity_comment') {
         $output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'gears') . '">' . __('View Conversation', 'gears');
     }
     // end bp_get_activity_type()
     $output .= '</div>';
     // end activity content
     $output .= '</li>';
     return $output;
 }
예제 #6
0
/**
 * Generate content for our picture grid
 *
 * @since BuddyBoss 2.0
 * @todo	Update the theme file (members/single/pictures.php) and create a Wordpress like loop for the images
 					e.g.
 					<?php if ( buddyboss_picgrid_has_pics() ): while( buddyboss_picgrid_has_pics() ): ?>
 						<?php buddyboss_picgrid_thumbnail(); ?>
 						- and -
 						<a href="<?php buddyboss_picgrid_fullsize_url(); ?>" title="<?php buddyboss_picgrid_image_title(); ?>">
 							<img src="<?php buddyboss_picgrid_thumbnail_url(); ?>" width="<?php buddyboss_picgrid_thumbnail_width(); ?>" height="<?php buddyboss_picgrid_thumbnail_height(); ?>" />
 						</a>
 					<?php endwhile; endif; ?>

					(need to rename these for clarity, I think they're too long (JP))
					* functions to create:
					buddyboss_picgrid_has_pics()							For the if/while Wordpress style loop
 					buddyboss_picgrid_attachment_id()					Returns the ID of the current image
 					buddyboss_picgrid_thumbnail()							Echo '<li><a><img>' tags for you of the current thumbnail
 					buddyboss_picgrid_thumbnail_url()					Echos the url location of the current thumbnail
 					get_buddyboss_picgrid_thumbnail_url()			Returns the url location of the current thumbnail
 					buddyboss_picgrid_thumbnail_width()				Echos the current thumbnail width
 					get_buddyboss_picgrid_thumbnail_width()		Returns the current thumbnail width
 					buddyboss_picgrid_thumbnail_height()			Echos the current thumbnail height
 					get_buddyboss_picgrid_thumbnail_height()	Returns the current thumbnail height
 					buddyboss_picgrid_fullsize_url()					Echos the url location of the current full size image
 					get_buddyboss_picgrid_fullsize_url()			Returns the url location of the current thumbnail
 					buddyboss_picgrid_fullsize_width()				Echos the current full size image width
 					get_buddyboss_picgrid_fullsize_width()		Returns the current full size image width
 					buddyboss_picgrid_fullsize_height()				Echos the current full size image height
 					get_buddyboss_picgrid_fullsize_height()		Returns the current full size image height
*/
function buddyboss_pics_screen_picture_grid_content()
{
    global $bp, $wpdb, $buddyboss_pics;
    $wpdb->show_errors = BUDDYBOSS_DEBUG;
    //$img_size = is_active_sidebar( 'Profile' ) ? 'buddyboss_pic_med' : 'buddyboss_pic_wide';
    $img_size = 'buddyboss_pic_wide';
    $gallery_class = is_active_sidebar('Profile') ? 'gallery has-sidebar' : 'gallery';
    $user_id = $bp->displayed_user->id;
    $activity_table = bp_core_get_table_prefix() . 'bp_activity';
    $activity_meta_table = bp_core_get_table_prefix() . 'bp_activity_meta';
    $groups_table = bp_core_get_table_prefix() . 'bp_groups';
    $pages_sql = "SELECT COUNT(*) FROM {$activity_table} a\n\t\t\t\t\t\t\t\tINNER JOIN {$activity_meta_table} am ON a.id = am.activity_id\n\t\t\t\t\t\t\t\tLEFT JOIN (SELECT activity_id, meta_key, meta_value FROM {$activity_meta_table}\n\t\t\t\t\t\t\t\t           WHERE meta_key = 'activityprivacy') am2 ON a.id = am2.activity_id\n\t\t\t\t\t\t\t\tLEFT JOIN (SELECT id FROM {$groups_table} WHERE status != 'public' ) grp ON a.item_id = grp.id\n\t\t\t\t\t\t\t\tWHERE a.user_id = {$user_id}\n\t\t\t\t\t\t\t\tAND (am.meta_key = 'buddyboss_pics_aid' OR am.meta_key = 'bboss_pics_aid')\n\t\t\t\t\t\t\t\tAND (a.component != 'groups' || a.item_id != grp.id)";
    $buddyboss_pics->grid_num_pics = $wpdb->get_var($pages_sql);
    $buddyboss_pics->grid_current_page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
    // Prepare a SQL query to retrieve the activity posts
    // that have pictures associated with them
    $sql = "SELECT a.*, am.meta_value, am2.meta_value as privacy FROM {$activity_table} a\n\t\t\t\t\tINNER JOIN {$activity_meta_table} am ON a.id = am.activity_id\n\t\t\t\t\tLEFT JOIN (SELECT activity_id, meta_key, meta_value FROM {$activity_meta_table}\n\t\t\t\t\t           WHERE meta_key = 'activityprivacy') am2 ON a.id = am2.activity_id\n\t\t\t\t\tLEFT JOIN (SELECT id FROM {$groups_table} WHERE status != 'public' ) grp ON a.item_id = grp.id\n\t\t\t\t\tWHERE a.user_id = {$user_id}\n\t\t\t\t\tAND (am.meta_key = 'buddyboss_pics_aid' OR am.meta_key = 'bboss_pics_aid')\n\t\t\t\t\tAND (a.component != 'groups' || a.item_id != grp.id)\n\t\t\t\t\tORDER BY a.date_recorded DESC";
    buddyboss_log("SQL: {$sql}");
    $pics = $wpdb->get_results($sql, ARRAY_A);
    $buddyboss_pics->grid_pagination = new BuddyBoss_Paginated($pics, $buddyboss_pics->grid_pics_per_page, $buddyboss_pics->grid_current_page);
    buddyboss_log("RESULT: {$pics}");
    // If we have results let's print out a simple grid
    if (!empty($pics)) {
        $buddyboss_pics->grid_had_pics = true;
        $buddyboss_pics->grid_num_pics = count($pics);
        /**
         * DEBUG
         */
        // echo '<br/><br/><div style="display:block;background:#f0f0f0;border:2px solid #ccc;margin:20px;padding:15px;color:#333;"><pre>';
        // var_dump( $pics );
        // echo '</pre></div><hr/><br/><br/><br/><br/>';
        // die;
        /**/
        $html_grid = '<ul class="' . $gallery_class . '" id="buddyboss-pics-grid">' . "\n";
        foreach ($pics as $pic) {
            /**
             * DEBUG
             */
            // echo '<br/><br/><div style="display:block;background:#f0f0f0;border:2px solid #ccc;margin:20px;padding:15px;color:#333;"><pre>';
            // var_dump( bp_activity_get_permalink($pic['id']), $pic );
            // echo '</pre></div><hr/><br/><br/><br/><br/>';
            // die;
            /**/
            //BP ACTIVITY PRIVACY FIX
            if (function_exists('bp_activity_privacy_add_js')) {
                $is_super_admin = is_super_admin();
                $bp_displayed_user_id = bp_displayed_user_id();
                $bp_loggedin_user_id = bp_loggedin_user_id();
                if ($pic['privacy'] == 'loggedin' && !$bp_loggedin_user_id) {
                    continue;
                }
                if ($pic['privacy'] == 'friends' && !friends_check_friendship($bp_loggedin_user_id, $bp_displayed_user_id) && $bp_loggedin_user_id != $bp_displayed_user_id) {
                    continue;
                }
                if ($pic['privacy'] == 'groupfriends' && !friends_check_friendship($bp_loggedin_user_id, $bp_displayed_user_id || !groups_is_user_member($bp_loggedin_user_id, $bp_displayed_user_id))) {
                    continue;
                }
                if ($pic['privacy'] == 'grouponly' && !groups_is_user_member($bp_loggedin_user_id, $bp_displayed_user_id)) {
                    continue;
                }
                if ($pic['privacy'] == 'groupmoderators' && !groups_is_user_mod($bp_loggedin_user_id, $bp_displayed_user_id)) {
                    continue;
                }
                if ($pic['privacy'] == 'groupadmins' && !groups_is_user_admin($bp_loggedin_user_id, $bp_displayed_user_id)) {
                    continue;
                }
                if ($pic['privacy'] == 'adminsonly' && !$is_super_admin) {
                    continue;
                }
                if ($pic['privacy'] == 'onlyme' && $bp_loggedin_user_id != $bp_displayed_user_id) {
                    continue;
                }
            }
            $attachment_id = isset($pic['meta_value']) ? (int) $pic['meta_value'] : 0;
            // Make sure we have a valid attachment ID
            if ($attachment_id > 0) {
                // Let's get the permalink of this attachment to show within a lightbox
                $permalink = bp_activity_get_permalink($pic['id']);
                $ajax_link = rtrim($permalink, '/') . '/?buddyboss_ajax_pic=true';
                // Let's get the caption
                $action = '';
                if (bp_has_activities('include=' . $pic['id'])) {
                    while (bp_activities()) {
                        bp_the_activity();
                        $action = '<div class="buddyboss_pics_action">' . bp_get_activity_action() . '</div>';
                    }
                }
                // Grab the image details
                $image = wp_get_attachment_image_src($attachment_id, $img_size);
                // grab the thumbnail details
                $tn = wp_get_attachment_image_src($attachment_id, 'buddyboss_pic_tn');
                if (is_array($tn) && !empty($tn) && isset($tn[0]) && $tn[0] != '') {
                    $buddyboss_pics->grid_data[] = array('attachment' => $attachment_id, 'action' => $action, 'image' => $image, 'tn' => $tn, 'permalink' => $permalink, 'ajaxlink' => $ajax_link);
                    $html_grid .= '<li class="gallery-item"><div><a rel="gal_item" href="' . $image[0] . '"><img src="' . $tn[0] . '" width="' . $tn[1] . '" height="' . $tn[2] . '" /></a></div></li>' . "\n";
                }
            }
        }
        $html_grid .= '</ul>' . "\n\n";
        $buddyboss_pics->grid_html = $html_grid;
        $buddyboss_pics->grid_has_pics = true;
    } else {
        $buddyboss_pics->grid_has_pics = false;
        $buddyboss_pics->grid_num_pics = 0;
        $buddyboss_pics->grid_current_pic = null;
        $buddyboss_pics->grid_data = array();
        $buddyboss_pics->grid_html = null;
    }
}