</label>
							<select id="topic_group_id" name="topic_group_id">

								<option value=""><?php 
        /* translators: no option picked in select box */
        _e('----', 'buddypress');
        ?>
</option>

								<?php 
        while (bp_groups()) {
            bp_the_group();
            ?>

									<?php 
            if (bp_group_is_forum_enabled() && (is_super_admin() || 'public' == bp_get_group_status() || bp_group_is_member())) {
                ?>

										<option value="<?php 
                bp_group_id();
                ?>
"><?php 
                bp_group_name();
                ?>
</option>

									<?php 
            }
            ?>

								<?php 
Example #2
0
"><?php 
        bp_group_name();
        ?>
</a></h1>
				<p class="status"><?php 
        bp_group_type();
        ?>
</p>
			</div>

			<div class="info-group">
				<?php 
        if (function_exists('bp_wire_get_post_list')) {
            ?>
					<?php 
            bp_wire_get_post_list(bp_get_group_id(), __('Group Wire', 'buddypress'), sprintf(__('The are no wire posts for %s', 'buddypress'), bp_get_group_name()), bp_group_is_member(), true);
            ?>
				<?php 
        }
        ?>
			</div>
			
		</div>
	</div>
	
	<?php 
    }
}
?>

</div>
/**
 * Get the row class of the current group in the loop.
 *
 * @since 1.7.0
 *
 * @param array $classes Array of custom classes.
 * @return string Row class of the group.
 */
