Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Hemberger committed Apr 2, 2018
2 parents b31335a + 881328c commit 25046ce
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 30 deletions.
12 changes: 12 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### Changelog

#### 1.1.0 (4/2/18)
* Fixed: Conflict with LD metabox by changing WP_Query to get_posts().
* Fixed: Missing text-domain.
* Fixed: Updater conditional, so updates actually work effectively.

#### 1.0.1 (3/12/18)
* Fixed: Allow clearing of saved Groups.

#### 1.0.0 (3/12/18)
* Initial Release.
2 changes: 1 addition & 1 deletion assets/js/ld-full-access-groups.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$(document).ready(function() {
jQuery(document).ready(function($) {
$( '#ld_full_access_groups' ).select2({
placeholder: 'Select Group(s)',
});
Expand Down
7 changes: 0 additions & 7 deletions includes/CHANGES.md

This file was deleted.

45 changes: 23 additions & 22 deletions learndash-full-access-groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: LearnDash Full Access Groups
* Plugin URI: https://bizbudding.com
* Description: Allow specific Groups to access a course without start date restrictions.
* Version: 1.0.1
* Version: 1.1.0
*
* Author: BizBudding, Mike Hemberger
* Author URI: https://bizbudding.com
Expand Down Expand Up @@ -89,7 +89,7 @@ private function setup_constants() {

// Plugin version.
if ( ! defined( 'LD_FULL_ACCESS_GROUPS_VERSION' ) ) {
define( 'LD_FULL_ACCESS_GROUPS_VERSION', '1.0.1' );
define( 'LD_FULL_ACCESS_GROUPS_VERSION', '1.1.0' );
}

// Plugin Folder Path.
Expand Down Expand Up @@ -142,10 +142,9 @@ public function setup() {
public function updater() {
if ( ! class_exists( 'Puc_v4_Factory' ) ) {
require_once LD_FULL_ACCESS_GROUPS_INCLUDES_DIR . 'vendor/plugin-update-checker/plugin-update-checker.php'; // 4.4
} else {
$updater = Puc_v4_Factory::buildUpdateChecker( 'https://github.com/bizbudding/learndash-full-access-groups/', __FILE__, 'learndash-full-access-groups' );
$updater->setAuthentication( '3221386f577b42d7089c35e0b4efffcaf3570ffd' );
}
$updater = Puc_v4_Factory::buildUpdateChecker( 'https://github.com/bizbudding/learndash-full-access-groups/', __FILE__, 'learndash-full-access-groups' );
$updater->setAuthentication( '3221386f577b42d7089c35e0b4efffcaf3570ffd' );
}

/**
Expand All @@ -168,11 +167,11 @@ function register_metabox() {

add_meta_box(
'ld_full_access_groups_edit',
esc_html__( 'LearnDash Full Access Groups', 'text-domain' ),
esc_html__( 'LearnDash Full Access Groups', 'learndash-full-access-groups' ),
array( $this, 'render_metabox' ),
'sfwd-courses',
'side',
'core'
'default'
);

}
Expand All @@ -190,32 +189,34 @@ function render_metabox( $post ) {
wp_enqueue_script( 'select2' );
wp_enqueue_script( 'ld_full_access_groups' );

$args = array(
'post_type' => 'groups',
'posts_per_page' => 500,
'post_status' => 'publish',
'no_found_rows' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
);
// return;

$groups = get_posts( array(
'post_type' => 'groups',
'posts_per_page' => 500,
'post_status' => 'publish',
'orderby' => 'title',
'order' => 'ASC',
'suppress_filters' => true
) );

$groups = new WP_Query( $args );
if ( $groups ) {

if ( $groups->have_posts() ) {
// Set nonce.
wp_nonce_field( 'nonce_ld_full_access_groups_action', 'nonce_ld_full_access_groups_field' );

// Existing values.
$selected = (array) get_post_meta( $post->ID, 'ld_full_access_groups', true );

// Select field.
echo '<p><select id="ld_full_access_groups" class="ld-full-access-groups widefat" name="ld_full_access_groups[]" multiple="multiple">';
while ( $groups->have_posts() ) : $groups->the_post();
printf( '<option value="%s" %s>%s</option>', get_the_ID(), selected( in_array( get_the_ID(), $selected ) ), get_the_title() );
endwhile;
foreach ( $groups as $group ) {
printf( '<option value="%s" %s>%s</option>', $group->ID, selected( in_array( $group->ID, $selected ) ), get_the_title( $group->ID ) );
}
echo '</select></p>';
printf( '<em>%s</em>', esc_html__( 'Selected groups will have access to this course without start date restrictions. Course access/enrollment is managed by the group itself. Course prerequisites will not be affected.', 'learndash-full-access-groups' ) );
}

wp_reset_postdata();
}

}

Expand Down

0 comments on commit 25046ce

Please sign in to comment.