PluginProbe
JSON API User / 4.1.4
JSON API User v4.1.4
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 4.1.4, at json-api-user.php

114 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Prevent direct access to this file.
4 if (!defined('ABSPATH')) {
5 exit;
6 }
7
8 /*
9
10 Plugin Name: JSON API User
11
12 Plugin URI: http://www.parorrey.com/solutions/json-api-user/
13
14 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.
15
16 Version: 4.1.4
17
18 Requires at least: 3.0.1
19
20 Requires PHP: 7.4
21
22 Tested up to: 7.1
23
24 Author: Ali Qureshi
25
26 Author URI: http://www.parorrey.com/
27
28 License: GPLv3
29
30 */
31
32 define('JAU_VERSION', '4.1.4');
33
34 include_once(ABSPATH . 'wp-admin/includes/plugin.php');
35
36 define('JSON_API_USER_HOME', dirname(__FILE__));
37
38
39
40 if (!(is_plugin_active('json-api/json-api.php') || is_plugin_active('json-api-master/json-api.php'))) {
41
42 add_action('admin_notices', 'pim_draw_notice_json_api');
43
44 return;
45
46 }
47
48 function jaup_action_links($links)
49 {
50
51 $links[] = '<a href="' . esc_url(get_admin_url(null, '/options-general.php?page=json-api')) . '">JSON API</a>';
52
53 $links[] = '<a href="https://www.parorrey.com/solutions/json-api-user-plus/" target="_blank">' . __('Upgrade to User Plus', 'json-api-user') . '</a>';
54
55 return $links;
56 }
57 add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'jaup_action_links', 10, 1);
58
59
60 add_filter('json_api_controllers', 'pimJsonApiController');
61
62 add_filter('json_api_user_controller_path', 'setUserControllerPath');
63
64 add_action('init', 'json_api_user_checkAuthCookie', 100);
65
66 load_plugin_textdomain('json-api-user', false, basename(dirname(__FILE__)) . '/languages');
67
68
69
70 function pim_draw_notice_json_api()
71 {
72
73 echo '<div id="message" class="error fade"><p style="line-height: 150%">';
74
75 _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');
76
77 echo '</p></div>';
78
79 }
80
81
82
83 function pimJsonApiController($aControllers)
84 {
85
86 $aControllers[] = 'User';
87
88 return $aControllers;
89
90 }
91
92
93
94 function setUserControllerPath($sDefaultPath)
95 {
96
97 return dirname(__FILE__) . '/controllers/User.php';
98
99 }
100
101 function json_api_user_checkAuthCookie($sDefaultPath)
102 {
103 global $json_api;
104
105 if ($json_api->query->cookie) {
106 $user_id = wp_validate_auth_cookie($json_api->query->cookie, 'logged_in');
107 if ($user_id) {
108 $user = get_userdata($user_id);
109
110 wp_set_current_user($user->ID, $user->user_login);
111 }
112 }
113 }
114