Skip to content

Commit

Permalink
UX tweak with Course Structure.
Browse files Browse the repository at this point in the history
Added course price to listing.
Updated CSS, Assets.svg
Fixed 'Delete Student' logic bug.
Removed default nav item 'Sign Up'.
Altered login/signup shortcode.
  • Loading branch information
rheinardkorf committed Jul 30, 2014
1 parent 375ccea commit 2947332
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 29 deletions.
48 changes: 26 additions & 22 deletions coursepress.php
Original file line number Diff line number Diff line change
Expand Up @@ -1060,9 +1060,13 @@ function courses_archive_custom_content( $content ) {
} */

if ( $content_shown[$GLOBALS['post']->ID] !== 1 ) {//make sure that we don't apply the filter on more than one content / excerpt on the page per post
if ( ! isset($content_shown[$GLOBALS['post']->ID]) || $content_shown[$GLOBALS['post']->ID] !== 1 ) {//make sure that we don't apply the filter on more than one content / excerpt on the page per post
include( $this->plugin_dir . 'includes/templates/archive-courses-single.php' );
$content_shown[$GLOBALS['post']->ID] ++;
if( ! isset($content_shown[$GLOBALS['post']->ID]) ) {
$content_shown[$GLOBALS['post']->ID] = 1;
} else {
$content_shown[$GLOBALS['post']->ID] ++;
}
}
}

