/** @see WP_Widget::widget -- do not rename this */ function widget($args, $instance) { extract($args); //Our variables from the widget settings. $title = apply_filters('widget_title', $instance['title']); $num = $instance['number']; $activity = $instance['activity']; $messages = $instance['messages']; $friends = $instance['friends']; if (!is_numeric($num)) { $num = 5; } $user_id = bp_loggedin_user_id(); $width = $instance['width']; echo '<div class="' . $width . '"><div class="dash-widget">' . $before_widget; echo '<div id="vibe-tabs-student-activity" class="tabs tabbable"> <ul class="nav nav-tabs clearfix">'; if (isset($messages) && $messages && function_exists('messages_get_unread_count')) { echo '<li><a href="#tab-messages" data-toggle="tab"><i class="icon-bubble-talk-1"></i>' . messages_get_unread_count($user_id) . '</a></li>'; } if (isset($friends) && $friends) { $searchArgs = array('type' => 'online', 'page' => 1, 'per_page' => $num, 'user_id' => $user_id); if (bp_has_members($searchArgs)) { while (bp_members()) { bp_the_member(); $user_friends[] = array('avatar' => bp_get_member_avatar(), 'name' => bp_get_member_name(), 'last_active' => bp_get_member_last_active()); } } if (!is_array($user_friends)) { $user_friends = array(); } echo '<li><a href="#tab-friends" data-toggle="tab"><i class="icon-myspace-alt"></i>' . count($user_friends) . '</a></li>'; } if (isset($activity) && $activity) { echo '<li><a href="#tab-activity" data-toggle="tab"><i class="icon-atom"></i> </a></li>'; } echo '</ul><div class="tab-content">'; // Display the widget title global $wpdb, $bp; if (isset($messages) && $messages) { echo '<div id="tab-messages" class="tab-pane"> <h4>' . __('Unread Messages', 'wplms-dashboard') . '</h4>'; $message_args = array('user_id' => $user_id, 'box' => 'inbox', 'type' => 'unread', 'max' => $num); if (bp_has_message_threads($message_args)) { echo '<ul class="dash-unread-messages">'; while (bp_message_threads()) { bp_message_thread(); echo '<li>' . bp_get_message_thread_avatar() . '<a href="' . bp_get_message_thread_view_link() . '">' . bp_get_message_thread_subject() . '<span>' . bp_get_message_thread_from() . '</span></a></li>'; } echo '</ul>'; } else { echo '<div class="message error">' . __('No messages found', 'wplms-dashboard') . '</div>'; } echo '</div>'; } if (isset($friends) && $friends) { echo '<div id="tab-friends" class="tab-pane"> <h4>' . __('Friends Online', 'wplms-dashboard') . '</h4>'; if (count($user_friends)) { echo '<ul class="dash-user-friends">'; foreach ($user_friends as $user_friend) { echo '<li>' . $user_friend['avatar'] . ' ' . $user_friend['name'] . '<span>' . $user_friend['last_active'] . '</span></li>'; } echo '</ul>'; } else { echo '<div class="message error">' . __('No friends online', 'wplms-dashboard') . '</div>'; } echo '</div>'; } if (isset($activity) && $activity) { $activities = apply_filters('wplms_dashboard_activity', $wpdb->get_results($wpdb->prepare("\n\t\t\tSELECT *\n\t\t FROM {$bp->activity->table_name} AS activity\n\t\t WHERE \tactivity.user_id IN (%d)\n\t\t AND (activity.action != '' OR activity.action IS NOT NULL)\n\t\t ORDER BY activity.date_recorded DESC\n\t\t LIMIT 0,{$num}\n\t\t", $user_id))); echo '<div id="tab-activity" class="tab-pane student_activity"> <h4>' . __('Recent Activity', 'wplms-dashboard') . '</h4>'; if (isset($activities) && is_array($activities)) { echo '<ul class="dash-activities">'; foreach ($activities as $activity) { if (isset($activity->action) && $activity->action != '') { $time = tofriendlytime(time() - strtotime($activity->date_recorded)); echo '<li class="' . $activity->component . ' ' . $activity->type . '"> <div class="dash-activity"> <span class="dash-activity-time">' . $time . ' ' . __('AGO', 'wplms-dashboard') . '</span> <strong>' . $activity->action . '</strong> </div> </li>'; } } echo '</ul>'; } else { echo '<div class="message error">' . __('No activity found', 'wplms-dashboard') . '</div>'; } echo '</div>'; } echo '</div></div>' . $after_widget . '</div></div>'; }
/** * Displays the widget. */ function widget($args, $instance) { // do not do anything if user isn't logged in if (!is_user_logged_in()) { return; } if (empty($instance['max_users'])) { $instance['max_users'] = 16; } // logged-in user isn't following anyone, so stop! if (!($following = bp_get_following_ids(array('user_id' => bp_loggedin_user_id())))) { return false; } // show the users the logged-in user is following if (bp_has_members(array('include' => $following, 'max' => $instance['max_users'], 'populate_extras' => false))) { do_action('bp_before_following_widget'); echo $args['before_widget']; echo $args['before_title'] . $instance['title'] . $args['after_title']; ?> <div class="avatar-block"> <?php while (bp_members()) { bp_the_member(); ?> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_avatar(); ?> </a> </div> <?php } ?> </div> <?php echo $args['after_widget']; ?> <?php do_action('bp_after_following_widget'); ?> <?php } }
function bpChat_displayGroupChatAdmin() { global $bp; global $members_template; ?> <script> jQuery(document).ready(function() { jQuery('div#item-nav').before("<div id='bp-group-chat-online'><p id='bp-group-chat-online-text'><?php _e("Admin is offline", "bp-chat"); ?> </p></div>"); <?php if (function_exists('bp_has_members')) { if (bp_has_members('user_id=0&type=online&per_page=' . $instance['max_members'] . '&max=' . $instance['max_members'] . '&populate_extras=0')) { while (bp_members()) { bp_the_member(); if ($members_template->member->id == $bp->groups->current_group->admins[0]->user_id && ($bp->groups->current_group->admins[0]->is_admin == 1 || $bp->groups->current_group->admins[0]->is_mod == 1)) { ?> jQuery('div#bp-group-chat-online').html("<p id='bp-group-chat-online-text'><?php _e("Admin is online", "bp-chat"); ?> </p>"); if ( (int)get_site_option( 'bp-chat-setting-disable-shoutbox-chat' ) == 0 ) { jQuery('#shoutboxwrapper').show('slow'); } <?php } } } else { ?> jQuery('div#bp-group-chat-online').html("<p id='bp-group-chat-online-text'><?php _e("There are no admin users currently online", "bp-chat"); ?> </p>"); <?php } } ?> jQuery('div#bp-group-chat-online').append("<?php echo "<br />"; ?> "); }); </script> <?php }
/** * @ticket BP6996 */ public function test_should_contain_member_type_classes() { buddypress()->members->types = array(); bp_register_member_type('foo'); bp_register_member_type('bar'); $u = $this->factory->user->create(); bp_set_member_type($u, 'bar'); if (bp_has_members(array('include' => array($u)))) { while (bp_members()) { bp_the_member(); $found = bp_get_member_class(); } } global $members_template; unset($members_template); buddypress()->members->types = array(); $this->assertContains('member-type-bar', $found); $this->assertNotContains('member-type-foo', $found); }
/** * Display the Recently Active 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) { extract($args); $title = apply_filters('widget_title', $instance['title']); echo $before_widget; echo $before_title . $title . $after_title; $members_args = array('user_id' => 0, 'type' => 'active', 'per_page' => $instance['max_members'], 'max' => $instance['max_members'], 'populate_extras' => true, 'search_terms' => false); ?> <?php if (bp_has_members($members_args)) { ?> <div class="avatar-block"> <?php while (bp_members()) { bp_the_member(); ?> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_avatar(); ?> </a> </div> <?php } ?> </div> <?php } else { ?> <div class="widget-error"> <?php _e('There are no recently active members', 'buddypress'); ?> </div> <?php } ?> <?php echo $after_widget; ?> <?php }
/** * @group bp_get_member_profile_data */ public function test_bp_get_member_profile_data_inside_loop() { $u = $this->factory->user->create(); $g = $this->factory->xprofile_group->create(); $f = $this->factory->xprofile_field->create(array('field_group_id' => $g, 'name' => 'Neato')); xprofile_set_field_data($f, $u, 'foo'); if (bp_has_members()) { while (bp_members()) { bp_the_member(); $found = bp_get_member_profile_data(array('user_id' => $u, 'field' => 'Neato')); } } // Cleanup unset($GLOBALS['members_template']); $this->assertSame('foo', $found); }
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; } } }
/** * 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; } }
/** * 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); }
/** * Process AJAX pagination or filtering for the Friends widget. * * @since 1.9.0 */ function bp_core_ajax_widget_friends() { check_ajax_referer('bp_core_widget_friends'); switch ($_POST['filter']) { case 'newest-friends': $type = 'newest'; break; case 'recently-active-friends': $type = 'active'; break; case 'popular-friends': $type = 'popular'; break; } $members_args = array('user_id' => bp_displayed_user_id(), 'type' => $type, 'max' => absint($_POST['max-friends']), 'populate_extras' => 1); if (bp_has_members($members_args)) { ?> <?php echo '0[[SPLIT]]'; // Return valid result. TODO: remove this. ?> <?php while (bp_members()) { bp_the_member(); ?> <li class="vcard"> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?> "><?php bp_member_avatar(); ?> </a> </div> <div class="item"> <div class="item-title fn"><a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_name(); ?> </a></div> <?php if ('active' == $type) { ?> <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?> </span></div> <?php } elseif ('newest' == $type) { ?> <div class="item-meta"><span class="activity"><?php bp_member_registered(); ?> </span></div> <?php } elseif (bp_is_active('friends')) { ?> <div class="item-meta"><span class="activity"><?php bp_member_total_friend_count(); ?> </span></div> <?php } ?> </div> </li> <?php } ?> <?php } else { ?> <?php echo "-1[[SPLIT]]<li>"; ?> <?php _e('There were no members found, please try another filter.', 'buddypress'); ?> <?php echo "</li>"; ?> <?php } }
/** * @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); }
/** * Display results */ public function results() { //Show/hide members with no location in the results. Default set to false $this->show_non_located_users = apply_filters('show_users_without_location', false, $this->form); //prevent BuddyPress from using its own "paged" value for the current page if (!empty($_REQUEST['upage'])) { unset($_REQUEST['upage']); } /* $xp_ids = array(); //query the xprofile fields. This is done in a saperate function if ( apply_filters( 'gmw_fl_do_xprofile_query', true ) ) { $xprofile_users = gmw_fl_query_xprofile_fields( $this->form ,$_GET ); //if fields entered but no users returned abort the query if ( $xprofile_users['status'] == 'no_ids_found' ) { $xp_ids = 0; //if users returned. add them to query } elseif ( $xprofile_users['status'] == 'ids_found' ) { $xp_ids = $xprofile_users['ids']; } } */ //query args $this->form['query_args'] = apply_filters('gmw_fl_search_query_args', array('type' => 'distance', 'per_page' => $this->form['get_per_page'], 'page' => $this->form['paged']), $this->form); //modify the form values before query $this->form = apply_filters('gmw_fl_form_before_members_query', $this->form, $this->settings); $this->form = apply_filters("gmw_fl_form_before_members_query_{$this->form['ID']}", $this->form, $this->settings); //modify BP users query add_action('bp_pre_user_query', array($this, 'gmwBpQuery')); //modify WP User query add_action('pre_user_query', array($this, 'gmwWpQuery')); //enqueue stylesheet and get results template file $results_template = $this->search_results(); if (bp_has_members($this->form['query_args'])) { global $members_template; $members_template = apply_filters('gmw_fl_members_before_members_loop', $members_template, $this->form, $this->settings); //setup member count $this->form['member_count'] = $this->form['paged'] == 1 ? 1 : $this->form['get_per_page'] * ($this->form['paged'] - 1) + 1; $this->form['results'] = $members_template->members; $this->form['total_results'] = $members_template->total_member_count; $this->form['max_pages'] = $this->form['total_results'] / $this->form['get_per_page']; echo '<div id="buddypress">'; //load results template file to display list of members if (isset($this->form['search_results']['display_members']) && !$this->form['in_widget']) { add_action('gmw_search_results_loop_item_start', array($this, 'modify_member'), 10); $gmw = $this->form; include $results_template; /* * if we do not display list of members we still need to have a loop * and add some information to each members in order to be able to * display it on the map */ } elseif ($this->form['search_results']['display_map'] != 'na') { while (bp_members()) { bp_the_member(); self::modify_member(); } } echo '</div>'; } remove_action('bp_pre_user_query', array($this, 'gmwBpQuery')); remove_action('pre_user_query', array($this, 'gmwWpQuery')); }
/** * 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); }
/** * Display the Members 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) { extract($args); if (!$instance['member_default']) { $instance['member_default'] = 'active'; } $title = apply_filters('widget_title', $instance['title']); echo $before_widget; $title = $instance['link_title'] ? '<a href="' . esc_url(trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug())) . '">' . $title . '</a>' : $title; echo $before_title . $title . $after_title; $members_args = array('user_id' => 0, 'type' => $instance['member_default'], 'per_page' => $instance['max_members'], 'max' => $instance['max_members'], 'populate_extras' => true, 'search_terms' => false); ?> <?php if (bp_has_members($members_args)) { ?> <div class="item-options" id="members-list-options"> <a href="<?php bp_members_directory_permalink(); ?> " id="newest-members" <?php if ($instance['member_default'] == 'newest') { ?> class="selected"<?php } ?> ><?php _e('Newest', 'socialchef'); ?> </a> <a href="<?php bp_members_directory_permalink(); ?> " id="recently-active-members" <?php if ($instance['member_default'] == 'active') { ?> class="selected"<?php } ?> ><?php _e('Active', 'socialchef'); ?> </a> <?php if (bp_is_active('friends')) { ?> <a href="<?php bp_members_directory_permalink(); ?> " id="popular-members" <?php if ($instance['member_default'] == 'popular') { ?> class="selected"<?php } ?> ><?php _e('Popular', 'socialchef'); ?> </a> <?php } ?> </div> <ul id="members-list" class="item-list"> <?php while (bp_members()) { bp_the_member(); ?> <li class="vcard"> <div class="item-avatar"> <a role="member" href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_avatar(); ?> </a> </div> </li> <?php } ?> </ul> <?php wp_nonce_field('bp_core_widget_members', '_wpnonce-members'); ?> <input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo esc_attr($instance['max_members']); ?> " /> <?php } else { ?> <div class="widget-error"> <?php _e('No one has signed up yet!', 'socialchef'); ?> </div> <?php } ?> <?php echo $after_widget; ?> <?php }
/** * Save or update a new event * @version 2.0 */ function save_event($post_id, $post = '') { // Don't do anything if it's not an event if ('event' != $post->post_type) { return; } // Verify the nonce before proceeding. if (!isset($_POST['event-details-box']) || !wp_verify_nonce($_POST['event-details-box'], basename(__FILE__))) { return $post_id; } /* ----------------------------------- SAVE EVENT TIME ------------------------------------*/ // Retrieve the event time $event_time = date('Y-m-d H:i:s', strtotime($_POST['event-time'])); $prior_time = $post->post_date; // Update the post object $post->post_date = $event_time; remove_action('save_post', array($this, 'save_event')); wp_update_post($post); add_action('save_post', array($this, 'save_event'), 10, 2); /* ----------------------------------- SAVE META INFORMATION ------------------------------------ */ // Define the meta to look for $meta = array('event_duration' => $_POST['event-duration'], 'event_capacity' => $_POST['event-capacity'], 'event_rsvp' => $_POST['event-rsvp'], 'event_role' => $_POST['event-role']); // Loop through each meta, saving it to the database foreach ($meta as $meta_key => $new_meta_value) { // Get the meta value of the custom field key. $meta_value = get_post_meta($post_id, $meta_key, true); // If there is no new meta value but an old value exists, delete it. if (current_user_can('delete_post_meta', $post_id, $meta_key) && '' == $new_meta_value && $meta_value) { delete_post_meta($post_id, $meta_key, $meta_value); } elseif (current_user_can('add_post_meta', $post_id, $meta_key) && $new_meta_value && '' == $meta_value) { add_post_meta($post_id, $meta_key, $new_meta_value, true); } elseif (current_user_can('edit_post_meta', $post_id, $meta_key) && $new_meta_value && $new_meta_value != $meta_value) { update_post_meta($post_id, $meta_key, $new_meta_value); } } // Delete the RSVP meta if the date has changed if ($event_time != $prior_time) { delete_post_meta($post_id, 'event_rsvps'); } /* ----------------------------------- BUDDYPRESS NOTIFICATION ------------------------------------ */ // Get event data global $bp, $wpdb; if (!$user_id) { $user_id = $post->post_author; } // Figure out which calendars this event belongs to $calendars = wp_get_post_terms($post_id, 'calendar'); $group_slugs = array(); // For each calendar, check if it's a group calendar foreach ($calendars as $calendar) { if (is_group_calendar($calendar->term_id)) { $groups[] = $calendar; } } // If this event does not belong to a group, we can stop here if (empty($groups)) { return $post_id; } // Only register notifications for future or published events if (!in_array($post->post_status, array('publish', 'future'))) { return $post_id; } // Loop through each group, adding an activity entry for each one foreach ($groups as $group) { // Get the group data $group_id = groups_get_id($group->slug); $group_name = $group->name; // Configure the activity entry $post_permalink = get_permalink($post_id); $activity_action = sprintf('%1$s added the event %2$s to the %3$s.', bp_core_get_userlink($post->post_author), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>', $group_name . ' <a href="' . SITEURL . '/calendar/' . $group->slug . '">group calendar</a>'); $activity_content = $post->post_content; // Check for existing entry $activity_id = bp_activity_get_activity_id(array('user_id' => $user_id, 'component' => $bp->groups->id, 'type' => 'new_calendar_event', 'item_id' => $group_id, 'secondary_item_id' => $post_id)); // Record the entry groups_record_activity(array('id' => $activity_id, 'user_id' => $user_id, 'action' => $activity_action, 'content' => $activity_content, 'primary_link' => $post_permalink, 'type' => 'new_calendar_event', 'item_id' => $group_id, 'secondary_item_id' => $post_id)); // Update the group's last activity meta groups_update_groupmeta($group_id, 'last_activity', bp_core_current_time()); // Maybe notify every group member if ($_POST['event-rsvp']) { if (bp_group_has_members($args = array('group_id' => $group_id, 'exclude_admins_mods' => false, 'per_page' => 99999))) { while (bp_members()) { bp_the_member(); // Remove any existing notifications ( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false ) bp_notifications_delete_notifications_by_item_id(bp_get_group_member_id(), $group_id, $bp->groups->id, 'new_calendar_event', $post_id); // Send a notification ( itemid , groupid , component, action , secondary ) bp_notifications_add_notification(array('user_id' => bp_get_group_member_id(), 'item_id' => $group_id, 'secondary_item_id' => $post_id, 'component_name' => $bp->groups->id, 'component_action' => 'new_calendar_event')); } } } } }
/** * BP Members List */ function bp_members_list($atts) { $output = ''; extract(shortcode_atts(array('type' => 'active', 'max_item' => 10), $atts)); // available columns are 1, 2, 3, and 4 $params = array('type' => $type, 'per_page' => $max_item); if (function_exists('bp_has_members')) { // begin bp members loop if (bp_has_members($params)) { $output .= '<div class="clearfix">'; $output .= '<ul class="gears-bp-members-list clear">'; while (bp_members()) { $output .= '<li class="clearfix bp-members-list-item ">'; bp_the_member(); $output .= bp_get_member_avatar(array('type' => 'full', 'class' => 'col-md-3 col-xs-3 col-sm-3 trans avatar')); $output .= '<div class="col-md-9 col-sm-9 col-xs-9">'; $output .= '<h5><a href="' . bp_get_member_permalink() . '" title="' . bp_get_member_name() . '">' . bp_get_member_name() . '</a></h5>'; $output .= '<div class="item-meta"><span class="small activity">' . bp_get_member_last_active() . '</span></div>'; do_action('bp_directory_members_item'); $output .= '</div>'; $output .= '</li>'; } $output .= '</ul>'; $output .= '</div>'; return $output; } } else { return $this->bp_not_installed; } }
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; }
/** * @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; }
/** * Display the widget. * * @since 1.9.0 * * @param array $args Widget arguments. * @param array $instance The widget settings, as saved by the user. */ function widget($args, $instance) { global $members_template; extract($args); if (!bp_displayed_user_id()) { return; } $user_id = bp_displayed_user_id(); $link = trailingslashit(bp_displayed_user_domain() . bp_get_friends_slug()); $instance['title'] = sprintf(__("%s's Friends", 'buddypress'), bp_get_displayed_user_fullname()); if (empty($instance['friend_default'])) { $instance['friend_default'] = 'active'; } /** * Filters the Friends widget title. * * @since 1.8.0 * @since 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', $instance['title'], $instance, $this->id_base); echo $before_widget; $title = $instance['link_title'] ? '<a href="' . esc_url($link) . '">' . esc_html($title) . '</a>' : esc_html($title); echo $before_title . $title . $after_title; $members_args = array('user_id' => absint($user_id), 'type' => sanitize_text_field($instance['friend_default']), 'max' => absint($instance['max_friends']), 'populate_extras' => 1); // Back up the global. $old_members_template = $members_template; ?> <?php if (bp_has_members($members_args)) { ?> <div class="item-options" id="friends-list-options"> <a href="<?php bp_members_directory_permalink(); ?> " id="newest-friends" <?php if ($instance['friend_default'] == 'newest') { ?> class="selected"<?php } ?> ><?php _e('Newest', 'buddypress'); ?> </a> | <a href="<?php bp_members_directory_permalink(); ?> " id="recently-active-friends" <?php if ($instance['friend_default'] == 'active') { ?> class="selected"<?php } ?> ><?php _e('Active', 'buddypress'); ?> </a> | <a href="<?php bp_members_directory_permalink(); ?> " id="popular-friends" <?php if ($instance['friend_default'] == 'popular') { ?> class="selected"<?php } ?> ><?php _e('Popular', 'buddypress'); ?> </a> </div> <ul id="friends-list" class="item-list"> <?php while (bp_members()) { bp_the_member(); ?> <li class="vcard"> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_avatar(); ?> </a> </div> <div class="item"> <div class="item-title fn"><a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_name(); ?> </a></div> <div class="item-meta"> <?php if ('newest' == $instance['friend_default']) { ?> <span class="activity" data-livestamp="<?php bp_core_iso8601_date(bp_get_member_registered(array('relative' => false))); ?> "><?php bp_member_registered(); ?> </span> <?php } elseif ('active' == $instance['friend_default']) { ?> <span class="activity" data-livestamp="<?php bp_core_iso8601_date(bp_get_member_last_active(array('relative' => false))); ?> "><?php bp_member_last_active(); ?> </span> <?php } else { ?> <span class="activity"><?php bp_member_total_friend_count(); ?> </span> <?php } ?> </div> </div> </li> <?php } ?> </ul> <?php wp_nonce_field('bp_core_widget_friends', '_wpnonce-friends'); ?> <input type="hidden" name="friends_widget_max" id="friends_widget_max" value="<?php echo absint($instance['max_friends']); ?> " /> <?php } else { ?> <div class="widget-error"> <?php _e('Sorry, no members were found.', 'buddypress'); ?> </div> <?php } ?> <?php echo $after_widget; // Restore the global. $members_template = $old_members_template; }
/** * 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); }
/** * Display the Recently Active 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) { global $members_template; // Get widget settings. $settings = $this->parse_settings($instance); /** * Filters the title of the Recently Active widget. * * @since 1.8.0 * @since 2.3.0 Added 'instance' and 'id_base' to arguments passed to filter. * * @param string $title The widget title. * @param array $settings 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', $settings['title'], $settings, $this->id_base); echo $args['before_widget']; echo $args['before_title'] . $title . $args['after_title']; // Setup args for querying members. $members_args = array('user_id' => 0, 'type' => 'active', 'per_page' => $settings['max_members'], 'max' => $settings['max_members'], 'populate_extras' => true, 'search_terms' => false); // Back up global. $old_members_template = $members_template; ?> <?php if (bp_has_members($members_args)) { ?> <div class="avatar-block"> <?php while (bp_members()) { bp_the_member(); ?> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_avatar(); ?> </a> </div> <?php } ?> </div> <?php } else { ?> <div class="widget-error"> <?php esc_html_e('There are no recently active members', 'buddypress'); ?> </div> <?php } ?> <?php echo $args['after_widget']; // Restore the global. $members_template = $old_members_template; }
function kleo_bp_member_stats($field = false, $value = false, $online = false) { global $wpdb; if (!$field || !$value) { return; } $where = " WHERE name = '" . $field . "' AND value = '" . esc_sql($value) . "'"; $sql = "SELECT " . $wpdb->base_prefix . "bp_xprofile_data.user_id FROM " . $wpdb->base_prefix . "bp_xprofile_data\n\t\t\t\tJOIN " . $wpdb->base_prefix . "bp_xprofile_fields ON " . $wpdb->base_prefix . "bp_xprofile_data.field_id = " . $wpdb->base_prefix . "bp_xprofile_fields.id\n\t\t\t\t{$where}"; $match_ids = $wpdb->get_col($sql); if (!$online) { return count($match_ids); } if (!$match_ids) { $match_ids = array(0); } if (!empty($match_ids)) { $include_members = '&include=' . join(",", $match_ids); } else { $include_members = ''; } $i = 0; if (bp_has_members('user_id=0&type=online&per_page=999999999&populate_extras=0' . $include_members)) { while (bp_members()) { bp_the_member(); $i++; } } return apply_filters('kleo_bp_member_stats', $i, $value); }
/** * Display the widget. * * @param array $args Widget arguments. * @param array $instance The widget settings, as saved by the user. */ function widget($args, $instance) { extract($args); if (!bp_displayed_user_id()) { return; } $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_enqueue_script('bp_core_widget_friends-js', buddypress()->plugin_url . "bp-friends/js/widget-friends{$min}.js", array('jquery'), bp_get_version()); $user_id = bp_displayed_user_id(); $link = trailingslashit(bp_displayed_user_domain() . bp_get_friends_slug()); $instance['title'] = sprintf(__('%s’s Friends', 'buddypress'), bp_get_displayed_user_fullname()); if (empty($instance['friend_default'])) { $instance['friend_default'] = 'active'; } $title = apply_filters('widget_title', $instance['title']); echo $before_widget; $title = $instance['link_title'] ? '<a href="' . esc_url($link) . '">' . esc_html($title) . '</a>' : esc_html($title); echo $before_title . $title . $after_title; $members_args = array('user_id' => absint($user_id), 'type' => sanitize_text_field($instance['friend_default']), 'max' => absint($instance['max_friends']), 'populate_extras' => 1); ?> <?php if (bp_has_members($members_args)) { ?> <div class="item-options" id="friends-list-options"> <a href="<?php bp_members_directory_permalink(); ?> " id="newest-friends" <?php if ($instance['friend_default'] == 'newest') { ?> class="selected"<?php } ?> ><?php _e('Newest', 'buddypress'); ?> </a> | <a href="<?php bp_members_directory_permalink(); ?> " id="recently-active-friends" <?php if ($instance['friend_default'] == 'active') { ?> class="selected"<?php } ?> ><?php _e('Active', 'buddypress'); ?> </a> | <a href="<?php bp_members_directory_permalink(); ?> " id="popular-friends" <?php if ($instance['friend_default'] == 'popular') { ?> class="selected"<?php } ?> ><?php _e('Popular', 'buddypress'); ?> </a> </div> <ul id="friends-list" class="item-list"> <?php while (bp_members()) { bp_the_member(); ?> <li class="vcard"> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_avatar(); ?> </a> </div> <div class="item"> <div class="item-title fn"><a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_name(); ?> </a></div> <div class="item-meta"> <span class="activity"> <?php if ('newest' == $instance['friend_default']) { bp_member_registered(); } if ('active' == $instance['friend_default']) { bp_member_last_active(); } if ('popular' == $instance['friend_default']) { bp_member_total_friend_count(); } ?> </span> </div> </div> </li> <?php } ?> </ul> <?php wp_nonce_field('bp_core_widget_friends', '_wpnonce-friends'); ?> <input type="hidden" name="friends_widget_max" id="friends_widget_max" value="<?php echo absint($instance['max_friends']); ?> " /> <?php } else { ?> <div class="widget-error"> <?php _e('Sorry, no members were found.', 'buddypress'); ?> </div> <?php } ?> <?php echo $after_widget; ?> <?php }
function buat_get_user_template($type) { $filtered_users = buat_gather_user_ids($type); if (bp_has_members("include={$filtered_users}&type=alphabetical")) { ?> <div class="pagination"> <div class="pag-count" id="member-dir-count"> <?php bp_members_pagination_count(); ?> </div> <div class="pagination-links" id="member-dir-pag"> <?php bp_members_pagination_links(); ?> </div> </div> <?php do_action('bp_before_directory_members_list'); ?> <ul id="members-list" class="item-list" style="list-style-type:none; margin: 0; width: auto"> <?php while (bp_members()) { bp_the_member(); ?> <li> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?> "><?php bp_member_avatar(); ?> </a> </div> <div class="item"> <div class="item-title"> <a href="<?php bp_member_permalink(); ?> "><?php bp_member_name(); ?> </a> <?php if (bp_get_member_latest_update()) { ?> <span class="update"> - <?php bp_member_latest_update('length=10'); ?> </span> <?php } ?> </div> <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?> </span></div> <?php do_action('bp_directory_members_item'); ?> <?php /*** * If you want to show specific profile fields here you can, * but it'll add an extra query for each member in the loop * (only one regadless of the number of fields you show): * * bp_member_profile_data( 'field=the field name' ); */ ?> </div> <div class="action"> <?php do_action('bp_directory_members_actions'); ?> </div> <div class="clear"></div> </li> <?php } ?> </ul> <?php do_action('bp_after_directory_members_list'); ?> <?php bp_member_hidden_fields(); ?> <?php } else { ?> <div id="message" class="info"> <p><?php _e("Sorry, no members were found.", 'buddypress'); ?> </p> </div> <?php } }
<div class="pagination-links" id="member-dir-pag-top"> <?php bp_members_pagination_links(); ?> </div> </div> <?php do_action( 'bp_before_directory_members_list' ); ?> <div class="clearfix"></div> <ul id="members-list" class="row clearfix" role="main"> <?php while ( bp_members() ) : bp_the_member(); ?> <li class="yit_animate fadeInUp col-md-4 col-sm-6 masonry_item"> <div class="item-container"> <div class="item-header clearfix"> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar( array( 'height' => 60, 'width' => 60 ) ); ?></a> </div> <div class="item"> <div class="item-username"> <a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a> </div> <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div>
/** * AJAX request handler for Members widgets. * * @since 1.0.0 * * @see BP_Core_Members_Widget */ function bp_core_ajax_widget_members() { check_ajax_referer('bp_core_widget_members'); // Setup some variables to check. $filter = !empty($_POST['filter']) ? $_POST['filter'] : 'recently-active-members'; $max_members = !empty($_POST['max-members']) ? absint($_POST['max-members']) : 5; // Determine the type of members query to perform. switch ($filter) { // Newest activated. case 'newest-members': $type = 'newest'; break; // Popular by friends. // Popular by friends. case 'popular-members': if (bp_is_active('friends')) { $type = 'popular'; } else { $type = 'active'; } break; // Default. // Default. case 'recently-active-members': default: $type = 'active'; break; } // Setup args for querying members. $members_args = array('user_id' => 0, 'type' => $type, 'per_page' => $max_members, 'max' => $max_members, 'populate_extras' => true, 'search_terms' => false); // Query for members. if (bp_has_members($members_args)) { ?> <?php echo '0[[SPLIT]]'; // Return valid result. TODO: remove this. ?> <?php while (bp_members()) { bp_the_member(); ?> <li class="vcard"> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?> "><?php bp_member_avatar(); ?> </a> </div> <div class="item"> <div class="item-title fn"><a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_name(); ?> </a></div> <?php if ('active' === $type) { ?> <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?> </span></div> <?php } elseif ('newest' === $type) { ?> <div class="item-meta"><span class="activity"><?php bp_member_registered(); ?> </span></div> <?php } elseif (bp_is_active('friends')) { ?> <div class="item-meta"><span class="activity"><?php bp_member_total_friend_count(); ?> </span></div> <?php } ?> </div> </li> <?php } ?> <?php } else { ?> <?php echo "-1[[SPLIT]]<li>"; ?> <?php esc_html_e('There were no members found, please try another filter.', 'buddypress'); ?> <?php echo "</li>"; ?> <?php } }
function build_html() { // Get the total member count global $members_template; $total = $members_template->total_member_count; // Add everything to an array $members = array(); while (bp_members()) { bp_the_member(); $members[] = sprintf('<a href="%1$s" title="%2$s User Profile">%2$s</a>', bp_get_member_permalink(), bp_get_member_name()); } if ($total > $this->number) { $members[] = sprintf('<a href="%1$s" title="View all online members">%2$d More</a>', bp_get_members_directory_permalink(), $total - $this->number); } // Implode the members with separator $members = implode(" | ", $members); // Store everything in an output buffer ob_start(); ?> <div id="sidebar-members-widget" class="widget"> <header class="widget-header"> <h3 class="widget-title">Online Members</h3> </header> <p class="online-members"><i class="fa fa-users"></i> <?php if ($total > 1) { printf('There are currently <span class="activity-count">%d</span> members online:', $total); } elseif ($total == 1) { printf('There is currently <span class="activity-count">%d</span> member online:', $total); } else { echo 'There are currently no members online:'; } ?> </p> <p class="online-members"><?php echo $members; ?> </p> </div><?php // Get the contents of the buffer $html = ob_get_contents(); ob_end_clean(); // Return the html to the class return $html; }
/** * Display the Members widget. * * @since 1.0.3 * * @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) { global $members_template; // Get widget settings. $settings = $this->parse_settings($instance); /** * Filters the title of the Members widget. * * @since 1.8.0 * @since 2.3.0 Added 'instance' and 'id_base' to arguments passed to filter. * * @param string $title The widget title. * @param array $settings 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', $settings['title'], $settings, $this->id_base); $title = $settings['link_title'] ? '<a href="' . bp_get_members_directory_permalink() . '">' . $title . '</a>' : $title; /** * Filters the separator of the member widget links. * * @since 2.4.0 * * @param string $separator Separator string. Default '|'. */ $separator = apply_filters('bp_members_widget_separator', '|'); // Output before widget HTMl, title (and maybe content before & after it). echo $args['before_widget'] . $args['before_title'] . $title . $args['after_title']; // Setup args for querying members. $members_args = array('user_id' => 0, 'type' => $settings['member_default'], 'per_page' => $settings['max_members'], 'max' => $settings['max_members'], 'populate_extras' => true, 'search_terms' => false); // Back up the global. $old_members_template = $members_template; ?> <?php if (bp_has_members($members_args)) { ?> <div class="item-options" id="members-list-options"> <a href="<?php bp_members_directory_permalink(); ?> " id="newest-members" <?php if ('newest' === $settings['member_default']) { ?> class="selected"<?php } ?> ><?php esc_html_e('Newest', 'buddypress'); ?> </a> <span class="bp-separator" role="separator"><?php echo esc_html($separator); ?> </span> <a href="<?php bp_members_directory_permalink(); ?> " id="recently-active-members" <?php if ('active' === $settings['member_default']) { ?> class="selected"<?php } ?> ><?php esc_html_e('Active', 'buddypress'); ?> </a> <?php if (bp_is_active('friends')) { ?> <span class="bp-separator" role="separator"><?php echo esc_html($separator); ?> </span> <a href="<?php bp_members_directory_permalink(); ?> " id="popular-members" <?php if ('popular' === $settings['member_default']) { ?> class="selected"<?php } ?> ><?php esc_html_e('Popular', 'buddypress'); ?> </a> <?php } ?> </div> <ul id="members-list" class="item-list" aria-live="polite" aria-relevant="all" aria-atomic="true"> <?php while (bp_members()) { bp_the_member(); ?> <li class="vcard"> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_avatar(); ?> </a> </div> <div class="item"> <div class="item-title fn"><a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_name(); ?> </a></div> <div class="item-meta"> <?php if ('newest' == $settings['member_default']) { ?> <span class="activity" data-livestamp="<?php bp_core_iso8601_date(bp_get_member_registered(array('relative' => false))); ?> "><?php bp_member_registered(); ?> </span> <?php } elseif ('active' == $settings['member_default']) { ?> <span class="activity" data-livestamp="<?php bp_core_iso8601_date(bp_get_member_last_active(array('relative' => false))); ?> "><?php bp_member_last_active(); ?> </span> <?php } else { ?> <span class="activity"><?php bp_member_total_friend_count(); ?> </span> <?php } ?> </div> </div> </li> <?php } ?> </ul> <?php wp_nonce_field('bp_core_widget_members', '_wpnonce-members', false); ?> <input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo esc_attr($settings['max_members']); ?> " /> <?php } else { ?> <div class="widget-error"> <?php esc_html_e('No one has signed up yet!', 'buddypress'); ?> </div> <?php } ?> <?php echo $args['after_widget']; // Restore the global. $members_template = $old_members_template; }
<?php 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() ) ); ?>
function widget($args, $instance) { extract($args); echo $before_widget; echo $before_title . $instance['title'] . $after_title; ?> <?php if (bp_has_members('user_id=0&type=active&per_page=' . $instance['max_members'] . '&max=' . $instance['max_members'] . '&populate_extras=0')) { ?> <div class="avatar-block"> <?php while (bp_members()) { bp_the_member(); ?> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_avatar(); ?> </a> </div> <?php } ?> </div> <?php } else { ?> <div class="widget-error"> <?php _e('There are no recently active members', 'buddypress'); ?> </div> <?php } ?> <?php echo $after_widget; ?> <?php }