Version Description
- Compatible with Learnpress 3.0.0
Download this release
Release Info
Developer | leehld |
Plugin | LearnPress – Course Wishlist |
Version | 3.0.0 |
Comparing to | |
See all releases |
Code changes from version 2.0 to 3.0.0
- assets/css/wishlist.css +42 -0
- {source → assets/js}/wishlist.js +3 -3
- inc/functions.php +203 -0
- inc/load.php +250 -0
- incs/class-lp-addon-wishlist.php +0 -250
- incs/lp-wishlist-functions.php +0 -143
- languages/learnpress-wishlist-ru_RU.po +52 -52
- languages/learnpress-wishlist.pot +67 -55
- learnpress-wishlist.php +60 -10
- readme.txt +10 -7
- source/wishlist.css +0 -52
- templates/button.php +11 -4
- templates/user-wishlist.php +17 -12
- templates/wishlist-content.php +19 -5
assets/css/wishlist.css
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#learn-press-profile-tab-course-wishlist.has-courses .learn-press-message {
|
2 |
+
display: none;
|
3 |
+
}
|
4 |
+
|
5 |
+
.course-wishlist.heartbeat {
|
6 |
+
animation-name: course-wishlist-heartbeat;
|
7 |
+
animation-duration: 1s;
|
8 |
+
animation-timing-function: ease-out;
|
9 |
+
animation-delay: 3s;
|
10 |
+
animation-direction: alternate;
|
11 |
+
animation-iteration-count: infinite;
|
12 |
+
animation-fill-mode: none;
|
13 |
+
animation-play-state: running;
|
14 |
+
}
|
15 |
+
|
16 |
+
.course-wishlist.heartbeat.ajaxload {
|
17 |
+
animation-duration: 0.3s;
|
18 |
+
animation-name: course-wishlist-heartbeat-ajaxload;
|
19 |
+
animation-delay: 0s;
|
20 |
+
}
|
21 |
+
|
22 |
+
@keyframes course-wishlist-heartbeat {
|
23 |
+
0% {
|
24 |
+
transform: scale(1);
|
25 |
+
}
|
26 |
+
100% {
|
27 |
+
transform: scale(1.2);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
@keyframes course-wishlist-heartbeat-ajaxload {
|
32 |
+
0% {
|
33 |
+
transform: scale(1);
|
34 |
+
}
|
35 |
+
100% {
|
36 |
+
transform: scale(1.5);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
.learn-press-courses .learn-press-course-wishlist.wishlist-button {
|
41 |
+
width: 100%;
|
42 |
+
}
|
{source → assets/js}/wishlist.js
RENAMED
@@ -6,10 +6,10 @@
|
|
6 |
course_id = $button.attr('data-id'),
|
7 |
nonce = $button.attr('data-nonce'),
|
8 |
text = $button.data('text');
|
9 |
-
if ($button.hasClass('
|
10 |
return;
|
11 |
}
|
12 |
-
$button.addClass('
|
13 |
if (text) {
|
14 |
$button.html(text);
|
15 |
}
|
@@ -37,7 +37,7 @@
|
|
37 |
}
|
38 |
});
|
39 |
} else {
|
40 |
-
$b.removeClass('
|
41 |
.toggleClass('on', response.state == 'on')
|
42 |
.prop('title', response.title)
|
43 |
.html(response.button_text);
|
6 |
course_id = $button.attr('data-id'),
|
7 |
nonce = $button.attr('data-nonce'),
|
8 |
text = $button.data('text');
|
9 |
+
if ($button.hasClass('ajaxload_wishlist')) {
|
10 |
return;
|
11 |
}
|
12 |
+
$button.addClass('ajaxload_wishlist').prop('disabled', true);
|
13 |
if (text) {
|
14 |
$button.html(text);
|
15 |
}
|
37 |
}
|
38 |
});
|
39 |
} else {
|
40 |
+
$b.removeClass('ajaxload_wishlist')
|
41 |
.toggleClass('on', response.state == 'on')
|
42 |
.prop('title', response.title)
|
43 |
.html(response.button_text);
|
inc/functions.php
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* LearnPress Wishlist Functions
|
4 |
+
*
|
5 |
+
* Define common functions for both front-end and back-end
|
6 |
+
*
|
7 |
+
* @author ThimPress
|
8 |
+
* @package LearnPress/Wishlist/Functions
|
9 |
+
* @version 3.0.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Prevent loading this file directly
|
13 |
+
defined( 'ABSPATH' ) || exit;
|
14 |
+
|
15 |
+
if ( ! function_exists( 'learn_press_course_wishlist_template' ) ) {
|
16 |
+
/**
|
17 |
+
* Get wishlist template.
|
18 |
+
*
|
19 |
+
* @param $name
|
20 |
+
* @param null $args
|
21 |
+
*/
|
22 |
+
function learn_press_course_wishlist_template( $name, $args = null ) {
|
23 |
+
LP_Addon_Wishlist::instance()->get_template($name, $args);
|
24 |
+
//learn_press_get_template( $name, $args, learn_press_template_path() . '/addons/wishlist/', LP_ADDON_WISHLIST_TEMPLATE );
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
if ( ! function_exists( 'learn_press_user_wishlist_has_course' ) ) {
|
29 |
+
/**
|
30 |
+
* Check user has course in wishlist.
|
31 |
+
*
|
32 |
+
* @param null $course_id
|
33 |
+
* @param null $user_id
|
34 |
+
*
|
35 |
+
* @return bool
|
36 |
+
*/
|
37 |
+
function learn_press_user_wishlist_has_course( $course_id = null, $user_id = null ) {
|
38 |
+
if ( ! $course_id ) {
|
39 |
+
$course_id = get_the_ID();
|
40 |
+
}
|
41 |
+
|
42 |
+
if ( ! $user_id ) {
|
43 |
+
$user_id = get_current_user_id();
|
44 |
+
}
|
45 |
+
|
46 |
+
$wish_list = (array) get_user_meta( $user_id, '_lpr_wish_list', true );
|
47 |
+
|
48 |
+
return in_array( $course_id, $wish_list );
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
add_action( 'learn_press_after_take_course', 'learn_press_update_wish_list', 10, 2 );
|
53 |
+
if ( ! function_exists( 'learn_press_update_wish_list' ) ) {
|
54 |
+
/**
|
55 |
+
* Update user's wishlist.
|
56 |
+
*
|
57 |
+
* @param $user_id
|
58 |
+
* @param $course_id
|
59 |
+
*/
|
60 |
+
function learn_press_update_wish_list( $user_id, $course_id ) {
|
61 |
+
if ( ! $user_id || ! $course_id ) {
|
62 |
+
return;
|
63 |
+
}
|
64 |
+
$wish_list = get_user_meta( $user_id, '_lpr_wish_list', true );
|
65 |
+
if ( ! $wish_list ) {
|
66 |
+
$wish_list = array();
|
67 |
+
}
|
68 |
+
$key = array_search( $course_id, $wish_list );
|
69 |
+
if ( $key !== false ) {
|
70 |
+
unset( $wish_list[ $key ] );
|
71 |
+
}
|
72 |
+
update_user_meta( $user_id, '_lpr_wish_list', $wish_list );
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
add_filter( 'learn_press_profile_tabs', 'learn_press_wishlist_tab', 10, 2 );
|
77 |
+
if ( ! function_exists( 'learn_press_wishlist_tab' ) ) {
|
78 |
+
/**
|
79 |
+
* Add wishlist tab into profile page.
|
80 |
+
*
|
81 |
+
* @param $tabs
|
82 |
+
* @param $user
|
83 |
+
*
|
84 |
+
* @return mixed
|
85 |
+
*/
|
86 |
+
function learn_press_wishlist_tab( $tabs, $user ) {
|
87 |
+
$content = '';
|
88 |
+
|
89 |
+
$tabs[35] = array(
|
90 |
+
'tab_id' => 'user_wishlist',
|
91 |
+
'tab_name' => __( 'Wishlist', 'learnpress_wishlist' ),
|
92 |
+
'tab_content' => apply_filters( 'learn_press_user_wishlist_tab_content', $content, $user )
|
93 |
+
);
|
94 |
+
// Private customize
|
95 |
+
if ( $user->ID != get_current_user_id() ) {
|
96 |
+
unset ( $tabs[35] );
|
97 |
+
}
|
98 |
+
|
99 |
+
return $tabs;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
add_filter( 'learn_press_user_wishlist_tab_content', 'learn_press_user_wishlist_tab_content', 10, 2 );
|
104 |
+
if ( ! function_exists( 'learn_press_user_wishlist_tab_content' ) ) {
|
105 |
+
/**
|
106 |
+
* Setup wishlist tab content.
|
107 |
+
*
|
108 |
+
* @param $content
|
109 |
+
* @param $user
|
110 |
+
*
|
111 |
+
* @return string
|
112 |
+
*/
|
113 |
+
function learn_press_user_wishlist_tab_content( $content, $user ) {
|
114 |
+
ob_start();
|
115 |
+
learn_press_course_wishlist_template( 'user-wishlist.php', array( 'user' => $user ) );
|
116 |
+
$content .= ob_get_clean();
|
117 |
+
|
118 |
+
return $content;
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
if ( ! function_exists( 'learn_press_buddypress_is_active' ) ) {
|
123 |
+
/**
|
124 |
+
* Check BuddyPress active.
|
125 |
+
*
|
126 |
+
* @return bool
|
127 |
+
*/
|
128 |
+
function learn_press_buddypress_is_active() {
|
129 |
+
if ( ! function_exists( 'is_plugin_active' ) ) {
|
130 |
+
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
131 |
+
}
|
132 |
+
|
133 |
+
return class_exists( 'BuddyPress' ) && is_plugin_active( 'buddypress/bp-loader.php' );
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
if ( learn_press_buddypress_is_active() ) {
|
138 |
+
|
139 |
+
/*
|
140 |
+
* Set up sub admin bar wishlist.
|
141 |
+
*/
|
142 |
+
add_filter( 'learn_press_bp_courses_bar', 'learn_press_bp_courses_bar_wishlist', 20 );
|
143 |
+
function learn_press_bp_courses_bar_wishlist( $wp_admin_nav ) {
|
144 |
+
|
145 |
+
$courses_slug = apply_filters( 'learn_press_bp_courses_slug', '' );
|
146 |
+
$courses_link = learn_press_get_current_bp_link();
|
147 |
+
|
148 |
+
$wp_admin_nav[] = array(
|
149 |
+
'parent' => 'my-account-' . $courses_slug,
|
150 |
+
'id' => 'my-account-' . $courses_slug . '-wishlist',
|
151 |
+
'title' => __( 'Wishlist', 'learnpress_wishlist' ),
|
152 |
+
'href' => trailingslashit( $courses_link . 'wishlist' )
|
153 |
+
);
|
154 |
+
|
155 |
+
return $wp_admin_nav;
|
156 |
+
}
|
157 |
+
|
158 |
+
/*
|
159 |
+
* Setup sub navigation wishlist.
|
160 |
+
*/
|
161 |
+
if ( bp_is_my_profile() || current_user_can( 'manage_options' ) ) {
|
162 |
+
add_filter( 'learn_press_bp_courses_sub_navs', 'learn_press_bp_courses_nav_wishlist' );
|
163 |
+
|
164 |
+
function learn_press_bp_courses_nav_wishlist( $sub_navs ) {
|
165 |
+
$nav_wishlist = array(
|
166 |
+
'name' => __( 'Wishlist', 'learnpress_wishlist' ),
|
167 |
+
'slug' => 'wishlist',
|
168 |
+
'show_for_displayed_user' => false,
|
169 |
+
'position' => 10,
|
170 |
+
'screen_function' => 'learn_press_bp_courses_wishlist',
|
171 |
+
'parent_url' => learn_press_get_current_bp_link(),
|
172 |
+
'parent_slug' => apply_filters( 'learn_press_bp_courses_slug', '' ),
|
173 |
+
);
|
174 |
+
array_push( $sub_navs, $nav_wishlist );
|
175 |
+
|
176 |
+
return $sub_navs;
|
177 |
+
}
|
178 |
+
|
179 |
+
function learn_press_bp_courses_wishlist() {
|
180 |
+
add_action( 'bp_template_title', 'learn_press_bp_courses_wishlist_title' );
|
181 |
+
add_action( 'bp_template_content', 'learn_press_bp_courses_wishlist_content' );
|
182 |
+
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
183 |
+
}
|
184 |
+
|
185 |
+
/*
|
186 |
+
* Setup title of navigation all.
|
187 |
+
*/
|
188 |
+
function learn_press_bp_courses_wishlist_title() {
|
189 |
+
echo __( 'Your wishlist', 'learnpress_wishlist' );
|
190 |
+
}
|
191 |
+
|
192 |
+
/*
|
193 |
+
* Setup content of navigation all.
|
194 |
+
*/
|
195 |
+
function learn_press_bp_courses_wishlist_content() {
|
196 |
+
global $bp;
|
197 |
+
echo apply_filters( 'learn_press_user_wishlist_tab_content', '', get_user_by( 'id', $bp->displayed_user->id ) );
|
198 |
+
}
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
|
203 |
+
|
inc/load.php
ADDED
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin load class.
|
4 |
+
*
|
5 |
+
* @author ThimPress
|
6 |
+
* @package LearnPress/Wishlist/Classes
|
7 |
+
* @version 3.0.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Prevent loading this file directly
|
11 |
+
defined( 'ABSPATH' ) || exit;
|
12 |
+
|
13 |
+
if ( ! class_exists( 'LP_Addon_Wishlist' ) ) {
|
14 |
+
/**
|
15 |
+
* Class LP_Addon_Wishlist.
|
16 |
+
*/
|
17 |
+
class LP_Addon_Wishlist extends LP_Addon {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
protected $_tab_slug = '';
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var string
|
26 |
+
*/
|
27 |
+
public $version = LP_ADDON_WISHLIST_VER;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
public $require_version = LP_ADDON_WISHLIST_REQUIRE_VER;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* LP_Addon_Wishlist constructor.
|
36 |
+
*/
|
37 |
+
public function __construct() {
|
38 |
+
parent::__construct();
|
39 |
+
$this->_tab_slug = sanitize_title( __( 'wishlist', 'learnpress-wishlist' ) );
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Defined constants.
|
44 |
+
*/
|
45 |
+
protected function _define_constants() {
|
46 |
+
define( 'LP_ADDON_WISHLIST_PATH', dirname( LP_ADDON_WISHLIST_FILE ) );
|
47 |
+
define( 'LP_ADDON_WISHLIST_INC', LP_ADDON_WISHLIST_PATH . '/inc/' );
|
48 |
+
define( 'LP_ADDON_WISHLIST_TEMPLATE', LP_ADDON_WISHLIST_PATH . '/templates/' );
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Includes files.
|
53 |
+
*/
|
54 |
+
protected function _includes() {
|
55 |
+
include_once LP_ADDON_WISHLIST_INC . 'functions.php';
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Init hooks.
|
60 |
+
*/
|
61 |
+
protected function _init_hooks() {
|
62 |
+
add_action( 'learn-press/after-course-buttons', array( $this, 'wishlist_button' ), 100 );
|
63 |
+
add_filter( 'learn-press/profile-tabs', array( $this, 'wishlist_tab' ), 100, 2 );
|
64 |
+
add_filter( 'learn_press_profile_tab_endpoints', array( $this, 'profile_tab_endpoints' ) );
|
65 |
+
|
66 |
+
LP_Request_Handler::register_ajax( 'toggle_course_wishlist', array( $this, 'toggle_course_wishlist' ) );
|
67 |
+
|
68 |
+
$this->rewrite_endpoint();
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Wishlist scripts.
|
74 |
+
*/
|
75 |
+
protected function _enqueue_assets() {
|
76 |
+
wp_enqueue_style( 'lp-course-wishlist-style', untrailingslashit( plugins_url( '/', LP_ADDON_WISHLIST_FILE ) ) . '/assets/css/wishlist.css' );
|
77 |
+
wp_enqueue_script( 'lp-course-wishlist-script', untrailingslashit( plugins_url( '/', LP_ADDON_WISHLIST_FILE ) ) . '/assets/js/wishlist.js', array( 'jquery' ) );
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Rewrite endpoint.
|
82 |
+
*/
|
83 |
+
public function rewrite_endpoint() {
|
84 |
+
$endpoint = preg_replace( '!_!', '-', $this->get_tab_slug() );
|
85 |
+
LP()->query_vars[ $endpoint ] = $endpoint;
|
86 |
+
add_rewrite_endpoint( $endpoint, EP_ROOT | EP_PAGES );
|
87 |
+
}
|
88 |
+
|
89 |
+
public function profile_tab_endpoints( $endpoints ) {
|
90 |
+
$endpoints[] = $this->get_tab_slug();
|
91 |
+
|
92 |
+
return $endpoints;
|
93 |
+
}
|
94 |
+
|
95 |
+
public function toggle_course_wishlist() {
|
96 |
+
sleep( 1 );
|
97 |
+
$nonce = ! empty( $_POST['nonce'] ) ? $_POST['nonce'] : null;
|
98 |
+
if ( ! wp_verify_nonce( $nonce, 'course-toggle-wishlist' ) ) {
|
99 |
+
die ( __( 'You have not permission to do this action', 'learnpress-wishlist' ) );
|
100 |
+
}
|
101 |
+
|
102 |
+
$course_id = ! empty( $_POST['course_id'] ) ? absint( $_POST['course_id'] ) : 0;
|
103 |
+
$user_id = get_current_user_id();
|
104 |
+
|
105 |
+
if ( ( get_post_type( $course_id ) != 'lp_course' ) || ! $user_id ) {
|
106 |
+
return;
|
107 |
+
}
|
108 |
+
$state = ! empty( $_POST['state'] ) ? $_POST['state'] : false;
|
109 |
+
$wishlist = (array) get_user_meta( $user_id, '_lpr_wish_list', true );
|
110 |
+
if ( $state === false ) {
|
111 |
+
$state = in_array( $course_id, $wishlist ) ? 'off' : 'on';
|
112 |
+
}
|
113 |
+
$pos = array_search( $course_id, $wishlist );
|
114 |
+
if ( $state == 'on' ) {
|
115 |
+
if ( $pos === false ) {
|
116 |
+
$wishlist[] = $course_id;
|
117 |
+
}
|
118 |
+
} else {
|
119 |
+
if ( $pos !== false ) {
|
120 |
+
unset( $wishlist[ $pos ] );
|
121 |
+
}
|
122 |
+
}
|
123 |
+
if ( sizeof( $wishlist ) ) {
|
124 |
+
update_user_meta( $user_id, '_lpr_wish_list', $wishlist );
|
125 |
+
} else {
|
126 |
+
delete_user_meta( $user_id, '_lpr_wish_list' );
|
127 |
+
}
|
128 |
+
learn_press_send_json(
|
129 |
+
array(
|
130 |
+
'state' => $state,
|
131 |
+
'course_id' => $course_id,
|
132 |
+
'user_id' => $user_id,
|
133 |
+
'title' => $this->_get_state_title( $state ),
|
134 |
+
'message' => '',
|
135 |
+
'button_text' => $state != 'on' ? __( 'Add to Wishlist', 'learnpress-wishlist' ) : __( 'Remove from Wishlist', 'learnpress-wishlist' )
|
136 |
+
)
|
137 |
+
);
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* @param string $state
|
142 |
+
*
|
143 |
+
* @return mixed
|
144 |
+
*/
|
145 |
+
private function _get_state_title( $state = 'on' ) {
|
146 |
+
return $state == 'on' ? __( 'Remove this course from your wishlist', 'learnpress-wishlist' ) : __( 'Add this course to your wishlist', 'learnpress-wishlist' );
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @param string $state
|
151 |
+
*
|
152 |
+
* @return mixed
|
153 |
+
*/
|
154 |
+
private function _get_state_message( $state = 'on' ) {
|
155 |
+
return $state == 'on' ? __( 'This course added to your wishlist', 'learnpress-wishlist' ) : __( 'This course removed from your wishlist', 'learnpress-wishlist' );
|
156 |
+
}
|
157 |
+
|
158 |
+
/*
|
159 |
+
* Show wishlist button
|
160 |
+
*/
|
161 |
+
public function wishlist_button( $course_id = null ) {
|
162 |
+
$user_id = get_current_user_id();
|
163 |
+
if ( ! $course_id ) {
|
164 |
+
$course_id = get_the_ID();
|
165 |
+
}
|
166 |
+
|
167 |
+
// If user or course are invalid then return.
|
168 |
+
if ( ! $user_id || ! $course_id ) {
|
169 |
+
return;
|
170 |
+
}
|
171 |
+
|
172 |
+
$classes = array( 'course-wishlist' /* dashicons dashicons-heart heartbeat'*/ );
|
173 |
+
$state = learn_press_user_wishlist_has_course( $course_id, $user_id ) ? 'on' : 'off';
|
174 |
+
|
175 |
+
if ( $state == 'on' ) {
|
176 |
+
$classes[] = 'on';
|
177 |
+
}
|
178 |
+
$classes = apply_filters( 'learn_press_course_wishlist_button_classes', $classes, $course_id );
|
179 |
+
$title = $this->_get_state_title( $state );
|
180 |
+
|
181 |
+
// fetch template
|
182 |
+
learn_press_course_wishlist_template( 'button.php', compact( 'user_id', 'course_id', 'classes', 'title', 'state' ) );
|
183 |
+
}
|
184 |
+
|
185 |
+
public function get_tab_slug() {
|
186 |
+
return apply_filters( 'learn_press_course_wishlist_tab_slug', $this->_tab_slug, $this );
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Add Wishlist tab to user profile.
|
191 |
+
*
|
192 |
+
* @param $tabs
|
193 |
+
*
|
194 |
+
* @return mixed
|
195 |
+
*/
|
196 |
+
public function wishlist_tab( $tabs ) {
|
197 |
+
$tabs[ $this->get_tab_slug() ] = array(
|
198 |
+
'title' => __( 'Wishlist', 'learnpress-wishlist' ),
|
199 |
+
'slug' => $this->get_tab_slug(),
|
200 |
+
'callback' => array( $this, 'wishlist_tab_content' ),
|
201 |
+
'priority' => 20
|
202 |
+
);
|
203 |
+
|
204 |
+
return $tabs;
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Display content of tab Wishlist
|
209 |
+
*
|
210 |
+
* @param $tab
|
211 |
+
* @param $user
|
212 |
+
* @param $tabs
|
213 |
+
*/
|
214 |
+
public function wishlist_tab_content( $tab, $tabs, $user ) {
|
215 |
+
$viewing_user = $user->get_user();
|
216 |
+
learn_press_course_wishlist_template(
|
217 |
+
'user-wishlist.php',
|
218 |
+
array(
|
219 |
+
'user' => $user,
|
220 |
+
'wishlist' => $this->get_wishlist_courses( $viewing_user->get_id() )
|
221 |
+
)
|
222 |
+
);
|
223 |
+
}
|
224 |
+
|
225 |
+
public function get_wishlist_courses( $user_id ) {
|
226 |
+
$pid = (array) get_user_meta( $user_id, '_lpr_wish_list', true );
|
227 |
+
|
228 |
+
$args = array(
|
229 |
+
'post_type' => 'lp_course',
|
230 |
+
'post__in' => $pid,
|
231 |
+
'post_status' => 'publish',
|
232 |
+
'ignore_sticky_posts' => true,
|
233 |
+
'posts_per_page' => - 1
|
234 |
+
);
|
235 |
+
$query = new WP_Query( $args );
|
236 |
+
$wishlist = array();
|
237 |
+
global $post;
|
238 |
+
if ( $query->have_posts() ) :
|
239 |
+
while ( $query->have_posts() ) : $query->the_post();
|
240 |
+
$wishlist[ $post->ID ] = $post;
|
241 |
+
endwhile;
|
242 |
+
endif;
|
243 |
+
wp_reset_postdata();
|
244 |
+
|
245 |
+
return $wishlist;
|
246 |
+
}
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
add_action( 'plugins_loaded', array( 'LP_Addon_Wishlist', 'instance' ) );
|
incs/class-lp-addon-wishlist.php
DELETED
@@ -1,250 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( !defined( 'ABSPATH' ) ) {
|
4 |
-
exit; // Exit if accessed directly
|
5 |
-
}
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Class LP_Addon_Wishlist
|
9 |
-
*/
|
10 |
-
class LP_Addon_Wishlist {
|
11 |
-
/**
|
12 |
-
* @var bool
|
13 |
-
*/
|
14 |
-
protected static $_instance = false;
|
15 |
-
|
16 |
-
/**
|
17 |
-
* @var string
|
18 |
-
*/
|
19 |
-
protected $_tab_slug = 'wishlist';
|
20 |
-
|
21 |
-
/**
|
22 |
-
* LP_Addon_Wishlist constructor.
|
23 |
-
*/
|
24 |
-
function __construct() {
|
25 |
-
|
26 |
-
if ( !function_exists( 'learn_press_load_plugin_text_domain' ) ) {
|
27 |
-
return;
|
28 |
-
}
|
29 |
-
|
30 |
-
$this->_tab_slug = sanitize_title( __( 'wishlist', 'learnpress-wishlist' ) );
|
31 |
-
add_action( 'init', array( $this, 'init' ) );
|
32 |
-
|
33 |
-
//add_action( 'learn_press_entry_footer_archive', array( $this, 'wishlist_button' ), 10 );
|
34 |
-
//add_action( 'learn_press_course_landing_content', array( $this, 'wishlist_button' ), 10 );
|
35 |
-
//add_action( 'learn_press_course_learning_content', array( $this, 'wishlist_button' ), 10 );
|
36 |
-
|
37 |
-
add_action( 'learn_press_content_learning_summary', array( $this, 'wishlist_button' ), 100 );
|
38 |
-
add_filter( 'learn_press_user_profile_tabs', array( $this, 'wishlist_tab' ), 100, 2 );
|
39 |
-
add_filter( 'learn_press_profile_tab_endpoints', array( $this, 'profile_tab_endpoints' ) );
|
40 |
-
add_action( 'plugins_loaded', array( __CLASS__, 'load_text_domain' ) );
|
41 |
-
add_action( 'init', array( $this, 'require_functions' ) );
|
42 |
-
//add_action( 'learn_press_after_wishlist_course_title', array( $this, 'wishlist_button' ), 10 );
|
43 |
-
|
44 |
-
// assets
|
45 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'wishlist_scripts' ) );
|
46 |
-
|
47 |
-
// ajax actions
|
48 |
-
//add_action( 'wp_ajax_learn_press_toggle_course_wishlist', array( $this, 'toggle_course_wishlist' ) );
|
49 |
-
LP_Request_Handler::register_ajax( 'toggle_course_wishlist', array( $this, 'toggle_course_wishlist' ) );
|
50 |
-
|
51 |
-
}
|
52 |
-
|
53 |
-
function require_functions() {
|
54 |
-
include_once dirname( __FILE__ ) . '/lp-wishlist-functions.php';
|
55 |
-
}
|
56 |
-
|
57 |
-
function init() {
|
58 |
-
define( 'WISHLIST_THEME_TMPL', learn_press_template_path() . '/addons/wishlist/' );
|
59 |
-
|
60 |
-
$endpoint = preg_replace( '!_!', '-', $this->get_tab_slug() );
|
61 |
-
LP()->query_vars[$endpoint] = $endpoint;
|
62 |
-
add_rewrite_endpoint( $endpoint, EP_ROOT | EP_PAGES );
|
63 |
-
}
|
64 |
-
|
65 |
-
function profile_tab_endpoints( $endpoints ) {
|
66 |
-
$endpoints[] = $this->get_tab_slug();
|
67 |
-
return $endpoints;
|
68 |
-
}
|
69 |
-
|
70 |
-
function toggle_course_wishlist() {
|
71 |
-
sleep( 1 );
|
72 |
-
$nonce = !empty( $_POST['nonce'] ) ? $_POST['nonce'] : null;
|
73 |
-
if ( !wp_verify_nonce( $nonce, 'course-toggle-wishlist' ) ) {
|
74 |
-
die ( __( 'You have not permission to do this action', 'learnpress-wishlist' ) );
|
75 |
-
}
|
76 |
-
|
77 |
-
$course_id = !empty( $_POST['course_id'] ) ? absint( $_POST['course_id'] ) : 0;
|
78 |
-
$user_id = get_current_user_id();
|
79 |
-
|
80 |
-
if ( ( get_post_type( $course_id ) != 'lp_course' ) || !$user_id ) {
|
81 |
-
return;
|
82 |
-
}
|
83 |
-
$state = !empty( $_POST['state'] ) ? $_POST['state'] : false;
|
84 |
-
$wishlist = (array) get_user_meta( $user_id, '_lpr_wish_list', true );
|
85 |
-
if ( $state === false ) {
|
86 |
-
$state = in_array( $course_id, $wishlist ) ? 'off' : 'on';
|
87 |
-
}
|
88 |
-
$pos = array_search( $course_id, $wishlist );
|
89 |
-
if ( $state == 'on' ) {
|
90 |
-
if ( $pos === false ) {
|
91 |
-
$wishlist[] = $course_id;
|
92 |
-
}
|
93 |
-
} else {
|
94 |
-
if ( $pos !== false ) {
|
95 |
-
unset( $wishlist[$pos] );
|
96 |
-
}
|
97 |
-
}
|
98 |
-
if ( sizeof( $wishlist ) ) {
|
99 |
-
update_user_meta( $user_id, '_lpr_wish_list', $wishlist );
|
100 |
-
} else {
|
101 |
-
delete_user_meta( $user_id, '_lpr_wish_list' );
|
102 |
-
}
|
103 |
-
learn_press_send_json(
|
104 |
-
array(
|
105 |
-
'state' => $state,
|
106 |
-
'course_id' => $course_id,
|
107 |
-
'user_id' => $user_id,
|
108 |
-
'title' => $this->_get_state_title( $state ),
|
109 |
-
'message' => '',
|
110 |
-
'button_text' => $state != 'on' ? __( 'Add to Wishlist', 'learnpress-wishlist' ) : __( 'Remove from Wishlist', 'learnpress-wishlist' )
|
111 |
-
)
|
112 |
-
);
|
113 |
-
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* @param string $state
|
117 |
-
*
|
118 |
-
* @return mixed
|
119 |
-
*/
|
120 |
-
private function _get_state_title( $state = 'on' ) {
|
121 |
-
return $state == 'on' ? __( 'Remove this course from your wishlist', 'learnpress-wishlist' ) : __( 'Add this course to your wishlist', 'learnpress-wishlist' );
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* @param string $state
|
126 |
-
*
|
127 |
-
* @return mixed
|
128 |
-
*/
|
129 |
-
private function _get_state_message( $state = 'on' ) {
|
130 |
-
return $state == 'on' ? __( 'This course added to your wishlist', 'learnpress-wishlist' ) : __( 'This course removed from your wishlist', 'learnpress-wishlist' );
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* Wishlist scripts processing
|
135 |
-
*/
|
136 |
-
function wishlist_scripts() {
|
137 |
-
wp_enqueue_style( 'course-wishlist-style', untrailingslashit( plugins_url( '/', LP_ADDON_WISHLIST_FILE ) ) . '/source/wishlist.css' );
|
138 |
-
wp_enqueue_script( 'course-wishlist-script', untrailingslashit( plugins_url( '/', LP_ADDON_WISHLIST_FILE ) ) . '/source/wishlist.js', array( 'jquery' ) );
|
139 |
-
}
|
140 |
-
|
141 |
-
/*
|
142 |
-
* Show wishlist button
|
143 |
-
*/
|
144 |
-
function wishlist_button( $course_id = null ) {
|
145 |
-
$user_id = get_current_user_id();
|
146 |
-
if ( !$course_id ) {
|
147 |
-
$course_id = get_the_ID();
|
148 |
-
}
|
149 |
-
|
150 |
-
// If user or course are invalid then return.
|
151 |
-
if ( !$user_id || !$course_id ) {
|
152 |
-
return;
|
153 |
-
}
|
154 |
-
|
155 |
-
$classes = array( 'course-wishlist' /* dashicons dashicons-heart heartbeat'*/ );
|
156 |
-
$state = learn_press_user_wishlist_has_course( $course_id, $user_id ) ? 'on' : 'off';
|
157 |
-
|
158 |
-
if ( $state == 'on' ) {
|
159 |
-
$classes[] = 'on';
|
160 |
-
}
|
161 |
-
$classes = apply_filters( 'learn_press_course_wishlist_button_classes', $classes, $course_id );
|
162 |
-
$title = $this->_get_state_title( $state );
|
163 |
-
|
164 |
-
// fetch template
|
165 |
-
learn_press_course_wishlist_template( 'button.php', compact( 'user_id', 'course_id', 'classes', 'title', 'state' ) );
|
166 |
-
}
|
167 |
-
|
168 |
-
function get_tab_slug() {
|
169 |
-
return apply_filters( 'learn_press_course_wishlist_tab_slug', $this->_tab_slug, $this );
|
170 |
-
}
|
171 |
-
|
172 |
-
/**
|
173 |
-
* Add Wishlist tab to user profile
|
174 |
-
*
|
175 |
-
* @param $tabs
|
176 |
-
* @param $user
|
177 |
-
*
|
178 |
-
* @return mixed
|
179 |
-
*/
|
180 |
-
function wishlist_tab( $tabs, $user ) {
|
181 |
-
$tabs[$this->get_tab_slug()] = array(
|
182 |
-
'title' => __( 'Wishlist', 'learnpress-wishlist' ),
|
183 |
-
'callback' => array( $this, 'wishlist_tab_content' )
|
184 |
-
);
|
185 |
-
return $tabs;
|
186 |
-
}
|
187 |
-
|
188 |
-
/**
|
189 |
-
* Display content of tab Wishlist
|
190 |
-
*
|
191 |
-
* @param $tab
|
192 |
-
* @param $user
|
193 |
-
* @param $tabs
|
194 |
-
*/
|
195 |
-
function wishlist_tab_content( $tab, $tabs, $user ) {
|
196 |
-
learn_press_course_wishlist_template(
|
197 |
-
'user-wishlist.php',
|
198 |
-
array(
|
199 |
-
'user' => $user,
|
200 |
-
'wishlist' => $this->get_wishlist_courses( $user->id )
|
201 |
-
)
|
202 |
-
);
|
203 |
-
}
|
204 |
-
|
205 |
-
function get_wishlist_courses( $user_id ) {
|
206 |
-
$pid = (array) get_user_meta( $user_id, '_lpr_wish_list', true );
|
207 |
-
|
208 |
-
$args = array(
|
209 |
-
'post_type' => 'lp_course',
|
210 |
-
'post__in' => $pid,
|
211 |
-
'post_status' => 'publish',
|
212 |
-
'ignore_sticky_posts' => true,
|
213 |
-
'posts_per_page' => - 1
|
214 |
-
);
|
215 |
-
$query = new WP_Query( $args );
|
216 |
-
$wishlist = array();
|
217 |
-
global $post;
|
218 |
-
if ( $query->have_posts() ) :
|
219 |
-
while ( $query->have_posts() ) : $query->the_post();
|
220 |
-
$wishlist[$post->ID] = $post;
|
221 |
-
endwhile;
|
222 |
-
endif;
|
223 |
-
wp_reset_postdata();
|
224 |
-
|
225 |
-
return $wishlist;
|
226 |
-
}
|
227 |
-
|
228 |
-
/**
|
229 |
-
* @return bool|LP_Addon_Wishlist
|
230 |
-
*/
|
231 |
-
static function instance() {
|
232 |
-
if ( !self::$_instance ) {
|
233 |
-
self::$_instance = new self();
|
234 |
-
}
|
235 |
-
return self::$_instance;
|
236 |
-
}
|
237 |
-
|
238 |
-
/**
|
239 |
-
* Load text domain for addon
|
240 |
-
*/
|
241 |
-
static function load_text_domain() {
|
242 |
-
if( function_exists('learn_press_load_plugin_text_domain')){ learn_press_load_plugin_text_domain(LP_ADDON_WISHLIST_PATH, true ); }
|
243 |
-
}
|
244 |
-
}
|
245 |
-
|
246 |
-
add_action( 'learn_press_ready', array( 'LP_Addon_Wishlist', 'instance' ) );
|
247 |
-
|
248 |
-
function learn_press_course_wishlist_template( $name, $args = null ) {
|
249 |
-
learn_press_get_template( $name, $args, WISHLIST_THEME_TMPL, WISHLIST_TMPL );
|
250 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
incs/lp-wishlist-functions.php
DELETED
@@ -1,143 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
function learn_press_user_wishlist_has_course( $course_id = null, $user_id = null ) {
|
4 |
-
if ( !$course_id ) {
|
5 |
-
$course_id = get_the_ID();
|
6 |
-
}
|
7 |
-
|
8 |
-
if ( !$user_id ) {
|
9 |
-
$user_id = get_current_user_id();
|
10 |
-
}
|
11 |
-
|
12 |
-
$wish_list = (array) get_user_meta( $user_id, '_lpr_wish_list', true );
|
13 |
-
return in_array( $course_id, $wish_list );
|
14 |
-
}
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Update user's wish list
|
18 |
-
*
|
19 |
-
* @param $user_id
|
20 |
-
* @param $course_id
|
21 |
-
*/
|
22 |
-
add_action( 'learn_press_after_take_course', 'learn_press_update_wish_list', 10, 2 );
|
23 |
-
function learn_press_update_wish_list( $user_id, $course_id ) {
|
24 |
-
if ( !$user_id || !$course_id ) {
|
25 |
-
return;
|
26 |
-
}
|
27 |
-
$wish_list = get_user_meta( $user_id, '_lpr_wish_list', true );
|
28 |
-
if ( !$wish_list ) {
|
29 |
-
$wish_list = array();
|
30 |
-
}
|
31 |
-
$key = array_search( $course_id, $wish_list );
|
32 |
-
if ( $key !== false ) {
|
33 |
-
unset( $wish_list[$key] );
|
34 |
-
}
|
35 |
-
update_user_meta( $user_id, '_lpr_wish_list', $wish_list );
|
36 |
-
}
|
37 |
-
|
38 |
-
/*
|
39 |
-
* Add wishlist tab into profile page
|
40 |
-
*/
|
41 |
-
add_filter( 'learn_press_profile_tabs', 'learn_press_wishlist_tab', 10, 2 );
|
42 |
-
function learn_press_wishlist_tab( $tabs, $user ) {
|
43 |
-
$content = '';
|
44 |
-
|
45 |
-
$tabs[35] = array(
|
46 |
-
'tab_id' => 'user_wishlist',
|
47 |
-
'tab_name' => __( 'Wishlist', 'learnpress_wishlist' ),
|
48 |
-
'tab_content' => apply_filters( 'learn_press_user_wishlist_tab_content', $content, $user )
|
49 |
-
);
|
50 |
-
// Private customize
|
51 |
-
if ( $user->ID != get_current_user_id() ) {
|
52 |
-
unset ( $tabs[35] );
|
53 |
-
}
|
54 |
-
return $tabs;
|
55 |
-
}
|
56 |
-
|
57 |
-
/*
|
58 |
-
* Setup wishlist tab content
|
59 |
-
*/
|
60 |
-
add_filter( 'learn_press_user_wishlist_tab_content', 'learn_press_user_wishlist_tab_content', 10, 2 );
|
61 |
-
function learn_press_user_wishlist_tab_content( $content, $user ) {
|
62 |
-
ob_start();
|
63 |
-
//learn_press_get_template( 'addons/course-wishlist/user-wishlist.php', array( 'user' => $user ) );
|
64 |
-
learn_press_course_wishlist_template( 'user-wishlist.php', array( 'user' => $user ) );
|
65 |
-
$content .= ob_get_clean();
|
66 |
-
return $content;
|
67 |
-
}
|
68 |
-
|
69 |
-
if ( !function_exists( 'learn_press_buddypress_is_active' ) ) {
|
70 |
-
function learn_press_buddypress_is_active() {
|
71 |
-
if ( !function_exists( 'is_plugin_active' ) ) {
|
72 |
-
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
73 |
-
}
|
74 |
-
|
75 |
-
return class_exists( 'BuddyPress' ) && is_plugin_active( 'buddypress/bp-loader.php' );
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
if ( learn_press_buddypress_is_active() ) {
|
80 |
-
|
81 |
-
/*
|
82 |
-
* Set up sub admin bar wishlist
|
83 |
-
*/
|
84 |
-
add_filter( 'learn_press_bp_courses_bar', 'learn_press_bp_courses_bar_wishlist', 20 );
|
85 |
-
function learn_press_bp_courses_bar_wishlist( $wp_admin_nav ) {
|
86 |
-
|
87 |
-
$courses_slug = apply_filters( 'learn_press_bp_courses_slug', '' );
|
88 |
-
$courses_link = learn_press_get_current_bp_link();
|
89 |
-
|
90 |
-
$wp_admin_nav[] = array(
|
91 |
-
'parent' => 'my-account-' . $courses_slug,
|
92 |
-
'id' => 'my-account-' . $courses_slug . '-wishlist',
|
93 |
-
'title' => __( 'Wishlist', 'learnpress_wishlist' ),
|
94 |
-
'href' => trailingslashit( $courses_link . 'wishlist' )
|
95 |
-
);
|
96 |
-
return $wp_admin_nav;
|
97 |
-
}
|
98 |
-
|
99 |
-
/*
|
100 |
-
* Setup sub navigation wishlist
|
101 |
-
*/
|
102 |
-
if ( bp_is_my_profile() || current_user_can( 'manage_options' ) ) {
|
103 |
-
add_filter( 'learn_press_bp_courses_sub_navs', 'learn_press_bp_courses_nav_wishlist' );
|
104 |
-
|
105 |
-
function learn_press_bp_courses_nav_wishlist( $sub_navs ) {
|
106 |
-
$nav_wishlist = array(
|
107 |
-
'name' => __( 'Wishlist', 'learnpress_wishlist' ),
|
108 |
-
'slug' => 'wishlist',
|
109 |
-
'show_for_displayed_user' => false,
|
110 |
-
'position' => 10,
|
111 |
-
'screen_function' => 'learn_press_bp_courses_wishlist',
|
112 |
-
'parent_url' => learn_press_get_current_bp_link(),
|
113 |
-
'parent_slug' => apply_filters( 'learn_press_bp_courses_slug', '' ),
|
114 |
-
);
|
115 |
-
array_push( $sub_navs, $nav_wishlist );
|
116 |
-
return $sub_navs;
|
117 |
-
}
|
118 |
-
|
119 |
-
function learn_press_bp_courses_wishlist() {
|
120 |
-
add_action( 'bp_template_title', 'learn_press_bp_courses_wishlist_title' );
|
121 |
-
add_action( 'bp_template_content', 'learn_press_bp_courses_wishlist_content' );
|
122 |
-
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
123 |
-
}
|
124 |
-
|
125 |
-
/*
|
126 |
-
* Setup title of navigation all
|
127 |
-
*/
|
128 |
-
function learn_press_bp_courses_wishlist_title() {
|
129 |
-
echo __( 'Your wishlist', 'learnpress_wishlist' );
|
130 |
-
}
|
131 |
-
|
132 |
-
/*
|
133 |
-
* Setup content of navigation all
|
134 |
-
*/
|
135 |
-
function learn_press_bp_courses_wishlist_content() {
|
136 |
-
global $bp;
|
137 |
-
echo apply_filters( 'learn_press_user_wishlist_tab_content', '', get_user_by( 'id', $bp->displayed_user->id ) );
|
138 |
-
}
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/learnpress-wishlist-ru_RU.po
CHANGED
@@ -1,52 +1,52 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: LearnPress Courses Wishlist\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2016-09-07 05:43+0000\n"
|
6 |
-
"PO-Revision-Date: 2016-09-07 05:47+0000\n"
|
7 |
-
"Last-Translator: tvardovsky <tvardovsky@me.com>\n"
|
8 |
-
"Language-Team: Russian\n"
|
9 |
-
"Language: ru-RU\n"
|
10 |
-
"MIME-Version: 1.0\n"
|
11 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
-
"Content-Transfer-Encoding: 8bit\n"
|
13 |
-
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10 >= 2 && "
|
14 |
-
"n%10<=4 &&(n%100<10||n%100 >= 20)? 1 : 2)\n"
|
15 |
-
"X-Generator: Loco - https://localise.biz/"
|
16 |
-
|
17 |
-
#: incs/class-lp-addon-wishlist.php:25
|
18 |
-
msgid "wishlist"
|
19 |
-
msgstr "Избранные"
|
20 |
-
|
21 |
-
#: incs/class-lp-addon-wishlist.php:69
|
22 |
-
msgid "You have not permission to do this action"
|
23 |
-
msgstr "У вас нет прав на это действие"
|
24 |
-
|
25 |
-
#: incs/class-lp-addon-wishlist.php:115
|
26 |
-
msgid "Remove this course from your wishlist"
|
27 |
-
msgstr "Удалить этот курс из Избранных"
|
28 |
-
|
29 |
-
#: incs/class-lp-addon-wishlist.php:115
|
30 |
-
msgid "Add this course to your wishlist"
|
31 |
-
msgstr "Добавить этот курс в Избранные"
|
32 |
-
|
33 |
-
#: incs/class-lp-addon-wishlist.php:124
|
34 |
-
msgid "This course added to your wishlist"
|
35 |
-
msgstr "Этот курс добавлен в Избранные"
|
36 |
-
|
37 |
-
#: incs/class-lp-addon-wishlist.php:124
|
38 |
-
msgid "This course removed from your wishlist"
|
39 |
-
msgstr "Этот курс удален из Избранных"
|
40 |
-
|
41 |
-
#: incs/class-lp-addon-wishlist.php:176 incs/lp-wishlist-functions.php:47
|
42 |
-
#: incs/lp-wishlist-functions.php:93 incs/lp-wishlist-functions.php:107
|
43 |
-
msgid "Wishlist"
|
44 |
-
msgstr "Избранные"
|
45 |
-
|
46 |
-
#: incs/lp-wishlist-functions.php:129
|
47 |
-
msgid "Your wishlist"
|
48 |
-
msgstr "Ваши Избранные"
|
49 |
-
|
50 |
-
#: template/user-wishlist.php:22
|
51 |
-
msgid "No courses in your wishlist!"
|
52 |
-
msgstr "Ваш список Избранных пуст"
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: LearnPress Courses Wishlist\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2016-09-07 05:43+0000\n"
|
6 |
+
"PO-Revision-Date: 2016-09-07 05:47+0000\n"
|
7 |
+
"Last-Translator: tvardovsky <tvardovsky@me.com>\n"
|
8 |
+
"Language-Team: Russian\n"
|
9 |
+
"Language: ru-RU\n"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10 >= 2 && "
|
14 |
+
"n%10<=4 &&(n%100<10||n%100 >= 20)? 1 : 2)\n"
|
15 |
+
"X-Generator: Loco - https://localise.biz/"
|
16 |
+
|
17 |
+
#: incs/class-lp-addon-wishlist.php:25
|
18 |
+
msgid "wishlist"
|
19 |
+
msgstr "Избранные"
|
20 |
+
|
21 |
+
#: incs/class-lp-addon-wishlist.php:69
|
22 |
+
msgid "You have not permission to do this action"
|
23 |
+
msgstr "У вас нет прав на это действие"
|
24 |
+
|
25 |
+
#: incs/class-lp-addon-wishlist.php:115
|
26 |
+
msgid "Remove this course from your wishlist"
|
27 |
+
msgstr "Удалить этот курс из Избранных"
|
28 |
+
|
29 |
+
#: incs/class-lp-addon-wishlist.php:115
|
30 |
+
msgid "Add this course to your wishlist"
|
31 |
+
msgstr "Добавить этот курс в Избранные"
|
32 |
+
|
33 |
+
#: incs/class-lp-addon-wishlist.php:124
|
34 |
+
msgid "This course added to your wishlist"
|
35 |
+
msgstr "Этот курс добавлен в Избранные"
|
36 |
+
|
37 |
+
#: incs/class-lp-addon-wishlist.php:124
|
38 |
+
msgid "This course removed from your wishlist"
|
39 |
+
msgstr "Этот курс удален из Избранных"
|
40 |
+
|
41 |
+
#: incs/class-lp-addon-wishlist.php:176 incs/lp-wishlist-functions.php:47
|
42 |
+
#: incs/lp-wishlist-functions.php:93 incs/lp-wishlist-functions.php:107
|
43 |
+
msgid "Wishlist"
|
44 |
+
msgstr "Избранные"
|
45 |
+
|
46 |
+
#: incs/lp-wishlist-functions.php:129
|
47 |
+
msgid "Your wishlist"
|
48 |
+
msgstr "Ваши Избранные"
|
49 |
+
|
50 |
+
#: template/user-wishlist.php:22
|
51 |
+
msgid "No courses in your wishlist!"
|
52 |
+
msgstr "Ваш список Избранных пуст"
|
languages/learnpress-wishlist.pot
CHANGED
@@ -1,55 +1,67 @@
|
|
1 |
-
# SOME DESCRIPTIVE TITLE.
|
2 |
-
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
3 |
-
# This file is distributed under the same license as the PACKAGE package.
|
4 |
-
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
5 |
-
#
|
6 |
-
#, fuzzy
|
7 |
-
msgid ""
|
8 |
-
msgstr ""
|
9 |
-
"Project-Id-Version: PACKAGE VERSION\n"
|
10 |
-
"Report-Msgid-Bugs-To: \n"
|
11 |
-
"POT-Creation-Date:
|
12 |
-
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13 |
-
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
-
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15 |
-
"Language: \n"
|
16 |
-
"MIME-Version: 1.0\n"
|
17 |
-
"Content-Type: text/plain; charset=CHARSET\n"
|
18 |
-
"Content-Transfer-Encoding: 8bit\n"
|
19 |
-
|
20 |
-
#: incs/
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
#: incs/
|
46 |
-
msgid "
|
47 |
-
msgstr ""
|
48 |
-
|
49 |
-
#: incs/
|
50 |
-
msgid "
|
51 |
-
msgstr ""
|
52 |
-
|
53 |
-
#:
|
54 |
-
msgid "
|
55 |
-
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# SOME DESCRIPTIVE TITLE.
|
2 |
+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
5 |
+
#
|
6 |
+
#, fuzzy
|
7 |
+
msgid ""
|
8 |
+
msgstr ""
|
9 |
+
"Project-Id-Version: PACKAGE VERSION\n"
|
10 |
+
"Report-Msgid-Bugs-To: \n"
|
11 |
+
"POT-Creation-Date: 2017-12-15 09:31+0700\n"
|
12 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15 |
+
"Language: \n"
|
16 |
+
"MIME-Version: 1.0\n"
|
17 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
18 |
+
"Content-Transfer-Encoding: 8bit\n"
|
19 |
+
|
20 |
+
#: incs/functions.php:90 incs/functions.php:150 incs/functions.php:165
|
21 |
+
#: incs/load.php:208
|
22 |
+
msgid "Wishlist"
|
23 |
+
msgstr ""
|
24 |
+
|
25 |
+
#: incs/functions.php:188
|
26 |
+
msgid "Your wishlist"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: incs/load.php:44
|
30 |
+
msgid "wishlist"
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#: incs/load.php:109
|
34 |
+
msgid "You have not permission to do this action"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#: incs/load.php:145 templates/button.php:21
|
38 |
+
msgid "Add to Wishlist"
|
39 |
+
msgstr ""
|
40 |
+
|
41 |
+
#: incs/load.php:145 templates/button.php:21
|
42 |
+
msgid "Remove from Wishlist"
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: incs/load.php:156
|
46 |
+
msgid "Remove this course from your wishlist"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: incs/load.php:156
|
50 |
+
msgid "Add this course to your wishlist"
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: incs/load.php:165
|
54 |
+
msgid "This course added to your wishlist"
|
55 |
+
msgstr ""
|
56 |
+
|
57 |
+
#: incs/load.php:165
|
58 |
+
msgid "This course removed from your wishlist"
|
59 |
+
msgstr ""
|
60 |
+
|
61 |
+
#: templates/button.php:20
|
62 |
+
msgid "Processing"
|
63 |
+
msgstr ""
|
64 |
+
|
65 |
+
#: templates/user-wishlist.php:26
|
66 |
+
msgid "No courses in your wishlist!"
|
67 |
+
msgstr ""
|
learnpress-wishlist.php
CHANGED
@@ -1,22 +1,72 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Plugin Name: LearnPress
|
4 |
Plugin URI: http://thimpress.com/learnpress
|
5 |
-
Description: Wishlist feature
|
6 |
Author: ThimPress
|
7 |
-
Version:
|
8 |
Author URI: http://thimpress.com
|
9 |
Tags: learnpress
|
10 |
Text Domain: learnpress-wishlist
|
11 |
Domain Path: /languages/
|
12 |
*/
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
|
17 |
define( 'LP_ADDON_WISHLIST_FILE', __FILE__ );
|
18 |
-
define( '
|
19 |
-
define( '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
-
|
22 |
-
require_once( LP_ADDON_WISHLIST_PATH . '/incs/class-lp-addon-wishlist.php' );
|
1 |
<?php
|
2 |
/*
|
3 |
+
Plugin Name: LearnPress - Course Wishlist
|
4 |
Plugin URI: http://thimpress.com/learnpress
|
5 |
+
Description: Wishlist feature.
|
6 |
Author: ThimPress
|
7 |
+
Version: 3.0.0
|
8 |
Author URI: http://thimpress.com
|
9 |
Tags: learnpress
|
10 |
Text Domain: learnpress-wishlist
|
11 |
Domain Path: /languages/
|
12 |
*/
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Prevent loading this file directly
|
16 |
+
*/
|
17 |
+
defined( 'ABSPATH' ) || exit();
|
18 |
|
19 |
define( 'LP_ADDON_WISHLIST_FILE', __FILE__ );
|
20 |
+
define( 'LP_ADDON_WISHLIST_VER', '3.0.0' );
|
21 |
+
define( 'LP_ADDON_WISHLIST_REQUIRE_VER', '3.0.0' );
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Class LP_Addon_Wishlist_Preload
|
25 |
+
*/
|
26 |
+
class LP_Addon_Wishlist_Preload {
|
27 |
+
|
28 |
+
/**
|
29 |
+
* LP_Addon_Wishlist_Preload constructor.
|
30 |
+
*/
|
31 |
+
public function __construct() {
|
32 |
+
add_action( 'learn-press/ready', array( $this, 'load' ) );
|
33 |
+
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Load addon
|
38 |
+
*/
|
39 |
+
public function load() {
|
40 |
+
LP_Addon::load( 'LP_Addon_Wishlist', 'inc/load.php', __FILE__ );
|
41 |
+
remove_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Admin notice
|
46 |
+
*/
|
47 |
+
public function admin_notices() {
|
48 |
+
?>
|
49 |
+
<div class="error">
|
50 |
+
<p><?php echo wp_kses(
|
51 |
+
sprintf(
|
52 |
+
__( '<strong>%s</strong> addon version %s requires %s version %s or higher is <strong>installed</strong> and <strong>activated</strong>.', 'learnpress-wishlist' ),
|
53 |
+
__( 'LearnPress Wishlist', 'learnpress-wishlist' ),
|
54 |
+
LP_ADDON_WISHLIST_VER,
|
55 |
+
sprintf( '<a href="%s" target="_blank"><strong>%s</strong></a>', admin_url( 'plugin-install.php?tab=search&type=term&s=learnpress' ), __( 'LearnPress', 'learnpress-wishlist' ) ),
|
56 |
+
LP_ADDON_WISHLIST_REQUIRE_VER
|
57 |
+
),
|
58 |
+
array(
|
59 |
+
'a' => array(
|
60 |
+
'href' => array(),
|
61 |
+
'blank' => array()
|
62 |
+
),
|
63 |
+
'strong' => array()
|
64 |
+
)
|
65 |
+
); ?>
|
66 |
+
</p>
|
67 |
+
</div>
|
68 |
+
<?php
|
69 |
+
}
|
70 |
+
}
|
71 |
|
72 |
+
new LP_Addon_Wishlist_Preload();
|
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: thimpress, tunnhn, kendy73
|
|
3 |
Donate link:
|
4 |
Tags: lms, elearning, e-learning, learning management system, education, course, courses, quiz, quizzes, questions, training, guru, sell courses
|
5 |
Requires at least: 3.8
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag:
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -32,10 +32,7 @@ Want to see it in action? See our [Educational WordPress Theme](http://themefore
|
|
32 |
- <a href="http://thimpress.com/shop/co-instructors-add-on-for-learnpress/" target="_blank">Co-instructors add-on for LearnPress</a> - multiple instructors support for each LMS course.
|
33 |
- <a href="http://thimpress.com/shop/collections-add-on-for-learnpress/" target="_blank">Collections add-on for LearnPress</a> - making LMS courses collection by selecting number of courses, this is helpful if you want to combine multiple LMS courses into a collection for a group of skills.
|
34 |
- <a href="http://thimpress.com/shop/stripe-add-on-for-learnpress/" target="_blank">Stripe Payment method for LearnPress</a> - Stripe payment method for LearnPress WordPress LMS Plugin.
|
35 |
-
- <a href="http://thimpress.com/shop/woocommerce-add-on-for-learnpress/" target="_blank">WooCommerce add-on for LearnPress</a> - using WooCommerce as payment gateway for LearnPrss WordPress LMS Plugin.
|
36 |
-
|
37 |
-
**Credit**
|
38 |
-
halink0803
|
39 |
|
40 |
== Installation ==
|
41 |
|
@@ -56,7 +53,13 @@ Check out <a href="http://docs.thimpress.com/learnpress" target="_blank">LearnPr
|
|
56 |
|
57 |
1. LearnPress Prerequisite screenshot.
|
58 |
|
59 |
-
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
= 2.0 =
|
62 |
+ Updated to be compatible with LearnPress 2.0
|
3 |
Donate link:
|
4 |
Tags: lms, elearning, e-learning, learning management system, education, course, courses, quiz, quizzes, questions, training, guru, sell courses
|
5 |
Requires at least: 3.8
|
6 |
+
Tested up to: 4.9.4
|
7 |
+
Stable tag: 3.0.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
32 |
- <a href="http://thimpress.com/shop/co-instructors-add-on-for-learnpress/" target="_blank">Co-instructors add-on for LearnPress</a> - multiple instructors support for each LMS course.
|
33 |
- <a href="http://thimpress.com/shop/collections-add-on-for-learnpress/" target="_blank">Collections add-on for LearnPress</a> - making LMS courses collection by selecting number of courses, this is helpful if you want to combine multiple LMS courses into a collection for a group of skills.
|
34 |
- <a href="http://thimpress.com/shop/stripe-add-on-for-learnpress/" target="_blank">Stripe Payment method for LearnPress</a> - Stripe payment method for LearnPress WordPress LMS Plugin.
|
35 |
+
- <a href="http://thimpress.com/shop/woocommerce-add-on-for-learnpress/" target="_blank">WooCommerce add-on for LearnPress</a> - using WooCommerce as payment gateway for LearnPrss WordPress LMS Plugin.
|
|
|
|
|
|
|
36 |
|
37 |
== Installation ==
|
38 |
|
53 |
|
54 |
1. LearnPress Prerequisite screenshot.
|
55 |
|
56 |
+
== Changelog ==
|
57 |
+
|
58 |
+
= 3.0.0 =
|
59 |
+
+ Compatible with Learnpress 3.0.0
|
60 |
+
|
61 |
+
= 2.0.1 =
|
62 |
+
+ Changed text domain to learnpress
|
63 |
|
64 |
= 2.0 =
|
65 |
+ Updated to be compatible with LearnPress 2.0
|
source/wishlist.css
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
/*.course-wishlist {
|
2 |
-
color: #d3d3d3;
|
3 |
-
transition: all 1s;
|
4 |
-
cursor: pointer;
|
5 |
-
vertical-align: middle;
|
6 |
-
}
|
7 |
-
.course-wishlist.on {
|
8 |
-
color: #ff0084;
|
9 |
-
}
|
10 |
-
|
11 |
-
.course-wishlist:hover {
|
12 |
-
color: #ff0084;
|
13 |
-
}
|
14 |
-
.course-wishlist.on:hover {
|
15 |
-
color: #d3d3d3;
|
16 |
-
}*/
|
17 |
-
#learn-press-profile-tab-course-wishlist.has-courses .learn-press-message{
|
18 |
-
display: none;
|
19 |
-
}
|
20 |
-
.course-wishlist.heartbeat{
|
21 |
-
animation-name: course-wishlist-heartbeat;
|
22 |
-
animation-duration: 1s;
|
23 |
-
animation-timing-function: ease-out;
|
24 |
-
animation-delay: 3s;
|
25 |
-
animation-direction: alternate;
|
26 |
-
animation-iteration-count: infinite;
|
27 |
-
animation-fill-mode: none;
|
28 |
-
animation-play-state: running;
|
29 |
-
}
|
30 |
-
|
31 |
-
.course-wishlist.heartbeat.ajaxload{
|
32 |
-
animation-duration: 0.3s;
|
33 |
-
animation-name: course-wishlist-heartbeat-ajaxload;
|
34 |
-
animation-delay: 0s;
|
35 |
-
}
|
36 |
-
|
37 |
-
@keyframes course-wishlist-heartbeat {
|
38 |
-
0% {
|
39 |
-
transform: scale(1);
|
40 |
-
}
|
41 |
-
100% {
|
42 |
-
transform: scale(1.2);
|
43 |
-
}
|
44 |
-
}
|
45 |
-
@keyframes course-wishlist-heartbeat-ajaxload {
|
46 |
-
0% {
|
47 |
-
transform: scale(1);
|
48 |
-
}
|
49 |
-
100% {
|
50 |
-
transform: scale(1.5);
|
51 |
-
}
|
52 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/button.php
CHANGED
@@ -1,16 +1,23 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Template for displaying button to toggle course wishlist on/off
|
|
|
|
|
4 |
*
|
5 |
* @author ThimPress
|
|
|
|
|
6 |
*/
|
7 |
-
|
|
|
|
|
|
|
8 |
printf(
|
9 |
-
'<button class="learn-press-course-wishlist-button-%2$d %s" data-id="%s" data-nonce="%s" title="%s" data-text="%s">%s</button>',
|
10 |
join( " ", $classes ),
|
11 |
$course_id,
|
12 |
wp_create_nonce( 'course-toggle-wishlist' ),
|
13 |
$title,
|
14 |
-
__( 'Processing', 'learnpress-wishlist' ),
|
15 |
$state == 'on' ? __( 'Remove from Wishlist', 'learnpress-wishlist' ) : __( 'Add to Wishlist', 'learnpress-wishlist' )
|
16 |
);
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Template for displaying button to toggle course wishlist on/off.
|
4 |
+
*
|
5 |
+
* This template can be overridden by copying it to yourtheme/learnpress/addons/wishlist/button.php.
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
+
* @package LearnPress/Wishlist/Templates
|
9 |
+
* @version 3.0.0
|
10 |
*/
|
11 |
+
|
12 |
+
// Prevent loading this file directly
|
13 |
+
defined( 'ABSPATH' ) || exit;
|
14 |
+
|
15 |
printf(
|
16 |
+
'<button class="learn-press-course-wishlist learn-press-course-wishlist-button-%2$d wishlist-button %s" data-id="%s" data-nonce="%s" title="%s" data-text="%s">%s</button>',
|
17 |
join( " ", $classes ),
|
18 |
$course_id,
|
19 |
wp_create_nonce( 'course-toggle-wishlist' ),
|
20 |
$title,
|
21 |
+
__( 'Processing...', 'learnpress-wishlist' ),
|
22 |
$state == 'on' ? __( 'Remove from Wishlist', 'learnpress-wishlist' ) : __( 'Add to Wishlist', 'learnpress-wishlist' )
|
23 |
);
|
templates/user-wishlist.php
CHANGED
@@ -1,25 +1,30 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Template for displaying the list of course is in wishlist
|
|
|
|
|
4 |
*
|
5 |
* @author ThimPress
|
|
|
|
|
6 |
*/
|
7 |
|
8 |
-
|
|
|
9 |
|
10 |
global $post;
|
11 |
-
|
12 |
$has_courses = $wishlist ? true : false;
|
13 |
?>
|
14 |
-
|
15 |
-
<?php
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
19 |
<?php } ?>
|
20 |
-
|
21 |
-
|
22 |
-
<?php learn_press_display_message( apply_filters( 'learn_press_wishlist_empty_course', __( 'No courses in your wishlist!', 'learnpress-wishlist' ) ) ); ?>
|
23 |
-
</div>
|
24 |
<?php
|
25 |
wp_reset_postdata();
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Template for displaying the list of course is in wishlist.
|
4 |
+
*
|
5 |
+
* This template can be overridden by copying it to yourtheme/learnpress/addons/wishlist/user-wishlist.php.
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
+
* @package LearnPress/Wishlist/Templates
|
9 |
+
* @version 3.0.0
|
10 |
*/
|
11 |
|
12 |
+
// Prevent loading this file directly
|
13 |
+
defined( 'ABSPATH' ) || exit;
|
14 |
|
15 |
global $post;
|
|
|
16 |
$has_courses = $wishlist ? true : false;
|
17 |
?>
|
18 |
+
|
19 |
+
<div id="learn-press-profile-tab-course-wishlist" class="<?php echo $has_courses ? 'has-courses' : ''; ?>">
|
20 |
+
<?php if ( $has_courses ) { ?>
|
21 |
+
<ul class="learn-press-courses profile-courses courses-list learn-press-wishlist-courses">
|
22 |
+
<?php foreach ( $wishlist as $post ) { ?>
|
23 |
+
<?php learn_press_course_wishlist_template( 'wishlist-content.php' ); ?>
|
24 |
+
<?php } ?>
|
25 |
+
</ul>
|
26 |
<?php } ?>
|
27 |
+
<?php learn_press_display_message( apply_filters( 'learn_press_wishlist_empty_course', __( 'No courses in your wishlist!', 'learnpress-wishlist' ) ) ); ?>
|
28 |
+
</div>
|
|
|
|
|
29 |
<?php
|
30 |
wp_reset_postdata();
|
templates/wishlist-content.php
CHANGED
@@ -1,14 +1,28 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
-
* Template for displaying the list of course is in wishlist
|
|
|
|
|
4 |
*
|
5 |
* @author ThimPress
|
|
|
|
|
6 |
*/
|
7 |
|
8 |
-
|
|
|
|
|
9 |
global $post;
|
10 |
?>
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
</li>
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
+
* Template for displaying the list of course content is in wishlist.
|
5 |
+
*
|
6 |
+
* This template can be overridden by copying it to yourtheme/learnpress/addons/wishlist/wishlist-content.php.
|
7 |
*
|
8 |
* @author ThimPress
|
9 |
+
* @package LearnPress/Wishlist/Templates
|
10 |
+
* @version 3.0.0
|
11 |
*/
|
12 |
|
13 |
+
// Prevent loading this file directly
|
14 |
+
defined( 'ABSPATH' ) || exit;
|
15 |
+
|
16 |
global $post;
|
17 |
?>
|
18 |
+
|
19 |
+
<li id="learn-press-tab-wishlist-course-<?php echo $post->ID; ?>" class="course" data-context="tab-wishlist">
|
20 |
+
|
21 |
+
<?php do_action( 'learn_press_before_profile_tab_wishlist_loop_course' ); ?>
|
22 |
+
<a href="<?php the_permalink(); ?>" class="course-title">
|
23 |
+
<?php do_action( 'learn-press/courses-loop-item-title' ); ?>
|
24 |
+
</a>
|
25 |
+
<?php do_action( 'learn_press_after_profile_tab_wishlist_loop_course' ); ?>
|
26 |
+
|
27 |
+
<?php LP_Addon_Wishlist::instance()->wishlist_button( $post->ID ); ?>
|
28 |
</li>
|