Expand Down Expand Up @@ -2661,16 +2665,16 @@ function main_navigation_links( $sorted_menu_items, $args ) {

/* Sign up page */

$signup = new stdClass;

if ( !$is_in ) {
$signup->title = __('Sign Up', 'cp');
$signup->menu_item_parent = 0;
$signup->ID = 'cp-signup';
$signup->db_id = '';
$signup->url = trailingslashit(site_url() . '/' . $this->get_signup_slug());
$sorted_menu_items[] = $signup;
}
// $signup = new stdClass;
//
// if ( !$is_in ) {
// $signup->title = __('Sign Up', 'cp');
// $signup->menu_item_parent = 0;
// $signup->ID = 'cp-signup';
// $signup->db_id = '';
// $signup->url = trailingslashit(site_url() . '/' . $this->get_signup_slug());
// $sorted_menu_items[] = $signup;
// }

/* Log in / Log out links */

Expand Down Expand Up @@ -2743,16 +2747,16 @@ function main_navigation_links_fallback( $current_menu ) {

/* Sign up page */

$signup = new stdClass;

if ( !$is_in ) {
$signup->title = __('Sign Up', 'cp');
$signup->menu_item_parent = 0;
$signup->ID = 'cp-signup';
$signup->db_id = '';
$signup->url = trailingslashit(site_url() . '/' . $this->get_signup_slug());
$main_sorted_menu_items[] = $signup;
}
// $signup = new stdClass;
//
// if ( !$is_in ) {
// $signup->title = __('Sign Up', 'cp');
// $signup->menu_item_parent = 0;
// $signup->ID = 'cp-signup';
// $signup->db_id = '';
// $signup->url = trailingslashit(site_url() . '/' . $this->get_signup_slug());
// $main_sorted_menu_items[] = $signup;
// }

/* Log in / Log out links */

Expand Down
2 changes: 1 addition & 1 deletion css/admin_coursepress_page_course_details.css
Original file line number Diff line number Diff line change
Expand Up @@ -2291,7 +2291,7 @@ ol.tree
.tree li
{
position: relative;
margin-left: -15px;
margin-left: -20px;
list-style: none;
}

Expand Down
24 changes: 23 additions & 1 deletion css/front_general.css
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ h1.notification-title{
}

.post-type-archive-course .quick-course-info .course-lang{
width: 18%;
width: 25%;
float: left;
font-size: 12px;
font-weight: 400;
Expand All @@ -614,6 +614,28 @@ h1.notification-title{
text-overflow: ellipsis;
}

.post-type-archive-course .quick-course-info .course-cost .mp_product_price {
background-image: url( "../images/Assets.svg" );
background-position: -873px -232px;
background-repeat: no-repeat;
line-height: 0px;
margin-right: 0px;
padding: 0 0 0 20px;
}
.post-type-archive-course .quick-course-info .course-cost {
width: 25%;
float: left;
font-size: 12px;
font-weight: 400;
color: #828282;
margin-top: 13px;
display: block;
text-transform: uppercase;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.post-type-archive-course .quick-course-info .go-to-course-button{
width: 44%;
float: right;
Expand Down
3 changes: 3 additions & 0 deletions images/Assets.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions includes/admin-pages/students.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
if ( current_user_can( 'manage_options' ) || current_user_can( 'coursepress_delete_students_cap' ) ) {
$student->delete_student();
// $message = __( 'Selected students has been removed successfully.', 'cp' );
$message = __( 'Selected students has been withdrawed from all courses successfully.', 'cp' );
$message = __( 'Selected students have been withdrawn from all courses successfully. Note: The user accounts still exist.', 'cp' );
}
break;

case 'withdraw':
if ( current_user_can( 'manage_options' ) || current_user_can( 'coursepress_withdraw_students_cap' ) ) {
$student->withdraw_from_all_courses();
$message = __( 'Selected students has been withdrawed from all courses successfully.', 'cp' );
$message = __( 'Selected students have been withdrawn from all courses successfully.', 'cp' );
}
break;
}
Expand All @@ -53,7 +53,7 @@
}
$student = new Student( $_GET['student_id'] );
$student->delete_student();
$message = __( 'Selected student has been withdrawn from all courses successfully.', 'cp' );
$message = __( 'Selected student has been withdrawn from all courses successfully. Note: The user account still exists.', 'cp' );
}

if ( isset( $_GET['action'] ) && ( $_GET['action'] == 'edit' || $_GET['action'] == 'view' ) && isset( $_GET['student_id'] ) && is_numeric( $_GET['student_id'] ) ) {
Expand Down
4 changes: 2 additions & 2 deletions includes/classes/class.shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -3084,7 +3084,7 @@ function course_signup( $atts ) {
<?php do_action('after_all_signup_fields'); ?>

<label class="full">
<a href="<?php echo $login_url; ?>"><?php _e('Already have an Account?', 'cp'); ?></a>
<?php printf( __( 'Already have an account? %s%s%s!', 'cp' ), '<a href="' . $login_url . '">', __( 'Login to your account', 'cp' ), '</a>' ); ?>
</label>

<label class="full-right">
Expand Down Expand Up @@ -3135,7 +3135,7 @@ function course_signup( $atts ) {
<?php do_action('cp_form_fields'); ?>

<label class="full">
<a href="<?php echo $signup_url; ?>"><?php _e("Don't have an account? Go to Signup!", 'cp'); ?></a>
<?php printf( __( 'Don\'t have an account? %s%s%s now!', 'cp' ), '<a href="' . $signup_url . '">', __( 'Create an Account', 'cp' ), '</a>' ); ?>
</label>

<label class="full-right"><br>
Expand Down
1 change: 1 addition & 0 deletions includes/classes/class.student.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ function delete_student( $delete_user = false ) {
wp_delete_user( $this->ID ); //without reassign
} else {
$this->withdraw_from_all_courses();
delete_user_meta( $this->ID, 'role' );
}
}

Expand Down
1 change: 1 addition & 0 deletions includes/templates/archive-courses-single.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
<div class="quick-course-info <?php echo ( isset( $extended_class ) ? $extended_class : '' ); ?>">
<?php echo do_shortcode( '[course_start label="" class="course-time"]' ); ?>
<?php echo do_shortcode( '[course_language label="" class="course-lang"]' ); ?>
<?php echo do_shortcode( '[course_cost label="" class="course-cost"]' ); ?>
<?php echo do_shortcode( '[course_join_button]' ); ?>
</div>
19 changes: 19 additions & 0 deletions js/coursepress-courses.js
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,25 @@ jQuery(document).ready(function($) {
$('#marketpressprompt').click(function(event) {
$('#marketpressprompt-box').toggle();
});

$('[name="meta_course_structure_options"]').change( function(event){

if ( $( this ).prop('checked') ) {
$('.course-structure [name^="meta_show_unit"]').attr('checked', 'checked');
$('.course-structure [name^="meta_show_unit"]').val( 'on' );

$('.course-structure [name^="meta_show_page"]').attr('checked', 'checked');
$('.course-structure [name^="meta_show_page"]').val( 'on' );
} else {
$('.course-structure [name^="meta_show_unit"]').removeAttr('checked');
$('.course-structure [name^="meta_show_unit"]').val( 'off' );

$('.course-structure [name^="meta_show_page"]').removeAttr('checked');
$('.course-structure [name^="meta_show_page"]').val( 'off' );
}


});

});

Expand Down

0 comments on commit 2947332

Please sign in to comment.