function bp_get_group_class($classes = array())
{
    global $groups_template;
    // Add even/odd classes, but only if there's more than 1 group.
    if ($groups_template->group_count > 1) {
        $pos_in_loop = (int) $groups_template->current_group;
        $classes[] = $pos_in_loop % 2 ? 'even' : 'odd';
        // If we've only one group in the loop, don't bother with odd and even.
    } else {
        $classes[] = 'bp-single-group';
    }
    // Group type - public, private, hidden.
    $classes[] = sanitize_key($groups_template->group->status);
    // User's group role.
    if (bp_is_user_active()) {
        // Admin.
        if (bp_group_is_admin()) {
            $classes[] = 'is-admin';
        }
        // Moderator.
        if (bp_group_is_mod()) {
            $classes[] = 'is-mod';
        }
        // Member.
        if (bp_group_is_member()) {
            $classes[] = 'is-member';
        }
    }
    // Whether a group avatar will appear.
    if (bp_disable_group_avatar_uploads() || !buddypress()->avatar->show_avatars) {
        $classes[] = 'group-no-avatar';
    } else {
        $classes[] = 'group-has-avatar';
    }
    /**
     * Filters classes that will be applied to row class of the current group in the loop.
     *
     * @since 1.7.0
     *
     * @param array $classes Array of determined classes for the row.
     */
    $classes = apply_filters('bp_get_group_class', $classes);
    $classes = array_merge($classes, array());
    $retval = 'class="' . join(' ', $classes) . '"';
    return $retval;
}
Example #4
0
if (!bp_is_group_forum_topic_edit() && !bp_is_group_forum_topic()) {
    ?>

	<?php 
    if (!bp_group_is_user_banned() && (is_user_logged_in() && 'public' == bp_get_group_status() || bp_group_is_member())) {
        ?>

		<form action="" method="post" id="forum-topic-form" class="standard-form">
			<div id="new-topic-post">

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

				<?php 
        if (bp_groups_auto_join() && !bp_group_is_member()) {
            ?>
					<p><?php 
            _e('You will auto join this group when you start a new topic.', 'buddypress');
            ?>
</p>
				<?php 
        }
        ?>

				<p id="post-new"></p>
				<h4><?php 
        _e('Post a New Topic:', 'buddypress');
        ?>
</h4>
 /**
  * student_screen( $vars )
  *
  * Hooks into courseware_assignment
  * If a student is visiting assignment screen, his grade will be shown
  *
  * @param Array $vars a set of variables received for this screen template
  * @return Array $vars a set of variable passed to this screen template
  */
 function student_screen($vars)
 {
     global $bp;
     $user_id = null;
     if (bp_group_is_member($bp->groups->current_group) && !bp_group_is_admin()) {
         $user_id = $bp->loggedin_user->id;
     }
     if ($user_id) {
         $vars['user_grade'] = $this->load_grade_by_user_id($this->current_assignment, $user_id);
     }
     $vars['has_gradebook_caps'] = $this->has_gradebook_caps($bp->loggedin_user->id);
     return $vars;
 }
Example #6
0
        } else {
            ?>

					<div id="message" class="info">
						<p><?php 
            _e('There are no topics for this group forum.', 'buddypress');
            ?>
</p>
					</div>

				<?php 
        }
        ?>
				
				<?php 
        if (bp_group_is_member()) {
            ?>
			
					<div id="post-new-topic">

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

						<a name="post-new"></a>
						<p><strong><?php 
            _e('Post a New Topic:', 'buddypress');
            ?>
</strong></p>
						
						<label><?php 
 /**
  * populate_responses( $vars )
  *
  * Hooks into single_assignment_screen
  * Populates $vars with responses
  *
  * @param Array $vars a set of variables received for this screen template
  * @return Array $vars a set of variable passed to this screen template
  */
 function populate_responses($vars)
 {
     global $bp;
     if ($this->has_student_caps() && bp_group_is_member($bp->current_group->id)) {
         $vars['response_add_uri'] = $vars['assignment_permalink'] . '/add_response';
     }
     $vars['response'] = $this->has_response();
     $vars['response_permalink'] = $vars['assignment_permalink'] . '/response/';
     if (!$this->group_responses_status() || $this->has_response_caps()) {
         $vars['responses'] = get_posts(array('numberposts' => '-1', 'post_type' => 'response', 'post_status' => 'publish', 'post_parent' => $this->current_assignment->ID));
     }
     return $vars;
 }
Example #8
0
</option>

				<?php 
do_action('bp_group_activity_filter_options');
?>
			</select>
		</li>
	</ul>
</div><!-- .item-list-tabs -->

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

<?php 
if (is_user_logged_in() && bp_group_is_member() && !newwriting_is_lurker()) {
    ?>
	<?php 
    locate_template(array('activity/post-form.php'), true);
}
?>

<?php 
do_action('bp_after_group_activity_post_form');
do_action('bp_before_group_activity_content');
?>

<div class="activity single-group" role="main">
	<?php 
locate_template(array('activity/activity-loop.php'), true);
?>
Example #9
0
 public function current_user_can($action)
 {
     global $bp;
     if (bp_group_is_admin()) {
         return true;
     }
     $user_is_owner = $this->user_id == get_current_user_id();
     switch ($action) {
         case 'add':
             switch (get_option('bp_group_documents_upload_permission')) {
                 case 'mods_decide':
                     switch (groups_get_groupmeta($bp->groups->current_group->id, 'group_documents_upload_permission')) {
                         case 'mods_only':
                             if (bp_group_is_mod($bp->groups->current_group)) {
                                 return true;
                             }
                             break;
                         case 'members':
                         default:
                             if (bp_group_is_member($bp->groups->current_group)) {
                                 return true;
                             }
                             break;
                     }
                     break;
                 case 'mods_only':
                     if (bp_group_is_mod($bp->groups->current_group)) {
                         return true;
                     }
                     break;
                 case 'members':
                 default:
                     if (bp_group_is_member($bp->groups->current_group)) {
                         return true;
                     }
                     break;
             }
             break;
         case 'edit':
             if (bp_group_is_mod($bp->groups->current_group) || bp_group_is_member($bp->groups->current_group) && $user_is_owner) {
                 return true;
             }
             break;
         case 'delete':
             if (bp_group_is_mod($bp->groups->current_group) || bp_group_is_member($bp->groups->current_group) && $user_is_owner) {
                 return true;
             }
             break;
     }
     return false;
 }
Example #10
0
 /**
  * Filters the output of cp_check_project_permissions() to correspond to group membership
  *
  * When the project is not associated with a group, it falls back on the CP value of
  * $has_access
  *
  * @package CollabPress
  * @subpackage CP BP
  * @since 1.2
  *
  * @param bool $has_access The value passed along by cp_check_project_permissions()
  * @param int $user_id The id of the user being checked against
  * @param int $project_id The id of the project
  * @param array $cp_project_users The users of the project, as stored by CP
  * @return bool $has_access Whether the user has access to the project
  */
 function project_perms($has_access, $user_id, $project_id, $cp_project_users)
 {
     // Super admins always have access
     if (is_super_admin()) {
         return true;
     }
     if (bp_is_group()) {
         // If we're looking at a group page, we can assume we're checking against
         // that group
         $has_access = bp_group_is_member();
     } else {
         // Otherwise (on the admin panel specifically) we have to check to see
         // whether the user is in the associated group
         $terms = wp_get_post_terms($project_id, 'cp-bp-group');
         // If there are associated groups, check to see whether the current user
         // is in at least one of them
         if (!empty($terms)) {
             foreach ((array) $terms as $term) {
                 $has_access = groups_is_user_member(bp_loggedin_user_id(), $term->name);
                 // Once we find a single group, no need to keep looping
                 if ($has_access) {
                     break;
                 }
             }
         }
     }
     return $has_access;
 }
    function display()
    {
        global $bp;
        $current_url = bp_get_group_permalink($bp->groups->current_group) . $bp->current_action . '/';
        $checkins_group_class = false;
        ?>
		<div class="item-list-tabs no-ajax checkins-type-tabs" id="subnav">
			<form action="" method="get" id="checkins-form-filter">
			<ul>
				<li id="group-checkins" class="<?php 
        if (!bp_action_variable(0) || 'checkins' == bp_action_variable(0)) {
            echo 'selected';
        }
        ?>
"><a href="<?php 
        echo $current_url;
        ?>
" id="checkins-area"><?php 
        _e('Checkins', 'bp-checkins');
        ?>
</a></li>
				
				<li id="group-places" class="<?php 
        if ('places' == bp_action_variable(0)) {
            echo 'selected';
        }
        ?>
"><a href="<?php 
        echo $current_url . 'places/';
        ?>
" id="places-area"><?php 
        _e('Places', 'bp-checkins');
        ?>
</a></li>
				
				<?php 
        do_action('bp_checkins_group_nav');
        ?>
				
				<?php 
        if (!bp_action_variable(0) || 'checkins' == bp_action_variable(0)) {
            ?>

				<li id="checkins-filter-select" class="last">

					<label for="checkins-filter-by"><?php 
            _e('Show:', 'bp-checkins');
            ?>
</label>
					<select id="checkins-filter-by" name="_checkins_filter_by">
						<option value="-1"><?php 
            _e('Everything', 'bp-checkins');
            ?>
</option>
						<option value="friends_checkin"><?php 
            _e('Friends checkins', 'bp-checkins');
            ?>
</option>
						<option value="activity_checkin"><?php 
            _e('Activity checkins', 'bp-checkins');
            ?>
</option>
						<option value="place_checkin"><?php 
            _e('Place checkins', 'bp-checkins');
            ?>
</option>
						
						<?php 
            do_action('bp_checkins_group_checkins_filters');
            ?>
						
					</select>
				</li>
				
				<?php 
        } else {
            ?>
					
					<li id="places-filter-select" class="last">

						<label for="places-filter-by"><?php 
            _e('Show:', 'bp-checkins');
            ?>
</label>
						<select id="places-filter-by">
							<option value="-1"><?php 
            _e('Everything', 'bp-checkins');
            ?>
</option>
							<option value="all_live_places"><?php 
            _e('Live Places', 'bp-checkins');
            ?>
</option>
							<option value="upcoming_places"><?php 
            _e('Upcoming Places', 'bp-checkins');
            ?>
</option>
							<?php 
            if (is_user_logged_in()) {
                ?>
								<option value="places_around"><?php 
                _e('Places around', 'bp-checkins');
                ?>
</option>
							<?php 
            }
            ?>

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

						</select>
					</li>
					
				<?php 
        }
        ?>
				
			</ul>
			</form>
		</div>
		<?php 
        if (!bp_action_variable(0) || 'checkins' == bp_action_variable(0)) {
            ?>
		
			<?php 
            do_action('bp_before_group_checkins_post_form');
            ?>

			<?php 
            if (is_user_logged_in() && bp_group_is_member()) {
                ?>
				<?php 
                bp_checkins_load_template_choose('bp-checkins-post-form');
                ?>
			<?php 
            }
            ?>

			<?php 
            do_action('bp_after_group_checkins_post_form');
            ?>
			<?php 
            do_action('bp_before_group_checkins_content');
            ?>

			<div class="activity single-group" role="main">
				<?php 
            bp_checkins_locate_template_choose('activity/activity-loop');
            ?>
			</div><!-- .activity.single-group -->

			<?php 
            do_action('bp_after_group_checkins_content');
            ?>
			
		<?php 
        } else {
            ?>
			
			<?php 
            do_action('bp_before_group_places_post_form');
            ?>

			<?php 
            if (is_user_logged_in() && bp_group_is_member()) {
                ?>
				<?php 
                bp_checkins_load_template_choose('bp-checkins-places-form');
                ?>
			<?php 
            }
            ?>

			<?php 
            do_action('bp_after_group_places_post_form');
            ?>
			<?php 
            do_action('bp_before_group_places_content');
            ?>

			<div class="activity single-group" role="main">
				<?php 
            bp_checkins_load_template_choose('bp-checkins-places-loop');
            ?>
			</div><!-- .activity.single-group -->

			<?php 
            do_action('bp_after_group_places_content');
            ?>
			
		<?php 
        }
        ?>
		
		<?php 
    }
/**
 * Checks upload permissions.
 * Adapted from Group Documents plugin.
 */
function bpfb_documents_allowed($group = false)
{
    if (!$group) {
        return false;
    }
    $user = wp_get_current_user();
    $moderator_of = BP_Groups_Member::get_is_admin_of($user->ID) + BP_Groups_Member::get_is_mod_of($user->ID);
    $moderator_of = is_array($moderator_of) && isset($moderator_of['groups']) ? $moderator_of['groups'] : false;
    $is_mod = false;
    foreach ($moderator_of as $gm) {
        if ($gm->id == $group->id) {
            $is_mod = true;
            break;
        }
    }
    switch (get_option('bp_group_documents_upload_permission')) {
        case 'mods_decide':
            switch (groups_get_groupmeta($group->id, 'group_documents_upload_permission')) {
                case 'mods_only':
                    if ($is_mod) {
                        return true;
                    }
                    break;
                case 'members':
                default:
                    if (bp_group_is_member($group)) {
                        return true;
                    }
                    break;
            }
            break;
        case 'mods_only':
            if ($is_mod) {
                return true;
            }
            break;
        case 'members':
        default:
            if (bp_group_is_member($group)) {
                return true;
            }
            break;
    }
    return false;
}
Example #13
0
<?php do_action( 'bp_before_group_forum_edit_form' ) ?>

<?php if ( bp_has_forum_topic_posts() ) : ?>

	<form action="<?php bp_forum_topic_action() ?>" method="post" id="forum-topic-form" class="standard-form">

		<div id="topic-meta">
			<h3><?php bp_the_topic_title() ?> (<?php bp_the_topic_total_post_count() ?>)</h3>
			<a class="button" href="<?php bp_forum_permalink() ?>/">&larr; <?php _e( 'Group Forum', 'buddypress' ) ?></a> &nbsp; <a class="button" href="<?php bp_forum_directory_permalink() ?>/"><?php _e( 'Group Forum Directory', 'buddypress') ?></a>

			<?php if ( bp_group_is_admin() || bp_group_is_mod() || bp_get_the_topic_is_mine() ) : ?>
				<div class="admin-links"><?php bp_the_topic_admin_links() ?></div>
			<?php endif; ?>
		</div>

		<?php if ( bp_group_is_member() ) : ?>

			<?php if ( bp_is_edit_topic() ) : ?>

				<div id="edit-topic">

					<?php do_action( 'bp_group_before_edit_forum_topic' ) ?>

					<p><strong><?php _e( 'Edit Topic:', 'buddypress' ) ?></strong></p>

					<label for="topic_title"><?php _e( 'Title:', 'buddypress' ) ?></label>
					<input type="text" name="topic_title" id="topic_title" value="<?php bp_the_topic_title() ?>" />

					<label for="topic_text"><?php _e( 'Content:', 'buddypress' ) ?></label>
					<textarea name="topic_text" id="topic_text"><?php bp_the_topic_text() ?></textarea>
/**
 * Return the row class of a group
 *
 * @global BP_Groups_Template $groups_template
 * @return string Row class of the group
 * @since BuddyPress (1.7)
 */
function bp_get_group_class()
{
    global $groups_template;
    $classes = array();
    $pos_in_loop = (int) $groups_template->current_group;
    // If we've only one group in the loop, don't both with odd and even.
    if ($groups_template->group_count > 1) {
        $classes[] = $pos_in_loop % 2 ? 'even' : 'odd';
    } else {
        $classes[] = 'bp-single-group';
    }
    // Group type - public, private, hidden.
    $classes[] = esc_attr($groups_template->group->status);
    // User's group status
    if (bp_is_user_active()) {
        if (bp_group_is_admin()) {
            $classes[] = 'is-admin';
        }
        if (bp_group_is_member()) {
            $classes[] = 'is-member';
        }
        if (bp_group_is_mod()) {
            $classes[] = 'is-mod';
        }
    }
    $classes = apply_filters('bp_get_group_class', $classes);
    $classes = array_merge($classes, array());
    $retval = 'class="' . join(' ', $classes) . '"';
    return $retval;
}
Example #15
0
</label>
					<select id="topic_group_id" name="topic_group_id">

						<option value=""><?php 
        /* translators: no option picked in select box */
        _e('----', 'buddypress');
        ?>
</option>

						<?php 
        while (bp_groups()) {
            bp_the_group();
            ?>

							<?php 
            if (bp_group_is_forum_enabled() && (bp_current_user_can('bp_moderate') || 'public' == bp_get_group_status() || bp_group_is_member())) {
                ?>

								<option value="<?php 
                bp_group_id();
                ?>
"><?php 
                bp_group_name();
                ?>
</option>

							<?php 
            }
            ?>

						<?php 
Example #16
0
</option>

				<?php 
do_action('bp_group_activity_filter_options');
?>
			</select>
		</li>
	</ul>
</div><!-- .item-list-tabs -->

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

<?php 
if (is_user_logged_in() && bp_group_is_member()) {
    ?>
	<?php 
    locate_template(array('activity/post-form.php'), true);
}
?>

<?php 
do_action('bp_after_group_activity_post_form');
do_action('bp_before_group_activity_content');
?>

<div class="activity single-group" role="main">
	<?php 
locate_template(array('activity/activity-loop.php'), true);
?>
Example #17
0
 /**
  * Allow group members to have advanced priviledges in group forum topics.
  *
  * @since bbPress (r4434)
  *
  * @param array $caps
  * @param string $cap
  * @param int $user_id
  * @param array $args
  * @return array
  */
 public function map_topic_meta_caps($caps = array(), $cap = '', $user_id = 0, $args = array())
 {
     // Bail if not viewing a single topic
     if (!bp_is_single_item() || !bp_is_groups_component() || !bp_is_current_action('forum') || !bp_is_action_variable(0, 'topic')) {
         return $caps;
     }
     switch ($cap) {
         // If user is a group mmember, allow them to create content.
         case 'read_forum':
         case 'publish_replies':
         case 'publish_topics':
         case 'read_hidden_forums':
         case 'read_private_forums':
             if (bp_group_is_member() || bp_group_is_mod() || bp_group_is_admin()) {
                 $caps = array('participate');
             }
             break;
             // If user is a group mod ar admin, map to participate cap.
         // If user is a group mod ar admin, map to participate cap.
         case 'moderate':
         case 'edit_topic':
         case 'edit_reply':
         case 'view_trash':
         case 'edit_others_replies':
         case 'edit_others_topics':
             if (bp_group_is_mod() || bp_group_is_admin()) {
                 $caps = array('participate');
             }
             break;
             // If user is a group admin, allow them to delete topics and replies.
         // If user is a group admin, allow them to delete topics and replies.
         case 'delete_topic':
         case 'delete_reply':
             if (bp_group_is_admin()) {
                 $caps = array('participate');
             }
             break;
     }
     return apply_filters('bbp_map_group_forum_topic_meta_caps', $caps, $cap, $user_id, $args);
 }