PluginProbe
JSON API User / 3.9.1
JSON API User v3.9.1
4.1.4 3.9.8 3.9.9 4.0.0 4.1.0 4.1.2 4.1.3 2.8 2.9 2.9.1 3.0.0 3.1.4 3.2.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 3.8.0 3.8.1 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 All 52 releases
json-api-user / json-api-user.php

json-api-user.php in JSON API User 3.9.1, at json-api-user.php

97 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4
5 Plugin Name: JSON API User
6
7 Plugin URI: http://www.parorrey.com/solutions/json-api-user/
8
9 Description: Extends the JSON API for RESTful user registration, authentication, password reset, Facebook Login, user meta and BuddyPress Profile related functions. A Pro version is also available.
10
11 Version: 3.9.1
12
13 Author: Ali Qureshi
14
15 Author URI: http://www.parorrey.com/
16
17 License: GPLv3
18
19 */
20
21 define('JAU_VERSION', '3.9.1');
22
23 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
24
25 define('JSON_API_USER_HOME', dirname(__FILE__));
26
27
28
29 if (!(is_plugin_active('json-api/json-api.php') || is_plugin_active('json-api-master/json-api.php'))) {
30
31 add_action('admin_notices', 'pim_draw_notice_json_api');
32
33 return;
34
35 }
36
37 function jaup_action_links( $links ) {
38
39 $links[] = '<a href="'. esc_url( get_admin_url(null, '/options-general.php?page=json-api') ) .'">JSON API</a>';
40
41 $links[] = '<a href="https://www.parorrey.com/solutions/json-api-user-plus/" target="_blank">' . __( 'Upgrade to User Plus', 'json-api-user' ) . '</a>';
42
43 return $links;
44 }
45 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'jaup_action_links', 10, 1 );
46
47
48 add_filter('json_api_controllers', 'pimJsonApiController');
49
50 add_filter('json_api_user_controller_path', 'setUserControllerPath');
51
52 add_action('init', 'json_api_user_checkAuthCookie', 100);
53
54 load_plugin_textdomain('json-api-user', false, basename(dirname(__FILE__)) . '/languages');
55
56
57
58 function pim_draw_notice_json_api() {
59
60 echo '<div id="message" class="error fade"><p style="line-height: 150%">';
61
62 _e('<strong>JSON API User</strong></a> requires the JSON API plugin to be activated. Please <a href="https://github.com/PI-Media/json-api">install / activate JSON API</a> first from <a href="https://github.com/PI-Media/json-api" target="_blank">GitHub repository here</a>. <br>You can also upgrade to a pro verison <a href="http://www.parorrey.com/solutions/json-api-user-plus/" target="_blank">JSON API User Plus</a>', 'json-api-user');
63
64 echo '</p></div>';
65
66 }
67
68
69
70 function pimJsonApiController($aControllers) {
71
72 $aControllers[] = 'User';
73
74 return $aControllers;
75
76 }
77
78
79
80 function setUserControllerPath($sDefaultPath) {
81
82 return dirname(__FILE__) . '/controllers/User.php';
83
84 }
85
86 function json_api_user_checkAuthCookie($sDefaultPath) {
87 global $json_api;
88
89 if ($json_api->query->cookie) {
90 $user_id = wp_validate_auth_cookie($json_api->query->cookie, 'logged_in');
91 if ($user_id) {
92 $user = get_userdata($user_id);
93
94 wp_set_current_user($user->ID, $user->user_login);
95 }
96 }
97 }