Пример #1
0
	function widget($args, $instance) {
		global $bp;

		extract( $args );

		echo $before_widget;
		echo $before_title . $widget_name . $after_title;

		if ( empty( $instance['max_posts'] ) || !$instance['max_posts'] )
			$instance['max_posts'] = 10; ?>

		<?php if ( bp_has_activities( 'action=new_blog_post&max=' . $instance['max_posts'] . '&per_page=' . $instance['max_posts'] ) ) : ?>

			<ul id="blog-post-list" class="activity-list item-list">

				<?php while ( bp_activities() ) : bp_the_activity(); ?>

					<li>
						<div class="activity-content" style="margin: 0">

							<div class="activity-header">
								<?php bp_activity_action() ?>
							</div>

							<?php if ( bp_get_activity_content_body() ) : ?>
								<div class="activity-inner">
									<?php bp_activity_content_body() ?>
								</div>
							<?php endif; ?>

						</div>
					</li>

				<?php endwhile; ?>

			</ul>

		<?php else : ?>
			<div id="message" class="info">
				<p><?php _e( 'Sorry, there were no blog posts found. Why not write one?', 'buddypress' ) ?></p>
			</div>
		<?php endif; ?>

		<?php echo $after_widget; ?>
	<?php
	}
Пример #2
0
        <?php 
}
?>
    </div>

	<div class="activity-content">


		<?php 
if (bp_activity_has_content()) {
    ?>

			<div class="activity-inner fs-have-thumbnail">

				<?php 
    bp_activity_content_body();
    ?>

			</div>

		<?php 
}
?>

		<?php 
do_action('bp_activity_entry_content');
?>

		<?php 
if (is_user_logged_in()) {
    ?>
Пример #3
0
    /**
     * Display the networkwide posts widget.
     *
     * @see WP_Widget::widget() for description of parameters.
     *
     * @param array $args     Widget arguments.
     * @param array $instance Widget settings, as saved by the user.
     */
    public function widget($args, $instance)
    {
        $title = !empty($instance['title']) ? esc_html($instance['title']) : __('Recent Networkwide Posts', 'buddypress');
        if (!empty($instance['link_title'])) {
            $title = '<a href="' . bp_get_blogs_directory_permalink() . '">' . esc_html($title) . '</a>';
        }
        /**
         * Filters the Blogs Recent Posts widget title.
         *
         * @since BuddyPress (2.2.0)
         * @since BuddyPress (2.3.0) Added 'instance' and 'id_base' to arguments passed to filter.
         *
         * @param string $title    The widget title.
         * @param array  $instance The settings for the particular instance of the widget.
         * @param string $id_base  Root ID for all widgets of this type.
         */
        $title = apply_filters('widget_title', $title, $instance, $this->id_base);
        echo $args['before_widget'];
        echo $args['before_title'] . $title . $args['after_title'];
        if (empty($instance['max_posts']) || empty($instance['max_posts'])) {
            $instance['max_posts'] = 10;
        }
        // Override some of the contextually set parameters for bp_has_activities()
        $args = array('action' => 'new_blog_post', 'max' => $instance['max_posts'], 'per_page' => $instance['max_posts'], 'user_id' => 0, 'scope' => false, 'object' => false, 'primary_id' => false);
        ?>

		<?php 
        if (bp_has_activities($args)) {
            ?>

			<ul id="blog-post-list" class="activity-list item-list">

				<?php 
            while (bp_activities()) {
                bp_the_activity();
                ?>

					<li>
						<div class="activity-content" style="margin: 0">
							<div class="activity-header"><?php 
                bp_activity_action();
                ?>
</div>

							<?php 
                if (bp_get_activity_content_body()) {
                    ?>

								<div class="activity-inner"><?php 
                    bp_activity_content_body();
                    ?>
</div>

							<?php 
                }
                ?>

						</div>
					</li>

				<?php 
            }
            ?>

			</ul>

		<?php 
        } else {
            ?>

			<div id="message" class="info">
				<p><?php 
            _e('Sorry, there were no posts found. Why not write one?', 'buddypress');
            ?>
</p>
			</div>

		<?php 
        }
        ?>

		<?php 
        echo $args['after_widget'];
        ?>
	<?php 
    }
    /**
     * Output the feed's item content.
     */
    protected function feed_content()
    {
        bp_activity_content_body();
        switch ($this->id) {
            // Also output parent activity item if we're on a specific feed.
            case 'favorites':
            case 'friends':
            case 'mentions':
            case 'personal':
                if ('activity_comment' == bp_get_activity_action_name()) {
                    ?>
				<strong><?php 
                    _e('In reply to', 'buddypress');
                    ?>
</strong> -
				<?php 
                    bp_activity_parent_content();
                    ?>
			<?php 
                }
                break;
        }
    }
Пример #5
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 
}
    /**
     *
     */
    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();
    }
