コード例 #1
2
ファイル: core.php プロジェクト: adisonc/MaineLearning
function bebop_twitter_photos($text)
{
    if (bp_get_activity_type() == 'twitter') {
        $text = preg_replace('#http://twitpic.com/([a-z0-9_]+)#i', '<a href="http://twitpic.com/\\1" target="_blank" rel="external"><img width="60" src="http://twitpic.com/show/mini/\\1" /></a>', $text);
        $text = preg_replace('#http://yfrog.com/([a-z0-9_]+)#i', '<a href="http://yfrog.com/\\1" target="_blank" rel="external"><img width="60" src="http://yfrog.com/\\1.th.jpg" /></a>', $text);
        $text = preg_replace('#http://yfrog.us/([a-z0-9_]+)#i', '<a href="http://yfrog.us/\\1" target="_blank" rel="external"><img width="60" src="http://yfrog.us/\\1:frame" /></a>', $text);
    }
    return $text;
}
コード例 #2
1
/**
 * bp_like_post_to_stream()
 * 
 * Posts to stream, depending on settings
 * 
 * TODO, Should we be posted that people like comments to the feed? This can get messy..
 * Also no point having 20 posts saying people liked the same status..
 * 
 */
function bp_like_post_to_stream($item_id, $user_id)
{
    if (bp_like_get_settings('post_to_activity_stream') == 1 and bp_get_activity_type() == "profile_updated") {
        //TODO change from 1 to something more meaningful
        $activity = bp_activity_get_specific(array('activity_ids' => $item_id, 'component' => 'buddypress-like'));
        $author_id = $activity['activities'][0]->user_id;
        if ($user_id == $author_id) {
            $action = bp_like_get_text('record_activity_likes_own');
        } elseif ($user_id == 0) {
            $action = bp_like_get_text('record_activity_likes_an');
        } else {
            $action = bp_like_get_text('record_activity_likes_users');
        }
        $liker = bp_core_get_userlink($user_id);
        $author = bp_core_get_userlink($author_id);
        $activity_url = bp_activity_get_permalink($item_id);
        $content = '';
        //content must be defined...
        /* Grab the content and make it into an excerpt of 140 chars if we're allowed */
        if (bp_like_get_settings('show_excerpt') == 1) {
            $content = $activity['activities'][0]->content;
            if (strlen($content) > bp_like_get_settings('excerpt_length')) {
                $content = substr($content, 0, bp_like_get_settings('excerpt_length'));
                $content = strip_tags($content);
                $content = $content . '...';
            }
        }
        /* Filter out the placeholders */
        $action = str_replace('%user%', $liker, $action);
        $action = str_replace('%permalink%', $activity_url, $action);
        $action = str_replace('%author%', $author, $action);
        bp_activity_add(array('action' => $action, 'content' => $content, 'primary_link' => $activity_url, 'component' => 'bp-like', 'type' => 'activity_liked', 'user_id' => $user_id, 'item_id' => $item_id));
    }
}
コード例 #3
1
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 
}
コード例 #4
1
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');
        }
    }
}
コード例 #5
0
 function activity_loop_link()
 {
     $act_type = bp_get_activity_type();
     if (empty($this->types_map[$act_type])) {
         return;
     }
     $args = array('type' => $this->types_map[$act_type], 'id' => bp_get_activity_item_id(), 'id2' => bp_get_activity_secondary_item_id(), 'author_id' => bp_get_activity_user_id(), 'is_main_content' => bp_is_single_activity(), 'context' => 'activity-loop', 'custom_class' => 'button');
     $args = apply_filters("bp_moderation_activity_loop_link_args_{$act_type}", $args);
     if ($args) {
         echo $this->generate_link($args);
     }
 }
コード例 #6
0
/**
 * bp_like_button()
 *
 * Outputs the 'Like/Unlike' button.
 * 
 * TODO: Need to find/make function for getting activity type.
 * Also idea to get all registered types on site, and alert admin of unspoorted types,
 * and ask them to report them to myself.
 *
 */
