/**
 * Returns a follow / unfollow button for a given user depending on the follower status.
 *
 * Checks to see if the follower is already following the leader.  If is following, returns
 * "Stop following" button; if not following, returns "Follow" button.
 *
 * @param array $args {
 *     Array of arguments.
 *     @type int $leader_id The user ID of the person we want to follow.
 *     @type int $follower_id The user ID initiating the follow request.
 *     @type string $link_text The anchor text for the link.
 *     @type string $link_title The title attribute for the link.
 *     @type string $wrapper_class CSS class for the wrapper container.
 *     @type string $link_class CSS class for the link.
 *     @type string $wrapper The element for the wrapper container. Defaults to 'div'.
 * }
 * @return mixed String of the button on success.  Boolean false on failure.
 * @uses bp_get_button() Renders a button using the BP Button API
 * @author r-a-y
 * @since 1.1
 */
function bp_follow_get_add_follow_button($args = '')
{
    global $bp, $members_template;
    $r = wp_parse_args($args, array('leader_id' => bp_displayed_user_id(), 'follower_id' => bp_loggedin_user_id(), 'link_text' => '', 'link_title' => '', 'wrapper_class' => '', 'link_class' => '', 'wrapper' => 'div'));
    if (!$r['leader_id'] || !$r['follower_id']) {
        return false;
    }
    // if we're checking during a members loop, then follow status is already
    // queried via bp_follow_inject_member_follow_status()
    if (!empty($members_template->in_the_loop) && $r['follower_id'] == bp_loggedin_user_id() && $r['leader_id'] == bp_get_member_user_id()) {
        $is_following = $members_template->member->is_following;
        // else we manually query the follow status
    } else {
        $is_following = bp_follow_is_following(array('leader_id' => $r['leader_id'], 'follower_id' => $r['follower_id']));
    }
    // if the logged-in user is the leader, use already-queried variables
    if (bp_loggedin_user_id() && $r['leader_id'] == bp_loggedin_user_id()) {
        $leader_domain = bp_loggedin_user_domain();
        $leader_fullname = bp_get_loggedin_user_fullname();
        // else we do a lookup for the user domain and display name of the leader
    } else {
        $leader_domain = bp_core_get_user_domain($r['leader_id']);
        $leader_fullname = bp_core_get_user_displayname($r['leader_id']);
    }
    // setup some variables
    if ($is_following) {
        $id = 'following';
        $action = 'stop';
        $class = 'unfollow';
        $link_text = sprintf(_x('Unfollow', 'Button', 'bp-follow'), apply_filters('bp_follow_leader_name', bp_get_user_firstname($leader_fullname), $r['leader_id']));
        if (empty($r['link_text'])) {
            $r['link_text'] = $link_text;
        }
    } else {
        $id = 'not-following';
        $action = 'start';
        $class = 'follow';
        $link_text = sprintf(_x('Follow', 'Button', 'bp-follow'), apply_filters('bp_follow_leader_name', bp_get_user_firstname($leader_fullname), $r['leader_id']));
        if (empty($r['link_text'])) {
            $r['link_text'] = $link_text;
        }
    }
    $wrapper_class = 'follow-button ' . $id;
    if (!empty($r['wrapper_class'])) {
        $wrapper_class .= ' ' . esc_attr($r['wrapper_class']);
    }
    $link_class = $class;
    if (!empty($r['link_class'])) {
        $link_class .= ' ' . esc_attr($r['link_class']);
    }
    // make sure we can view the button if a user is on their own page
    $block_self = empty($members_template->member) ? true : false;
    // if we're using AJAX and a user is on their own profile, we need to set
    // block_self to false so the button shows up
    if (bp_follow_is_doing_ajax() && bp_is_my_profile()) {
        $block_self = false;
    }
    // setup the button arguments
    $button = array('id' => $id, 'component' => 'follow', 'must_be_logged_in' => true, 'block_self' => $block_self, 'wrapper_class' => $wrapper_class, 'wrapper_id' => 'follow-button-' . (int) $r['leader_id'], 'link_href' => wp_nonce_url($leader_domain . $bp->follow->followers->slug . '/' . $action . '/', $action . '_following'), 'link_text' => esc_attr($r['link_text']), 'link_title' => esc_attr($r['link_title']), 'link_id' => $class . '-' . (int) $r['leader_id'], 'link_class' => $link_class, 'wrapper' => !empty($r['wrapper']) ? esc_attr($r['wrapper']) : false);
    // Filter and return the HTML button
    return bp_get_button(apply_filters('bp_follow_get_add_follow_button', $button, $r['leader_id'], $r['follower_id']));
}
Exemplo n.º 2
0
 /**
  * @group friends_check_friendship_status
  */
 public function test_friends_check_friendship_status_in_members_loop()
 {
     $now = time();
     $u1 = $this->factory->user->create(array('last_activity' => date('Y-m-d H:i:s', $now)));
     $u2 = $this->factory->user->create(array('last_activity' => date('Y-m-d H:i:s', $now - 100)));
     $u3 = $this->factory->user->create(array('last_activity' => date('Y-m-d H:i:s', $now - 200)));
     $u4 = $this->factory->user->create(array('last_activity' => date('Y-m-d H:i:s', $now - 300)));
     $u5 = $this->factory->user->create(array('last_activity' => date('Y-m-d H:i:s', $now - 400)));
     friends_add_friend($u1, $u2, true);
     friends_add_friend($u1, $u3, false);
     friends_add_friend($u4, $u1, false);
     $old_user = get_current_user_id();
     $this->set_current_user($u1);
     $found = array();
     if (bp_has_members()) {
         while (bp_members()) {
             bp_the_member();
             $found[bp_get_member_user_id()] = friends_check_friendship_status($u1, bp_get_member_user_id());
         }
     }
     $expected = array($u1 => 'not_friends', $u2 => 'is_friend', $u3 => 'pending', $u4 => 'awaiting_response', $u5 => 'not_friends');
     $this->assertSame($expected, $found);
     // clean up
     $GLOBALS['members_template'] = null;
     $this->set_current_user($old_user);
 }
