Changeset 2001946
- Timestamp:
- 12/26/2018 11:34:54 PM (7 years ago)
- Location:
- edunext-openedx-integrator/trunk
- Files:
-
- 6 edited
-
includes/class-wp-edunext-eox-core-api.php (modified) (4 diffs)
-
includes/class-wp-edunext-marketing-site-settings.php (modified) (1 diff)
-
includes/class-wp-edunext-marketing-site.php (modified) (1 diff)
-
includes/templates/exoapi_settings_custom_html.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
wp-edunext-marketing-site.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
edunext-openedx-integrator/trunk/includes/class-wp-edunext-eox-core-api.php
r1946360 r2001946 64 64 add_action('eoxapi_after_settings_page_html', array($this, 'eoxapi_settings_custom_html')); 65 65 add_action('wp_ajax_save_users_ajax', array($this, 'save_users_ajax')); 66 add_action('wp_ajax_get_users_ajax', array($this, 'get_users_ajax')); 66 67 add_action('wp_ajax_get_userinfo_ajax', array($this, 'get_userinfo_ajax')); 67 68 add_action('wp_ajax_save_enrollments_ajax', array($this, 'save_enrollments_ajax')); … … 92 93 'default' => '', 93 94 'placeholder' => '' 95 ) , 96 array( 97 'id' => 'eox_client_wc_field_mappings', 98 'label' => __('User fields mappings', 'wp-edunext-marketing-site') , 99 'description' => __('Mapping of user fields for pre-filling, from Open-edX (extended_profile) to Woocommerce', 'wp-edunext-marketing-site', 'wp-edunext-marketing-site') , 100 'type' => 'text', 101 'default' => '', 102 'placeholder' => '{"wc_example": "example"}' 94 103 ) 95 104 ) … … 145 154 } 146 155 } 156 $this->show_notices(); 157 wp_die(); 158 } 159 160 /** 161 * Called with AJAX function to POST to users API 162 */ 163 public function get_users_ajax() { 164 $new_users = $this->handle_ajax_json_input($_POST['users']); 165 $users_info = []; 166 if ($new_users) { 167 foreach ($new_users as $user) { 168 $users_info[] = $this->get_user_info($user); 169 } 170 } 171 $this->add_notice('user-info', '<pre>' . json_encode($users_info, JSON_PRETTY_PRINT) . '</pre>'); 147 172 $this->show_notices(); 148 173 wp_die(); … … 244 269 $success_message = 'User creation success!'; 245 270 return $this->api_call($api_url, $data, $ref, $success_message); 271 } 272 273 /** 274 * Function to execute the API calls required to get an existing edxapp user 275 */ 276 public function get_user_info($args) { 277 $args = (array)$args; 278 $api_url = self::PATH_USER_API; 279 $ref = $args['email'] ?: $args['username'] ?: ''; 280 $success_message = 'User fetching success!'; 281 $api_url .= '?' . http_build_query($args); 282 return $this->api_call($api_url, NULL, $ref, $success_message); 246 283 } 247 284 -
edunext-openedx-integrator/trunk/includes/class-wp-edunext-marketing-site-settings.php
r1931230 r2001946 155 155 'default' => '', 156 156 'placeholder' => __( '', 'wp-edunext-marketing-site' ) 157 ), 158 array( 159 'id' => 'enable_woocommerce_integration', 160 'label' => __( 'Enable Eox-core Woocommerce integrations' , 'wp-edunext-marketing-site' ), 161 'description' => __( 'Features: Checkout pre-filling', 'wp-edunext-marketing-site' ), 162 'type' => 'checkbox', 163 'default' => false, 164 'placeholder' => __( '', 'wp-edunext-marketing-site' ), 165 'advanced_setting' => true 157 166 ), 158 167 array( -
edunext-openedx-integrator/trunk/includes/class-wp-edunext-marketing-site.php
r1931230 r2001946 117 117 // Add attributes for menus items 118 118 add_action( 'init', array( 'Edx_Walker_Nav_Menu_Edit', 'setup' ) ); 119 120 if ( get_option('wpt_enable_woocommerce_integration') ) { 121 $this->woocommerce = new WP_eduNEXT_Woocommerce_Integration(); 122 } 119 123 120 124 if ( is_admin() ) { -
edunext-openedx-integrator/trunk/includes/templates/exoapi_settings_custom_html.php
r1922563 r2001946 52 52 <option value="exoapi-add-new-users" selected>Users</option> 53 53 <option value="exoapi-add-new-enrollments">Enrollments</option> 54 <option value="exoapi-get-users">Get users info</option> 54 55 </select> 55 56 <div class="exoapi-get-users"> 57 <h2>Get Open edx users info</h2> 58 <p> 59 Write an array of users as JSON array: 60 </p> 61 <textarea name="eox-api-get-users" id="eox-api-get-users" cols="70" rows="10"> 62 [{ 63 "username": "honor" 64 }]</textarea> 65 <button class="button-secondary get-users-button">Execute API call</button> 66 </div> 56 67 <div class="exoapi-add-new-users"> 57 68 <h2>Add new Open edx users</h2> … … 109 120 }); 110 121 122 $('.get-users-button').click(function (e) { 123 var data = {users: $('#eox-api-get-users').val()}; 124 callAction('get_users_ajax', data); 125 e.stopPropagation(); 126 return false; 127 }); 128 111 129 $('.save-enrollments-button').click(function (e) { 112 130 var data = {enrollments: $('#eox-api-new-enrollments').val()}; -
edunext-openedx-integrator/trunk/readme.txt
r1946360 r2001946 4 4 Requires at least: 3.9 5 5 Tested up to: 4.9.5 6 Stable tag: 1. 5.06 Stable tag: 1.6.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
edunext-openedx-integrator/trunk/wp-edunext-marketing-site.php
r1946360 r2001946 23 23 require_once( 'includes/class-wp-edunext-marketing-site-settings.php' ); 24 24 require_once( 'includes/class-wp-edunext-eox-core-api.php' ); 25 require_once( 'includes/class-wp-edunext-eox-woocommerce-integration.php' ); 25 26 26 27 // Load plugin libraries … … 63 64 64 65 WP_EoxCoreApi(); 65
Note: See TracChangeset
for help on using the changeset viewer.