function bp_like_button($id = '', $type = '')
{
    /* 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') {
        bplike_activity_button();
    } elseif ($type == 'blogpost') {
        bplike_blog_button();
        bp_get_activity_type();
    }
}
コード例 #7
0
ファイル: functions.php プロジェクト: adisonc/MaineLearning
function my_bp_activity_entry_content()
{
    if (bp_get_activity_object_name() == 'blogs' && bp_get_activity_type() == 'new_blog_post') {
        ?>
        <a class="view-post view-group-blog-comment" href="<?php 
        bp_activity_thread_permalink();
        ?>
">View group blog</a>
    <?php 
    }
    if (bp_get_activity_object_name() == 'blogs' && bp_get_activity_type() == 'new_blog_comment') {
        ?>
        <a class="view-post view-group-blog-comment" href="<?php 
        bp_activity_thread_permalink();
        ?>
">View group blog</a>
    <?php 
    }
    if (bp_get_activity_object_name() == 'activity' && bp_get_activity_type() == 'activity_update') {
        ?>
        <a class="view-post view-group-activity" href="<?php 
        bp_activity_thread_permalink();
        ?>
">View status update</a>
    <?php 
    }
    if (bp_get_activity_object_name() == 'groups' && bp_get_activity_type() == 'new_forum_topic') {
        ?>
        <a class="view-thread view-group-discussion-topic" href="<?php 
        bp_activity_thread_permalink();
        ?>
">View group discussion</a>
    <?php 
    }
    if (bp_get_activity_object_name() == 'groups' && bp_get_activity_type() == 'new_forum_post') {
        ?>
        <a class="view-post view-group-discussion-post" href="<?php 
        bp_activity_thread_permalink();
        ?>
">View group discussion</a>
    <?php 
    }
}
コード例 #8
0
ファイル: class-bplabs-like.php プロジェクト: rmccue/BP-Labs
 /**
  * Filter the activity stream item markup for Likes.
  *
  * @global unknown $activities_template
  * @return string
  * @since 1.3
  */
 public function activity_content($content)
 {
     global $activities_template;
     // Only handle Like activity items.
     if ('bpl_like' != bp_get_activity_object_name() || 'bpl_like' != bp_get_activity_type()) {
         return $content;
     }
     // Get the post
     // @todo handle a missing post better
     $post = get_post(bp_get_activity_item_id());
     if (is_null($post)) {
         return $content;
     }
     // Get number of Likes that this post has
     $extra_people = BPLabs_Like::get_likes_total();
     if ($extra_people) {
         $extra_content = '<p><img src="http://0.gravatar.com/avatar/81ec16063d89b162d55efe72165c105f?s=32&d=identicon&r=G" width="20" height="20" /> <img src="http://1.gravatar.com/avatar/9cf7c4541a582729a5fc7ae484786c0c?s=32&d=identicon&r=G" width="20" height="20" /> <img src="http://0.gravatar.com/avatar/e81cd075a6c9c29f712a691320e52dfd?s=32&d=identicon&r=G" width="20" height="20" /></p>';
         $extra_people = sprintf(__('and %s others', 'bpl'), number_format_i18n($extra_people - 1));
     } else {
         $extra_content = '';
         $extra_people = '';
     }
     // Build the content
     $content = '<p>' . sprintf(__('<a href="%1$s">%2$s</a> %3$s liked the article, <a href="%4$s">%5$s</a>.', 'bpl'), esc_attr(bp_get_activity_user_link()), $activities_template->activity->display_name, $extra_people, esc_attr(get_permalink($post->ID)), apply_filters('the_title', $post->post_title, $post->ID)) . '</p>';
     $content .= $extra_content;
     // Don't truncate the activity content
     remove_filter('bp_get_activity_content_body', 'bp_activity_truncate_entry', 5);
     return $content;
 }
コード例 #9
0
ファイル: widgets.php プロジェクト: tamriel-foundry/apoc2
    function build_html()
    {
        // Store everything in an output buffer
        ob_start();
        ?>
	
		<div class="widget showcase-widget">
			<header class="widget-header">
				<h3 class="widget-title">Recent Discussion</h3>
			</header>
			<ul class="recent-discussion-list">		
	
			<?php 
        // Iterate topics
        while (bp_activities()) {
            bp_the_activity();
            // Get the activity user
            $user = new Apoc_User(bp_get_activity_user_id(), 'directory', 40);
            // Get the activity type
            $type = bp_get_activity_type();
            // Format activity based on context
            switch ($type) {
                case 'bbp_topic_create':
                    $topic_id = bp_get_activity_item_id();
                    $link = '<a href="' . bbp_get_topic_permalink($topic_id) . '" title="Read topic" target="_blank">' . bbp_get_topic_title($topic_id) . '</a>';
                    $verb = 'created topic';
                    break;
                case 'bbp_reply_create':
                    $reply_id = bp_get_activity_secondary_item_id();
                    $link = '<a href="' . bbp_get_topic_last_reply_url($reply_id) . '" title="Read reply" target="_blank">' . bbp_get_topic_title($reply_id) . '</a>';
                    $verb = 'replied to';
                    break;
                case 'new_blog_comment':
                    $comment_id = bp_get_activity_secondary_item_id();
                    $comment = get_comment($comment_id);
                    $link = '<a href="' . get_comment_link($comment_id) . '" title="Read reply" target="_blank">' . get_the_title($comment->comment_post_ID) . '</a>';
                    $verb = 'commented on';
                    break;
            }
            // Get the activity time
            $time = bp_core_time_since(bp_get_activity_date_recorded());
            // Output the HTML
            ?>
				<li class="recent-discussion double-border">			
					<?php 
            echo $user->avatar;
            ?>
					<div class="recent-discussion-content">
						<span class="recent-discussion-title"><?php 
            echo $user->link . ' ' . $verb . ' ' . $link;
            ?>
</span>
						<span class="recent-discussion-time"><?php 
            echo $time;
            ?>
					</div>
				</li>
			
			<?php 
        }
        ?>
			</ul>
		</div><?php 
        // Get the contents of the buffer
        $html = ob_get_contents();
        ob_end_clean();
        // Return the html to the class
        return $html;
    }
コード例 #10
0
 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);
 }