if (bp_has_members("include={$_POST['userid']}&max=1")) {
    ?>

    <?php 
    while (bp_members()) {
        bp_the_member();
        global $members_template;
        ?>

        <?php 
        /* The loop for the member you're showing a hovercard for is set up. Place hovercard code here */
        ?>

        <div class="tipsy-avatar">
            <img src="<?php 
        echo bp_core_fetch_avatar(array('item_id' => bp_get_member_user_id(), 'type' => 'full', 'width' => 100, 'height' => 100, 'html' => false));
        ?>
">
        </div>

        <div class='tipsy-content'>

            <div class="user">

                <h3>
                    <?php 
        // iexpert_skype_status( xprofile_get_field_data( 'skype', bp_get_member_user_id() ) );
        ?>

                    <a href="<?php 
        bp_member_link();
/**
 * Output the ID of the current member in the loop.
 *
 * @uses bp_get_member_user_id()
 */
function bp_member_user_id()
{
    echo bp_get_member_user_id();
}
Exemplo n.º 5
0
                bp_member_name();
                ?>
</a>
							<span class="small">
								<a href="<?php 
                bp_group_member_promote_admin_link(array('user_id' => bp_get_member_user_id()));
                ?>
" class="button confirm mod-promote-to-admin" title="<?php 
                _e('Promote to Admin', 'buddypress');
                ?>
"><?php 
                _e('Promote to Admin', 'buddypress');
                ?>
</a>
								<a class="button confirm mod-demote-to-member" href="<?php 
                bp_group_member_demote_link(bp_get_member_user_id());
                ?>
"><?php 
                _e('Demote to Member', 'buddypress');
                ?>
</a>
							</span>		
						</h5>		
					</li>	
					<?php 
            }
            ?>
			
				
				</ul>
			
 /**
  * Builds the button based on class parameters:
  *
  * @since BuddyPress (1.2.6)
  *
  * @param array $args
  * @return bool False if not allowed
  */
 public function __construct($args = '')
 {
     $r = wp_parse_args($args, get_class_vars(__CLASS__));
     // Required button properties
     $this->id = $r['id'];
     $this->component = $r['component'];
     $this->must_be_logged_in = (bool) $r['must_be_logged_in'];
     $this->block_self = (bool) $r['block_self'];
     $this->wrapper = $r['wrapper'];
     // $id and $component are required
     if (empty($r['id']) || empty($r['component'])) {
         return false;
     }
     // No button if component is not active
     if (!bp_is_active($this->component)) {
         return false;
     }
     // No button for guests if must be logged in
     if (true == $this->must_be_logged_in && !is_user_logged_in()) {
         return false;
     }
     // No button if viewing your own profile
     if (true == $this->block_self && bp_is_my_profile()) {
         return false;
     }
     // No button if you are the current user in a loop
     if (true === $this->block_self && is_user_logged_in() && bp_loggedin_user_id() === bp_get_member_user_id()) {
         return false;
     }
     // Wrapper properties
     if (false !== $this->wrapper) {
         // Wrapper ID
         if (!empty($r['wrapper_id'])) {
             $this->wrapper_id = ' id="' . $r['wrapper_id'] . '"';
         }
         // Wrapper class
         if (!empty($r['wrapper_class'])) {
             $this->wrapper_class = ' class="generic-button ' . $r['wrapper_class'] . '"';
         } else {
             $this->wrapper_class = ' class="generic-button"';
         }
         // Set before and after
         $before = '<' . $r['wrapper'] . $this->wrapper_class . $this->wrapper_id . '>';
         $after = '</' . $r['wrapper'] . '>';
         // No wrapper
     } else {
         $before = $after = '';
     }
     // Link properties
     if (!empty($r['link_id'])) {
         $this->link_id = ' id="' . $r['link_id'] . '"';
     }
     if (!empty($r['link_href'])) {
         $this->link_href = ' href="' . $r['link_href'] . '"';
     }
     if (!empty($r['link_title'])) {
         $this->link_title = ' title="' . $r['link_title'] . '"';
     }
     if (!empty($r['link_rel'])) {
         $this->link_rel = ' rel="' . $r['link_rel'] . '"';
     }
     if (!empty($r['link_class'])) {
         $this->link_class = ' class="' . $r['link_class'] . '"';
     }
     if (!empty($r['link_text'])) {
         $this->link_text = $r['link_text'];
     }
     // Build the button
     $this->contents = $before . '<a' . $this->link_href . $this->link_title . $this->link_id . $this->link_rel . $this->link_class . '>' . $this->link_text . '</a>' . $after;
     // Allow button to be manipulated externally
     $this->contents = apply_filters('bp_button_' . $this->component . '_' . $this->id, $this->contents, $this, $before, $after);
 }
 protected function generate_html($template_type = '')
 {
     $group_ids = array();
     foreach ($this->search_results['items'] as $item_id => $item) {
         $group_ids[] = $item_id;
     }
     //now we have all the posts
     //lets do a groups loop
     if (bp_has_members(array('include' => $group_ids, 'per_page' => count($group_ids)))) {
         while (bp_members()) {
             bp_the_member();
             $result_item = array('id' => bp_get_member_user_id(), 'type' => $this->type, 'title' => bp_get_member_name(), 'html' => buddyboss_global_search_buffer_template_part('loop/member', $template_type, false));
             $this->search_results['items'][bp_get_member_user_id()] = $result_item;
         }
     }
 }
Exemplo n.º 8
0
    function bp_members_carousel_2($atts)
    {
        $output = '';
        extract(shortcode_atts(array('type' => '', 'max_item' => 10, 'max_slides' => 7, 'min_slides' => 1, 'item_width' => 320, 'slide_margin' => 20), $atts));
        $params = array('type' => $type, 'per_page' => $max_item);
        if (function_exists('bp_has_members')) {
            // begin bp members loop
            if (bp_has_members($params)) {
                ob_start();
                $output .= '<ul data-slide-margin="' . $slide_margin . '"';
                $output .= 'data-max-slides="' . $max_slides . '" data-min-slides="' . $min_slides . '"';
                $output .= 'data-item-width="' . $item_width . '" class="gears-carousel-standard bp-members-carousel-2">';
                while (bp_members()) {
                    bp_the_member();
                    ?>
					    	<li class="carousel-item gears-members-carousel-2-item">
					    		<div class="gears-members-carousel-2-wrap">
					    			<div class="cover-photo">
					    				<?php 
                    if (function_exists('bcp_get_cover_photo')) {
                        $args = array('size' => 'thumb', 'object_id' => bp_get_member_user_id());
                        $src = bcp_get_cover_photo($args);
                        echo '<img src="' . $src . '" alt="' . __('Cover Photo', 'gears') . '"/>';
                    }
                    ?>
					    			</div>
					    			<div class="member-avatar">
					    				<a href="<?php 
                    bp_member_permalink();
                    ?>
" title="<?php 
                    bp_member_name();
                    ?>
">
					    					<?php 
                    bp_member_avatar(array('type' => 'thumb'));
                    ?>
					    				</a>
					    			</div>
					    			<div class="member-name">
					    				<a href="<?php 
                    bp_member_permalink();
                    ?>
" title="<?php 
                    bp_member_name();
                    ?>
">
					    					<h3><?php 
                    bp_member_name();
                    ?>
</h3>
					    				</a>
					    			</div>
					    			<div class="spacer"></div>
					    		</div>
					    	</li>
					    <?php 
                }
                // end while
                $output .= ob_get_clean();
                $output .= '</ul>';
            }
            return $output;
        } else {
            return $this->bp_not_installed;
        }
    }
Exemplo n.º 9
0
 /**
  * Shows all displayed users on a map.
  */
 function show_all_users_on_map()
 {
     $member_ids = array();
     $limit = apply_filters('agm_google_maps-bp_profile_map-user_limit', AGM_BP_PROFILE_MAP_USER_LIMIT);
     $overrides = apply_filters('agm_google_maps-bp_profile_map-all_users_overrides', array());
     // Get member ids
     if (bp_has_members(array('per_page' => $limit))) {
         while (bp_members()) {
             bp_the_member();
             $member_ids[] = bp_get_member_user_id();
         }
     }
     bp_rewind_members();
     echo $this->show_users_on_map($member_ids, $overrides);
 }
Exemplo n.º 10
0
                        	<span><?php 
                _e("Friend", "boss");
                ?>
</span>
                        <?php 
            }
            ?>
                    <?php 
        }
        ?>

                    <?php 
        if ($showing == "follows") {
            ?>
                    <span class="count"><?php 
            $followers = bp_follow_total_follow_counts(array("user_id" => bp_get_member_user_id()));
            echo $followers["followers"];
            ?>
</span><span><?php 
            _e("Followers", "boss");
            ?>
</span>
                    <?php 
        }
        ?>
				</div>

				<div class="item-desc">
					<p>
						<?php 
        if (bp_get_member_latest_update()) {
Exemplo n.º 11
0
        /**
         * Outputs the list of friends (active or online)
         * 
         * @package BP_Show_Friends_Widget
         * @since    2.0
         * 
         * @uses bp_is_user() to check we're on a user's profile
         * @uses bp_displayed_user_id() to get displayed user id
         * @uses bp_loggedin_user_id() to get loggedin user id
         * @uses Widget->get_settings() to get the instance of the widget
         * @uses the Members loop
         */
        public function list_friends($limit = 0, $size = 0)
        {
            $user_id = bp_is_user() ? bp_displayed_user_id() : bp_loggedin_user_id();
            if (empty($limit) || empty($size)) {
                $widget_settings = $this->get_settings();
                $number = intval($_POST['bpsf_number']);
                $limit = !empty($widget_settings[$number]['per_page']) ? $widget_settings[$number]['per_page'] : 5;
                $size = !empty($widget_settings[$number]['size']) ? $widget_settings[$number]['size'] : 50;
            }
            // plugins or themes can now order the friends differently !
            $args = apply_filters('bp_show_friends_args', array('user_id' => $user_id, 'type' => 'active', 'per_page' => $limit, 'max' => $limit, 'populate_extra' => 0));
            $fallback_message = '<p>' . __('No friends!', 'bp-show-friends') . '</p>';
            if (!empty($_POST['bpsf_type'])) {
                $args['type'] = $_POST['bpsf_type'];
                if ('online' == $args['type']) {
                    $fallback_message = '<p>' . __('No online friends!', 'bp-show-friends') . '</p>';
                }
            }
            $avatar_args = apply_filters('bp_show_friends_avatar_args', array('type' => 'full', 'width' => $size, 'height' => $size, 'class' => 'avatar bp-show-friends'));
            ?>

		<?php 
            if (empty($_POST['bpsf_type'])) {
                ?>
			<div class="friends-container">
		<?php 
            }
            ?>

		    <?php 
            if (bp_has_members($args)) {
                ?>
		    	<ul class="bpsf-members">
			      <?php 
                while (bp_members()) {
                    bp_the_member();
                    ?>

			      	<li class="bpsf-member">
				        <div class="item-avatar">
				          	<a href="<?php 
                    bp_member_permalink();
                    ?>
" title="<?php 
                    bp_member_name();
                    ?>
">
				          		<?php 
                    bp_member_avatar($avatar_args);
                    ?>
				          	</a>
				        </div>
				        <?php 
                    do_action('bp_show_friends_after_friend_avatar', bp_get_member_user_id());
                    ?>
				    </li>

			      <?php 
                }
                ?>
			     </ul>

		    <?php 
            } else {
                echo $fallback_message;
            }
            if (empty($_POST['bpsf_type'])) {
                ?>
			</div>
		    <br style="clear:both"/>
		<?php 
            } else {
                exit;
            }
        }
Exemplo n.º 12
0
 * Version 2.0
 * 9-22-2014
 */
?>

<?php 
// Group members
if (bp_is_group() && bp_group_has_members('exclude_admins_mods=0') || bp_has_members(bp_ajax_querystring('members'))) {
    ?>

<ul id="members-list" class="directory-list" role="main">
	<?php 
    // Loop through all members
    while (bp_members()) {
        bp_the_member();
        $user = new Apoc_User(bp_get_member_user_id(), 'directory', 60);
        ?>
		<li class="member directory-entry">
			<div class="directory-member reply-author">
				<?php 
        echo $user->block;
        ?>
			</div>

			<div class="directory-content">

				<header class="activity-header">	
					<p class="activity"><?php 
        bp_member_last_active();
        ?>
</p>
function buatp_get_filtered_members($return = 'exclude', $type_name = '', $query = '')
{
    if (!$type_name) {
        $type_name = buatp_current_page_type();
    }
    if (!$type_name && $return != 'all') {
        return;
    }
    if (!$query) {
        $query = 'type=alphabetical&per_page=false';
    }
    $users = (array) buatp_get_all_users_by_type($type_name);
    if (bp_has_members($query)) {
        while (bp_members()) {
            bp_the_member();
            $i++;
            if (!in_array(bp_get_member_user_id(), $users)) {
                $excludes[$i] = (int) bp_get_member_user_id();
            } else {
                $includes[$i] = (int) bp_get_member_user_id();
            }
        }
    }
    if ($return == 'exclude') {
        return (array) $excludes;
    } else {
        if ($return == 'include') {
            return (array) $includes;
        } else {
            return array_merge((array) $excludes, (array) $includes);
        }
    }
}
Exemplo n.º 14
0
extract(shortcode_atts(array('type' => 'newest', 'number' => 12, 'class' => '', 'rounded' => "rounded", 'online' => 'show'), $atts));
$params = array('type' => $type, 'per_page' => $number);
if ($rounded == 'rounded') {
    $rounded = 'rounded';
}
if (function_exists('bp_is_active')) {
    if (bp_has_members($params)) {
        ob_start();
        echo '<div class="wpb_wrapper">';
        echo '<div id="members-dir-list" class="members dir-list">';
        echo '<ul id="members-list" class="item-list row kleo-isotope masonry ' . $class . '">';
        while (bp_members()) {
            bp_the_member();
            echo '<li class="kleo-masonry-item">' . '<div class="member-inner-list animated animate-when-almost-visible bottom-to-top">' . '<div class="item-avatar ' . $rounded . '">' . '<a href="' . bp_get_member_permalink() . '">' . bp_get_member_avatar() . kleo_get_img_overlay() . '</a>';
            if ($online == 'show') {
                echo kleo_get_online_status(bp_get_member_user_id());
            }
            echo '</div>' . '<div class="item">
							<div class="item-title">' . '<a href="' . bp_get_member_permalink() . '">' . bp_get_member_name() . '</a>
							</div>
					<div class="item-meta"><span class="activity">' . bp_get_member_last_active() . '</span></div>';
            if (bp_get_member_latest_update()) {
                echo '<span class="update"> ' . bp_get_member_latest_update() . '</span>';
            }
            do_action('bp_directory_members_item');
            echo '</div>';
            echo '<div class="action">';
            do_action('bp_directory_members_actions');
            echo '</div>';
            echo '</div><!--end member-inner-list-->
				</li>';
Exemplo n.º 15
0
    function x_buddypress_members_loop_item_current_member_meta_link()
    {
        if (bp_loggedin_user_id() == bp_get_member_user_id()) {
            ?>

      <a href="<?php 
            bp_member_permalink();
            ?>
"><?php 
            _e('Your Activity', '__x__');
            ?>
</a>

    <?php 
        }
    }
Exemplo n.º 16
0
 /**
  * @group block_self
  */
 public function test_block_self_inside_members_loop_on_my_profile_page()
 {
     $now = time();
     $u1 = $this->factory->user->create(array('last_activity' => date('Y-m-d H:i:s', $now)));
     $u2 = $this->factory->user->create(array('last_activity' => date('Y-m-d H:i:s', $now - 100)));
     $this->set_current_user($u1);
     $this->go_to(bp_core_get_user_domain($u1));
     $found = array();
     if (bp_has_members()) {
         while (bp_members()) {
             bp_the_member();
             $b = new BP_Button(array('id' => 'foo', 'component' => 'members', 'block_self' => true));
             $found[bp_get_member_user_id()] = empty($b->contents);
         }
     }
     $expected = array($u1 => true, $u2 => false);
     $this->assertSame($expected, $found);
     // clean up
     $GLOBALS['members_template'] = null;
 }
/**
 * Get a list of friends that a user can invite into this group.
 *
 * Excludes friends that are already in the group, and banned friends if the
 * user is not a group admin.
 *
 * @since 1.0.0
 *
 * @param int $user_id  User ID whose friends to see can be invited. Default:
 *                      ID of the logged-in user.
 * @param int $group_id Group to check possible invitations against.
 * @return mixed False if no friends, array of users if friends.
 */
function friends_get_friends_invite_list($user_id = 0, $group_id = 0)
{
    // Default to logged in user id.
    if (empty($user_id)) {
        $user_id = bp_loggedin_user_id();
    }
    // Only group admins can invited previously banned users.
    $user_is_admin = (bool) groups_is_user_admin($user_id, $group_id);
    // Assume no friends.
    $friends = array();
    /**
     * Filters default arguments for list of friends a user can invite into this group.
     *
     * @since 1.5.4
     *
     * @param array $value Array of default parameters for invite list.
     */
    $args = apply_filters('bp_friends_pre_get_invite_list', array('user_id' => $user_id, 'type' => 'alphabetical', 'per_page' => 0));
    // User has friends.
    if (bp_has_members($args)) {
        /**
         * Loop through all friends and try to add them to the invitation list.
         *
         * Exclude friends that:
         *     1. are already members of the group
         *     2. are banned from this group if the current user is also not a
         *        group admin.
         */
        while (bp_members()) {
            // Load the member.
            bp_the_member();
            // Get the user ID of the friend.
            $friend_user_id = bp_get_member_user_id();
            // Skip friend if already in the group.
            if (groups_is_user_member($friend_user_id, $group_id)) {
                continue;
            }
            // Skip friend if not group admin and user banned from group.
            if (false === $user_is_admin && groups_is_user_banned($friend_user_id, $group_id)) {
                continue;
            }
            // Friend is safe, so add it to the array of possible friends.
            $friends[] = array('id' => $friend_user_id, 'full_name' => bp_get_member_name());
        }
    }
    // If no friends, explicitly set to false.
    if (empty($friends)) {
        $friends = false;
    }
    /**
     * Filters the list of potential friends that can be invited to this group.
     *
     * @since 1.5.4
     *
     * @param array|bool $friends  Array friends available to invite or false for no friends.
     * @param int        $user_id  ID of the user checked for who they can invite.
     * @param int        $group_id ID of the group being checked on.
     */
    return apply_filters('bp_friends_get_invite_list', $friends, $user_id, $group_id);
}
Exemplo n.º 18
0
function friends_get_friends_invite_list($user_id = 0)
{
    global $bp;
    if (!$user_id) {
        $user_id = bp_loggedin_user_id();
    }
    if (bp_has_members('user_id=' . $user_id . '&type=alphabetical&per_page=0')) {
        while (bp_members()) {
            bp_the_member();
            $friends[] = array('id' => bp_get_member_user_id(), 'full_name' => bp_get_member_name());
        }
    }
    if (empty($friends)) {
        return false;
    }
    return $friends;
}
Exemplo n.º 19
0
 /**
  * Builds the button based on class parameters.
  *
  * @since BuddyPress (1.2.6)
  *
  * @param array $args See {@BP_Button}.
  * @return bool|null Returns false when the button is not allowed for
  *         the current context.
  */
 public function __construct($args = '')
 {
     $r = wp_parse_args($args, get_class_vars(__CLASS__));
     // Required button properties
     $this->id = $r['id'];
     $this->component = $r['component'];
     $this->must_be_logged_in = (bool) $r['must_be_logged_in'];
     $this->block_self = (bool) $r['block_self'];
     $this->wrapper = $r['wrapper'];
     // $id and $component are required
     if (empty($r['id']) || empty($r['component'])) {
         return false;
     }
     // No button if component is not active
     if (!bp_is_active($this->component)) {
         return false;
     }
     // No button for guests if must be logged in
     if (true == $this->must_be_logged_in && !is_user_logged_in()) {
         return false;
     }
     // block_self
     if (true == $this->block_self) {
         // No button if you are the current user in a members loop
         // This condition takes precedence, because members loops
         // can be found on user profiles
         if (bp_get_member_user_id()) {
             if (is_user_logged_in() && bp_loggedin_user_id() == bp_get_member_user_id()) {
                 return false;
             }
             // No button if viewing your own profile (and not in
             // a members loop)
         } elseif (bp_is_my_profile()) {
             return false;
         }
     }
     // Wrapper properties
     if (false !== $this->wrapper) {
         // Wrapper ID
         if (!empty($r['wrapper_id'])) {
             $this->wrapper_id = ' id="' . $r['wrapper_id'] . '"';
         }
         // Wrapper class
         if (!empty($r['wrapper_class'])) {
             $this->wrapper_class = ' class="generic-button ' . $r['wrapper_class'] . '"';
         } else {
             $this->wrapper_class = ' class="generic-button"';
         }
         // Set before and after
         $before = '<' . $r['wrapper'] . $this->wrapper_class . $this->wrapper_id . '>';
         $after = '</' . $r['wrapper'] . '>';
         // No wrapper
     } else {
         $before = $after = '';
     }
     // Link properties
     if (!empty($r['link_id'])) {
         $this->link_id = ' id="' . $r['link_id'] . '"';
     }
     if (!empty($r['link_href'])) {
         $this->link_href = ' href="' . $r['link_href'] . '"';
     }
     if (!empty($r['link_title'])) {
         $this->link_title = ' title="' . $r['link_title'] . '"';
     }
     if (!empty($r['link_rel'])) {
         $this->link_rel = ' rel="' . $r['link_rel'] . '"';
     }
     if (!empty($r['link_class'])) {
         $this->link_class = ' class="' . $r['link_class'] . '"';
     }
     if (!empty($r['link_text'])) {
         $this->link_text = $r['link_text'];
     }
     // Build the button
     $this->contents = $before . '<a' . $this->link_href . $this->link_title . $this->link_id . $this->link_rel . $this->link_class . '>' . $this->link_text . '</a>' . $after;
     /**
      * Filters the button based on class parameters.
      *
      * This filter is a dynamic filter based on component and component ID and
      * allows button to be manipulated externally.
      *
      * @since BuddyPress (1.2.6)
      *
      * @param string    $contents HTML being used for the button.
      * @param BP_Button $this     Current BP_Button instance.
      * @param string    $before   HTML appended before the actual button.
      * @param string    $after    HTML appended after the actual button.
      */
     $this->contents = apply_filters('bp_button_' . $this->component . '_' . $this->id, $this->contents, $this, $before, $after);
 }
Exemplo n.º 20
0
function x_pastor_dispay_name_bp($bp_name)
{
    return x_pastor_dispay_name_callback($bp_name, bp_get_member_user_id());
}
Exemplo n.º 21
0
Arquivo: members.php Projeto: 6226/wp
        bp_group_the_member();
        ?>

		<li class="kleo-masonry-item">
			<div class="member-inner-list animated animate-when-almost-visible bottom-to-top">
				<div class="item-avatar rounded">
					<a href="<?php 
        bp_group_member_domain();
        ?>
">
						<?php 
        bp_group_member_avatar_thumb();
        ?>
					</a>
					<?php 
        do_action('bp_member_online_status', bp_get_member_user_id());
        ?>
				</div>
				<div class="member-list-content">
					<h5><?php 
        bp_group_member_link();
        ?>
</h5>
					<span class="activity"><?php 
        bp_group_member_joined_since();
        ?>
</span>
        </div>

				<?php 
        do_action('bp_group_members_list_item');
Exemplo n.º 22
0
<?php 
if (bp_has_members(bp_ajax_querystring('members') . '&type=alphabetical&per_page=999')) {
    ?>

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

	<ul id="members-list" class="item-list" role="main">

	<?php 
    while (bp_members()) {
        bp_the_member();
        $groups = '';
        $user_id = bp_get_member_user_id();
        $group_ids = $wpdb->get_results("SELECT group_id FROM wp_bp_groups_members WHERE user_id={$user_id}");
        foreach ($group_ids as $group) {
            $group_id = intval($group->group_id);
            $group_name = $wpdb->get_var("SELECT name FROM wp_bp_groups WHERE id={$group_id}");
            $group_slug = $wpdb->get_var("SELECT slug FROM wp_bp_groups WHERE id={$group_id}");
            $avatar = bp_core_fetch_avatar(array('item_id' => $group_id, 'object' => 'group', 'width' => 50, 'height' => 50));
            $groups = $groups . ' ' . $group_slug;
        }
        ?>
		<li class="member <?php 
        echo $groups;
        ?>
">
			<div class="item-avatar">
			<?php 
Exemplo n.º 23
0
/**
 * Get a list of friends that a user can invite into this group.
 *
 * Excludes friends that are already in the group, and banned friends if the
 * user is not a group admin.
 *
 * @since BuddyPress (1.0.0)
 *
 * @param int $user_id User ID whose friends to see can be invited. Default:
 *        ID of the logged-in user.
 * @param int $group_id Group to check possible invitations against.
 * @return mixed False if no friends, array of users if friends.
 */
function friends_get_friends_invite_list($user_id = 0, $group_id = 0)
{
    // Default to logged in user id
    if (empty($user_id)) {
        $user_id = bp_loggedin_user_id();
    }
    // Only group admins can invited previously banned users
    $user_is_admin = (bool) groups_is_user_admin($user_id, $group_id);
    // Assume no friends
    $friends = array();
    // Default args
    $args = apply_filters('bp_friends_pre_get_invite_list', array('user_id' => $user_id, 'type' => 'alphabetical', 'per_page' => 0));
    // User has friends
    if (bp_has_members($args)) {
        /**
         * Loop through all friends and try to add them to the invitation list.
         *
         * Exclude friends that:
         *     1. are already members of the group
         *     2. are banned from this group if the current user is also not a
         *        group admin.
         */
        while (bp_members()) {
            // Load the member
            bp_the_member();
            // Get the user ID of the friend
            $friend_user_id = bp_get_member_user_id();
            // Skip friend if already in the group
            if (groups_is_user_member($friend_user_id, $group_id)) {
                continue;
            }
            // Skip friend if not group admin and user banned from group
            if (false === $user_is_admin && groups_is_user_banned($friend_user_id, $group_id)) {
                continue;
            }
            // Friend is safe, so add it to the array of possible friends
            $friends[] = array('id' => $friend_user_id, 'full_name' => bp_get_member_name());
        }
    }
    // If no friends, explicitly set to false
    if (empty($friends)) {
        $friends = false;
    }
    // Allow friends to be filtered
    return apply_filters('bp_friends_get_invite_list', $friends, $user_id, $group_id);
}
Exemplo n.º 24
0
        $output .= '<div class="clearfix">';
        $output .= '<ul data-max-slides="' . $max_slides . '" data-min-slides="' . $min_slides . '" 
		data-item-width="' . $item_width . '" class="gears-carousel-standard bp-members-carousel">';
        while (bp_members()) {
            bp_the_member();
            $output .= '<li class="carousel-item">';
            $name = bp_get_member_name();
            $permalink = bp_get_member_permalink();
            $last_active = bp_get_member_last_active();
            $output .= '<a class="members-name" href="' . esc_url($permalink) . '" title="' . esc_attr($name) . '">';
            $output .= esc_attr($name);
            $output .= '</a>';
            $output .= '<a href="' . esc_url($permalink) . '" title="' . esc_attr($name) . '">';
            $output .= bp_get_member_avatar(array('type' => 'full'));
            $output .= '</a>';
            if (class_exists('BP_Follow')) {
                if (method_exists('BP_Follow', 'get_counts')) {
                    $follow_count = BP_Follow::get_counts(bp_get_member_user_id());
                    $follow_label = $follow_count['followers'] == 1 ? 'Follower' : 'Followers';
                    $output .= '<p><strong>' . $follow_count['followers'] . ' ' . $follow_label . '</strong></p>';
                }
            }
            $output .= '</li>';
        }
        $output .= '</ul>';
        $output .= '</div>';
        echo $output;
    }
} else {
    echo $this->bp_not_installed;
}
Exemplo n.º 25
0
        ?>
</a></div>
						<div class="item">
							<div class="item-title"><a href="<?php 
        bp_member_permalink();
        ?>
"><?php 
        bp_member_name();
        ?>
</a></div>
							<div class="item-meta"><?php 
        bp_member_last_active();
        ?>
</div>
							<div class="item-body"><?php 
        echo get_the_author_meta('description', bp_get_member_user_id());
        ?>
</div>
						</div>
						<a href="<?php 
        bp_member_permalink();
        ?>
" class="dt-sc-button small"><?php 
        _e(' View Profile', 'dt_themes');
        ?>
</a>
					</div>	
				</div>
		<?php 
    }
    ?>
Exemplo n.º 26
0
function kleo_bp_dir_send_private_message_button()
{
    if (bp_get_member_user_id() != bp_loggedin_user_id()) {
        add_filter('bp_get_send_private_message_link', 'filter_message_button_link', 1, 1);
        bp_send_message_button();
    }
}
Exemplo n.º 27
0
/**
 * Output the "Add Friend" button in the member loop.
 *
 * @since 1.2.6
 */
function bp_member_add_friend_button()
{
    bp_add_friend_button(bp_get_member_user_id());
}
 /**
  * Builds the button based on class parameters.
  *
  * @since 1.2.6
  *
  * @param array|string $args See {@BP_Button}.
  */
 public function __construct($args = '')
 {
     $r = wp_parse_args($args, get_class_vars(__CLASS__));
     // Backward compatibility with deprecated parameters.
     $r = $this->backward_compatibility_args($r);
     // Deprecated. Subject to removal in a future release.
     $this->wrapper = $r['wrapper'];
     if (!empty($r['link_id'])) {
         $this->link_id = ' id="' . $r['link_id'] . '"';
     }
     if (!empty($r['link_href'])) {
         $this->link_href = ' href="' . $r['link_href'] . '"';
     }
     if (!empty($r['link_title'])) {
         $this->link_title = ' title="' . $r['link_title'] . '"';
     }
     if (!empty($r['link_rel'])) {
         $this->link_rel = ' rel="' . $r['link_rel'] . '"';
     }
     if (!empty($r['link_class'])) {
         $this->link_class = ' class="' . $r['link_class'] . '"';
     }
     if (!empty($r['link_text'])) {
         $this->link_text = $r['link_text'];
     }
     // Required button properties.
     $this->id = $r['id'];
     $this->component = $r['component'];
     $this->must_be_logged_in = (bool) $r['must_be_logged_in'];
     $this->block_self = (bool) $r['block_self'];
     // $id and $component are required and component must be active.
     if (empty($r['id']) || empty($r['component']) || !bp_is_active($this->component)) {
         return false;
     }
     // No button for guests if must be logged in.
     if (true == $this->must_be_logged_in && !is_user_logged_in()) {
         return false;
     }
     // The block_self property.
     if (true == $this->block_self) {
         /*
          * No button if you are the current user in a members loop.
          *
          * This condition takes precedence, because members loops can be found on user
          * profiles.
          */
         if (bp_get_member_user_id()) {
             if (is_user_logged_in() && bp_loggedin_user_id() == bp_get_member_user_id()) {
                 return false;
             }
             // No button if viewing your own profile (and not in a members loop).
         } elseif (bp_is_my_profile()) {
             return false;
         }
     }
     // Should we use a parent element?
     if (!empty($r['parent_element'])) {
         if (!isset($r['parent_attr']['class'])) {
             $r['parent_attr']['class'] = '';
         }
         // Always add 'generic-button' class.
         if (false === strpos($r['parent_attr']['class'], 'generic-button')) {
             if (!empty($r['parent_attr']['class'])) {
                 $r['parent_attr']['class'] .= ' ';
             }
             $r['parent_attr']['class'] .= 'generic-button';
         }
         // Render parent element attributes.
         $parent_elem = new BP_Core_HTML_Element(array('element' => $r['parent_element'], 'attr' => $r['parent_attr']));
         // Set before and after.
         $before = $parent_elem->get('open_tag');
         $after = $parent_elem->get('close_tag');
         // No parent element.
     } else {
         $before = $after = '';
     }
     // Button properties.
     $button = '';
     if (!empty($r['button_element'])) {
         $button = new BP_Core_HTML_Element(array('element' => $r['button_element'], 'attr' => $r['button_attr'], 'inner_html' => !empty($r['link_text']) ? $r['link_text'] : ''));
         $button = $button->contents();
     }
     // Build the button.
     $this->contents = $before . $button . $after;
     /**
      * Filters the button based on class parameters.
      *
      * This filter is a dynamic filter based on component and component ID and
      * allows button to be manipulated externally.
      *
      * @since 1.2.6
      * @since 2.7.0 Added $r as a parameter.
      *
      * @param string    $contents HTML being used for the button.
      * @param BP_Button $this     Current BP_Button instance.
      * @param string    $before   HTML appended before the actual button.
      * @param string    $after    HTML appended after the actual button.
      * @param array     $r        Parsed button arguments.
      */
     $this->contents = apply_filters('bp_button_' . $this->component . '_' . $this->id, $this->contents, $this, $before, $after, $r);
 }
function buatp_set_default_avatar_size($avatar = '', $custom = '')
{
    return apply_filters('buatp_set_default_avatar_size', bp_get_member_avatar('type=full&id=' . (int) bp_get_member_user_id() . $custom));
}
 public function send_gifts_content()
 {
     global $bp;
     if (isset($_POST["submitgift"]) && !empty($_POST['post_id'])) {
         $post_id = $_POST['post_id'];
         $sender = $_POST['sender'];
         $reciever = $_POST['reciever'];
         $sender_msg = trim($_POST['sender_msg']);
         update_post_meta($post_id, 'sender_id', $sender);
         update_post_meta($post_id, 'reciever_id', $reciever);
         update_post_meta($post_id, 'sender_msg', $sender_msg);
     }
     $this->show_gift();
     echo '<div class="gift-form">';
     echo '<form name="SendGiftForm" id="SendGiftForm" method="POST" action="' . esc_url($_SERVER['REQUEST_URI']) . '" >';
     echo '<input type="hidden" name="sender" value="' . $bp->loggedin_user->id . '">';
     echo '<input type="text" name="sender_msg" id="sender_msg" placeholder="Your Message Here.." />';
     echo "<label>Select Recipient : </label>";
     /******* all User List ************/
     if (bp_has_members()) {
         echo '<select name="reciever" required>';
         echo "<option value=''>Select</option> ";
         while (bp_members()) {
             bp_the_member();
             if (bp_get_member_user_id() != bp_loggedin_user_id()) {
                 echo "<option value='" . bp_get_member_user_id() . "'> ";
                 echo bp_member_name();
                 echo '</option>';
             }
         }
         echo '</select>';
     }
     echo '<input type="hidden" name="post_id" id="post_id" value="123">';
     echo '<input type="submit" name="submitgift" value="Send" class="form_submit">';
     echo '</form>';
     echo '<div>';
 }