Skip to content

Commit

Permalink
Merge pull request #76 from codehaiku/1.4.11
Browse files Browse the repository at this point in the history
1.4.11
  • Loading branch information
JosephGabito authored Oct 3, 2017
2 parents 42fb18c + e8d49b5 commit 6c4e86c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
14 changes: 13 additions & 1 deletion core/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,19 @@ public function get_displayed_user_groups_projects() {
$db = TaskBreaker::wpdb();

$user_id = bp_displayed_user_id();
$user_groups = groups_get_user_groups( $user_id );

// Bail out when buddypress groups components is not installed/activated.
if ( ! function_exists('groups_get_user_groups') ) {
return array(
'projects' => [],
'total' => 0,
'total_pages' => 1,
'total_user_groups' => 0,
'summary' => 'BP_GROUPS_COMPONENT_NOT_INSTALLED',
);
} else {
$user_groups = groups_get_user_groups( $user_id );
}

if ( empty( $user_groups['groups'] ) ) {
$user_groups['groups'] = array( 0 );
Expand Down
27 changes: 17 additions & 10 deletions templates/project-single.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
if ( ! defined( 'ABSPATH' ) ) {
return;
}

if ( ! function_exists('bp_is_active') ) {
echo '<div id="message" class="info">';
esc_html_e( 'Please install and activate BuddyPress to use this feature.', 'task_breaker' );
echo '</div>';
return;
}
?>

<?php if ( bp_is_active( 'groups' ) ) { ?>
Expand All @@ -28,34 +35,34 @@
<?php if ( $user_access->can_view_project( $args->ID ) ) { ?>

<?php include $core->get_template_directory() . '/project-heading.php'; ?>

<div class="task_breaker-project-tabs">

<ul id="task_breaker-project-tab-li">
<li class="task_breaker-project-tab-li-item active">
<a data-content="task_breaker-project-dashboard" class="task_breaker-project-tab-li-item-a" href="#tasks/dashboard">
<?php esc_html_e( 'Dashboard', 'task_breaker' ); ?>
<?php esc_html_e( 'Dashboard', 'task-breaker' ); ?>
</a>
</li>
<li class="task_breaker-project-tab-li-item">
<a data-content="task_breaker-project-tasks" class="task_breaker-project-tab-li-item-a" href="#tasks">
<?php esc_html_e( 'Tasks', 'task_breaker' ); ?>
<?php esc_html_e( 'Tasks', 'task-breaker' ); ?>
</a>
</li>
<li class="task_breaker-project-tab-li-item">
<a data-content="task_breaker-project-add-new" id="task_breaker-project-add-new" class="task_breaker-project-tab-li-item-a" href="#tasks/add">
<?php esc_html_e( 'Add New', 'task_breaker' ); ?>
<?php esc_html_e( 'Add New', 'task-breaker' ); ?>
</a>
</li>
<li class="task_breaker-project-tab-li-item">
<a data-content="task_breaker-project-edit" id="task_breaker-project-edit-tab" class="task_breaker-project-tab-li-item-a" href="#">
<?php esc_html_e( 'Edit', 'task_breaker' ); ?>
<?php esc_html_e( 'Edit', 'task-breaker' ); ?>
</a>
</li>
<?php if ( $user_access->can_edit_project( $__post->ID ) ) { ?>
<li class="task_breaker-project-tab-li-item">
<a data-content="task_breaker-project-settings" class="task_breaker-project-tab-li-item-a" href="#tasks/settings">
<?php esc_html_e( 'Settings', 'task_breaker' ); ?>
<?php esc_html_e( 'Settings', 'task-breaker' ); ?>
</a>
</li>
<?php } ?>
Expand All @@ -75,7 +82,7 @@
<div id="task-breaker-access-project-not-allowed" class="row">
<div class="col-xs-12">
<div class="task-breaker-message info">
<?php esc_attr_e( 'This project can only be accessed by group members. Use the button below join the group and receive an access to this project.', 'task_breaker' ); ?>
<?php esc_attr_e( 'This project can only be accessed by group members. Use the button below join the group and receive an access to this project.', 'task-breaker' ); ?>
</div>
</div>
</div>
Expand All @@ -86,14 +93,14 @@

<?php $join_link = wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ); ?>

<a class="button" href="<?php echo esc_url( $join_link ); ?>" title="<?php esc_attr_e( 'Join Group', 'task_breaker' ); ?>">
<?php esc_attr_e( 'Join Group', 'task_breaker' ); ?>
<a class="button" href="<?php echo esc_url( $join_link ); ?>" title="<?php esc_attr_e( 'Join Group', 'task-breaker' ); ?>">
<?php esc_attr_e( 'Join Group', 'task-breaker' ); ?>
</a>

<?php } ?>
</div><!--#task_breaker-project-->
<?php } else { ?>
<p id="message" class="info">
<?php _e( 'Please enable BuddyPress Groups Components.', 'task_breaker' ); ?>
<?php _e( 'Please enable BuddyPress Groups Components.', 'task-breaker' ); ?>
</p>
<?php } ?>

0 comments on commit 6c4e86c

Please sign in to comment.