コード例 #11
0
 /**
  * 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));
 }
コード例 #12
0
    /**
     *
     */
    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();
    }
コード例 #13
0
ファイル: likebtn_like_button.php プロジェクト: Omuze/barakat
function _likebtn_bp_get_entity_name()
{
    $activity_type = bp_get_activity_type();
    switch ($activity_type) {
        case 'bbp_topic_create':
            return LIKEBTN_ENTITY_BP_ACTIVITY_TOPIC;
        case 'new_blog_post':
            // Post
            return LIKEBTN_ENTITY_BP_ACTIVITY_POST;
        case 'new_member':
            return LIKEBTN_ENTITY_BP_ACTIVITY_UPDATE;
        default:
            return LIKEBTN_ENTITY_BP_ACTIVITY_UPDATE;
    }
}
コード例 #14
0
/**
 * Determine if a comment can be made on an activity item.
 *
 * @since 1.2.0
 *
 * @global object $activities_template {@link BP_Activity_Template}
 *
 * @return bool $can_comment True if item can receive comments.
 */
function bp_activity_can_comment()
{
    global $activities_template;
    $bp = buddypress();
    // Determine ability to comment based on activity type name.
    $activity_type = bp_get_activity_type();
    // Get the 'comment-reply' support for the current activity type.
    $can_comment = bp_activity_type_supports($activity_type, 'comment-reply');
    // Neutralize activity_comment.
    if ('activity_comment' === $activity_type) {
        $can_comment = false;
    }
    /**
     * Filters whether a comment can be made on an activity item.
     *
     * @since 1.5.0
     * @since 2.5.0 Use $activity_type instead of $activity_name for the second parameter.
     *
     * @param bool   $can_comment     Status on if activity can be commented on.
     * @param string $activity_type   Current activity type being checked on.
     */
    return apply_filters('bp_activity_can_comment', $can_comment, $activity_type);
}
コード例 #15
0
/**
 * Get the follow type associated with an activity item.
 *
 * If no custom follow type is set, falls back to the generic 'activity' type.
 *
 * @param  int $activity_id The activity ID to check.
 * @return string
 */