Пример #7
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;
}
Пример #8
0
    function widget($args, $instance)
    {
        extract($args);
        echo $before_widget;
        echo $before_title . $widget_name . $after_title;
        if (empty($instance['max_posts']) || !$instance['max_posts']) {
            $instance['max_posts'] = 10;
        }
        ?>

		<?php 
        /* Override some of the contextually set parameters for bp_has_activities() */
        ?>
		<?php 
        if (bp_has_activities(array('action' => 'new_blog_post', 'max' => $instance['max_posts'], 'per_page' => $instance['max_posts'], 'user_id' => 0, 'scope' => false, 'object' => false, 'primary_id' => false))) {
            ?>

			<ul id="blog-post-list" class="activity-list item-list">

				<?php 
            while (bp_activities()) {
                bp_the_activity();
                ?>

					<li>
						<div class="activity-content" style="margin: 0">

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

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

						</div>
					</li>

				<?php 
            }
            ?>

			</ul>

		<?php 
        } else {
            ?>
			<div id="message" class="info">
				<p><?php 
            _e('Sorry, there were no posts found. Why not write one?', 'buddypress');
            ?>
</p>
			</div>
		<?php 
        }
        ?>

		<?php 
        echo $after_widget;
        ?>
	<?php 
    }
Пример #9
0
<li class="<?php bp_activity_css_class() ?>" id="activity-<?php bp_activity_id() ?>">
	<div class="activity-avatar">
		<a href="<?php bp_activity_user_link() ?>">
			<?php bp_activity_avatar( 'type=full&width=100&height=100' ) ?>
		</a>
	</div>

	<div class="activity-content">

		<div class="activity-header">
			<?php bp_activity_action() ?>
		</div>

		<?php if ( bp_activity_has_content() ) : ?>
			<div class="activity-inner">
				<?php bp_activity_content_body() ?>
			</div>
		<?php endif; ?>

		<?php do_action( 'bp_activity_entry_content' ) ?>

		<div class="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 endif; ?>

			<?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', 'buddypress' ) ?>"><?php _e( 'Favorite', 'buddypress' ) ?></a>
				<?php else : ?>
					<a href="<?php bp_activity_unfavorite_link() ?>" class="unfav" title="<?php _e( 'Remove Favorite', 'buddypress' ) ?>"><?php _e( 'Remove Favorite', 'buddypress' ) ?></a>
Пример #10
0
    /**
     * Display the networkwide posts widget.
     *
     * @see WP_Widget::widget() for description of parameters.
     *
     * @param array $args Widget arguments.
     * @param array $instance Widget settings, as saved by the user.
     */
    function widget($args, $instance)
    {
        $title = !empty($instance['title']) ? esc_html($instance['title']) : __('Recent Networkwide Posts', 'buddypress');
        if (!empty($instance['link_title'])) {
            $title = '<a href="' . trailingslashit(bp_get_root_domain()) . trailingslashit(bp_get_blogs_root_slug()) . '">' . esc_html($title) . '</a>';
        }
        echo $args['before_widget'];
        echo $args['before_title'] . $title . $args['after_title'];
        if (empty($instance['max_posts']) || !$instance['max_posts']) {
            $instance['max_posts'] = 10;
        }
        ?>

		<?php 
        // Override some of the contextually set parameters for bp_has_activities()
        ?>
		<?php 
        if (bp_has_activities(array('action' => 'new_blog_post', 'max' => $instance['max_posts'], 'per_page' => $instance['max_posts'], 'user_id' => 0, 'scope' => false, 'object' => false, 'primary_id' => false))) {
            ?>

			<ul id="blog-post-list" class="activity-list item-list">

				<?php 
            while (bp_activities()) {
                bp_the_activity();
                ?>

					<li>
						<div class="activity-content" style="margin: 0">

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

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

						</div>
					</li>

				<?php 
            }
            ?>

			</ul>

		<?php 
        } else {
            ?>
			<div id="message" class="info">
				<p><?php 
            _e('Sorry, there were no posts found. Why not write one?', 'buddypress');
            ?>
</p>
			</div>
		<?php 
        }
        ?>

		<?php 
        echo $args['after_widget'];
        ?>
	<?php 
    }
