function bplike_activity_update_button()
{
    $liked_count = 0;
    if (is_user_logged_in() && bp_get_activity_type() !== 'activity_liked') {
        if (bp_activity_get_meta(bp_get_activity_id(), 'liked_count', true)) {
            $users_who_like = array_keys(bp_activity_get_meta(bp_get_activity_id(), 'liked_count', true));
            $liked_count = count($users_who_like);
        }
        if (!bp_like_is_liked(bp_get_activity_id(), 'activity_update', get_current_user_id())) {
            ?>
            <a href="#" class="button bp-primary-action like" id="like-activity-<?php 
            echo bp_get_activity_id();
            ?>
" title="<?php 
            echo bp_like_get_text('like_this_item');
            ?>
">
                <?php 
            echo bp_like_get_text('like');
            if ($liked_count) {
                echo ' <span>' . $liked_count . '</span>';
            }
            ?>
            </a>
        <?php 
        } else {
            ?>
            <a href="#" class="button bp-primary-action unlike" id="unlike-activity-<?php 
            echo bp_get_activity_id();
            ?>
" title="<?php 
            echo bp_like_get_text('unlike_this_item');
            ?>
">
                <?php 
            echo bp_like_get_text('unlike');
            if ($liked_count) {
                echo '<span>' . $liked_count . '</span>';
            }
            ?>
            </a>
            <?php 
        }
        // Checking if there are users who like item.
        if (isset($users_who_like)) {
            view_who_likes(bp_get_activity_id(), 'activity_update');
        }
    }
}
Example #2
1
<?php

// Exit if the file is accessed directly over web
if (!defined('ABSPATH')) {
    exit;
}
/*** 
 * 
 * Attachment in single media comment
 * This is a fallback template for new media types
 * 
 */