function bp_follow_activity_get_type($activity_id = 0)
{
    // If in activity loop, use already-queried activity action
    if (!empty($GLOBALS['activities_template']->in_the_loop)) {
        $action = bp_activity_get_action(bp_get_activity_object_name(), bp_get_activity_type());
        // Manually query for the activity action of a given activity item
    } else {
        // Do not do anything if empty
        if (empty($activity_id)) {
            return false;
        }
        $activity = new BP_Activity_Activity($activity_id);
        if (empty($activity->type)) {
            return false;
        }
        $action = bp_activity_get_action($activity->component, $activity->type);
    }
    return isset($action['follow_type']) ? $action['follow_type'] : 'activity';
}
コード例 #16
0
ファイル: filters.php プロジェクト: socialray/surfied-2-0
/**
 * Replaces the activity delete link in case of a reshare type
 *
 * @package BP Reshare
 * @since    1.0
 * 
 * @param  string $delete_link        
 * @uses   bp_get_activity_type() to get activity type
 * @uses   wp_nonce_url() for security reason
 * @uses   bp_get_root_domain() to get the blog's url
 * @uses   bp_get_activity_root_slug() to get the activity slug
 * @uses   buddyreshare_get_component_slug() to get the component's slug
 * @uses   bp_get_activity_id() to get the activity id
 * @return string $delete_link
 */