Пример #11
0
        /**
         * Do widget framework.
         *
         * @param array $instance The settings for the particular instance of the widget.
         */
        public static function framework($instance)
        {
            global $gs_counter, $processed_activities;
            genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry'));
            $settings = get_option('widget_featured-content');
            if (!isset($settings[3]['buddypress-group']) || 1 != $settings[3]['buddypress-group']) {
                GS_Featured_Content::action('thememixfc_before_post_content', $instance);
                GS_Featured_Content::action('thememixfc_post_content', $instance);
                GS_Featured_Content::action('thememixfc_after_post_content', $instance);
            } else {
                if (!isset($processed_activities)) {
                    $processed_activities = array();
                }
                $group_id = $settings[3]['buddypress-group-group'];
                if (bp_has_activities(bp_ajax_querystring('activity') . '&primary_id=' . $group_id)) {
                    while (bp_activities()) {
                        bp_the_activity();
                        $url = trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/');
                        $fontawesome_position = $settings[3]['fontawesome-position'];
                        $activity_id = bp_get_activity_id();
                        if (!in_array($activity_id, $processed_activities) && !isset($done)) {
                            // Get image HTML
                            if (isset($settings[3]['show_image']) && 1 == $settings[3]['show_image']) {
                                $size = $settings[3]['image_size'];
                                $image_html = bp_get_activity_avatar('type=' . $size);
                                // Add image link to image HTML
                                if (isset($settings[3]['link_image']) && 1 == $settings[3]['link_image']) {
                                    $image_html = '<a href="' . esc_attr(bp_get_activity_user_link()) . '">' . $image_html . '</a>';
                                }
                            }
                            echo '
						<article itemscope="itemscope" itemtype="http://schema.org/Event">';
                            if (isset($settings[3]['image_position']) && 'before-title' == $settings[3]['image_position']) {
                                echo $image_html;
                            }
                            if ('before_title' == $fontawesome_position) {
                                echo thememixfc_span_fontawesome();
                            }
                            echo '
							<h2 class="entry-title">';
                            if ('inline_before_title' == $fontawesome_position) {
                                echo thememixfc_span_fontawesome();
                            }
                            echo '
								<a href="' . esc_url($url) . '" title="' . esc_attr($group->name) . '">' . esc_html($group->name) . '</a>';
                            if ('inline_after_title' == $fontawesome_position) {
                                echo thememixfc_span_fontawesome();
                            }
                            echo '
							</h2>';
                            if ('after_title' == $fontawesome_position) {
                                echo thememixfc_span_fontawesome();
                            }
                            if (isset($settings[3]['image_position']) && 'after-title' == $settings[3]['image_position']) {
                                echo $image_html;
                            }
                            if (bp_activity_has_content()) {
                                bp_activity_content_body();
                            }
                            if (isset($settings[3]['image_position']) && 'after-content' == $settings[3]['image_position']) {
                                echo $image_html;
                            }
                            echo '
						</article>';
                            $processed_activities[] = $activity_id;
                            $done = true;
                        }
                    }
                }
            }
            $gs_counter++;
            genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>'));
        }