$activity_id = bp_get_activity_id();
$mppq = new MPP_Cached_Media_Query(array('in' => (array) mpp_activity_get_media_id($activity_id)));
if ($mppq->have_media()) {
    ?>
	<div class="mpp-container mpp-media-list mpp-activity-media-list">

		<?php 
    while ($mppq->have_media()) {
        $mppq->the_media();
        ?>

			<a href="<?php 
        mpp_media_permalink();
        ?>
" ><img src="<?php 
        mpp_media_src('thumbnail');
        ?>
" class='mpp-attached-media-item' data-mpp-activity-id="<?php 
        echo $activity_id;
/**
 * Check if activity has associated media
 * 
 * @param int $activity_id
 * @return mixed false if no attachment else array of attachment ids
 */
function mpp_activity_has_media($activity_id = false)
{
    if (!$activity_id) {
        $activity_id = bp_get_activity_id();
    }
    return mpp_activity_get_attached_media_ids($activity_id);
}
function bp_reshare_replace_activity_delete_link($link)
{
    // if activity type is a reshare, then we replace the delete link behavior
    if (bp_get_activity_type() == 'reshare_update') {
        $class = 'delete-reshare';
        $action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/?delete_reshare=' . bp_get_activity_id(), '_reshare_delete');
        $link = '<a href="' . $action_url . '" class="button item-button bp-secondary-action ' . $class . ' confirm" rel="nofollow">' . __('Delete', 'bp-reshare') . '</a>';
    }
    return apply_filters('bp_reshare_replace_activity_delete_link', $link);
}
 /**
  * Processes images-type shortcode and create proper markup.
  * Relies on ./forms/images_tag_template.php for markup rendering.
  */
 function process_images_tag($atts, $content)
 {
     $images = explode("\n", trim(strip_tags($content)));
     //return var_export($images,1);
     $activity_id = bp_get_activity_id();
     global $blog_id;
     $activity_blog_id = $blog_id;
     $use_thickbox = defined('BPFB_USE_THICKBOX') ? esc_attr(BPFB_USE_THICKBOX) : 'thickbox';
     if ($activity_id) {
         $activity_blog_id = bp_activity_get_meta($activity_id, 'bpfb_blog_id');
     }
     ob_start();
     @(include BPFB_PLUGIN_BASE_DIR . '/lib/forms/images_tag_template.php');
     $out = ob_get_clean();
     return $out;
 }
 /**
  * Processes images-type shortcode and create proper markup.
  * Relies on ./forms/images_tag_template.php for markup rendering.
  */
 function process_images_tag($atts, $content)
 {
     $images = self::extract_images($content);
     //return var_export($images,1);
     $activity_id = bp_get_activity_id();
     global $blog_id;
     $activity_blog_id = $blog_id;
     $use_thickbox = defined('BPFB_USE_THICKBOX') ? esc_attr(BPFB_USE_THICKBOX) : 'thickbox';
     if ($activity_id) {
         $activity_blog_id = bp_activity_get_meta($activity_id, 'bpfb_blog_id');
     }
     $template = locate_template(array('images_tag_template.php'));
     if (empty($template)) {
         $template = BPFB_PLUGIN_BASE_DIR . '/lib/forms/images_tag_template.php';
     }
     ob_start();
     @(include $template);
     $out = ob_get_clean();
     return $out;
 }
Example #7
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;
 }
Example #8
0
function mpp_activity_inject_media_in_comment_replies()
{
    $activity_id = bp_get_activity_id();
    $media_id = mpp_activity_get_media_id($activity_id);
    if (empty($media_id)) {
        return;
    }
    $media = mpp_get_media($media_id);
    if (!$media) {
        return;
    }
    //	$gallery_id	= mpp_activity_get_gallery_id( $activity_id );
    //
    //	$gallery	= mpp_get_gallery( $gallery_id );
    //
    //	if( ! $gallery ) {
    //		return ;
    //	}
    $slug = $media->type;
    //media-loop-audio/media-loop-video,media-loop-photo, media-loop
    mpp_get_template_part('buddypress/activity/entry-comment', $slug);
}
Example #9
0
/**
 * Show the list of attached media in an activity
 * Should we add a link to view gallery too?
 * 
 * @return type
 */
function mpp_activity_inject_attached_media_html()
{
    $media_list = mpp_activity_get_attached_media_ids(bp_get_activity_id());
    if (empty($media_list)) {
        return;
    }
    $activity_id = bp_get_activity_id();
    $gallery_id = mpp_activity_get_gallery_id($activity_id);
    $gallery = mpp_get_gallery($gallery_id);
    //in case we are using oembed or other storage method
    $storage_method = mpp_get_media_meta($gallery->id, '_mpp_storage_method', true);
    if ($storage_method == mpp_get_default_storage_method()) {
        $storage_method = '';
    }
    $slug = $gallery->type;
    if (!empty($storage_method)) {
        $slug = $slug . '-' . $storage_method;
    }
    //eg. video-oembed
    //media-loop-audio/media-loop-video,media-loop-photo, media-loop
    mpp_get_template_part('gallery/activity/loop', $slug);
}
function bp_checkins_attach_thumb($activity_content)
{
    $activity_id = bp_get_activity_id();
    $pictures = bp_activity_get_meta($activity_id, 'bpci_picture');
    if ($pictures) {
        foreach ($pictures as $pic) {
            if ($pic->width == 100) {
                $src["100"] = $pic->url;
            }
            if ($pic->width == 960) {
                $src["960"] = $pic->url;
            }
        }
        if ($src) {
            $image = '<a href="' . esc_attr($src["960"]) . '" class="bp-ci-zoompic align-left"><img src="' . esc_attr($src["100"]) . '" width="100px" alt="' . __('Thumbnail', 'bp-checkins') . '" class="align-left thumbnail" /></a>';
            return $image . $activity_content;
        } else {
            return $activity_content;
        }
    } else {
        return $activity_content;
    }
}
    function show_tags_from_activity()
    {
        //   var_dump( get_terms( 'activity_tags', $args = '' ) );
        //   var_dump( wp_get_object_terms( bp_get_activity_id(), 'activity_tags', $args = array()) );
        ?>
       <div class='activity-content activity-tag-list activity-tag-list-<?php 
        echo bp_get_activity_id();
        ?>
'>
       <?php 
        foreach (wp_get_object_terms(bp_get_activity_id(), 'activity_tags') as $term) {
            ?>

        <a href="#" class="fa fa-tag activity-tag"><?php 
            echo $term->name;
            ?>
</a>

        <?php 
        }
        ?>
       </div>
    <?php 
    }
extract(shortcode_atts(array('show' => false, 'number' => 6, 'show_button' => 'yes', 'button_link' => '/activity', 'button_label' => 'View All Activity', 'post_form' => ''), $atts));
if (function_exists('bp_is_active') && bp_is_active('activity')) {
    $output = '';
    $params = array('max' => $number, 'object' => $show);
    $output .= '<div class="wpb_wrapper">';
    $output .= '<div class="activity kleo-activity-streams">';
    if (is_user_logged_in() && $post_form == 'yes') {
        ob_start();
        bp_get_template_part('activity/post-form');
        $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>';
/**
 * Disable activity commenting for blog posts based on certain criteria.
 *
 * If activity commenting is enabled for blog posts, we still need to disable
 * commenting if:
 *  - comments are disabled for the WP blog post from the admin dashboard
 *  - the WP blog post is supposed to be automatically closed from comments
 *    based on a certain age
 *  - the activity entry is a 'new_blog_comment' type
 *
 * @since BuddyPress (2.0.0)
 *
 * @param bool $retval Is activity commenting enabled for this activity entry?
 * @return bool
 */
function bp_blogs_disable_activity_commenting( $retval ) {
	// if activity commenting is disabled, return current value
	if ( bp_disable_blogforum_comments() ) {
		return $retval;
	}

	// activity commenting is enabled for blog posts
	switch ( bp_get_activity_action_name() ) {

		// we still have to disable activity commenting for 'new_blog_comment' items
		// commenting should only be done on the parent 'new_blog_post' item
		case 'new_blog_comment' :
			$retval = false;

			break;

		// check if commenting is disabled for the WP blog post
		// we should extrapolate this and automate this for plugins... or not
		case 'new_blog_post' :
			global $activities_template;

			// setup some globals we'll need to reference later
			bp_blogs_setup_activity_loop_globals( $activities_template->activity );

			// if comments are closed for the WP blog post, we should disable
			// activity comments for this activity entry
			if ( empty( buddypress()->blogs->allow_comments[bp_get_activity_id()] ) ) {
				$retval = false;
			}

			break;
	}

	return $retval;
}
/**
 * Truncate long activity entries when viewed in activity streams.
 *
 * This method can only be used inside the Activity loop.
 *
 * @since 1.5.0
 *
 * @uses bp_is_single_activity()
 * @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook.
 * @uses apply_filters() To call the 'bp_activity_excerpt_length' hook.
 * @uses bp_create_excerpt()
 * @uses bp_get_activity_id()
 * @uses bp_get_activity_thread_permalink()
 * @uses apply_filters() To call the 'bp_activity_truncate_entry' hook.
 *
 * @param string $text The original activity entry text.
 * @return string $excerpt The truncated text.
 */
function bp_activity_truncate_entry($text)
{
    global $activities_template;
    /**
     * Provides a filter that lets you choose whether to skip this filter on a per-activity basis.
     *
     * @since 2.3.0
     *
     * @param bool $value If true, text should be checked to see if it needs truncating.
     */
    $maybe_truncate_text = apply_filters('bp_activity_maybe_truncate_entry', isset($activities_template->activity->type) && !in_array($activities_template->activity->type, array('new_blog_post'), true));
    // The full text of the activity update should always show on the single activity screen.
    if (!$maybe_truncate_text || bp_is_single_activity()) {
        return $text;
    }
    /**
     * Filters the appended text for the activity excerpt.
     *
     * @since 1.5.0
     *
     * @param string $value Internationalized "Read more" text.
     */
    $append_text = apply_filters('bp_activity_excerpt_append_text', __('[Read more]', 'buddypress'));
    /**
     * Filters the excerpt length for the activity excerpt.
     *
     * @since 1.5.0
     *
     * @param int $value Number indicating how many words to trim the excerpt down to.
     */
    $excerpt_length = apply_filters('bp_activity_excerpt_length', 358);
    // Run the text through the excerpt function. If it's too short, the original text will be returned.
    $excerpt = bp_create_excerpt($text, $excerpt_length, array('ending' => __('&hellip;', 'buddypress')));
    /*
     * If the text returned by bp_create_excerpt() is different from the original text (ie it's
     * been truncated), add the "Read More" link. Note that bp_create_excerpt() is stripping
     * shortcodes, so we have strip them from the $text before the comparison.
     */
    if ($excerpt != strip_shortcodes($text)) {
        $id = !empty($activities_template->activity->current_comment->id) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id();
        $excerpt = sprintf('%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', $excerpt, $id, bp_get_activity_thread_permalink(), $append_text);
    }
    /**
     * Filters the composite activity excerpt entry.
     *
     * @since 1.5.0
     *
     * @param string $excerpt     Excerpt text and markup to be displayed.
     * @param string $text        The original activity entry text.
     * @param string $append_text The final append text applied.
     */
    return apply_filters('bp_activity_truncate_entry', $excerpt, $text, $append_text);
}
Example #15
0
/**
 * List the users that have reshared an activity
 *
 * @package BP Reshare
 * @since    1.0
 *
 * @uses   bp_get_option() to get the setting for the number of users to display
 * @uses   bp_activity_get_meta() to get some meta about the activity
 * @uses   bp_get_activity_id() to get activity id
 * @uses   bp_core_get_userlink() to build user's profile link
 * @uses   bp_core_fetch_avatar() to get user's avatar
 * @return string html output
 */
function buddyreshare_list_user_avatars()
{
    $max = (int) bp_get_option('bp-reshare-user-amount', 5);
    if (empty($max)) {
        return;
    }
    $user_list = bp_activity_get_meta(bp_get_activity_id(), 'reshared_by');
    if (is_array($user_list) && count($user_list) >= 1) {
        rsort($user_list);
        $output = '<div class="reshared-list activity-content">' . __('Reshared by :', 'bp-reshare') . '<ul>';
        $step = 0;
        foreach ($user_list as $user) {
            if ($step == $max) {
                break;
            }
            $output .= '<li><a href="' . bp_core_get_userlink($user, false, true) . '">' . bp_core_fetch_avatar(array('item_id' => $user, 'object' => 'user', 'type' => 'thumb', 'class' => 'avatar reshared', 'width' => '40', 'height' => '40')) . '</a></li>';
            $step += 1;
        }
        $output .= '</ul><br style="clear:both"></div>';
        echo $output;
    }
}
Example #16
0
/**
 * Truncates long activity entries when viewed in activity streams
 *
 * @since 1.5.0
 *
 * @param $text The original activity entry text
 *
 * @uses bp_is_single_activity()
 * @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook
 * @uses apply_filters() To call the 'bp_activity_excerpt_length' hook
 * @uses bp_create_excerpt()
 * @uses bp_get_activity_id()
 * @uses bp_get_activity_thread_permalink()
 * @uses apply_filters() To call the 'bp_activity_truncate_entry' hook
 *
 * @return string $excerpt The truncated text
 */
function bp_activity_truncate_entry($text)
{
    global $activities_template;
    // The full text of the activity update should always show on the single activity screen
    if (bp_is_single_activity()) {
        return $text;
    }
    $append_text = apply_filters('bp_activity_excerpt_append_text', __('[Read more]', 'buddypress'));
    $excerpt_length = apply_filters('bp_activity_excerpt_length', 358);
    // Run the text through the excerpt function. If it's too short, the original text will be
    // returned.
    $excerpt = bp_create_excerpt($text, $excerpt_length, array('ending' => __('&hellip;', 'buddypress')));
    // If the text returned by bp_create_excerpt() is different from the original text (ie it's
    // been truncated), add the "Read More" link.
    if ($excerpt != $text) {
        $id = !empty($activities_template->activity->current_comment->id) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id();
        $excerpt = sprintf('%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', $excerpt, $id, bp_get_activity_thread_permalink(), $append_text);
    }
    return apply_filters('bp_activity_truncate_entry', $excerpt, $text, $append_text);
}
Example #17
0
<?php

// Exit if the file is accessed directly over web
if (!defined('ABSPATH')) {
    exit;
}
/**
 * List videos attached to activity
 * 
 */
?>
<div class="mpp-container mpp-media-list mpp-activity-media-list mpp-activity-video-list mpp-activity-video-player">
<?php 
$ids = mpp_activity_get_attached_media_ids(bp_get_activity_id());
//is there only one video attached?
if (count($ids) == 1) {
    $ids = array_pop($ids);
    $media = mpp_get_media($ids);
    $args = array('src' => mpp_get_media_src('', $media), 'poster' => mpp_get_media_src('thumbnail', $media));
    //show single video with poster
    echo wp_video_shortcode($args);
} else {
    //show all videos as playlist
    echo wp_playlist_shortcode(array('ids' => $ids, 'type' => 'video'));
}
?>
</div>
Example #18
0
/**
 * bp_like_button()
 *
 * Outputs the 'Like/Unlike' and 'View likes/Hide likes' buttons.
 *
 */
function bp_like_button($id = '', $type = '')
{
    $users_who_like = 0;
    $liked_count = 0;
    /* Set the type if not already set, and check whether we are outputting the button on a blogpost or not. */
    if (!$type && !is_single()) {
        $type = 'activity';
    } elseif (!$type && is_single()) {
        $type = 'blogpost';
    }
    if ($type == 'activity') {
        $activity = bp_activity_get_specific(array('activity_ids' => bp_get_activity_id()));
        $activity_type = $activity['activities'][0]->type;
        if (is_user_logged_in() && $activity_type !== 'activity_liked') {
            if (bp_activity_get_meta(bp_get_activity_id(), 'liked_count', true)) {
                $users_who_like = array_keys(bp_activity_get_meta(bp_get_activity_id(), 'liked_count', true));
                $liked_count = count($users_who_like);
            }
            if (!bp_like_is_liked(bp_get_activity_id(), 'activity')) {
                ?>
				<a href="#" class="like" id="like-activity-<?php 
                bp_activity_id();
                ?>
" title="<?php 
                echo bp_like_get_text('like_this_item');
                ?>
"><?php 
                echo bp_like_get_text('like');
                if ($liked_count) {
                    echo ' (' . $liked_count . ')';
                }
                ?>
</a>
			<?php 
            } else {
                ?>
				<a href="#" class="unlike" id="unlike-activity-<?php 
                bp_activity_id();
                ?>
" title="<?php 
                echo bp_like_get_text('unlike_this_item');
                ?>
"><?php 
                echo bp_like_get_text('unlike');
                if ($liked_count) {
                    echo ' (' . $liked_count . ')';
                }
                ?>
</a>
			<?php 
            }
            if ($users_who_like) {
                ?>
				<a href="#" class="view-likes" id="view-likes-<?php 
                bp_activity_id();
                ?>
"><?php 
                echo bp_like_get_text('view_likes');
                ?>
</a>
				<p class="users-who-like" id="users-who-like-<?php 
                bp_activity_id();
                ?>
"></p>
			<?php 
            }
        }
    } elseif ($type == 'blogpost') {
        global $post;
        if (!$id && is_single()) {
            $id = $post->ID;
        }
        if (is_user_logged_in() && get_post_meta($id, 'liked_count', true)) {
            $liked_count = count(get_post_meta($id, 'liked_count', true));
        }
        if (!bp_like_is_liked($id, 'blogpost')) {
            ?>
		
		<div class="like-box"><a href="#" class="like_blogpost" id="like-blogpost-<?php 
            echo $id;
            ?>
" title="<?php 
            echo bp_like_get_text('like_this_item');
            ?>
"><?php 
            echo bp_like_get_text('like');
            if ($liked_count) {
                echo ' (' . $liked_count . ')';
            }
            ?>
</a></div>
		
		<?php 
        } else {
            ?>
		
		<div class="like-box"><a href="#" class="unlike_blogpost" id="unlike-blogpost-<?php 
            echo $id;
            ?>
" title="<?php 
            echo bp_like_get_text('unlike_this_item');
            ?>
"><?php 
            echo bp_like_get_text('unlike');
            if ($liked_count) {
                echo ' (' . $liked_count . ')';
            }
            ?>
</a></div>
		<?php 
        }
    }
}
 /**
  * Retrive likes for current activity (within activity loop)
  *
  * @since 2.0
  */
 function has_likes($actid = null)
 {
     if ($actid === null) {
         $actid = bp_get_activity_id();
     }
     return bp_activity_get_meta($actid, 'favorite_count');
 }
    /**
     *
     */
    function unpin_activity()
    {
        global $wpdb;
        $nonce = isset($_REQUEST['nonces']) ? sanitize_text_field($_REQUEST['nonces']) : 0;
        if (!wp_verify_nonce($nonce, 'pin-activity-nonce')) {
            exit(__('Not permitted', RW_Sticky_Activity::$textdomain));
        }
        $activityID = isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) ? $_REQUEST['id'] : '';
        if ($activityID != '') {
            bp_activity_update_meta($activityID, 'rw_sticky_activity', 0);
        }
        $meta_query_args = array('relation' => 'AND', array('key' => 'rw_sticky_activity', 'value' => '1', 'compare' => '='));
        if (function_exists('bb_bp_activity_url_filter')) {
            // deactivate BuddyBoss Wall activity url preview
            remove_action('bp_get_activity_content_body', 'bb_bp_activity_url_filter');
        }
        add_filter('bp_activity_excerpt_length', function () {
            return 99999;
        });
        if (bp_has_activities(array('meta_query' => $meta_query_args))) {
            ?>
            <?php 
            while (bp_activities()) {
                bp_the_activity();
                ?>
                <div class="buddypress-sa">
                    <div id="factivity-stream">
                        <div class="activity-list">
                            <div class="activity-content" style="margin-left: 0px;">
                                <?php 
                $nonce = wp_create_nonce('pin-activity-nonce');
                $title = __('Unpin activity', RW_Sticky_Activity::$textdomain);
                $class = "sa-button-unpin  pinned";
                ?>
                                <a href="" class="fa fa-map-marker icon-button sa-button <?php 
                echo $class;
                ?>
" title="<?php 
                echo $title;
                ?>
" data-post-nonces="<?php 
                echo $nonce;
                ?>
" data-post-id="<?php 
                echo bp_get_activity_id();
                ?>
"></a>
                                <?php 
                if (bp_activity_has_content() && bp_get_activity_type() != 'bbp_topic_create' && bp_get_activity_type() != 'bbp_reply_create') {
                    ?>
                                    <div class="activity-inner">
                                        <?php 
                    bp_activity_content_body();
                    ?>
                                    </div>
                                <?php 
                }
                ?>
                                <?php 
                if (bp_get_activity_type() == 'bp_doc_edited') {
                    ?>
                                    <div class="activity-inner"><p>
                                            <?php 
                    $doc = get_post(url_to_postid(bp_get_activity_feed_item_link()));
                    echo __('Doc: ', RW_Sticky_Activity::$textdomain);
                    echo "<a href='" . get_permalink($doc->ID) . "'>";
                    echo $doc->post_title;
                    echo "</a>";
                    ?>
</p>
                                    </div>
                                    <?php 
                }
                // New forum topic created
                if (bp_get_activity_type() == 'bbp_topic_create') {
                    // url_to_postid fails on permalinks like http://gruppen.domain.tld/groups/frank-testgruppe/forum/topic/neues-thema/ !!!
                    ?>
                                    <div class="activity-inner"><p>
                                            <?php 
                    $link = bp_get_activity_feed_item_link();
                    $guid = substr($link, strpos($link, "/forum/topic") + 6);
                    $topicid = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE guid like '%%%s%%'", $guid));
                    $topic = get_post($topicid);
                    echo __('Forum new topic: ', RW_Sticky_Activity::$textdomain);
                    echo "<a href='" . get_permalink($topic->ID) . "'> ";
                    echo $topic->post_title;
                    echo "</a><br>";
                    ?>
</p>
                                    </div>
                                    <?php 
                }
                // New forum reply
                if (bp_get_activity_type() == 'bbp_reply_create') {
                    // url_to_postid fails on permalinks like http://gruppen.domain.tld/groups/frank-testgruppe/forum/topic/neues-thema/ !!!
                    ?>
                                    <div class="activity-inner"><p>
                                            <?php 
                    $link = bp_get_activity_feed_item_link();
                    $id = substr($link, strpos($link, "/#post-") + 7);
                    $topic = get_post($id);
                    echo __('Forum reply: ', RW_Sticky_Activity::$textdomain);
                    echo "<a href='" . get_permalink($topic->ID) . "'> ";
                    $parent = get_post($topic->post_parent);
                    echo $parent->post_title;
                    echo "</a><br>";
                    ?>
</p>
                                    </div>
                                    <?php 
                }
                ?>
                                <div class="activity-header">
                                    <?php 
                $userid = bp_get_activity_user_id();
                $user = get_user_by('id', $userid);
                echo "(" . $user->nickname . ")";
                ?>
                                </div>
                                <div class="clearfix"></div>
                            </div>
                        </div>
                    </div>
                </div>
            <?php 
            }
            ?>
        <?php 
        }
        if (function_exists('bb_bp_activity_url_filter')) {
            // activate BuddyBoss Wall activity url preview
            add_action('bp_get_activity_content_body', 'bb_bp_activity_url_filter');
        }
        wp_die();
    }
/**
 * Disable activity commenting for blog posts based on certain criteria.
 *
 * If activity commenting is enabled for blog posts, we still need to disable
 * commenting if:
 *  - comments are disabled for the WP blog post from the admin dashboard
 *  - the WP blog post is supposed to be automatically closed from comments
 *    based on a certain age
 *  - the activity entry is a 'new_blog_comment' type
 *
 * @since 2.0.0
 *
 * @param bool $retval Is activity commenting enabled for this activity entry.
 * @return bool
 */
function bp_blogs_disable_activity_commenting($retval)
{
    global $activities_template;
    // If activity commenting is disabled, return current value.
    if (bp_disable_blogforum_comments() || !isset($activities_template->in_the_loop)) {
        return $retval;
    }
    $type = bp_get_activity_type();
    // It's a post type supporting comment tracking.
    if (bp_activity_type_supports($type, 'post-type-comment-tracking')) {
        // The activity type is supporting comments or replies
        if (bp_activity_type_supports($type, 'post-type-comment-reply')) {
            // Setup some globals we'll need to reference later.
            bp_blogs_setup_activity_loop_globals($activities_template->activity);
            // If comments are closed for the WP blog post, we should disable
            // activity comments for this activity entry.
            if (empty(buddypress()->blogs->allow_comments[bp_get_activity_id()])) {
                $retval = false;
            }
            // The activity type does not support comments or replies
        } else {
            $retval = false;
        }
    }
    return $retval;
}
Example #22
0
function vortex_buddypress_before($content)
{
    return vortex_buddypress_render(bp_get_activity_id()) . $content;
}
function bp_like_get_some_likes($number = '')
{
    // $number is max likers it will output. Currently only takes 2.
    // need to decide if checking number of likes here, or in another fucntion, or in call to here..
    $bp_like_id = bp_get_activity_id();
    $users_who_like = array_keys(bp_activity_get_meta($bp_like_id, 'liked_count', true));
    if (count($users_who_like) == 0) {
        // if no user likes this.
    } elseif (count($users_who_like) == 1) {
        // If only one person likes the current item.
        $string = '<p class="users-who-like" id="users-who-like-';
        $string .= $bp_like_id;
        $string .= '">%s liked this.</p>';
        $one = bp_core_get_userlink($users_who_like[0]);
        printf($string, $one);
    } elseif (count($users_who_like) == 2) {
        // If two people like the current item.
        $string = '<p class="users-who-like" id="users-who-like-';
        $string .= $bp_like_id;
        $string .= '">%s and %s liked this.</p>';
        $one = bp_core_get_userlink($users_who_like[0]);
        $two = bp_core_get_userlink($users_who_like[1]);
        printf($string, $one, $two);
    } elseif (count($users_who_like) > 2) {
        $string = '<p class="users-who-like" id="users-who-like-';
        $string .= $bp_like_id;
        $string .= '">%s, %s and %s others liked this.</p>';
        $others = count($users_who_like);
        // output last two people to like (2 at end of array)
        $one = bp_core_get_userlink($users_who_like[0]);
        $two = bp_core_get_userlink($users_who_like[1]);
        // $users_who_like will always be greater than 2.
        if ($users_who_like == 3) {
            $others = $others - 1;
        } else {
            $others = $others - 2;
        }
        printf($string, $one, $two, $others);
    }
}
/**
 * Outputs the activity id
 *
 * @since 1.2.0
 *
 * @uses bp_get_activity_id()
 */
function bp_activity_id()
{
    echo bp_get_activity_id();
}
Example #25
0
// Exit if the file is accessed directly over web
if (!defined('ABSPATH')) {
    exit;
}
/**
 * List videos attached to activity
 * 
 */
?>
<div class=" mpp-activity-media-list mpp-activity-video-list mpp-activity-video-player">
<?php 
$ids = $media_ids;
//is there only one video attached?
if (count($ids) == 1) {
    $ids = array_pop($ids);
    $media = mpp_get_media($ids);
    $args = array('src' => mpp_get_media_src('', $media), 'poster' => mpp_get_media_src('thumbnail', $media));
    //show single video with poster
    echo wp_video_shortcode($args);
} else {
    //show all videos as playlist
    echo wp_playlist_shortcode(array('ids' => $ids, 'type' => 'video'));
}
?>
<script type='text/javascript'>
	mpp_mejs_activate(<?php 
echo bp_get_activity_id();
?>
);
</script>
</div>
 /**
  * Adds a "mark as spam" button to each activity item for site admins.
  *
  * This function is intended to be used inside the activity stream loop.
  *
  * @since BuddyPress (1.6)
  */
 public function add_activity_spam_button()
 {
     if (!bp_activity_user_can_mark_spam()) {
         return;
     }
     // By default, only handle activity updates and activity comments.
     if (!in_array(bp_get_activity_type(), BP_Akismet::get_activity_types())) {
         return;
     }
     bp_button(array('block_self' => false, 'component' => 'activity', 'id' => 'activity_make_spam_' . bp_get_activity_id(), 'link_class' => 'bp-secondary-action spam-activity confirm button item-button', 'link_href' => wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_slug() . '/spam/' . bp_get_activity_id() . '/', 'bp_activity_akismet_spam_' . bp_get_activity_id()), 'link_text' => __('Spam', 'buddypress'), 'wrapper' => false));
 }
Example #27
0
function bp_dtheme_new_activity_comment() {
	global $bp;

	/* Check the nonce */
	check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );

	if ( !is_user_logged_in() ) {
		echo '-1';
		return false;
	}

	if ( empty( $_POST['content'] ) ) {
		echo '-1<div id="message" class="error"><p>' . __( 'Please do not leave the comment area blank.', 'buddypress' ) . '</p></div>';
		return false;
	}

	if ( empty( $_POST['form_id'] ) || empty( $_POST['comment_id'] ) || !is_numeric( $_POST['form_id'] ) || !is_numeric( $_POST['comment_id'] ) ) {
		echo '-1<div id="message" class="error"><p>' . __( 'There was an error posting that reply, please try again.', 'buddypress' ) . '</p></div>';
		return false;
	}

	$comment_id = bp_activity_new_comment( array(
		'content' => $_POST['content'],
		'activity_id' => $_POST['form_id'],
		'parent_id' => $_POST['comment_id']
	));

	if ( !$comment_id ) {
		echo '-1<div id="message" class="error"><p>' . __( 'There was an error posting that reply, please try again.', 'buddypress' ) . '</p></div>';
		return false;
	}

	if ( bp_has_activities ( 'include=' . $comment_id ) ) : ?>
		<?php while ( bp_activities() ) : bp_the_activity(); ?>
			<li id="acomment-<?php bp_activity_id() ?>">
				<div class="acomment-avatar">
					<?php bp_activity_avatar() ?>
				</div>

				<div class="acomment-meta">
					<?php echo bp_core_get_userlink( bp_get_activity_user_id() ) ?> &middot; <?php printf( __( '%s ago', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?> &middot;
					<a class="acomment-reply" href="#acomment-<?php bp_activity_id() ?>" id="acomment-reply-<?php echo esc_attr( $_POST['form_id'] ) ?>"><?php _e( 'Reply', 'buddypress' ) ?></a>
					 &middot; <a href="<?php echo wp_nonce_url( $bp->root_domain . '/' . $bp->activity->slug . '/delete/' . bp_get_activity_id() . '?cid=' . $comment_id, 'bp_activity_delete_link' ) ?>" class="delete acomment-delete confirm"><?php _e( 'Delete', 'buddypress' ) ?></a>
				</div>

				<div class="acomment-content">
					<?php bp_activity_content_body() ?>
				</div>
			</li>
		<?php endwhile; ?>
	 <?php endif;
}
 private function GetBuddyPressRating($ver, $horAlign = true)
 {
     RWLogger::LogEnterence('GetBuddyPressRating');
     global $activities_template;
     // Set current activity-comment to current activity update (recursive comments).
     $this->current_comment = $activities_template->activity;
     $rclass = str_replace('_', '-', bp_get_activity_type());
     $is_forum_topic = $rclass === 'new-forum-topic';
     if ($is_forum_topic && !$this->IsBBPressInstalled()) {
         return false;
     }
     if (!in_array($rclass, array('forum-post', 'forum-reply', 'new-forum-post', 'user-forum-post', 'user', 'activity-update', 'user-activity-update', 'activity-comment', 'user-activity-comment'))) {
         // If unknown activity type, change it to activity update.
         $rclass = 'activity-update';
     }
     if ($is_forum_topic) {
         $rclass = 'new-forum-post';
     }
     // Check if item rating is top positioned.
     if (!isset($this->activity_align[$rclass]) || $ver !== $this->activity_align[$rclass]->ver) {
         return false;
     }
     // Get item id.
     $item_id = 'activity-update' === $rclass || 'activity-comment' === $rclass ? bp_get_activity_id() : bp_get_activity_secondary_item_id();
     if ($is_forum_topic) {
         // If forum topic, then we must extract post id
         // from forum posts table, because secondary_item_id holds
         // topic id.
         if (function_exists('bb_get_first_post')) {
             $post = bb_get_first_post($item_id);
         } else {
             // Extract post id straight from the BB DB.
             global $bb_table_prefix;
             // Load bbPress config file.
             @(include_once WP_RW__BBP_CONFIG_LOCATION);
             // Failed loading config file.
             if (!defined('BBDB_NAME')) {
                 return false;
             }
             $connection = null;
             if (!($connection = mysql_connect(BBDB_HOST, BBDB_USER, BBDB_PASSWORD, true))) {
                 return false;
             }
             if (!mysql_selectdb(BBDB_NAME, $connection)) {
                 return false;
             }
             $results = mysql_query("SELECT * FROM {$bb_table_prefix}posts WHERE topic_id={$item_id} AND post_position=1", $connection);
             $post = mysql_fetch_object($results);
         }
         if (!isset($post->post_id) && empty($post->post_id)) {
             return false;
         }
         $item_id = $post->post_id;
     }
     // If the item is post, queue rating with post title.
     $title = 'new-blog-post' === $rclass ? get_the_title($item_id) : bp_get_activity_content_body();
     // $activities_template->activity->content;
     $options = array();
     $owner_id = bp_get_activity_user_id();
     // Add accumulator id if user accumulated rating.
     if ($this->IsUserAccumulatedRating()) {
         $options['uarid'] = $this->_getUserRatingGuid($owner_id);
     }
     return $this->EmbedRatingIfVisible($item_id, $owner_id, strip_tags($title), bp_activity_get_permalink(bp_get_activity_id()), $rclass, false, $horAlign ? $this->activity_align[$rclass]->hor : false, false, $options, false);
 }
Example #29
0
            echo bp_core_time_since(bp_get_activity_date_recorded());
            ?>
										

				<!-- Delete -->
		
				<?php 
            $owner = bp_get_activity_user_id() == $bp->loggedin_user->id;
            ?>
					 
				<?php 
            if (is_super_admin() || $bp->current_action != "just-me" && $bp->is_item_admin || $owner) {
                ?>
				
					&middot; <a href="<?php 
                echo wp_nonce_url($bp->root_domain . '/' . $bp->activity->slug . '/delete/' . bp_get_activity_id() . '?cid=' . $comment_id, 'bp_activity_delete_link');
                ?>
" class="delete acomment-delete confirm"><?php 
                _e('Delete', 'buddypress');
                ?>
</a>
				
				<?php 
            }
            ?>
				

				<?php 
            do_action('bp_activity_entry_meta');
            ?>
 function activity_comments_print_link()
 {
     $link = bpModFrontend::get_link(array('type' => 'activity_comment', 'author_id' => bp_get_activity_comment_user_id(), 'id' => bp_get_activity_comment_id(), 'id2' => bp_get_activity_id(), 'custom_class' => 'bpm-no-images bp-secondary-action'));
     echo $link;
 }