function buddyreshare_maybe_replace_delete_link($delete_link = '')
{
    if (bp_get_activity_type() == 'reshare_update') {
        $action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/' . buddyreshare_get_component_slug() . '/delete/' . bp_get_activity_id() . '/', 'buddyreshare_delete');
        $delete_link = '<a href="' . $action_url . '" class="button item-button bp-secondary-action delete-reshare confirm" rel="nofollow">' . __('Delete', 'bp-reshare') . '</a>';
    }
    return $delete_link;
}
コード例 #17
0
function swa_activity_entry($show_avatar = false)
{
    ?>
 <?php 
    do_action('bp_before_activity_entry');
    ?>
    <li class="<?php 
    bp_activity_css_class();
    ?>
" id="activity-<?php 
    bp_activity_id();
    ?>
">
            <?php 
    if ($show_avatar == "yes") {
        ?>
                      <div class="swa-activity-avatar">
                            <a href="<?php 
        bp_activity_user_link();
        ?>
">
                                    <?php 
        bp_activity_avatar('type=thumb&width=50&height=50');
        ?>
                            </a>

                    </div>
           <?php 
    }
    ?>
          <div class="swa-activity-content">
		<div class="swa-activity-header">
			<?php 
    bp_activity_action();
    ?>
		</div>

		<?php 
    if (bp_activity_has_content()) {
        ?>
			<div class="swa-activity-inner">
				<?php 
        bp_activity_content_body();
        ?>
			</div>
		<?php 
    }
    ?>

	<?php 
    do_action('bp_activity_entry_content');
    ?>
	<div class="swa-activity-meta">
            <?php 
    if (is_user_logged_in() && bp_activity_can_comment()) {
        ?>
				<a href="<?php 
        bp_activity_comment_link();
        ?>
" class="acomment-reply" id="acomment-comment-<?php 
        bp_activity_id();
        ?>
"><?php 
        _e('Reply', 'buddypress');
        ?>
 (<span><?php 
        bp_activity_comment_count();
        ?>
</span>)</a>
			<?php 
    }
    ?>
            <?php 
    if (is_user_logged_in()) {
        ?>
		<?php 
        if (!bp_get_activity_is_favorite()) {
            ?>
                    <a href="<?php 
            bp_activity_favorite_link();
            ?>
" class="fav" title="<?php 
            _e('Mark as Favorite', 'swa');
            ?>
"><?php 
            _e('Favorite', 'swa');
            ?>
</a>
		<?php 
        } else {
            ?>
                    <a href="<?php 
            bp_activity_unfavorite_link();
            ?>
" class="unfav" title="<?php 
            _e('Remove Favorite', 'swa');
            ?>
"><?php 
            _e('Remove Favorite', 'swa');
            ?>
</a>
		<?php 
        }
        ?>
            <?php 
    }
    ?>
            <?php 
    do_action('bp_activity_entry_meta');
    ?>
        </div>
	<div class="clear" ></div>
    </div>
    <?php 
    if ('activity_comment' == bp_get_activity_type()) {
        ?>
	<div class="swa-activity-inreplyto">
            <strong><?php 
        _e('In reply to', 'swa');
        ?>
</strong> - <?php 
        bp_activity_parent_content();
        ?>
 &middot;
            <a href="<?php 
        bp_activity_thread_permalink();
        ?>
" class="view" title="<?php 
        _e('View Thread / Permalink', 'swa');
        ?>
"><?php 
        _e('View', 'swa');
        ?>
</a>
	</div>
    <?php 
    }
    ?>
    <?php 
    if (bp_activity_can_comment()) {
        ?>
        <div class="swa-activity-comments">
        	<?php 
        bp_activity_comments();
        ?>
            <?php 
        if (is_user_logged_in()) {
            ?>
			<form action="<?php 
            bp_activity_comment_form_action();
            ?>
" method="post" id="swa-ac-form-<?php 
            bp_activity_id();
            ?>
" class="swa-ac-form"<?php 
            bp_activity_comment_form_nojs_display();
            ?>
>
				<div class="ac-reply-avatar"><?php 
            bp_loggedin_user_avatar('width=' . BP_AVATAR_THUMB_WIDTH . '&height=' . BP_AVATAR_THUMB_HEIGHT);
            ?>
</div>
				<div class="ac-reply-content">
					<div class="ac-textarea">
						<textarea id="swa-ac-input-<?php 
            bp_activity_id();
            ?>
" class="ac-input" name="ac_input_<?php 
            bp_activity_id();
            ?>
"></textarea>
					</div>
					<input type="submit" name="swa_ac_form_submit" value="<?php 
            _e('Post', 'buddypress');
            ?>
 &rarr;" /> &nbsp; <?php 
            _e('or press esc to cancel.', 'buddypress');
            ?>
					<input type="hidden" name="comment_form_id" value="<?php 
            bp_activity_id();
            ?>
" />
				</div>
				<?php 
            wp_nonce_field('new_activity_comment', '_wpnonce_new_activity_comment');
            ?>
			</form>
			<?php 
        }
        ?>
	</div>
    <?php 
    }
    ?>
</li>
<?php 
    do_action('bp_after_swa_activity_entry');
    ?>

<?php 
}
コード例 #18
0
function bp_reshare_check_for_parent_type($can_comment)
{
    global $activities_template;
    if ($activities_template->disable_blogforum_replies == 0) {
        return $can_comment;
    }
    if ('reshare_update' != bp_get_activity_type()) {
        return $can_comment;
    } else {
        if (!(int) bp_get_option('bp-reshare-disable-blogforum-comments') || '' == bp_get_option('bp-reshare-disable-blogforum-comments')) {
            return $can_comment;
        }
        /*
         	the activity is a reshare, 
        	Admin wants to disable comments for blogs and forums
        	we now need to check for parent type
        */
        $activity_first_id = bp_get_activity_secondary_item_id();
        $parent_activity = bp_activity_get_specific('activity_ids=' . $activity_first_id);
        if (in_array($parent_activity['activities'][0]->type, array('new_blog_post', 'new_blog_comment', 'new_forum_topic', 'new_forum_post'))) {
            return false;
        } else {
            return $can_comment;
        }
    }
}
コード例 #19
0
/**
 * Returns the activity type
 *
 * Just a wrapper for bp_get_activity_type()
 *
 * @since 1.2.0
 * @deprecated 1.5.0
 *
 * @todo Properly deprecate in favor of bp_get_activity_type()
 *
 * @uses bp_get_activity_type()
 *
 * @return string The activity type
 */