Пример #12
0
    function widget($args, $instance)
    {
        global $bp;
        extract($args);
        $link_title = !empty($instance['link_title']);
        echo $before_widget;
        echo $before_title;
        if ($link_title) {
            $dir_link = trailingslashit(bp_get_root_domain()) . trailingslashit(bp_get_blogs_root_slug());
            $title = '<a href="' . $dir_link . '">' . $instance['title'] . '</a>';
        } else {
            $title = $instance['title'];
        }
        echo $title;
        echo $after_title;
        if (empty($instance['max_posts']) || !$instance['max_posts']) {
            $instance['max_posts'] = 10;
        }
        // Load more items that we need, because many will be filtered out by privacy
        $real_max = $instance['max_posts'] * 10;
        $counter = 0;
        $query_string = empty($instance['include_groupblog']) ? 'action=new_blog_post' : 'action=new_blog_post,new_groupblog_post';
        $query_string .= '&max=' . $real_max . '&per_page=' . $real_max;
        if (bp_has_activities($query_string)) {
            ?>

			<ul id="blog-post-list" class="activity-list item-list">

				<?php 
            while (bp_activities()) {
                bp_the_activity();
                ?>

					<?php 
                if ($counter >= $instance['max_posts']) {
                    break;
                }
                ?>

					<li>
						<div class="activity-content" style="margin: 0">
							<div class="activity-avatar">
								<?php 
                bp_activity_avatar();
                ?>
							</div>

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

							<?php 
                if (bp_get_activity_content_body()) {
                    ?>

									<?php 
                    bp_activity_content_body();
                    ?>

							<?php 
                }
                ?>

						</div>
					</li>

					<?php 
                $counter++;
                ?>

				<?php 
            }
            ?>

			</ul>

		<p class="cac-more-link"><a href="<?php 
            bp_blogs_directory_permalink();
            ?>
">More Blogs</a></p>

		<?php 
        } else {
            ?>
			<div id="message" class="info">
				<p><?php 
            _e('Sorry, there were no blog posts found. Why not write one?', 'buddypress');
            ?>
</p>
			</div>
		<?php 
        }
        ?>

		<?php 
        echo $after_widget;
        ?>
	<?php 
    }
function themefix_buddypress_groups_widget($settings, $key, $group)
{
    global $gs_counter, $processed_activities;
    if (!isset($processed_activities)) {
        $processed_activities = array();
    }
    $group_id = $settings[$key]['buddypress-group-group'];
    $group = groups_get_group(array('group_id' => $group_id));
    if (bp_has_activities(bp_ajax_querystring('activity') . '&primary_id=' . $group_id)) {
        while (bp_activities()) {
            bp_the_activity();
            $url = trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/');
            $fontawesome_position = $settings[$key]['fontawesome-position'];
            $activity_id = bp_get_activity_id();
            if (!in_array($activity_id, $processed_activities) && !isset($done)) {
                // Get image HTML
                if (isset($settings[$key]['show_image']) && 1 == $settings[$key]['show_image']) {
                    $size = $settings[$key]['image_size'];
                    $image_html = bp_get_activity_avatar('type=' . $size);
                    // Add image link to image HTML
                    if (isset($settings[$key]['link_image']) && 1 == $settings[$key]['link_image']) {
                        if ('' == $settings[$key]['gravatar_alignment']) {
                            $alignment = 'alignnone';
                        } else {
                            $alignment = $settings[$key]['gravatar_alignment'];
                        }
                        $image_html = '<a href="' . esc_attr(bp_get_activity_user_link()) . '"><span class="' . esc_attr($alignment) . '">' . $image_html . '</span></a>';
                    }
                }
                echo '
				<article itemscope="itemscope" itemtype="http://schema.org/Event">';
                if (isset($settings[$key]['image_position']) && 'before-title' == $settings[$key]['image_position']) {
                    echo $image_html;
                }
                if ('before_title' == $fontawesome_position) {
                    thememix_featured_content_span_fontawesome($key);
                }
                echo '
					<h2 class="entry-title">';
                echo '
						<a href="' . esc_url($url) . '" title="' . esc_attr($group->name) . '">';
                if ('inline_before_title' == $fontawesome_position) {
                    thememix_featured_content_span_fontawesome($key, true);
                    echo ' ';
                }
                echo esc_html($group->name);
                if ('inline_after_title' == $fontawesome_position) {
                    echo ' ';
                    thememix_featured_content_span_fontawesome($key, true);
                }
                echo '</a>';
                echo '
					</h2>';
                if ('after_title' == $fontawesome_position) {
                    thememix_featured_content_span_fontawesome($key);
                }
                if (isset($settings[$key]['image_position']) && 'after-title' == $settings[$key]['image_position']) {
                    echo $image_html;
                }
                if (bp_activity_has_content()) {
                    bp_activity_content_body();
                }
                if (isset($settings[$key]['image_position']) && 'after-content' == $settings[$key]['image_position']) {
                    echo $image_html;
                }
                echo '
				</article>';
                $processed_activities[] = $activity_id;
                $done = true;
            }
        }
    }
}