function bp_get_activity_action_name()
{
    return bp_get_activity_type();
}
コード例 #20
0
ファイル: rating-widget.php プロジェクト: panser/wandromaha
 private function GetBuddyPressRating($ver, $horAlign = true)
 {
     if (RWLogger::IsOn()) {
         $params = func_get_args();
         RWLogger::LogEnterence("GetBuddyPressRating", $params);
     }
     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 ($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);
     /*
             // Queue activity rating.
             $this->QueueRatingData($urid, strip_tags($title), bp_activity_get_permalink($activities_template->activity->id), $rclass);
     
             // Return rating html container.
             return '<div class="rw-ui-container rw-class-' . $rclass . ' rw-urid-' . $urid . '"></div>';*/
 }
コード例 #21
0
/**
 * Limit the display of post type synced comments.
 *
 * @since  2.5.0
 *
 * When viewing the synced comments in stream mode, this prevents comments to
 * be displayed twice, and avoids a Javascript error as the form to add replies
 * is not available.
 *
 * @param  int $retval  The comment count for the activity.
 * @return int          The comment count, or 0 to hide activity comment replies.
 */
function bp_blogs_post_type_comments_avoid_duplicates($retval)
{
    /**
     * Only limit the display when Post type comments are synced with
     * activity comments.
     */
    if (bp_disable_blogforum_comments()) {
        return $retval;
    }
    if ('activity_comment' !== bp_get_activity_type()) {
        return $retval;
    }
    // Check the parent activity
    $parent_activity = new BP_Activity_Activity(bp_get_activity_item_id());
    if (isset($parent_activity->type) && bp_activity_post_type_get_tracking_arg($parent_activity->type, 'post_type')) {
        $retval = 0;
    }
    return $retval;
}
コード例 #22
0
 function handle_buddypress_activity_integration()
 {
     if ($this->check_applicability_module('buddypress')) {
         $activity_type = bp_get_activity_type();
         $activity_link = bp_get_activity_thread_permalink();
         $activity_title = bp_get_activity_feed_item_title();
         printf('%1$s<div style="clear: both;"></div>', $this->generate_share_buttons('buddypress', 'share', array('only_share' => false, 'post_type' => 'buddypress', 'url' => $activity_link, 'title' => $activity_title)));
     }
 }
コード例 #23
0
ファイル: bp.php プロジェクト: deepakd92/anspress
 public function activity_buttons()
 {
     if ('new_question' == bp_get_activity_type()) {
         echo '<a class="button answer bp-secondary-action" title="' . __('Answer this question', 'anspress-question-answer') . '" href="' . ap_answers_link(bp_get_activity_secondary_item_id()) . '">' . __('Answer', 'anspress-question-answer') . '</a>';
     }
 }
コード例 #24
0
ファイル: library.php プロジェクト: poweronio/mbsite
 /**
  * @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;
 }
コード例 #25
0
ファイル: entry.php プロジェクト: kosir/thatcamp-org
}
?>

		<?php 
/**
 * Fires after the display of an activity entry content.
 *
 * @since BuddyPress (1.2.0)
 */
do_action('bp_activity_entry_content');
?>

		<div class="activity-meta">

			<?php 
if (bp_get_activity_type() == 'activity_comment') {
    ?>

				<a href="<?php 
    bp_activity_thread_permalink();
    ?>
" class="button view bp-secondary-action" title="<?php 
    esc_attr_e('View Conversation', 'buddypress');
    ?>
"><?php 
    _e('View Conversation', 'buddypress');
    ?>
</a>

			<?php 
}
コード例 #26
0
/**
 * Append the featured image for the activity excerpt.
 *
 * @since 1.0.5
 * @package GeoDirectory_BuddyPress_Integration
 *
 * @param string $excerpt The appended text for the activity excerpt.
 * @return string The activity excerpt.
 */
function geodir_buddypress_bp_activity_featured_image($excerpt = '')
{
    $activity_name = bp_get_activity_object_name();
    $activity_type = bp_get_activity_type();
    $item_id = bp_get_activity_secondary_item_id();
    if ($activity_name == 'activity' && $item_id > 0 && $activity_type == 'new_' . get_post_type($item_id) && get_option('geodir_buddypress_show_feature_image')) {
        $image = wp_get_attachment_image_src(get_post_thumbnail_id($item_id));
        if (!empty($image) && !empty($image[0])) {
            $listing_title = geodir_get_post_meta($item_id, 'post_title', true);
            $featured_image = '<a class="gdbp-feature-image" href="' . get_permalink($item_id) . '" title="' . esc_attr($listing_title) . '"><img alt="' . esc_attr($listing_title) . '" src="' . $image[0] . '" /></a>';
            /**
             * Filter the new listing featured image in activity.
             *
             * @since 1.0.5
             *
             * @param string $featured_image Featured image content.
             * @param int $item_id Activity item id.
             * @param string $activity_name Current activity name.
             * @param string $activity_type Current activity type.
             */
            $featured_image = apply_filters('geodir_buddypress_bp_activity_featured_image', $featured_image, $item_id, $activity_name, $activity_type);
            echo $featured_image;
        }
    }
    return $excerpt;
}
コード例 #27
0
ファイル: entry.php プロジェクト: paulmedwal/edxforumspublic
                <?php 
bp_activity_avatar();
?>
    
            </a>
        </div>
        <div class="activity-header">
    
            <?php 
bp_activity_action();
?>
    
        </div>
    
        <?php 
if ('activity_comment' == bp_get_activity_type()) {
    ?>
    
            <div class="activity-inreplyto">
                <strong><?php 
    _e('In reply to: ', 'firmasite');
    ?>
</strong><?php 
    bp_activity_parent_content();
    ?>
 <a href="<?php 
    bp_activity_thread_permalink();
    ?>
" class="view" title="<?php 
    _e('View Thread / Permalink', 'firmasite');
    ?>
コード例 #28
0
ファイル: essb.php プロジェクト: ajay786singh/emc
 function buddy_social_button_activity_filter()
 {
     // buddypress activity
     $activity_type = bp_get_activity_type();
     $activity_link = bp_get_activity_thread_permalink();
     $activity_title = bp_get_activity_feed_item_title();
     echo '<div style="clear: both;\\"></div>';
     $options = $this->options;
     $essb_networks = $options['networks'];
     $buttons = "";
     foreach ($essb_networks as $k => $v) {
         if ($v[0] == 1) {
             if ($buttons != '') {
                 $buttons .= ",";
             }
             $buttons .= $k;
         }
     }
     $activity_title = str_replace('[&#8230;]', '', $activity_title);
     $need_counters = $options['show_counter'] ? 1 : 0;
     $links = do_shortcode('[easy-share buttons="' . $buttons . '" counters=0 native="no" url="' . urlencode($activity_link) . '" text="' . htmlspecialchars($activity_title) . '" nostats="yes" hide_names="yes"]');
     echo $links . '<div style="clear: both;\\"></div>';
 }