Version Description
- Tweak - Code improvement
Download this release
Release Info
Developer | wpexpertsio |
Plugin | New User Approve |
Version | 2.4 |
Comparing to | |
See all releases |
Code changes from version 2.3 to 2.4
- admin/templates/approve.php +2 -2
- admin/templates/upgrade.php +1 -3
- assets/js/checkout.min.js +129 -0
- assets/js/modernizr.min.js +153 -0
- includes/admin-approve.php +367 -325
- includes/invitation-code.php +162 -154
- includes/user-list.php +23 -20
- new-user-approve.php +30 -21
- readme.txt +4 -1
admin/templates/approve.php
CHANGED
@@ -3,12 +3,12 @@
|
|
3 |
|
4 |
<?php
|
5 |
if ( isset( $_GET['user'] ) && isset( $_GET['status'] ) ) {
|
6 |
-
echo '<div id="message" class="updated fade"><p>' . __( 'User successfully updated.', 'new-user-approve' ) . '</p></div>';
|
7 |
}
|
8 |
?>
|
9 |
|
10 |
<div class="wrap">
|
11 |
-
<h2><?php
|
12 |
|
13 |
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
14 |
<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
|
3 |
|
4 |
<?php
|
5 |
if ( isset( $_GET['user'] ) && isset( $_GET['status'] ) ) {
|
6 |
+
echo wp_kses_post('<div id="message" class="updated fade"><p>' . __( 'User successfully updated.', 'new-user-approve' ) . '</p></div>');
|
7 |
}
|
8 |
?>
|
9 |
|
10 |
<div class="wrap">
|
11 |
+
<h2><?php esc_html_e( 'User Registration Approval', 'new-user-approve' ); ?></h2>
|
12 |
|
13 |
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
14 |
<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
|
admin/templates/upgrade.php
CHANGED
@@ -846,9 +846,7 @@ a {
|
|
846 |
</style>
|
847 |
|
848 |
|
849 |
-
|
850 |
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js" crossorigin="anonymous"></script>
|
851 |
-
<script src="https://checkout.freemius.com/checkout.min.js"></script>
|
852 |
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
853 |
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
854 |
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
846 |
</style>
|
847 |
|
848 |
|
849 |
+
|
|
|
|
|
850 |
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
851 |
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
852 |
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
assets/js/checkout.min.js
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function NoJQueryPostMessageMixin(e, t) {
|
2 |
+
var n, o, i, r, s, c = 1;
|
3 |
+
return window.postMessage ? (window.addEventListener ? (n = function(e) { window.addEventListener("message", e, !1) }, o = function(e) { window.removeEventListener("message", e, !1) }) : (n = function(e) { window.attachEvent("onmessage", e) }, o = function(e) { window.detachEvent("onmessage", e) }), this[e] = function(e, t, n) { t && n.postMessage(e, t.replace(/([^:]+:\/\/[^\/]+).*/, "$1")) }, this[t] = function(e, t, r) {
|
4 |
+
return i && (o(i), i = null), !!e && void(i = n(function(n) {
|
5 |
+
switch (Object.prototype.toString.call(t)) {
|
6 |
+
case "[object String]":
|
7 |
+
if (t !== n.origin) return !1;
|
8 |
+
break;
|
9 |
+
case "[object Function]":
|
10 |
+
if (t(n.origin)) return !1
|
11 |
+
}
|
12 |
+
e(n)
|
13 |
+
}))
|
14 |
+
}) : (this[e] = function(e, t, n) { t && (n.location = t.replace(/#.*$/, "") + "#" + +new Date + c++ + "&" + e) }, this[t] = function(e, t, n) {
|
15 |
+
r && (clearInterval(r), r = null), e && (n = "number" == typeof t ? t : "number" == typeof n ? n : 100, r = setInterval(function() {
|
16 |
+
var t = document.location.hash,
|
17 |
+
n = /^#?\d+&/;
|
18 |
+
t !== s && n.test(t) && (s = t, e({ data: t.replace(n, "") }))
|
19 |
+
}, n))
|
20 |
+
}), this
|
21 |
+
}! function(e) {
|
22 |
+
var t = this;
|
23 |
+
t.FS = t.FS || {}, e === t.FS.Logger && (t.FS.Logger = function() {
|
24 |
+
for (var t = {}, n = ["log", "debug", "error"], o = 0; o < n.length; o++) {
|
25 |
+
var i = n[o],
|
26 |
+
r = i.charAt(0).toUpperCase() + i.slice(1);
|
27 |
+
e === console[i] && (i = "log"),
|
28 |
+
function(e) { t[r] = function() { Function.prototype.apply.call(console[e], console, arguments) } }(i)
|
29 |
+
}
|
30 |
+
return t
|
31 |
+
}())
|
32 |
+
}(),
|
33 |
+
function(e, t) {
|
34 |
+
var n = this;
|
35 |
+
n.FS = n.FS || {}, null == n.FS.PostMessage && (n.FS.PostMessage = function() {
|
36 |
+
var n, o, i, r = !1,
|
37 |
+
s = !1,
|
38 |
+
c = new NoJQueryPostMessageMixin("postMessage", "receiveMessage"),
|
39 |
+
a = {},
|
40 |
+
u = function(e) { o = e, i = e.substring(0, e.indexOf("/", "https://" === e.substring(0, "https://".length) ? 8 : 7)), l = "" !== e },
|
41 |
+
g = function() {
|
42 |
+
c.receiveMessage(function(e) {
|
43 |
+
var t;
|
44 |
+
try {
|
45 |
+
if (null != e && e.origin && (e.origin.indexOf("js.stripe.com") > 0 || e.origin.indexOf("www.paypal.com") > 0)) return;
|
46 |
+
if (e && e.data && "string" == typeof e.data && "{" === e.data.charAt(0) && (t = JSON.parse(e.data), a[t.type]))
|
47 |
+
for (var n = 0; n < a[t.type].length; n++) a[t.type][n](t.data)
|
48 |
+
} catch (o) { FS.Logger.Error("FS.PostMessage.receiveMessage", o.message), FS.Logger.Log(e.data) }
|
49 |
+
}, n)
|
50 |
+
},
|
51 |
+
d = -1,
|
52 |
+
l = "" !== o,
|
53 |
+
f = e(window),
|
54 |
+
p = e("html"),
|
55 |
+
h = !0;
|
56 |
+
try { h = window.self !== window.top } catch (v) {}
|
57 |
+
return h && u(decodeURIComponent(document.location.hash.replace(/^#/, ""))), { init: function(e, t) { n = e, g(), FS.PostMessage.receiveOnce("forward", function(e) { window.location = e.url }), t = t || [], t.length > 0 && f.on("scroll", function() { for (var e = 0; e < t.length; e++) FS.PostMessage.postScroll(t[e]) }) }, init_child: function(t) { t && u(t), this.init(i), r = !0, s = !0, e(window).bind("load", function() { FS.PostMessage.postHeight(), FS.PostMessage.post("loaded") }), e(window).resize(function() { FS.PostMessage.postHeight(), FS.PostMessage.post("resize") }) }, hasParent: function() { return l }, postHeight: function(t, n) { t = t || 0, n = n || "#wrap_section"; var o = t + e(n).outerHeight(!0); return o != d && (this.post("height", { height: o }), d = o, !0) }, postScroll: function(e) { this.post("scroll", { top: f.scrollTop(), height: f.height() - parseFloat(p.css("paddingTop")) - parseFloat(p.css("marginTop")) }, e) }, post: function(e, t, n) { FS.Logger.Debug("PostMessage.post", e), n ? c.postMessage(JSON.stringify({ type: e, data: t }), n.src, n.contentWindow) : c.postMessage(JSON.stringify({ type: e, data: t }), o, window.parent) }, receive: function(e, t) { FS.Logger.Debug("PostMessage.receive", e), null == a[e] && (a[e] = []), a[e].push(t) }, receiveOnce: function(e, n, o) { o = t !== o && o, o && this.unset(e), this.is_set(e) || this.receive(e, n) }, is_set: function(e) { return null != a[e] }, unset: function(e) { a[e] = null }, parent_url: function() { return o }, parent_subdomain: function() { return i }, isChildInitialized: function() { return s } }
|
58 |
+
}())
|
59 |
+
}(jQuery),
|
60 |
+
function(e, t) {
|
61 |
+
var n = this;
|
62 |
+
n.FS = n.FS || {}, n.FS.Checkout = function() {
|
63 |
+
var o = !1,
|
64 |
+
i = navigator.userAgent.toLowerCase();
|
65 |
+
/edge\/|trident\/|msie /.test(i) ? (o = !0, FS.Logger.Log("browser", "ie")) : i.indexOf("safari") != -1 ? i.indexOf("chrome") > -1 ? FS.Logger.Log("browser", "chrome") : (o = !0, FS.Logger.Log("browser", "safari")) : FS.Logger.Log("browser", "other");
|
66 |
+
var r, s, c = !1,
|
67 |
+
a = function() { return null == location.port || "" === location.port || 80 == location.port },
|
68 |
+
u = function() {
|
69 |
+
for (var e = document.getElementsByTagName("script"), t = 0; t < e.length; t++)
|
70 |
+
if (-1 !== e[t].src.indexOf("//checkout.freemius")) {
|
71 |
+
var n = null,
|
72 |
+
o = e[t].src.substr("https://".length).indexOf("/");
|
73 |
+
return n = -1 === o ? e[t].src : e[t].src.substr(0, o + "https://".length), 0 === n.indexOf("http:") && a() && (n = n.replace("http:", "https:"), e[t].src = n), n
|
74 |
+
}
|
75 |
+
return "https://checkout.freemius.com"
|
76 |
+
},
|
77 |
+
g = u(),
|
78 |
+
d = function() { return Math.floor(65536 * (1 + Math.random())).toString(16).substring(1) },
|
79 |
+
l = function() { return d() + d() + "-" + d() + "-" + d() + "-" + d() + "-" + d() + d() + d() },
|
80 |
+
f = { mode: "dialog", guid: l() },
|
81 |
+
p = 2147483647,
|
82 |
+
h = function(t) { return t = e.extend({}, f, t), null == t.plugin_id && FS.Logger.Error("plugin_id must be configured."), null == t.public_key && FS.Logger.Error("public_key must be configured."), _(t, "timestamp", "s_ctx_ts"), _(t, "sandbox_token", "sandbox"), t },
|
83 |
+
v = function(t) {
|
84 |
+
var n = g + "/?" + y(t) + "#" + encodeURIComponent(document.location.href);
|
85 |
+
s = e('<iframe id="' + t.guid + '" src="' + n + '" width="100%" height="100%" allowtransparency="true" frameborder="0" style="z-index: ' + (p - 1) + "; background: rgba(0,0,0,0.003); border: 0 none transparent; visibility: " + (o ? "hidden" : "visible") + '; margin: 0; padding: 0; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; -webkit-tap-highlight-color: transparent; overflow: hidden;"></iframe>').appendTo("body"), e('<div id="exit_intent_' + t.guid + '" style="z-index: ' + p + '; border: 0; background: transparent; position: fixed; padding: 0; margin: 0; height: 10px; left: 0; right: 0; width: 100%; top: 0;"></div>').appendTo("body"), c || (FS.PostMessage.init(g), m(), c = !0)
|
86 |
+
},
|
87 |
+
m = function() {
|
88 |
+
var e, t = document.documentElement,
|
89 |
+
n = 300,
|
90 |
+
o = function(e) { return !(e.pageY > 20) },
|
91 |
+
i = function(t) { o(t) && (e = setTimeout(c, n)) },
|
92 |
+
r = function() { e && (clearTimeout(e), e = null) },
|
93 |
+
c = function() { s && FS.PostMessage.post("exit_intent", null, s[0]) };
|
94 |
+
t.addEventListener("mouseleave", i), t.addEventListener("mouseenter", r)
|
95 |
+
},
|
96 |
+
b = function(t) { if (e(document.body).css("overflowX", r.x), e(document.body).css("overflowY", r.y), e("#exit_intent_" + t.guid).remove(), e("#" + t.guid).remove(), s = null, t.afterClose) try { t.afterClose() } catch (n) { FS.Logger.Log(n) } },
|
97 |
+
w = function(t) {
|
98 |
+
e("#loader_" + t.guid).show(), r = { x: e(document.body).css("overflowX"), y: e(document.body).css("overflowY") }, e(document.body).css("overflow", "hidden"), v(t), FS.PostMessage.receiveOnce("upgraded", function(e) {
|
99 |
+
if (t.success) try { t.success(e) } catch (n) { FS.Logger.Log(n) }
|
100 |
+
b(t)
|
101 |
+
}, !0), FS.PostMessage.receiveOnce("purchaseCompleted", function(e) { if (t.purchaseCompleted) try { t.purchaseCompleted(e) } catch (n) { FS.Logger.Log(n) } }, !0), FS.PostMessage.receiveOnce("canceled", function(e) {
|
102 |
+
if (t.cancel) try { t.cancel(e) } catch (n) { FS.Logger.Log(n) }
|
103 |
+
b(t)
|
104 |
+
}, !0), FS.PostMessage.receiveOnce("track", function(e) { if (t.track) try { t.track(e.event, e) } catch (n) { FS.Logger.Log(n) } }, !0), FS.PostMessage.receiveOnce("loaded", function(n) { e("#loader_" + t.guid).hide(), o && e("#" + t.guid).ready(function() { e("#" + t.guid).css("visibility", "visible") }) }, !0)
|
105 |
+
},
|
106 |
+
y = function(e) { var t = ""; for (var n in e) !e.hasOwnProperty(n) || "function" == typeof e[n] || "object" == typeof e[n] && null !== e[n] || (t += "&" + n + "=" + S(e[n])); return t.length > 0 && (t = t.substr(1)), t },
|
107 |
+
S = function(e) { return null === e ? "null" : !0 === e ? "1" : !1 === e ? "0" : encodeURIComponent(e).replace(/!/g, "%21").replace(/'/g, "%27").replace(/\(/g, "%28").replace(/\)/g, "%29").replace(/\*/g, "%2A").replace(/%20/g, "+") },
|
108 |
+
_ = function(e, n, o) { t !== e[n] && (e[o] = e[n], delete e[n]) },
|
109 |
+
F = function() { e(document.body).append('<div id="loader_' + f.guid + '" style=" display: none; position: fixed; z-index: ' + (p - 1) + '; width: 100%; height: 100%; top: 0; left: 0; right: 0; bottom: 0; text-align: left; background: rgba(0,0,0,0.6); "> <img src="' + g + '/assets/img/spinner.svg" alt="Loading animation" style=" position: absolute; top: 40%; left: 50%; width: auto; height: auto; margin-left: -25px; background: #fff; padding: 10px; border-radius: 50%; box-shadow: 2px 2px 2px rgba(0,0,0,0.1); "> </div>') },
|
110 |
+
x = function() {
|
111 |
+
var e = window.location.toString(),
|
112 |
+
t = e.indexOf("__fs_authorization="),
|
113 |
+
n = e.indexOf("?");
|
114 |
+
if (0 < n && n < t) {
|
115 |
+
var o = e.indexOf("#");
|
116 |
+
0 < o && (e = e.substr(0, o));
|
117 |
+
var i, r = e.split("?")[1],
|
118 |
+
s = {},
|
119 |
+
c = 0,
|
120 |
+
a = new RegExp("\\+", "g");
|
121 |
+
r = r.split("&");
|
122 |
+
for (var u = 0; u < r.length; u++) i = r[u].split("="), i[0].length > 5 && "__fs_" == i[0].substr(0, 5) && (s[i[0]] = decodeURIComponent(i[1].replace(a, " ")), c++);
|
123 |
+
if (c > 1) return s
|
124 |
+
}
|
125 |
+
return !1
|
126 |
+
};
|
127 |
+
return { configure: function(e) { f = h(e || {}), F(); var o = x(); return !1 !== o && (t !== o.__fs_plugin_id && _(o, "__fs_plugin_id", "plugin_id"), t !== o.__fs_plugin_public_key && _(o, "__fs_plugin_public_key", "public_key"), this.open(o)), n.FS.Checkout }, open: function(e) { w(h(e)) }, close: function() { FS.PostMessage.post("close", null, s[0]) }, clearOptions: function() { f = { mode: f.mode, guid: f.guid } } }
|
128 |
+
}()
|
129 |
+
}(jQuery);
|
assets/js/modernizr.min.js
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
window.Modernizr = function(e, t, n) {
|
2 |
+
function r(e) { b.cssText = e }
|
3 |
+
|
4 |
+
function o(e, t) { return r(S.join(e + ";") + (t || "")) }
|
5 |
+
|
6 |
+
function a(e, t) { return typeof e === t }
|
7 |
+
|
8 |
+
function i(e, t) { return !!~("" + e).indexOf(t) }
|
9 |
+
|
10 |
+
function c(e, t) { for (var r in e) { var o = e[r]; if (!i(o, "-") && b[o] !== n) return "pfx" == t ? o : !0 } return !1 }
|
11 |
+
|
12 |
+
function s(e, t, r) { for (var o in e) { var i = t[e[o]]; if (i !== n) return r === !1 ? e[o] : a(i, "function") ? i.bind(r || t) : i } return !1 }
|
13 |
+
|
14 |
+
function u(e, t, n) {
|
15 |
+
var r = e.charAt(0).toUpperCase() + e.slice(1),
|
16 |
+
o = (e + " " + k.join(r + " ") + r).split(" ");
|
17 |
+
return a(t, "string") || a(t, "undefined") ? c(o, t) : (o = (e + " " + T.join(r + " ") + r).split(" "), s(o, t, n))
|
18 |
+
}
|
19 |
+
|
20 |
+
function l() { p.input = function(n) { for (var r = 0, o = n.length; o > r; r++) j[n[r]] = !!(n[r] in E); return j.list && (j.list = !(!t.createElement("datalist") || !e.HTMLDataListElement)), j }("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")), p.inputtypes = function(e) { for (var r, o, a, i = 0, c = e.length; c > i; i++) E.setAttribute("type", o = e[i]), r = "text" !== E.type, r && (E.value = x, E.style.cssText = "position:absolute;visibility:hidden;", /^range$/.test(o) && E.style.WebkitAppearance !== n ? (g.appendChild(E), a = t.defaultView, r = a.getComputedStyle && "textfield" !== a.getComputedStyle(E, null).WebkitAppearance && 0 !== E.offsetHeight, g.removeChild(E)) : /^(search|tel)$/.test(o) || (r = /^(url|email)$/.test(o) ? E.checkValidity && E.checkValidity() === !1 : E.value != x)), P[e[i]] = !!r; return P }("search tel url email datetime date month week time datetime-local number range color".split(" ")) }
|
21 |
+
var d, f, m = "2.8.3",
|
22 |
+
p = {},
|
23 |
+
h = !0,
|
24 |
+
g = t.documentElement,
|
25 |
+
v = "modernizr",
|
26 |
+
y = t.createElement(v),
|
27 |
+
b = y.style,
|
28 |
+
E = t.createElement("input"),
|
29 |
+
x = ":)",
|
30 |
+
w = {}.toString,
|
31 |
+
S = " -webkit- -moz- -o- -ms- ".split(" "),
|
32 |
+
C = "Webkit Moz O ms",
|
33 |
+
k = C.split(" "),
|
34 |
+
T = C.toLowerCase().split(" "),
|
35 |
+
N = { svg: "http://www.w3.org/2000/svg" },
|
36 |
+
M = {},
|
37 |
+
P = {},
|
38 |
+
j = {},
|
39 |
+
$ = [],
|
40 |
+
D = $.slice,
|
41 |
+
F = function(e, n, r, o) {
|
42 |
+
var a, i, c, s, u = t.createElement("div"),
|
43 |
+
l = t.body,
|
44 |
+
d = l || t.createElement("body");
|
45 |
+
if (parseInt(r, 10))
|
46 |
+
for (; r--;) c = t.createElement("div"), c.id = o ? o[r] : v + (r + 1), u.appendChild(c);
|
47 |
+
return a = ["­", '<style id="s', v, '">', e, "</style>"].join(""), u.id = v, (l ? u : d).innerHTML += a, d.appendChild(u), l || (d.style.background = "", d.style.overflow = "hidden", s = g.style.overflow, g.style.overflow = "hidden", g.appendChild(d)), i = n(u, e), l ? u.parentNode.removeChild(u) : (d.parentNode.removeChild(d), g.style.overflow = s), !!i
|
48 |
+
},
|
49 |
+
z = function(t) { var n = e.matchMedia || e.msMatchMedia; if (n) return n(t) && n(t).matches || !1; var r; return F("@media " + t + " { #" + v + " { position: absolute; } }", function(t) { r = "absolute" == (e.getComputedStyle ? getComputedStyle(t, null) : t.currentStyle).position }), r },
|
50 |
+
A = function() {
|
51 |
+
function e(e, o) { o = o || t.createElement(r[e] || "div"), e = "on" + e; var i = e in o; return i || (o.setAttribute || (o = t.createElement("div")), o.setAttribute && o.removeAttribute && (o.setAttribute(e, ""), i = a(o[e], "function"), a(o[e], "undefined") || (o[e] = n), o.removeAttribute(e))), o = null, i }
|
52 |
+
var r = { select: "input", change: "input", submit: "form", reset: "form", error: "img", load: "img", abort: "img" };
|
53 |
+
return e
|
54 |
+
}(),
|
55 |
+
L = {}.hasOwnProperty;
|
56 |
+
f = a(L, "undefined") || a(L.call, "undefined") ? function(e, t) { return t in e && a(e.constructor.prototype[t], "undefined") } : function(e, t) { return L.call(e, t) }, Function.prototype.bind || (Function.prototype.bind = function(e) {
|
57 |
+
var t = this;
|
58 |
+
if ("function" != typeof t) throw new TypeError;
|
59 |
+
var n = D.call(arguments, 1),
|
60 |
+
r = function() {
|
61 |
+
if (this instanceof r) {
|
62 |
+
var o = function() {};
|
63 |
+
o.prototype = t.prototype;
|
64 |
+
var a = new o,
|
65 |
+
i = t.apply(a, n.concat(D.call(arguments)));
|
66 |
+
return Object(i) === i ? i : a
|
67 |
+
}
|
68 |
+
return t.apply(e, n.concat(D.call(arguments)))
|
69 |
+
};
|
70 |
+
return r
|
71 |
+
}), M.flexbox = function() { return u("flexWrap") }, M.flexboxlegacy = function() { return u("boxDirection") }, M.canvas = function() { var e = t.createElement("canvas"); return !(!e.getContext || !e.getContext("2d")) }, M.canvastext = function() { return !(!p.canvas || !a(t.createElement("canvas").getContext("2d").fillText, "function")) }, M.webgl = function() { return !!e.WebGLRenderingContext }, M.touch = function() { var n; return "ontouchstart" in e || e.DocumentTouch && t instanceof DocumentTouch ? n = !0 : F(["@media (", S.join("touch-enabled),("), v, ")", "{#modernizr{top:9px;position:absolute}}"].join(""), function(e) { n = 9 === e.offsetTop }), n }, M.geolocation = function() { return "geolocation" in navigator }, M.postmessage = function() { return !!e.postMessage }, M.websqldatabase = function() { return !!e.openDatabase }, M.indexedDB = function() { return !!u("indexedDB", e) }, M.hashchange = function() { return A("hashchange", e) && (t.documentMode === n || t.documentMode > 7) }, M.history = function() { return !(!e.history || !history.pushState) }, M.draganddrop = function() { var e = t.createElement("div"); return "draggable" in e || "ondragstart" in e && "ondrop" in e }, M.websockets = function() { return "WebSocket" in e || "MozWebSocket" in e }, M.rgba = function() { return r("background-color:rgba(150,255,150,.5)"), i(b.backgroundColor, "rgba") }, M.hsla = function() { return r("background-color:hsla(120,40%,100%,.5)"), i(b.backgroundColor, "rgba") || i(b.backgroundColor, "hsla") }, M.multiplebgs = function() { return r("background:url(https://),url(https://),red url(https://)"), /(url\s*\(.*?){3}/.test(b.background) }, M.backgroundsize = function() { return u("backgroundSize") }, M.borderimage = function() { return u("borderImage") }, M.borderradius = function() { return u("borderRadius") }, M.boxshadow = function() { return u("boxShadow") }, M.textshadow = function() { return "" === t.createElement("div").style.textShadow }, M.opacity = function() { return o("opacity:.55"), /^0.55$/.test(b.opacity) }, M.cssanimations = function() { return u("animationName") }, M.csscolumns = function() { return u("columnCount") }, M.cssgradients = function() {
|
72 |
+
var e = "background-image:",
|
73 |
+
t = "gradient(linear,left top,right bottom,from(#9f9),to(white));",
|
74 |
+
n = "linear-gradient(left top,#9f9, white);";
|
75 |
+
return r((e + "-webkit- ".split(" ").join(t + e) + S.join(n + e)).slice(0, -e.length)), i(b.backgroundImage, "gradient")
|
76 |
+
}, M.cssreflections = function() { return u("boxReflect") }, M.csstransforms = function() { return !!u("transform") }, M.csstransforms3d = function() { var e = !!u("perspective"); return e && "webkitPerspective" in g.style && F("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}", function(t) { e = 9 === t.offsetLeft && 3 === t.offsetHeight }), e }, M.csstransitions = function() { return u("transition") }, M.fontface = function() {
|
77 |
+
var e;
|
78 |
+
return F('@font-face {font-family:"font";src:url("https://")}', function(n, r) {
|
79 |
+
var o = t.getElementById("smodernizr"),
|
80 |
+
a = o.sheet || o.styleSheet,
|
81 |
+
i = a ? a.cssRules && a.cssRules[0] ? a.cssRules[0].cssText : a.cssText || "" : "";
|
82 |
+
e = /src/i.test(i) && 0 === i.indexOf(r.split(" ")[0])
|
83 |
+
}), e
|
84 |
+
}, M.generatedcontent = function() { var e; return F(["#", v, "{font:0/0 a}#", v, ':after{content:"', x, '";visibility:hidden;font:3px/1 a}'].join(""), function(t) { e = t.offsetHeight >= 3 }), e }, M.video = function() {
|
85 |
+
var e = t.createElement("video"),
|
86 |
+
n = !1;
|
87 |
+
try {
|
88 |
+
(n = !!e.canPlayType) && (n = new Boolean(n), n.ogg = e.canPlayType('video/ogg; codecs="theora"').replace(/^no$/, ""), n.h264 = e.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/, ""), n.webm = e.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/, ""))
|
89 |
+
} catch (r) {}
|
90 |
+
return n
|
91 |
+
}, M.audio = function() {
|
92 |
+
var e = t.createElement("audio"),
|
93 |
+
n = !1;
|
94 |
+
try {
|
95 |
+
(n = !!e.canPlayType) && (n = new Boolean(n), n.ogg = e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), n.mp3 = e.canPlayType("audio/mpeg;").replace(/^no$/, ""), n.wav = e.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ""), n.m4a = (e.canPlayType("audio/x-m4a;") || e.canPlayType("audio/aac;")).replace(/^no$/, ""))
|
96 |
+
} catch (r) {}
|
97 |
+
return n
|
98 |
+
}, M.localstorage = function() { try { return localStorage.setItem(v, v), localStorage.removeItem(v), !0 } catch (e) { return !1 } }, M.sessionstorage = function() { try { return sessionStorage.setItem(v, v), sessionStorage.removeItem(v), !0 } catch (e) { return !1 } }, M.webworkers = function() { return !!e.Worker }, M.applicationcache = function() { return !!e.applicationCache }, M.svg = function() { return !!t.createElementNS && !!t.createElementNS(N.svg, "svg").createSVGRect }, M.inlinesvg = function() { var e = t.createElement("div"); return e.innerHTML = "<svg/>", (e.firstChild && e.firstChild.namespaceURI) == N.svg }, M.smil = function() { return !!t.createElementNS && /SVGAnimate/.test(w.call(t.createElementNS(N.svg, "animate"))) }, M.svgclippaths = function() { return !!t.createElementNS && /SVGClipPath/.test(w.call(t.createElementNS(N.svg, "clipPath"))) };
|
99 |
+
for (var H in M) f(M, H) && (d = H.toLowerCase(), p[d] = M[H](), $.push((p[d] ? "" : "no-") + d));
|
100 |
+
return p.input || l(), p.addTest = function(e, t) {
|
101 |
+
if ("object" == typeof e)
|
102 |
+
for (var r in e) f(e, r) && p.addTest(r, e[r]);
|
103 |
+
else {
|
104 |
+
if (e = e.toLowerCase(), p[e] !== n) return p;
|
105 |
+
t = "function" == typeof t ? t() : t, "undefined" != typeof h && h && (g.className += " " + (t ? "" : "no-") + e), p[e] = t
|
106 |
+
}
|
107 |
+
return p
|
108 |
+
}, r(""), y = E = null,
|
109 |
+
function(e, t) {
|
110 |
+
function n(e, t) {
|
111 |
+
var n = e.createElement("p"),
|
112 |
+
r = e.getElementsByTagName("head")[0] || e.documentElement;
|
113 |
+
return n.innerHTML = "x<style>" + t + "</style>", r.insertBefore(n.lastChild, r.firstChild)
|
114 |
+
}
|
115 |
+
|
116 |
+
function r() { var e = y.elements; return "string" == typeof e ? e.split(" ") : e }
|
117 |
+
|
118 |
+
function o(e) { var t = v[e[h]]; return t || (t = {}, g++, e[h] = g, v[g] = t), t }
|
119 |
+
|
120 |
+
function a(e, n, r) {
|
121 |
+
if (n || (n = t), l) return n.createElement(e);
|
122 |
+
r || (r = o(n));
|
123 |
+
var a;
|
124 |
+
return a = r.cache[e] ? r.cache[e].cloneNode() : p.test(e) ? (r.cache[e] = r.createElem(e)).cloneNode() : r.createElem(e), !a.canHaveChildren || m.test(e) || a.tagUrn ? a : r.frag.appendChild(a)
|
125 |
+
}
|
126 |
+
|
127 |
+
function i(e, n) {
|
128 |
+
if (e || (e = t), l) return e.createDocumentFragment();
|
129 |
+
n = n || o(e);
|
130 |
+
for (var a = n.frag.cloneNode(), i = 0, c = r(), s = c.length; s > i; i++) a.createElement(c[i]);
|
131 |
+
return a
|
132 |
+
}
|
133 |
+
|
134 |
+
function c(e, t) { t.cache || (t.cache = {}, t.createElem = e.createElement, t.createFrag = e.createDocumentFragment, t.frag = t.createFrag()), e.createElement = function(n) { return y.shivMethods ? a(n, e, t) : t.createElem(n) }, e.createDocumentFragment = Function("h,f", "return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&(" + r().join().replace(/[\w\-]+/g, function(e) { return t.createElem(e), t.frag.createElement(e), 'c("' + e + '")' }) + ");return n}")(y, t.frag) }
|
135 |
+
|
136 |
+
function s(e) { e || (e = t); var r = o(e); return !y.shivCSS || u || r.hasCSS || (r.hasCSS = !!n(e, "article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")), l || c(e, r), e }
|
137 |
+
var u, l, d = "3.7.0",
|
138 |
+
f = e.html5 || {},
|
139 |
+
m = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,
|
140 |
+
p = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,
|
141 |
+
h = "_html5shiv",
|
142 |
+
g = 0,
|
143 |
+
v = {};
|
144 |
+
! function() {
|
145 |
+
try {
|
146 |
+
var e = t.createElement("a");
|
147 |
+
e.innerHTML = "<xyz></xyz>", u = "hidden" in e, l = 1 == e.childNodes.length || function() { t.createElement("a"); var e = t.createDocumentFragment(); return "undefined" == typeof e.cloneNode || "undefined" == typeof e.createDocumentFragment || "undefined" == typeof e.createElement }()
|
148 |
+
} catch (n) { u = !0, l = !0 }
|
149 |
+
}();
|
150 |
+
var y = { elements: f.elements || "abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video", version: d, shivCSS: f.shivCSS !== !1, supportsUnknownElements: l, shivMethods: f.shivMethods !== !1, type: "default", shivDocument: s, createElement: a, createDocumentFragment: i };
|
151 |
+
e.html5 = y, s(t)
|
152 |
+
}(this, t), p._version = m, p._prefixes = S, p._domPrefixes = T, p._cssomPrefixes = k, p.mq = z, p.hasEvent = A, p.testProp = function(e) { return c([e]) }, p.testAllProps = u, p.testStyles = F, p.prefixed = function(e, t, n) { return t ? u(e, t, n) : u(e, "pfx") }, g.className = g.className.replace(/(^|\s)no-js(\s|$)/, "$1$2") + (h ? " js " + $.join(" ") : ""), p
|
153 |
+
}(this, this.document);
|
includes/admin-approve.php
CHANGED
@@ -5,262 +5,294 @@
|
|
5 |
* Admin must approve all new users
|
6 |
*/
|
7 |
|
8 |
-
class pw_new_user_approve_admin_approve
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
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 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
<?php
|
101 |
-
|
102 |
-
|
103 |
-
<p class="status_heading"><?php
|
104 |
<?php
|
105 |
-
|
106 |
-
|
107 |
-
<p class="status_heading"><?php
|
108 |
-
<?php
|
109 |
-
|
110 |
-
|
111 |
<table class="widefat">
|
112 |
<thead>
|
113 |
<tr class="thead">
|
114 |
-
<th><?php
|
115 |
-
<th><?php
|
116 |
-
<th><?php
|
117 |
-
<?php if (
|
118 |
-
<th colspan="2"><?php
|
119 |
-
<?php } else {
|
120 |
-
<th><?php
|
121 |
-
<?php }
|
122 |
</tr>
|
123 |
</thead>
|
124 |
<tbody class="nua-user-list">
|
125 |
<?php
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
166 |
</td>
|
167 |
-
<?php if (
|
168 |
-
|
169 |
-
title="<?php _e( 'Approve', 'new-user-approve' ); ?> <?php echo $user->user_login; ?>"><?php _e( 'Approve', 'new-user-approve' ); ?></a>
|
170 |
</td>
|
171 |
-
<?php }
|
172 |
-
<?php if (
|
173 |
-
<td><a class="button" href="<?php echo esc_url(
|
174 |
-
title="<?php _e( 'Deny', 'new-user-approve' ); ?> <?php echo $user->user_login; ?>"><?php _e( 'Deny', 'new-user-approve' ); ?></a>
|
175 |
</td>
|
176 |
-
<?php }
|
177 |
-
<?php if (
|
178 |
<td colspan="2"> </td>
|
179 |
-
<?php endif
|
180 |
</tr><?php
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
</tbody>
|
185 |
</table>
|
186 |
<?php
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
<h3 class="nav-tab-wrapper" style="padding-bottom: 0; border-bottom: none;">
|
265 |
<script>
|
266 |
jQuery(document).ready(function() {
|
@@ -270,46 +302,47 @@ class pw_new_user_approve_admin_approve {
|
|
270 |
});
|
271 |
</script>
|
272 |
<input type="search" name="nua_search" placeholder="Search" style="float: right;" data-list=".nua-user-list">
|
273 |
-
<a href="<?php echo esc_url(
|
274 |
-
class="nav-tab<?php echo $active_tab == 'pending_users' ? ' nav-tab-active' : ''; ?>"><span><?php
|
275 |
-
<a href="<?php echo esc_url(
|
276 |
-
class="nav-tab<?php echo $active_tab == 'approved_users' ? ' nav-tab-active' : ''; ?>"><span><?php
|
277 |
-
<a href="<?php echo esc_url(
|
278 |
-
class="nav-tab<?php echo $active_tab == 'denied_users' ? ' nav-tab-active' : ''; ?>"><span><?php
|
279 |
-
<a href="<?php echo esc_url(
|
280 |
-
class="nav-tab<?php echo $active_tab == 'zapier' ? ' nav-tab-active' : ''; ?>"><span><?php
|
281 |
-
<a href="<?php echo esc_url(
|
282 |
-
class="nav-tab<?php echo $active_tab == 'pro_features' ? ' nav-tab-active' : ''; ?>"><span><?php
|
283 |
</h3>
|
284 |
|
285 |
-
<?php if (
|
286 |
<div id="pw_pending_users">
|
287 |
-
<?php $this->user_table(
|
288 |
</div>
|
289 |
-
<?php elseif (
|
290 |
<div id="pw_approved_users">
|
291 |
-
<?php $this->user_table(
|
292 |
</div>
|
293 |
<?php
|
294 |
-
elseif (
|
295 |
<div id="pw_denied_users">
|
296 |
-
<?php $this->user_table(
|
297 |
</div>
|
298 |
<?php
|
299 |
-
|
300 |
<div id="pw_denied_users">
|
301 |
-
<?php $this->zapier()
|
302 |
</div>
|
303 |
<?php
|
304 |
-
elseif (
|
305 |
<div id="pw_pro_features">
|
306 |
-
<?php $this->pro_features()
|
307 |
</div>
|
308 |
<?php endif;
|
309 |
-
|
310 |
|
311 |
-
|
312 |
-
|
|
|
313 |
<h3>Premium Features</h3>
|
314 |
<ul style="padding-left: 30px; list-style-type: disc;">
|
315 |
<li>Provides Ability To remove plugin stats from admin dashboard.</li>
|
@@ -332,90 +365,99 @@ elseif ( $active_tab == 'pro_features' ) : ?>
|
|
332 |
|
333 |
<p>Please Visit this link For <a class="button" href="https://newuserapprove.com/options-addon" target="_blank" >Premium Plugin </a> </p>
|
334 |
<?php
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
|
|
|
|
356 |
<table cellpadding='10'>
|
357 |
<tr>
|
358 |
-
<td>
|
359 |
-
<td>
|
360 |
</tr>
|
361 |
<tr>
|
362 |
-
<td>
|
363 |
<td>
|
364 |
-
<form action
|
365 |
-
|
|
|
366 |
<button id='nua-generate-api' class='button'>Generate API Key</button>
|
|
|
367 |
<input type='hidden' name='action' value='nua-save-api-key' />
|
368 |
<input type='submit' value='Save' name='nua_save_api' class='button'/>
|
369 |
</form>
|
370 |
</td>
|
371 |
</tr>
|
372 |
</table>
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
|
|
|
|
|
|
404 |
<p>If you haven't already, check out the <a href="https://wordpress.org/plugins/new-user-approve/faq/" target="_blank">Frequently Asked Questions</a>.</p>
|
405 |
<p>Still not fixed? Please <a href="https://wordpress.org/support/plugin/new-user-approve" target="_blank">start a support topic</a> and I or someone from the community will be able to assist you.</p>
|
406 |
<?php
|
407 |
-
|
408 |
|
409 |
-
|
410 |
-
|
|
|
411 |
<p>Please show your appreciation for New User Approve by giving it a positive <a href="https://wordpress.org/support/view/plugin-reviews/new-user-approve#postform" target="_blank">review</a> in the plugin repository!</p>
|
412 |
<?php
|
413 |
-
|
414 |
|
415 |
}
|
416 |
|
417 |
-
function pw_new_user_approve_admin_approve()
|
418 |
-
|
|
|
419 |
}
|
420 |
|
421 |
pw_new_user_approve_admin_approve();
|
5 |
* Admin must approve all new users
|
6 |
*/
|
7 |
|
8 |
+
class pw_new_user_approve_admin_approve
|
9 |
+
{
|
10 |
+
|
11 |
+
public $_admin_page = 'new-user-approve-admin';
|
12 |
+
public $_admin_upgrade_page = 'new-user-approve-upgrade';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* The only instance of pw_new_user_approve_admin_approve.
|
16 |
+
*
|
17 |
+
* @var pw_new_user_approve_admin_approve
|
18 |
+
*/
|
19 |
+
private static $instance;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Returns the main instance.
|
23 |
+
*
|
24 |
+
* @return pw_new_user_approve_admin_approve
|
25 |
+
*/
|
26 |
+
public static function instance()
|
27 |
+
{
|
28 |
+
if (!isset(self::$instance)) {
|
29 |
+
self::$instance = new pw_new_user_approve_admin_approve();
|
30 |
+
}
|
31 |
+
return self::$instance;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @since 1.0
|
36 |
+
* @since 2.1 `admin_post_nua-save-api-key` added for zapier
|
37 |
+
*/
|
38 |
+
private function __construct()
|
39 |
+
{
|
40 |
+
// Actions
|
41 |
+
add_action('admin_menu', array($this, 'admin_menu_link'));
|
42 |
+
add_action('admin_init', array($this, 'process_input'));
|
43 |
+
add_action('admin_notices', array($this, 'admin_notice'));
|
44 |
+
add_action('admin_init', array($this, 'notice_ignore'));
|
45 |
+
add_action('admin_init', array($this, '_add_meta_boxes'));
|
46 |
+
add_action('admin_post_nua-save-api-key', array($this, 'save_api_key'));
|
47 |
+
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_script'));
|
48 |
+
}
|
49 |
+
|
50 |
+
public function admin_enqueue_script()
|
51 |
+
{
|
52 |
+
wp_enqueue_script('hide-seek-search', pw_new_user_approve()->get_plugin_url() . '/assets/js/jquery.hideseek.min.js', array('jquery'), '3.1');
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Add the new menu item to the users portion of the admin menu
|
57 |
+
*
|
58 |
+
* @uses admin_menu
|
59 |
+
*/
|
60 |
+
public function admin_menu_link()
|
61 |
+
{
|
62 |
+
$show_admin_page = apply_filters('new_user_approve_show_admin_page', true);
|
63 |
+
|
64 |
+
if ($show_admin_page) {
|
65 |
+
$cap = apply_filters('new_user_approve_minimum_cap', 'edit_users');
|
66 |
+
$hook = add_menu_page(__('Approve New Users', 'new-user-approve'), __('Approve New Users', 'new-user-approve'), $cap, $this->_admin_page, array($this, 'approve_admin'));
|
67 |
+
$hook_upgrade = add_submenu_page($this->_admin_page, __('Upgrade', 'new-user-approve'), __('Upgrade', 'new-user-approve'), $cap, $this->_admin_upgrade_page, array($this, 'new_user_approve_upgrade'));
|
68 |
+
add_action('load-' . $hook, array($this, 'admin_enqueue_scripts'));
|
69 |
+
|
70 |
+
add_action('load-' . $hook_upgrade, array($this, 'admin_enqueue_upgrade_scripts'));
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
public function admin_enqueue_upgrade_scripts() {
|
77 |
+
|
78 |
+
wp_enqueue_script('upgrade-script', pw_new_user_approve()->get_plugin_url() . '/assets/js/modernizr.min.js', array('jquery'), NUA_VERSION);
|
79 |
+
wp_enqueue_script('upgrade-freemius-script', pw_new_user_approve()->get_plugin_url() . '/assets/js/checkout.min.js',array('jquery'), NUA_VERSION);
|
80 |
+
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Create the upgrade to premium page
|
85 |
+
*/
|
86 |
+
public function new_user_approve_upgrade()
|
87 |
+
{
|
88 |
+
require_once pw_new_user_approve()->get_plugin_dir() . '/admin/templates/upgrade.php';
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Create the view for the admin interface
|
93 |
+
*/
|
94 |
+
public function approve_admin()
|
95 |
+
{
|
96 |
+
require_once pw_new_user_approve()->get_plugin_dir() . '/admin/templates/approve.php';
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Output the table that shows the registered users grouped by status
|
101 |
+
*
|
102 |
+
* @param string $status the filter to use for which the users will be queried. Possible values are pending, approved, or denied.
|
103 |
+
*/
|
104 |
+
public function user_table($status)
|
105 |
+
{
|
106 |
+
global $current_user;
|
107 |
+
|
108 |
+
$approve = ('denied' == $status || 'pending' == $status);
|
109 |
+
$deny = ('approved' == $status || 'pending' == $status);
|
110 |
+
|
111 |
+
$user_status = pw_new_user_approve()->get_user_statuses();
|
112 |
+
$users = $user_status[$status];
|
113 |
+
|
114 |
+
if (count($users) > 0) {
|
115 |
+
if ('denied' == $status) {
|
116 |
+
?>
|
117 |
+
<p class="status_heading"><?php esc_html_e('Denied Users', 'new-user-approve');?></p>
|
118 |
<?php
|
119 |
+
} else if ('approved' == $status) {
|
120 |
+
?>
|
121 |
+
<p class="status_heading"><?php esc_html_e('Approved Users', 'new-user-approve');?></p>
|
122 |
<?php
|
123 |
+
} else if ('pending' == $status) {
|
124 |
+
?>
|
125 |
+
<p class="status_heading"><?php esc_html_e('Pending Users', 'new-user-approve');?></p>
|
126 |
+
<?php
|
127 |
+
}
|
128 |
+
?>
|
129 |
<table class="widefat">
|
130 |
<thead>
|
131 |
<tr class="thead">
|
132 |
+
<th><?php esc_html_e('Username', 'new-user-approve');?></th>
|
133 |
+
<th><?php esc_html_e('Name', 'new-user-approve');?></th>
|
134 |
+
<th><?php esc_html_e('E-mail', 'new-user-approve');?></th>
|
135 |
+
<?php if ('pending' == $status) {?>
|
136 |
+
<th colspan="2"><?php esc_html_e('Action', 'new-user-approve');?></th>
|
137 |
+
<?php } else {?>
|
138 |
+
<th><?php esc_html_e('Action', 'new-user-approve');?></th>
|
139 |
+
<?php }?>
|
140 |
</tr>
|
141 |
</thead>
|
142 |
<tbody class="nua-user-list">
|
143 |
<?php
|
144 |
+
// show each of the users
|
145 |
+
$row = 1;
|
146 |
+
foreach ($users as $user) {
|
147 |
+
$class = ($row % 2) ? '' : ' class="alternate"';
|
148 |
+
$avatar = get_avatar($user->user_email, 32);
|
149 |
+
|
150 |
+
if ($approve) {
|
151 |
+
$approve_link = get_option('siteurl') . '/wp-admin/admin.php?page=' . $this->_admin_page . '&user=' . $user->ID . '&status=approve';
|
152 |
+
if (isset($_REQUEST['tab'])) {
|
153 |
+
$approve_link = add_query_arg(array('tab' => sanitize_text_field(wp_unslash($_REQUEST['tab']))), $approve_link);
|
154 |
+
}
|
155 |
+
|
156 |
+
$approve_link = wp_nonce_url($approve_link, 'pw_new_user_approve_action_' . get_class($this));
|
157 |
+
|
158 |
+
}
|
159 |
+
if ($deny) {
|
160 |
+
$deny_link = get_option('siteurl') . '/wp-admin/admin.php?page=' . $this->_admin_page . '&user=' . $user->ID . '&status=deny';
|
161 |
+
if (isset($_REQUEST['tab'])) {
|
162 |
+
$deny_link = add_query_arg('tab', sanitize_text_field(wp_unslash($_REQUEST['tab'])), $deny_link);
|
163 |
+
}
|
164 |
+
|
165 |
+
$deny_link = wp_nonce_url($deny_link, 'pw_new_user_approve_action_' . get_class($this));
|
166 |
+
}
|
167 |
+
|
168 |
+
if (current_user_can('edit_user', $user->ID)) {
|
169 |
+
if ($current_user->ID == $user->ID) {
|
170 |
+
$edit_link = 'profile.php';
|
171 |
+
} else {
|
172 |
+
$SERVER_URI = get_admin_url();
|
173 |
+
if (isset($_SERVER['REQUEST_URI'])) { $SERVER_URI = sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])); }
|
174 |
+
$edit_link = add_query_arg('wp_http_referer', urlencode(esc_url($SERVER_URI)), "user-edit.php?user_id=$user->ID");
|
175 |
+
}
|
176 |
+
$edit = ($avatar == true) ? ('<strong style="position: relative; top: -17px; left: 6px;"><a href="' . esc_url($edit_link) . '">' . esc_html($user->user_login) . '</a></strong>') : ('<strong style="top: -17px; left: 6px;"><a href="' . esc_url($edit_link) . '">' . esc_html($user->user_login) . '</a></strong>');
|
177 |
+
|
178 |
+
} else {
|
179 |
+
$edit = ($avatar == true) ? ('<strong style="position: relative; top: -17px; left: 6px;">' . esc_html($user->user_login) . '</strong>') : ('<strong style="top: -17px; left: 6px;">' . esc_html($user->user_login) . '</strong>');
|
180 |
+
|
181 |
+
}
|
182 |
+
|
183 |
+
?>
|
184 |
+
<tr <?php echo esc_attr($class); ?>>
|
185 |
+
<td><?php echo wp_kses_post($avatar . ' ' . $edit); ?></td>
|
186 |
+
<td><?php echo (esc_attr(get_user_meta($user->ID, 'first_name', true)) . ' ' . esc_attr(get_user_meta($user->ID, 'last_name', true))); ?></td>
|
187 |
+
<td><a href="mailto:<?php esc_attr_e($user->user_email);?>"
|
188 |
+
title="<?php esc_attr_e('email:', 'new-user-approve')?> <?php esc_attr_e($user->user_email);?>"><?php esc_html_e($user->user_email);?></a>
|
189 |
</td>
|
190 |
+
<?php if ($approve && $user->ID != get_current_user_id()) {?>
|
191 |
+
<td><a class="button" href= "<?php echo esc_url($approve_link) ?>" title="<?php esc_attr_e('Approve', 'new-user-approve');?> <?php esc_attr_e($user->user_login);?>"><?php esc_html_e('Approve', 'new-user-approve');?></a>
|
|
|
192 |
</td>
|
193 |
+
<?php }?>
|
194 |
+
<?php if ($deny && $user->ID != get_current_user_id()) {?>
|
195 |
+
<td><a class="button" href="<?php echo esc_url($deny_link); ?>" title="<?php esc_attr_e('Deny', 'new-user-approve');?> <?php esc_attr_e($user->user_login);?>"><?php echo esc_html('Deny', 'new-user-approve'); ?></a>
|
|
|
196 |
</td>
|
197 |
+
<?php }?>
|
198 |
+
<?php if ($user->ID == get_current_user_id()): ?>
|
199 |
<td colspan="2"> </td>
|
200 |
+
<?php endif;?>
|
201 |
</tr><?php
|
202 |
+
$row++;
|
203 |
+
}
|
204 |
+
?>
|
205 |
</tbody>
|
206 |
</table>
|
207 |
<?php
|
208 |
+
} else {
|
209 |
+
$status_i18n = $status;
|
210 |
+
if ($status == 'approved') {
|
211 |
+
$status_i18n = __('approved', 'new-user-approve');
|
212 |
+
} else if ($status == 'denied') {
|
213 |
+
$status_i18n = __('denied', 'new-user-approve');
|
214 |
+
} else if ($status == 'pending') {
|
215 |
+
$status_i18n = __('pending', 'new-user-approve');
|
216 |
+
}
|
217 |
+
|
218 |
+
?>
|
219 |
+
|
220 |
+
<p> <?php sprintf(__('There are no users with a status of %s', 'new-user-approve'), $status_i18n);?> </p>
|
221 |
+
<?php
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Accept input from admin to modify a user
|
227 |
+
*
|
228 |
+
* @uses init
|
229 |
+
*/
|
230 |
+
public function process_input()
|
231 |
+
{
|
232 |
+
if ((isset($_GET['page']) && $_GET['page'] == $this->_admin_page) && isset($_GET['status'])&& isset($_GET['user'])) {
|
233 |
+
$valid_request = check_admin_referer('pw_new_user_approve_action_' . get_class($this));
|
234 |
+
|
235 |
+
if ($valid_request) {
|
236 |
+
$status = sanitize_key($_GET['status']);
|
237 |
+
$user_id = absint(sanitize_user(wp_unslash($_GET['user'])));
|
238 |
+
|
239 |
+
pw_new_user_approve()->update_user_status($user_id, $status);
|
240 |
+
}
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Display a notice on the legacy page that notifies the user of the new interface.
|
246 |
+
*
|
247 |
+
* @uses admin_notices
|
248 |
+
*/
|
249 |
+
public function admin_notice()
|
250 |
+
{
|
251 |
+
$screen = get_current_screen();
|
252 |
+
|
253 |
+
if ($screen->id == 'users_page_new-user-approve-admin') {
|
254 |
+
$user_id = get_current_user_id();
|
255 |
+
|
256 |
+
// Check that the user hasn't already clicked to ignore the message
|
257 |
+
if (!get_user_meta($user_id, 'pw_new_user_approve_ignore_notice')) {
|
258 |
+
?>
|
259 |
+
<div class="updated"><p>
|
260 |
+
<?php printf(wp_kses_post(__('You can now update user status on the <a href="%1$s">users admin page</a>. | <a href="%2$s">Hide Notice</a>', 'new-user-approve'), admin_url('users.php'), add_query_arg(array('new-user-approve-ignore-notice' => 1))));?>
|
261 |
+
</p></div>
|
262 |
+
<?php
|
263 |
+
}
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* If user clicks to ignore the notice, add that to their user meta
|
269 |
+
*
|
270 |
+
* @uses admin_init
|
271 |
+
*/
|
272 |
+
public function notice_ignore()
|
273 |
+
{
|
274 |
+
if (isset($_GET['new-user-approve-ignore-notice']) && '1' == $_GET['new-user-approve-ignore-notice']) {
|
275 |
+
$user_id = get_current_user_id();
|
276 |
+
add_user_meta($user_id, 'pw_new_user_approve_ignore_notice', '1', true);
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
public function admin_enqueue_scripts()
|
281 |
+
{
|
282 |
+
wp_enqueue_script('post');
|
283 |
+
}
|
284 |
+
|
285 |
+
public function _add_meta_boxes()
|
286 |
+
{
|
287 |
+
add_meta_box('nua-approve-admin', __('Approve Users', 'new-user-approve'), array($this, 'metabox_main'), 'users_page_new-user-approve-admin', 'main', 'high');
|
288 |
+
add_meta_box('nua-support', __('Support', 'new-user-approve'), array($this, 'metabox_support'), 'users_page_new-user-approve-admin', 'side', 'default');
|
289 |
+
add_meta_box('nua-feedback', __('Feedback', 'new-user-approve'), array($this, 'metabox_feedback'), 'users_page_new-user-approve-admin', 'side', 'default');
|
290 |
+
}
|
291 |
+
|
292 |
+
public function metabox_main()
|
293 |
+
{
|
294 |
+
$active_tab = isset($_GET['tab']) ? sanitize_text_field(wp_unslash($_GET['tab'])) : 'pending_users';
|
295 |
+
?>
|
296 |
<h3 class="nav-tab-wrapper" style="padding-bottom: 0; border-bottom: none;">
|
297 |
<script>
|
298 |
jQuery(document).ready(function() {
|
302 |
});
|
303 |
</script>
|
304 |
<input type="search" name="nua_search" placeholder="Search" style="float: right;" data-list=".nua-user-list">
|
305 |
+
<a href="<?php echo esc_url(admin_url('admin.php?page=new-user-approve-admin&tab=pending_users')); ?>"
|
306 |
+
class="nav-tab<?php echo $active_tab == 'pending_users' ? ' nav-tab-active' : ''; ?>"><span><?php esc_html_e('Pending Users', 'new-user-approve');?></span></a>
|
307 |
+
<a href="<?php echo esc_url(admin_url('admin.php?page=new-user-approve-admin&tab=approved_users')); ?>"
|
308 |
+
class="nav-tab<?php echo $active_tab == 'approved_users' ? ' nav-tab-active' : ''; ?>"><span><?php esc_html_e('Approved Users', 'new-user-approve');?></span></a>
|
309 |
+
<a href="<?php echo esc_url(admin_url('admin.php?page=new-user-approve-admin&tab=denied_users')); ?>"
|
310 |
+
class="nav-tab<?php echo $active_tab == 'denied_users' ? ' nav-tab-active' : ''; ?>"><span><?php esc_html_e('Denied Users', 'new-user-approve');?></span></a>
|
311 |
+
<a href="<?php echo esc_url(admin_url('admin.php?page=new-user-approve-admin&tab=zapier')); ?>"
|
312 |
+
class="nav-tab<?php echo $active_tab == 'zapier' ? ' nav-tab-active' : ''; ?>"><span><?php esc_html_e('Zapier', 'new-user-approve');?></span></a>
|
313 |
+
<a href="<?php echo esc_url(admin_url('admin.php?page=new-user-approve-admin&tab=pro_features')); ?>"
|
314 |
+
class="nav-tab<?php echo $active_tab == 'pro_features' ? ' nav-tab-active' : ''; ?>"><span><?php esc_html_e('Pro Features', 'new-user-approve');?></span></a>
|
315 |
</h3>
|
316 |
|
317 |
+
<?php if ($active_tab == 'pending_users'): ?>
|
318 |
<div id="pw_pending_users">
|
319 |
+
<?php $this->user_table('pending');?>
|
320 |
</div>
|
321 |
+
<?php elseif ($active_tab == 'approved_users'): ?>
|
322 |
<div id="pw_approved_users">
|
323 |
+
<?php $this->user_table('approved');?>
|
324 |
</div>
|
325 |
<?php
|
326 |
+
elseif ($active_tab == 'denied_users'): ?>
|
327 |
<div id="pw_denied_users">
|
328 |
+
<?php $this->user_table('denied');?>
|
329 |
</div>
|
330 |
<?php
|
331 |
+
elseif ($active_tab == 'zapier'): ?>
|
332 |
<div id="pw_denied_users">
|
333 |
+
<?php $this->zapier();?>
|
334 |
</div>
|
335 |
<?php
|
336 |
+
elseif ($active_tab == 'pro_features'): ?>
|
337 |
<div id="pw_pro_features">
|
338 |
+
<?php $this->pro_features();?>
|
339 |
</div>
|
340 |
<?php endif;
|
341 |
+
}
|
342 |
|
343 |
+
public function pro_features()
|
344 |
+
{
|
345 |
+
?>
|
346 |
<h3>Premium Features</h3>
|
347 |
<ul style="padding-left: 30px; list-style-type: disc;">
|
348 |
<li>Provides Ability To remove plugin stats from admin dashboard.</li>
|
365 |
|
366 |
<p>Please Visit this link For <a class="button" href="https://newuserapprove.com/options-addon" target="_blank" >Premium Plugin </a> </p>
|
367 |
<?php
|
368 |
+
}
|
369 |
+
|
370 |
+
/**
|
371 |
+
* Renders Zapier Tab
|
372 |
+
* @since 2.0
|
373 |
+
* @version 1.0
|
374 |
+
*/
|
375 |
+
public function zapier()
|
376 |
+
{
|
377 |
+
|
378 |
+
$triggers = array(
|
379 |
+
__('Triggers when a user is Approved.', 'new-user-approve'),
|
380 |
+
__('Triggers when a user is Denied.', 'new-user-approve'),
|
381 |
+
);
|
382 |
+
|
383 |
+
$api_key = (\NewUserApproveZapier\RestRoutes::api_key()) ? "value='" . \NewUserApproveZapier\RestRoutes::api_key() . "'" : '';
|
384 |
+
|
385 |
+
?>
|
386 |
+
<?php $get_api_key = get_option('nua_api_key', $api_key);?>
|
387 |
+
<html>
|
388 |
+
|
389 |
+
<p class="status_heading"> <?php esc_html_e('Zapier Settings', 'new-user-approve');?> </p>
|
390 |
+
|
391 |
<table cellpadding='10'>
|
392 |
<tr>
|
393 |
+
<td> <?php esc_html_e('Website URL: ', 'new-user-approve')?> </td>
|
394 |
+
<td> <?php echo esc_url(get_site_url()); ?> </td>
|
395 |
</tr>
|
396 |
<tr>
|
397 |
+
<td> <?php esc_html_e('API Key: ', 'new-user-approve');?> </td>
|
398 |
<td>
|
399 |
+
<form action=<?php echo esc_url(admin_url('admin-post.php')); ?> method="POST">
|
400 |
+
<?php $nonce = wp_create_nonce('api-generate-nonce');?>
|
401 |
+
<input type='text' name='nua_api_key' id='nua-api' value = "<?php $get_api_key ? esc_attr_e($get_api_key) : ''?>" />
|
402 |
<button id='nua-generate-api' class='button'>Generate API Key</button>
|
403 |
+
<input type='hidden' name='wp-api-generate-nonce' value='<?php esc_attr_e($nonce)?>' />
|
404 |
<input type='hidden' name='action' value='nua-save-api-key' />
|
405 |
<input type='submit' value='Save' name='nua_save_api' class='button'/>
|
406 |
</form>
|
407 |
</td>
|
408 |
</tr>
|
409 |
</table>
|
410 |
+
|
411 |
+
<p class="status_heading"> <?php esc_html_e('Triggers', 'new-user-approve')?> </p>
|
412 |
+
<ul style='padding-left: 30px; list-style-type: disc;'>
|
413 |
+
<?php foreach ($triggers as $trigger): ?>
|
414 |
+
|
415 |
+
<li> <?php esc_html_e($trigger);?> </li>
|
416 |
+
|
417 |
+
<?php endforeach;?>
|
418 |
+
</ul>
|
419 |
+
</html>
|
420 |
+
<?php
|
421 |
+
}
|
422 |
+
|
423 |
+
public function save_api_key()
|
424 |
+
{
|
425 |
+
|
426 |
+
|
427 |
+
|
428 |
+
if (isset($_REQUEST['wp-api-generate-nonce']) && isset($_POST['action']) && $_POST['action'] == 'nua-save-api-key') {
|
429 |
+
$nonce = sanitize_text_field(wp_unslash($_REQUEST['wp-api-generate-nonce']));
|
430 |
+
if (wp_verify_nonce($nonce, 'api-generate-nonce') && isset($_POST['nua_api_key'])) {
|
431 |
+
|
432 |
+
$api_key = sanitize_text_field(wp_unslash($_POST['nua_api_key']));
|
433 |
+
|
434 |
+
update_option('nua_api_key', $api_key);
|
435 |
+
|
436 |
+
wp_redirect(admin_url('admin.php?page=new-user-approve-admin&tab=zapier'));
|
437 |
+
}
|
438 |
+
}
|
439 |
+
}
|
440 |
+
|
441 |
+
public function metabox_support()
|
442 |
+
{
|
443 |
+
?>
|
444 |
<p>If you haven't already, check out the <a href="https://wordpress.org/plugins/new-user-approve/faq/" target="_blank">Frequently Asked Questions</a>.</p>
|
445 |
<p>Still not fixed? Please <a href="https://wordpress.org/support/plugin/new-user-approve" target="_blank">start a support topic</a> and I or someone from the community will be able to assist you.</p>
|
446 |
<?php
|
447 |
+
}
|
448 |
|
449 |
+
public function metabox_feedback()
|
450 |
+
{
|
451 |
+
?>
|
452 |
<p>Please show your appreciation for New User Approve by giving it a positive <a href="https://wordpress.org/support/view/plugin-reviews/new-user-approve#postform" target="_blank">review</a> in the plugin repository!</p>
|
453 |
<?php
|
454 |
+
}
|
455 |
|
456 |
}
|
457 |
|
458 |
+
function pw_new_user_approve_admin_approve()
|
459 |
+
{
|
460 |
+
return pw_new_user_approve_admin_approve::instance();
|
461 |
}
|
462 |
|
463 |
pw_new_user_approve_admin_approve();
|
includes/invitation-code.php
CHANGED
@@ -17,8 +17,7 @@
|
|
17 |
*/
|
18 |
|
19 |
|
20 |
-
class nua_invitation_code
|
21 |
-
{
|
22 |
|
23 |
private static $instance;
|
24 |
|
@@ -37,16 +36,14 @@ class nua_invitation_code
|
|
37 |
*
|
38 |
* @return nua_invitation_code
|
39 |
*/
|
40 |
-
public static function instance()
|
41 |
-
{
|
42 |
if (!isset(self::$instance)) {
|
43 |
self::$instance = new nua_invitation_code();
|
44 |
}
|
45 |
return self::$instance;
|
46 |
}
|
47 |
|
48 |
-
private function __construct()
|
49 |
-
{
|
50 |
//Action
|
51 |
add_action('admin_menu', array($this, 'admin_menu_link'), 30);
|
52 |
add_action('admin_init', array($this, 'nua_deactivate_code'));
|
@@ -71,8 +68,7 @@ class nua_invitation_code
|
|
71 |
}
|
72 |
}
|
73 |
|
74 |
-
public function nua_deactivate_code()
|
75 |
-
{
|
76 |
|
77 |
if (isset($_GET['post_type']) && $_GET['post_type'] == $this->code_post_type && is_admin()) {
|
78 |
if (isset($_GET['post_id']) && check_admin_referer('nua_deactivate-' . absint($_GET['post_id']), 'nonce')) {
|
@@ -81,8 +77,7 @@ class nua_invitation_code
|
|
81 |
}
|
82 |
}
|
83 |
|
84 |
-
public function invitation_code_edit_page_css()
|
85 |
-
{
|
86 |
if (isset($_GET['post_type']) && $_GET['post_type'] == $this->code_post_type) {
|
87 |
?>
|
88 |
<style>
|
@@ -96,8 +91,7 @@ class nua_invitation_code
|
|
96 |
}
|
97 |
}
|
98 |
|
99 |
-
public function remove_row_actions_from_table($actions, $post)
|
100 |
-
{
|
101 |
if ($post->post_type == $this->code_post_type) {
|
102 |
|
103 |
return array();
|
@@ -108,22 +102,20 @@ class nua_invitation_code
|
|
108 |
/**
|
109 |
* Add the link to the admin menu for the settings page
|
110 |
*/
|
111 |
-
public function admin_menu_link()
|
112 |
-
{
|
113 |
// don't show the link in the admin menu if the parent plugin is inactive
|
114 |
if (!function_exists('pw_new_user_approve')) {
|
115 |
return;
|
116 |
}
|
117 |
|
118 |
-
$hook = add_submenu_page('new-user-approve-admin', __('Invitation Code', 'new-user-approve
|
119 |
|
120 |
-
add_submenu_page('new-user-approve-admin', __('All Codes', '
|
121 |
|
122 |
add_action('admin_print_scripts-' . $hook, array($this, 'admin_scripts'));
|
123 |
}
|
124 |
|
125 |
-
public function admin_scripts()
|
126 |
-
{
|
127 |
wp_enqueue_script('nua-options');
|
128 |
}
|
129 |
|
@@ -131,20 +123,19 @@ class nua_invitation_code
|
|
131 |
/**
|
132 |
* Post Registration
|
133 |
*/
|
134 |
-
public function nua_invitation()
|
135 |
-
{
|
136 |
|
137 |
$labels = array(
|
138 |
-
'name' => __('Invitation Code', 'new-user-approve
|
139 |
-
'singular_name' => __('Invitation Code', 'new-user-approve
|
140 |
-
'menu_name' => __('All Codes', 'new-user-approve
|
141 |
-
'name_admin_bar' => __('All Codes', 'new-user-approve
|
142 |
-
'add_new' => __('Add New', 'new-user-approve
|
143 |
-
'add_new_item' => __('Add New Invitation Code', 'new-user-approve
|
144 |
-
'new_item' => __('New Invitation Code', 'new-user-approve
|
145 |
-
'edit_item' => __('Edit Invitation Code', 'new-user-approve
|
146 |
-
'view_item' => __('View Invitation Code', 'new-user-approve
|
147 |
-
'all_items' => __('All Invitation Code', 'new-user-approve
|
148 |
);
|
149 |
|
150 |
$args = array(
|
@@ -169,33 +160,35 @@ class nua_invitation_code
|
|
169 |
/**
|
170 |
* Output the settings
|
171 |
*/
|
172 |
-
public function invitation_code_settings()
|
173 |
-
|
174 |
-
|
|
|
175 |
|
176 |
?>
|
177 |
<div class="wrap">
|
178 |
<div id="icon-options-general" class="icon32"><br /></div>
|
179 |
-
<h2 class="nua-settings-heading"><?php
|
180 |
|
181 |
<h2 class="nav-tab-wrapper">
|
182 |
|
183 |
-
<a href="<?php echo esc_url(add_query_arg(array('page' => $this->screen_name), admin_url('admin.php'))); ?>" class="nav-tab<?php if ('add-codes' == $action) echo ' nav-tab-active'; ?>"><?php esc_html_e('Add Codes', 'new-user-approve
|
184 |
|
185 |
-
<a href="<?php echo esc_url(add_query_arg(array('page' => $this->screen_name, 'action' => 'Settings'), admin_url('admin.php'))); ?>" class="nav-tab <?php if ('Settings' == $action) echo ' nav-tab-active'; ?>"><?php esc_html_e('Settings', 'new-user-approve
|
186 |
-
<a href="<?php echo esc_url(add_query_arg(array('page' => $this->screen_name, 'action' => 'import-codes'), admin_url('admin.php'))); ?>" class="nav-tab<?php if ('import-codes' == $action) echo ' nav-tab-active'; ?>"><?php esc_html_e('Import Codes', 'new-user-approve
|
187 |
-
<a href="<?php echo esc_url(add_query_arg(array('page' => $this->screen_name, 'action' => 'email'), admin_url('admin.php'))); ?>" class="nav-tab<?php if ('email' == $action) echo ' nav-tab-active'; ?>"><?php esc_html_e('Email', 'new-user-approve
|
188 |
|
189 |
</h2>
|
190 |
<?php
|
191 |
-
$tab = (isset($_GET['tab'])) ? $_GET['tab'] : '';
|
|
|
192 |
$tab = (empty($tab) && !isset($_GET['action'])) ? 'manual' : $tab;
|
193 |
?>
|
194 |
<?php if (!isset($_GET['action'])) : ?>
|
195 |
<h2 class="nav-subtab-wrapper">
|
196 |
|
197 |
-
<a href="<?php echo esc_url(add_query_arg(array('page' => $this->screen_name, 'tab' => 'manual'), admin_url('admin.php'))); ?>" class="nav-tab<?php if ('manual' == $tab) echo ' nav-tab-active'; ?>"><?php esc_html_e('Manual Generate', 'new-user-approve
|
198 |
-
<a href="<?php echo esc_url(add_query_arg(array('page' => $this->screen_name, 'tab' => 'auto'), admin_url('admin.php'))); ?>" class="nav-tab<?php if ('auto' == $tab) echo ' nav-tab-active'; ?>"><?php esc_html_e('Auto Generate', 'new-user-approve
|
199 |
|
200 |
|
201 |
</h2>
|
@@ -207,8 +200,7 @@ class nua_invitation_code
|
|
207 |
$this->get_the_required_tab($action, $tab);
|
208 |
}
|
209 |
|
210 |
-
public function get_the_required_tab($action, $tab)
|
211 |
-
{
|
212 |
|
213 |
if ('add-codes' == $action) {
|
214 |
|
@@ -227,19 +219,20 @@ class nua_invitation_code
|
|
227 |
}
|
228 |
}
|
229 |
|
230 |
-
public function manual_add_codes()
|
231 |
-
{
|
232 |
$count = 0;
|
233 |
if (isset($_POST['nua_manual_add'])) {
|
234 |
-
|
235 |
-
|
236 |
-
|
|
|
|
|
237 |
$Status = 'Active';
|
238 |
//$dateTime = new DateTime(str_replace('/','-',$expiry));
|
239 |
//$expiry_timestamp = $dateTime->format('U');
|
240 |
$expiry_timestamp = strtotime("$expiry 23:59:59");
|
241 |
|
242 |
-
$code =
|
243 |
$code = explode("\n", $code);
|
244 |
|
245 |
foreach ($code as $in_code) {
|
@@ -266,41 +259,43 @@ class nua_invitation_code
|
|
266 |
}
|
267 |
}
|
268 |
if (!empty($count)) {
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
'</p>';
|
273 |
} else {
|
274 |
|
275 |
-
|
276 |
-
echo
|
277 |
-
|
278 |
}
|
|
|
279 |
}
|
280 |
|
281 |
|
282 |
?>
|
283 |
<form method="post" action=''>
|
284 |
-
|
285 |
<table class="form-table" role="presentation">
|
286 |
<tbody>
|
287 |
<tr>
|
288 |
-
<th><?php
|
289 |
<td>
|
290 |
<div style="max-width: 600px;">
|
291 |
<textarea id="nua_manual_add_add_codes" name="nua_manual_add[codes]" required class="nua-textarea"></textarea>
|
292 |
</div>
|
293 |
-
<p class="description"><?php
|
294 |
</td>
|
295 |
</tr>
|
296 |
<tr>
|
297 |
-
<th><?php
|
298 |
<td>
|
299 |
<input id="nua_manual_add_usage_limit" name="nua_manual_add[usage_limit]" placeholder="1" size="40" type="text" class="nua-text-field">
|
|
|
|
|
300 |
</td>
|
301 |
</tr>
|
302 |
<tr>
|
303 |
-
<th><?php
|
304 |
<td>
|
305 |
<input id="nua_manual_add_expiry_date" name="nua_manual_add[expiry_date]" size="40" type="date" class="nua-text-field">
|
306 |
|
@@ -320,26 +315,27 @@ class nua_invitation_code
|
|
320 |
|
321 |
}
|
322 |
|
323 |
-
public function auto_add_codes()
|
324 |
-
|
325 |
-
|
326 |
-
|
|
|
327 |
}
|
328 |
-
public function import_codes()
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
}
|
334 |
-
public function email()
|
335 |
-
|
336 |
-
|
337 |
-
|
|
|
338 |
}
|
339 |
|
340 |
|
341 |
-
public function get_available_invitation_codes()
|
342 |
-
{
|
343 |
|
344 |
$args = array(
|
345 |
'numberposts' => -1,
|
@@ -380,12 +376,10 @@ class nua_invitation_code
|
|
380 |
/**
|
381 |
* Output the Meta Value
|
382 |
*/
|
383 |
-
public function add_invitation_meta()
|
384 |
-
|
385 |
-
add_meta_box('nua_invitation', __('Invitation code for new user', 'new-user-approve-options'), array($this, 'funct_nua_invitation'), $this->code_post_type);
|
386 |
}
|
387 |
-
public function funct_nua_invitation()
|
388 |
-
{
|
389 |
|
390 |
$code = get_post_meta(get_the_ID(), $this->code_key, true);
|
391 |
$useage = get_post_meta(get_the_ID(), $this->usage_limit_key, true);
|
@@ -397,38 +391,42 @@ class nua_invitation_code
|
|
397 |
|
398 |
?>
|
399 |
<form method="post" action=''>
|
|
|
400 |
<table class="form-table" role="presentation">
|
|
|
401 |
<tbody>
|
402 |
<tr>
|
403 |
-
|
404 |
-
<
|
|
|
|
|
405 |
</tr>
|
406 |
<tr>
|
407 |
-
<th scope="row"><?php
|
408 |
-
<td><input type="text" name="usage_limit" required value="<?php echo $useage ?>" class="nua_codetxt" /><br>
|
409 |
</tr>
|
410 |
<tr>
|
411 |
-
<th scope="row"><?php
|
412 |
-
<td><input type="text" name="total_code" required value="<?php echo $total_code_key
|
413 |
</tr>
|
414 |
<tr>
|
415 |
-
<th scope="row"><?php
|
416 |
-
<td><input type="date" name="expiry_date" required value="<?php echo $convert_date
|
417 |
</tr>
|
418 |
<tr>
|
419 |
-
<th scope="row"><?php
|
420 |
<td>
|
421 |
<select name="code_status" required class="nua_codetxt">
|
422 |
-
<option value='Active' <?php echo ('Active' == $Status ? 'selected' : '') ?>>Active</option>
|
423 |
-
<option value='InActive' <?php echo ('InActive' == $Status ? 'selected' : '') ?>> InActive</option>
|
424 |
-
<option value='Expire' <?php echo ('Expire' == $Status ? 'selected' : '') ?>> Expire</option>
|
425 |
</select>
|
426 |
</td>
|
427 |
</tr>
|
428 |
<tr>
|
429 |
<td colspan="2">
|
430 |
<table>
|
431 |
-
<p><?php
|
432 |
<thead>
|
433 |
<tr>
|
434 |
<th>USER-ID</th>
|
@@ -442,21 +440,29 @@ class nua_invitation_code
|
|
442 |
if (!empty($registered_user)) {
|
443 |
|
444 |
foreach ($registered_user as $userid) {
|
445 |
-
|
|
|
|
|
446 |
|
447 |
$the_user = get_user_by('id', $userid);
|
448 |
|
449 |
if (!empty($the_user)) {
|
450 |
$link = get_edit_user_link($userid);
|
451 |
-
|
452 |
-
|
|
|
|
|
453 |
} else {
|
454 |
-
|
|
|
|
|
455 |
}
|
456 |
-
|
457 |
}
|
458 |
} else {
|
459 |
-
|
|
|
|
|
460 |
}
|
461 |
?>
|
462 |
</tbody>
|
@@ -470,16 +476,16 @@ class nua_invitation_code
|
|
470 |
|
471 |
}
|
472 |
|
473 |
-
public function save_nua_invitation()
|
474 |
-
{
|
475 |
|
476 |
-
if (isset($_POST['post_type']) && $this->code_post_type == $_POST['post_type']) {
|
477 |
-
|
478 |
-
$
|
479 |
-
$
|
480 |
-
$
|
481 |
-
$
|
482 |
-
$
|
|
|
483 |
//$dateTime = new DateTime(str_replace('/','-',$Expiry));
|
484 |
//$expiry_timestamp = $dateTime->format('U');
|
485 |
$expiry_timestamp = strtotime("$expiry 23:59:59");
|
@@ -492,19 +498,20 @@ class nua_invitation_code
|
|
492 |
}
|
493 |
}
|
494 |
|
495 |
-
public function nua_invitation_code_field()
|
496 |
-
|
497 |
-
?>
|
498 |
<p>
|
499 |
-
<label> <?php
|
|
|
500 |
<input type="text" class="nua_invitation_code" name="nua_invitation_code" />
|
501 |
</p>
|
502 |
<?php
|
503 |
}
|
504 |
|
505 |
-
public function nua_invitation_status_code($status, $user_id)
|
506 |
-
|
507 |
-
|
|
|
508 |
if (isset($_POST['nua_invitation_code']) && !empty($_POST['nua_invitation_code'])) {
|
509 |
$args = array(
|
510 |
'numberposts' => -1,
|
@@ -516,7 +523,7 @@ class nua_invitation_code
|
|
516 |
array(
|
517 |
array(
|
518 |
'key' => $this->code_key,
|
519 |
-
'value' => sanitize_text_field($_POST['nua_invitation_code']),
|
520 |
'compare' => '=',
|
521 |
),
|
522 |
array(
|
@@ -541,13 +548,12 @@ class nua_invitation_code
|
|
541 |
);
|
542 |
|
543 |
$posts = get_posts($args);
|
544 |
-
|
545 |
-
|
546 |
foreach ($posts as $post_inv) {
|
547 |
-
|
548 |
$code_inv = get_post_meta($post_inv->ID, $this->code_key, true);
|
549 |
|
550 |
-
if (sanitize_text_field($_POST['nua_invitation_code']) == $code_inv) {
|
551 |
$register_user = get_post_meta($post_inv->ID, $this->registered_users, true);
|
552 |
|
553 |
if (empty($register_user)) {
|
@@ -570,78 +576,80 @@ class nua_invitation_code
|
|
570 |
}
|
571 |
return $status;
|
572 |
}
|
573 |
-
public function invitation_code_columns($columns)
|
574 |
-
{
|
575 |
unset($columns['date']);
|
576 |
unset($columns['title']);
|
577 |
-
$columns['inv_code'] = __('Invitation Code', 'new-user-approve
|
578 |
-
$columns['usage'] = __('Uses Remaining', 'new-user-approve
|
579 |
-
$columns['expiry'] = __('Expiry', 'new-user-approve
|
580 |
-
$columns['status'] = __('Status', 'new-user-approve
|
581 |
-
$columns['actions'] = __('Actions', 'new-user-approve
|
582 |
|
583 |
return $columns;
|
584 |
}
|
585 |
|
586 |
-
public function invitation_code_columns_content($column, $post_id)
|
587 |
-
{
|
588 |
|
589 |
switch ($column) {
|
590 |
|
591 |
case 'usage':
|
592 |
-
echo get_post_meta($post_id, $this->usage_limit_key, true) . '/' . get_post_meta($post_id, $this->total_code_key, true);
|
593 |
break;
|
594 |
|
595 |
case 'expiry':
|
596 |
$exp_date = get_post_meta($post_id, $this->expiry_date_key, true);
|
597 |
if (!empty($exp_date)) {
|
598 |
-
echo date('Y-m-d', $exp_date);
|
599 |
}
|
600 |
break;
|
601 |
case 'status':
|
602 |
-
echo get_post_meta($post_id, $this->status_key, true);
|
603 |
break;
|
604 |
case 'inv_code':
|
605 |
-
echo get_post_meta($post_id, $this->code_key, true);
|
606 |
break;
|
607 |
case 'actions':
|
608 |
if ('trash' != get_post_status($post_id)) {
|
609 |
$deactivate_link = admin_url('edit.php?post_type=' . $this->code_post_type);
|
610 |
$deactivate_link .= '&nua_action=deactivate&post_id=' . $post_id . '&nonce=' . wp_create_nonce('nua_deactivate-' . $post_id);
|
611 |
?>
|
612 |
-
<a href="<?php echo $deactivate_link; ?>"><?php
|
613 |
<?php
|
614 |
}
|
615 |
|
616 |
break;
|
617 |
}
|
618 |
}
|
619 |
-
public function option_invitation_code()
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
}
|
|
|
627 |
$options = get_option('nua_free_invitation');
|
628 |
$invitation_code_invite = ($options == 'enable') ? $options : false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
629 |
|
630 |
-
|
631 |
-
|
632 |
-
echo ' <div class = "nua-switch-text-checkbox"> <h4 class="nua-switch-text"> Enable/Disable: </h4> <label class="nua_switch" for="nua_free_invitation" > <input id="nua_free_invitation" name="nua_free_invitation" type="checkbox" value="enable" ' . checked($invitation_code_invite, 'enable', false) . '/><span class="nua_slider round"></span></label> </div>';
|
633 |
-
echo '<p class="description">' . __('Invitation Code for user to register without hesitation', 'new-user-approve-options') . '</p>';
|
634 |
-
echo '<tr>
|
635 |
-
<th colspan="2">
|
636 |
-
<p class="submit nua-submit"><input type="submit" name="nua_inv_code_submit" id="submit" class="button button-primary" value="Save Changes"></p>
|
637 |
-
</th>
|
638 |
-
</tr>
|
639 |
-
</form>';
|
640 |
}
|
641 |
} // End Class
|
642 |
|
643 |
-
function nua_invitation_code()
|
644 |
-
{
|
645 |
|
646 |
|
647 |
return nua_invitation_code::instance();
|
17 |
*/
|
18 |
|
19 |
|
20 |
+
class nua_invitation_code {
|
|
|
21 |
|
22 |
private static $instance;
|
23 |
|
36 |
*
|
37 |
* @return nua_invitation_code
|
38 |
*/
|
39 |
+
public static function instance() {
|
|
|
40 |
if (!isset(self::$instance)) {
|
41 |
self::$instance = new nua_invitation_code();
|
42 |
}
|
43 |
return self::$instance;
|
44 |
}
|
45 |
|
46 |
+
private function __construct() {
|
|
|
47 |
//Action
|
48 |
add_action('admin_menu', array($this, 'admin_menu_link'), 30);
|
49 |
add_action('admin_init', array($this, 'nua_deactivate_code'));
|
68 |
}
|
69 |
}
|
70 |
|
71 |
+
public function nua_deactivate_code() {
|
|
|
72 |
|
73 |
if (isset($_GET['post_type']) && $_GET['post_type'] == $this->code_post_type && is_admin()) {
|
74 |
if (isset($_GET['post_id']) && check_admin_referer('nua_deactivate-' . absint($_GET['post_id']), 'nonce')) {
|
77 |
}
|
78 |
}
|
79 |
|
80 |
+
public function invitation_code_edit_page_css() {
|
|
|
81 |
if (isset($_GET['post_type']) && $_GET['post_type'] == $this->code_post_type) {
|
82 |
?>
|
83 |
<style>
|
91 |
}
|
92 |
}
|
93 |
|
94 |
+
public function remove_row_actions_from_table($actions, $post) {
|
|
|
95 |
if ($post->post_type == $this->code_post_type) {
|
96 |
|
97 |
return array();
|
102 |
/**
|
103 |
* Add the link to the admin menu for the settings page
|
104 |
*/
|
105 |
+
public function admin_menu_link() {
|
|
|
106 |
// don't show the link in the admin menu if the parent plugin is inactive
|
107 |
if (!function_exists('pw_new_user_approve')) {
|
108 |
return;
|
109 |
}
|
110 |
|
111 |
+
$hook = add_submenu_page('new-user-approve-admin', __('Invitation Code', 'new-user-approve'), __('Invitation Code', 'new-user-approve'), 'manage_options', $this->screen_name, array($this, 'invitation_code_settings'), 2);
|
112 |
|
113 |
+
add_submenu_page('new-user-approve-admin', __('All Codes', 'new-user-approve'), __('All Codes', 'new-user-approve'), 'manage_options', 'edit.php?post_type=' . $this->code_post_type);
|
114 |
|
115 |
add_action('admin_print_scripts-' . $hook, array($this, 'admin_scripts'));
|
116 |
}
|
117 |
|
118 |
+
public function admin_scripts() {
|
|
|
119 |
wp_enqueue_script('nua-options');
|
120 |
}
|
121 |
|
123 |
/**
|
124 |
* Post Registration
|
125 |
*/
|
126 |
+
public function nua_invitation() {
|
|
|
127 |
|
128 |
$labels = array(
|
129 |
+
'name' => __('Invitation Code', 'new-user-approve'),
|
130 |
+
'singular_name' => __('Invitation Code', 'new-user-approve'),
|
131 |
+
'menu_name' => __('All Codes', 'new-user-approve'),
|
132 |
+
'name_admin_bar' => __('All Codes', 'new-user-approve'),
|
133 |
+
'add_new' => __('Add New', 'new-user-approve'),
|
134 |
+
'add_new_item' => __('Add New Invitation Code', 'new-user-approve'),
|
135 |
+
'new_item' => __('New Invitation Code', 'new-user-approve'),
|
136 |
+
'edit_item' => __('Edit Invitation Code', 'new-user-approve'),
|
137 |
+
'view_item' => __('View Invitation Code', 'new-user-approve'),
|
138 |
+
'all_items' => __('All Invitation Code', 'new-user-approve'),
|
139 |
);
|
140 |
|
141 |
$args = array(
|
160 |
/**
|
161 |
* Output the settings
|
162 |
*/
|
163 |
+
public function invitation_code_settings() {
|
164 |
+
$action = (isset($_GET['action'])) ? sanitize_text_field(wp_unslash($_GET['action'])) : 'add-codes';
|
165 |
+
|
166 |
+
|
167 |
|
168 |
?>
|
169 |
<div class="wrap">
|
170 |
<div id="icon-options-general" class="icon32"><br /></div>
|
171 |
+
<h2 class="nua-settings-heading"><?php esc_html_e('Invitation Code Settings', 'new-user-approve'); ?></h2>
|
172 |
|
173 |
<h2 class="nav-tab-wrapper">
|
174 |
|
175 |
+
<a href="<?php echo esc_url(add_query_arg(array('page' => $this->screen_name), admin_url('admin.php'))); ?>" class="nav-tab<?php if ('add-codes' == $action) echo ' nav-tab-active'; ?>"><?php esc_html_e('Add Codes', 'new-user-approve'); ?> </a>
|
176 |
|
177 |
+
<a href="<?php echo esc_url(add_query_arg(array('page' => $this->screen_name, 'action' => 'Settings'), admin_url('admin.php'))); ?>" class="nav-tab <?php if ('Settings' == $action) echo ' nav-tab-active'; ?>"><?php esc_html_e('Settings', 'new-user-approve'); ?></a>
|
178 |
+
<a href="<?php echo esc_url(add_query_arg(array('page' => $this->screen_name, 'action' => 'import-codes'), admin_url('admin.php'))); ?>" class="nav-tab<?php if ('import-codes' == $action) echo ' nav-tab-active'; ?>"><?php esc_html_e('Import Codes', 'new-user-approve'); ?> <span class="invite-code-btn-label">Pro</span> </a>
|
179 |
+
<a href="<?php echo esc_url(add_query_arg(array('page' => $this->screen_name, 'action' => 'email'), admin_url('admin.php'))); ?>" class="nav-tab<?php if ('email' == $action) echo ' nav-tab-active'; ?>"><?php esc_html_e('Email', 'new-user-approve'); ?> <span class="invite-code-btn-label">Pro</span> </a>
|
180 |
|
181 |
</h2>
|
182 |
<?php
|
183 |
+
$tab = (isset($_GET['tab'])) ? sanitize_text_field(wp_unslash($_GET['tab'])) : '';
|
184 |
+
|
185 |
$tab = (empty($tab) && !isset($_GET['action'])) ? 'manual' : $tab;
|
186 |
?>
|
187 |
<?php if (!isset($_GET['action'])) : ?>
|
188 |
<h2 class="nav-subtab-wrapper">
|
189 |
|
190 |
+
<a href="<?php echo esc_url(add_query_arg(array('page' => $this->screen_name, 'tab' => 'manual'), admin_url('admin.php'))); ?>" class="nav-tab<?php if ('manual' == $tab) echo ' nav-tab-active'; ?>"><?php esc_html_e('Manual Generate', 'new-user-approve'); ?></a>
|
191 |
+
<a href="<?php echo esc_url(add_query_arg(array('page' => $this->screen_name, 'tab' => 'auto'), admin_url('admin.php'))); ?>" class="nav-tab<?php if ('auto' == $tab) echo ' nav-tab-active'; ?>"><?php esc_html_e('Auto Generate', 'new-user-approve'); ?> <span class="invite-code-btn-label">Pro</span> </a>
|
192 |
|
193 |
|
194 |
</h2>
|
200 |
$this->get_the_required_tab($action, $tab);
|
201 |
}
|
202 |
|
203 |
+
public function get_the_required_tab($action, $tab) {
|
|
|
204 |
|
205 |
if ('add-codes' == $action) {
|
206 |
|
219 |
}
|
220 |
}
|
221 |
|
222 |
+
public function manual_add_codes() {
|
|
|
223 |
$count = 0;
|
224 |
if (isset($_POST['nua_manual_add'])) {
|
225 |
+
if (!empty($_POST['nua-manual-add-nonce-field'])) {$nonce = sanitize_text_field(wp_unslash($_POST['nua-manual-add-nonce-field']));}
|
226 |
+
if (!wp_verify_nonce($nonce, 'nua-manual-add-nonce')) return;
|
227 |
+
|
228 |
+
$limit = empty( $_POST['nua_manual_add']['usage_limit'] ) ? 1 : absint($_POST['nua_manual_add']['usage_limit']);
|
229 |
+
$expiry = !empty( $_POST['nua_manual_add']['expiry_date']) ? sanitize_text_field( wp_unslash($_POST['nua_manual_add']['expiry_date']) ):'';
|
230 |
$Status = 'Active';
|
231 |
//$dateTime = new DateTime(str_replace('/','-',$expiry));
|
232 |
//$expiry_timestamp = $dateTime->format('U');
|
233 |
$expiry_timestamp = strtotime("$expiry 23:59:59");
|
234 |
|
235 |
+
$code = !empty($_POST['nua_manual_add']['codes']) ? sanitize_textarea_field(wp_unslash($_POST['nua_manual_add']['codes'])) :'' ;
|
236 |
$code = explode("\n", $code);
|
237 |
|
238 |
foreach ($code as $in_code) {
|
259 |
}
|
260 |
}
|
261 |
if (!empty($count)) {
|
262 |
+
?> <p class="nua-success" > <?php
|
263 |
+
echo esc_html(sprintf("Post Successfully Added %s.", $count), 'new-user-approve');
|
264 |
+
?> </p> <?php
|
|
|
265 |
} else {
|
266 |
|
267 |
+
?> <p class="nua-fail" > <?php
|
268 |
+
echo esc_html(sprintf("Post Not Added %s.", $count), 'new-user-approve');
|
269 |
+
?> </p> <?php
|
270 |
}
|
271 |
+
|
272 |
}
|
273 |
|
274 |
|
275 |
?>
|
276 |
<form method="post" action=''>
|
277 |
+
<?php $nonce = wp_create_nonce('nua-manual-add-nonce'); ?>
|
278 |
<table class="form-table" role="presentation">
|
279 |
<tbody>
|
280 |
<tr>
|
281 |
+
<th><?php esc_html_e('Add Codes', 'new-user-approve'); ?></th>
|
282 |
<td>
|
283 |
<div style="max-width: 600px;">
|
284 |
<textarea id="nua_manual_add_add_codes" name="nua_manual_add[codes]" required class="nua-textarea"></textarea>
|
285 |
</div>
|
286 |
+
<p class="description"><?php esc_html_e('Enter one code per line.', 'new-user-approve'); ?></p>
|
287 |
</td>
|
288 |
</tr>
|
289 |
<tr>
|
290 |
+
<th><?php esc_html_e('Usage Limit', 'new-user-approve'); ?></th>
|
291 |
<td>
|
292 |
<input id="nua_manual_add_usage_limit" name="nua_manual_add[usage_limit]" placeholder="1" size="40" type="text" class="nua-text-field">
|
293 |
+
<input type = "hidden" name="nua-manual-add-nonce-field" value = "<?php esc_attr_e($nonce); ?>">
|
294 |
+
|
295 |
</td>
|
296 |
</tr>
|
297 |
<tr>
|
298 |
+
<th><?php esc_html_e('Expiry Date', 'new-user-approve'); ?></th>
|
299 |
<td>
|
300 |
<input id="nua_manual_add_expiry_date" name="nua_manual_add[expiry_date]" size="40" type="date" class="nua-text-field">
|
301 |
|
315 |
|
316 |
}
|
317 |
|
318 |
+
public function auto_add_codes() {
|
319 |
+
?>
|
320 |
+
<h2>Get pro version to avail these feature<br></h2>
|
321 |
+
<h3><a href='https://newuserapprove.com/options-addon' target = _blank>Click here to get the Pro Version</a></h3>
|
322 |
+
<?php
|
323 |
}
|
324 |
+
public function import_codes() {
|
325 |
+
?>
|
326 |
+
<h2>Get pro version to avail these feature<br></h2>
|
327 |
+
<h3><a href='https://newuserapprove.com/options-addon' target = _blank>Click here to get the Pro Version</a></h3>
|
328 |
+
<?php
|
329 |
}
|
330 |
+
public function email() {
|
331 |
+
?>
|
332 |
+
<h2>Get pro version to avail these feature<br></h2>
|
333 |
+
<h3><a href='https://newuserapprove.com/options-addon' target = _blank>Click here to get the Pro Version</a></h3>
|
334 |
+
<?php
|
335 |
}
|
336 |
|
337 |
|
338 |
+
public function get_available_invitation_codes() {
|
|
|
339 |
|
340 |
$args = array(
|
341 |
'numberposts' => -1,
|
376 |
/**
|
377 |
* Output the Meta Value
|
378 |
*/
|
379 |
+
public function add_invitation_meta() {
|
380 |
+
add_meta_box('nua_invitation', __('Invitation code for new user', 'new-user-approve'), array($this, 'funct_nua_invitation'), $this->code_post_type);
|
|
|
381 |
}
|
382 |
+
public function funct_nua_invitation() {
|
|
|
383 |
|
384 |
$code = get_post_meta(get_the_ID(), $this->code_key, true);
|
385 |
$useage = get_post_meta(get_the_ID(), $this->usage_limit_key, true);
|
391 |
|
392 |
?>
|
393 |
<form method="post" action=''>
|
394 |
+
<?php $nonce = wp_create_nonce('user-reg-by-invite-code-nonce'); ?>
|
395 |
<table class="form-table" role="presentation">
|
396 |
+
|
397 |
<tbody>
|
398 |
<tr>
|
399 |
+
|
400 |
+
<th scope="row"><?php esc_html_e("Invitation Code", "new-user-approve") ?></th>
|
401 |
+
<td><input type="text" name="codes" required value="<?php echo esc_attr($code); ?>" class="nua_codetxt" /><br>
|
402 |
+
<input type="hidden" name="user_reg_by_invite_code_nonce_field" value ="<?php esc_attr_e($nonce) ?>"> </input>
|
403 |
</tr>
|
404 |
<tr>
|
405 |
+
<th scope="row"><?php esc_html_e("Uses left", "new-user-approve") ?></th>
|
406 |
+
<td><input type="text" name="usage_limit" required value="<?php echo esc_attr( $useage) ; ?>" class="nua_codetxt" /><br>
|
407 |
</tr>
|
408 |
<tr>
|
409 |
+
<th scope="row"><?php esc_html_e("Usage Limit", "new-user-approve") ?></th>
|
410 |
+
<td><input type="text" name="total_code" required value="<?php echo esc_attr( $total_code_key );?>" class="nua_codetxt" /><br>
|
411 |
</tr>
|
412 |
<tr>
|
413 |
+
<th scope="row"><?php esc_html_e("Date", "new-user-approve") ?></th>
|
414 |
+
<td><input type="date" name="expiry_date" required value="<?php echo esc_attr( $convert_date );?>" class="nua_codetxt" /><br>
|
415 |
</tr>
|
416 |
<tr>
|
417 |
+
<th scope="row"><?php esc_html_e("Status", "new-user-approve") ?></th>
|
418 |
<td>
|
419 |
<select name="code_status" required class="nua_codetxt">
|
420 |
+
<option value='Active' <?php echo esc_attr ('Active' == $Status ? 'selected' : ''); ?>>Active</option>
|
421 |
+
<option value='InActive' <?php echo esc_attr('InActive' == $Status ? 'selected' : ''); ?>> InActive</option>
|
422 |
+
<option value='Expire' <?php echo esc_attr('Expire' == $Status ? 'selected' : ''); ?>> Expire</option>
|
423 |
</select>
|
424 |
</td>
|
425 |
</tr>
|
426 |
<tr>
|
427 |
<td colspan="2">
|
428 |
<table>
|
429 |
+
<p><?php esc_html_e('Users that have registered by using this invitation code', 'new-user-approve') ?></p>
|
430 |
<thead>
|
431 |
<tr>
|
432 |
<th>USER-ID</th>
|
440 |
if (!empty($registered_user)) {
|
441 |
|
442 |
foreach ($registered_user as $userid) {
|
443 |
+
?>
|
444 |
+
<tr><td> <?php echo esc_html($userid); ?></td>
|
445 |
+
<?php
|
446 |
|
447 |
$the_user = get_user_by('id', $userid);
|
448 |
|
449 |
if (!empty($the_user)) {
|
450 |
$link = get_edit_user_link($userid);
|
451 |
+
?>
|
452 |
+
<td><?php echo esc_html($the_user->user_email); ?></td>
|
453 |
+
<td><a href='<?php echo esc_url($link); ?>'><?php echo esc_html($the_user->user_email); ?></a></td>
|
454 |
+
<?php
|
455 |
} else {
|
456 |
+
?>
|
457 |
+
<td><?php esc_html_e("User Not Found", "new-user-approve"); ?></td>
|
458 |
+
<?php
|
459 |
}
|
460 |
+
?> </tr> <?php
|
461 |
}
|
462 |
} else {
|
463 |
+
?>
|
464 |
+
<tr colspan="3"><td><?php esc_html_e("No User Found", "new-user-approve"); ?></td></tr>
|
465 |
+
<?php
|
466 |
}
|
467 |
?>
|
468 |
</tbody>
|
476 |
|
477 |
}
|
478 |
|
479 |
+
public function save_nua_invitation() {
|
|
|
480 |
|
481 |
+
if (isset($_POST['post_type']) && $this->code_post_type == sanitize_text_field( wp_unslash( $_POST['post_type'] ) ) ) {
|
482 |
+
$nonce = isset($_POST['user_reg_by_invite_code_nonce_field']) ? sanitize_text_field(wp_unslash($_POST['user_reg_by_invite_code_nonce_field'])):'';
|
483 |
+
if(!wp_verify_nonce($nonce, 'user-reg-by-invite-code-nonce') ) {return;}
|
484 |
+
$code = isset($_POST['codes']) ? sanitize_text_field(wp_unslash($_POST['codes'])):'';
|
485 |
+
$usage = isset($_POST['usage_limit']) ? absint($_POST['usage_limit']):'';
|
486 |
+
$use_limit = isset($_POST['total_code']) ? absint( $_POST['total_code']):'';
|
487 |
+
$expiry = isset($_POST['expiry_date']) ? sanitize_text_field( wp_unslash( $_POST['expiry_date'] ) ):'';
|
488 |
+
$Status = isset($_POST['code_status']) ? sanitize_text_field( wp_unslash( $_POST['code_status'] ) ):'';
|
489 |
//$dateTime = new DateTime(str_replace('/','-',$Expiry));
|
490 |
//$expiry_timestamp = $dateTime->format('U');
|
491 |
$expiry_timestamp = strtotime("$expiry 23:59:59");
|
498 |
}
|
499 |
}
|
500 |
|
501 |
+
public function nua_invitation_code_field() {
|
502 |
+
?> <?php $nonce = wp_create_nonce('nua-invitation-code-nonce'); ?>
|
|
|
503 |
<p>
|
504 |
+
<label> <?php esc_html_e('Invitation Code', 'new-user-approve'); ?></label>
|
505 |
+
<input type="hidden" name="nua_invitation_code_nonce_field" value = <?php esc_attr_e($nonce) ?>/>
|
506 |
<input type="text" class="nua_invitation_code" name="nua_invitation_code" />
|
507 |
</p>
|
508 |
<?php
|
509 |
}
|
510 |
|
511 |
+
public function nua_invitation_status_code($status, $user_id) {
|
512 |
+
$nonce = isset($_POST['nua_invitation_code_nonce_field']) ? sanitize_text_field(wp_unslash($_POST['nua_invitation_code_nonce_field'])):'';
|
513 |
+
if(!wp_verify_nonce($nonce, 'nua-invitation-code-nonce') ) {$nonce='';}
|
514 |
+
|
515 |
if (isset($_POST['nua_invitation_code']) && !empty($_POST['nua_invitation_code'])) {
|
516 |
$args = array(
|
517 |
'numberposts' => -1,
|
523 |
array(
|
524 |
array(
|
525 |
'key' => $this->code_key,
|
526 |
+
'value' => sanitize_text_field(wp_unslash($_POST['nua_invitation_code'])),
|
527 |
'compare' => '=',
|
528 |
),
|
529 |
array(
|
548 |
);
|
549 |
|
550 |
$posts = get_posts($args);
|
551 |
+
|
|
|
552 |
foreach ($posts as $post_inv) {
|
553 |
+
|
554 |
$code_inv = get_post_meta($post_inv->ID, $this->code_key, true);
|
555 |
|
556 |
+
if (sanitize_text_field(wp_unslash($_POST['nua_invitation_code'])) == $code_inv) {
|
557 |
$register_user = get_post_meta($post_inv->ID, $this->registered_users, true);
|
558 |
|
559 |
if (empty($register_user)) {
|
576 |
}
|
577 |
return $status;
|
578 |
}
|
579 |
+
public function invitation_code_columns($columns) {
|
|
|
580 |
unset($columns['date']);
|
581 |
unset($columns['title']);
|
582 |
+
$columns['inv_code'] = __('Invitation Code', 'new-user-approve');
|
583 |
+
$columns['usage'] = __('Uses Remaining', 'new-user-approve');
|
584 |
+
$columns['expiry'] = __('Expiry', 'new-user-approve');
|
585 |
+
$columns['status'] = __('Status', 'new-user-approve');
|
586 |
+
$columns['actions'] = __('Actions', 'new-user-approve');
|
587 |
|
588 |
return $columns;
|
589 |
}
|
590 |
|
591 |
+
public function invitation_code_columns_content($column, $post_id) {
|
|
|
592 |
|
593 |
switch ($column) {
|
594 |
|
595 |
case 'usage':
|
596 |
+
echo esc_attr ( get_post_meta($post_id, $this->usage_limit_key, true) . '/' . get_post_meta($post_id, $this->total_code_key, true));
|
597 |
break;
|
598 |
|
599 |
case 'expiry':
|
600 |
$exp_date = get_post_meta($post_id, $this->expiry_date_key, true);
|
601 |
if (!empty($exp_date)) {
|
602 |
+
echo esc_attr(date('Y-m-d', $exp_date));
|
603 |
}
|
604 |
break;
|
605 |
case 'status':
|
606 |
+
echo esc_attr( get_post_meta($post_id, $this->status_key, true));
|
607 |
break;
|
608 |
case 'inv_code':
|
609 |
+
echo esc_attr( get_post_meta($post_id, $this->code_key, true));
|
610 |
break;
|
611 |
case 'actions':
|
612 |
if ('trash' != get_post_status($post_id)) {
|
613 |
$deactivate_link = admin_url('edit.php?post_type=' . $this->code_post_type);
|
614 |
$deactivate_link .= '&nua_action=deactivate&post_id=' . $post_id . '&nonce=' . wp_create_nonce('nua_deactivate-' . $post_id);
|
615 |
?>
|
616 |
+
<a href="<?php echo esc_url( $deactivate_link); ?>"><?php esc_html_e('Deactivate', 'new-user-approve'); ?></a> | <a href="<?php echo esc_url( get_edit_post_link($post_id) ); ?>"><?php esc_html_e('Edit', 'new-user-approve'); ?></a> | <a href="<?php echo esc_url( get_delete_post_link($post_id)); ?>"><?php esc_html_e('Delete', 'new-user-approve'); ?></a>
|
617 |
<?php
|
618 |
}
|
619 |
|
620 |
break;
|
621 |
}
|
622 |
}
|
623 |
+
public function option_invitation_code() {
|
624 |
+
if (isset($_POST['nua-free-invite-nonce-field']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nua-free-invite-nonce-field'])), 'nua-free-invite-nonce') ) {
|
625 |
+
if (isset($_POST['nua_free_invitation']) && sanitize_text_field(wp_unslash( $_POST['nua_free_invitation'])) == 'enable') {
|
626 |
+
update_option('nua_free_invitation', sanitize_text_field(wp_unslash($_POST['nua_free_invitation'])));
|
627 |
+
} else if (isset($_POST['nua_inv_code_submit'])) {
|
628 |
+
update_option('nua_free_invitation', '');
|
629 |
+
}
|
630 |
}
|
631 |
+
|
632 |
$options = get_option('nua_free_invitation');
|
633 |
$invitation_code_invite = ($options == 'enable') ? $options : false;
|
634 |
+
$nonce = wp_create_nonce('nua-free-invite-nonce');
|
635 |
+
?>
|
636 |
+
<form method="post" action="">
|
637 |
+
|
638 |
+
<input type ="hidden" name="nua-free-invite-nonce-field" value ="<?php echo esc_attr($nonce); ?>" />
|
639 |
+
<div class = "nua-switch-text-checkbox"> <h4 class="nua-switch-text"> Enable/Disable: </h4> <label class="nua_switch" for="nua_free_invitation" > <input id="nua_free_invitation" name="nua_free_invitation" type="checkbox" value="enable" <?php checked($invitation_code_invite, 'enable'); ?> /> <span class="nua_slider round"></span></label> </div>
|
640 |
+
<p class="description"><?php esc_html_e('Invitation Code for user to register', 'new-user-approve'); ?></p>
|
641 |
+
<tr>
|
642 |
+
<th colspan="2">
|
643 |
+
<p class="submit nua-submit"><input type="submit" name="nua_inv_code_submit" id="submit" class="button button-primary" value="Save Changes"></p>
|
644 |
+
</th>
|
645 |
+
</tr>
|
646 |
+
</form>
|
647 |
|
648 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
649 |
}
|
650 |
} // End Class
|
651 |
|
652 |
+
function nua_invitation_code() {
|
|
|
653 |
|
654 |
|
655 |
return nua_invitation_code::instance();
|
includes/user-list.php
CHANGED
@@ -58,8 +58,8 @@ class pw_new_user_approve_user_list {
|
|
58 |
$pagenum = $wp_list_table->get_pagenum();
|
59 |
$sendback = add_query_arg( 'paged', $pagenum, $sendback );
|
60 |
|
61 |
-
$status = sanitize_key( $_GET['action'] );
|
62 |
-
$user
|
63 |
|
64 |
pw_new_user_approve()->update_user_status( $user, $status );
|
65 |
|
@@ -174,14 +174,14 @@ class pw_new_user_approve_user_list {
|
|
174 |
$filtered_status = $this->selected_status();
|
175 |
|
176 |
?>
|
177 |
-
<label class="screen-reader-text" for="<?php echo $id ?>"><?php
|
178 |
-
<select id="<?php echo $id ?>" name="<?php echo $id ?>" style="float: none; margin: 0 0 0 15px;">
|
179 |
-
<option value="view_all"><?php
|
180 |
<?php foreach ( pw_new_user_approve()->get_valid_statuses() as $status ) : ?>
|
181 |
<option value="<?php echo esc_attr( $status ); ?>"<?php selected( $status, $filtered_status ); ?>><?php echo esc_html( $status ); ?></option>
|
182 |
<?php endforeach; ?>
|
183 |
</select>
|
184 |
-
<?php echo apply_filters( 'new_user_approve_filter_button', $filter_button ); ?>
|
185 |
<style>
|
186 |
#pw-status-query-submit {
|
187 |
float: right;
|
@@ -236,7 +236,7 @@ class pw_new_user_approve_user_list {
|
|
236 |
|
237 |
private function selected_status() {
|
238 |
if ( ! empty( $_REQUEST['new_user_approve_filter-top'] ) || ! empty( $_REQUEST['new_user_approve_filter-bottom'] ) ) {
|
239 |
-
return esc_attr( ( ! empty( $_REQUEST['new_user_approve_filter-top'] ) ) ? $_REQUEST['new_user_approve_filter-top'] : $_REQUEST['new_user_approve_filter-bottom'] );
|
240 |
}
|
241 |
|
242 |
return null;
|
@@ -253,11 +253,12 @@ class pw_new_user_approve_user_list {
|
|
253 |
if ( $screen->id == 'users' ) : ?>
|
254 |
<script type="text/javascript">
|
255 |
jQuery(document).ready(function ($) {
|
256 |
-
|
257 |
-
$('<option>').val('approve').text('<?php
|
|
|
258 |
|
259 |
-
$('<option>').val('deny').text('<?php
|
260 |
-
$('<option>').val('deny').text('<?php
|
261 |
});
|
262 |
</script>
|
263 |
<?php endif;
|
@@ -349,17 +350,17 @@ class pw_new_user_approve_user_list {
|
|
349 |
$message = null;
|
350 |
|
351 |
if ( isset( $_REQUEST['denied'] ) && (int) $_REQUEST['denied'] ) {
|
352 |
-
$denied =
|
353 |
$message = sprintf( _n( 'User denied.', '%s users denied.', $denied, 'new-user-approve' ), number_format_i18n( $denied ) );
|
354 |
}
|
355 |
|
356 |
if ( isset( $_REQUEST['approved'] ) && (int) $_REQUEST['approved'] ) {
|
357 |
-
$approved =
|
358 |
$message = sprintf( _n( 'User approved.', '%s users approved.', $approved, 'new-user-approve' ), number_format_i18n( $approved ) );
|
359 |
}
|
360 |
|
361 |
if ( !empty( $message ) ) {
|
362 |
-
echo '<div class="updated"><p>' . $message . '</p></div>';
|
363 |
}
|
364 |
}
|
365 |
|
@@ -379,12 +380,12 @@ class pw_new_user_approve_user_list {
|
|
379 |
?>
|
380 |
<table class="form-table">
|
381 |
<tr>
|
382 |
-
<th><label for="new_user_approve_status"><?php
|
383 |
</th>
|
384 |
<td>
|
385 |
<select id="new_user_approve_status" name="new_user_approve_status">
|
386 |
<?php if ( $user_status == 'pending' ) : ?>
|
387 |
-
<option value=""><?php
|
388 |
<?php endif; ?>
|
389 |
<?php foreach ( array( 'approved', 'denied' ) as $status ) : ?>
|
390 |
<option
|
@@ -392,10 +393,10 @@ class pw_new_user_approve_user_list {
|
|
392 |
<?php endforeach; ?>
|
393 |
</select>
|
394 |
<span
|
395 |
-
class="description"><?php
|
396 |
<?php if ( $user_status == 'pending' ) : ?>
|
397 |
<br/><span
|
398 |
-
class="description"><?php
|
399 |
<?php endif; ?>
|
400 |
</td>
|
401 |
</tr>
|
@@ -411,12 +412,14 @@ class pw_new_user_approve_user_list {
|
|
411 |
* @return bool
|
412 |
*/
|
413 |
public function save_profile_status_field( $user_id ) {
|
|
|
414 |
if ( !current_user_can( 'edit_user', $user_id ) ) {
|
415 |
return false;
|
416 |
}
|
417 |
-
|
|
|
418 |
if ( !empty( $_POST['new_user_approve_status'] ) ) {
|
419 |
-
$new_status =
|
420 |
|
421 |
if ( $new_status == 'approved' )
|
422 |
$new_status = 'approve'; else if ( $new_status == 'denied' )
|
58 |
$pagenum = $wp_list_table->get_pagenum();
|
59 |
$sendback = add_query_arg( 'paged', $pagenum, $sendback );
|
60 |
|
61 |
+
$status = ( !empty( $_GET['action']) ) ? sanitize_key( $_GET['action'] ): '';
|
62 |
+
$user = ( !empty( $_GET['user'] ) ) ? absint( wp_unslash($_GET['user'] ) ) :'';
|
63 |
|
64 |
pw_new_user_approve()->update_user_status( $user, $status );
|
65 |
|
174 |
$filtered_status = $this->selected_status();
|
175 |
|
176 |
?>
|
177 |
+
<label class="screen-reader-text" for="<?php echo esc_attr( $id) ?>"><?php esc_html_e( 'View all users', 'new-user-approve' ); ?></label>
|
178 |
+
<select id="<?php echo esc_attr($id) ?>" name="<?php echo esc_attr( $id )?>" style="float: none; margin: 0 0 0 15px;">
|
179 |
+
<option value="view_all"><?php esc_html_e( 'View all users', 'new-user-approve' ); ?></option>
|
180 |
<?php foreach ( pw_new_user_approve()->get_valid_statuses() as $status ) : ?>
|
181 |
<option value="<?php echo esc_attr( $status ); ?>"<?php selected( $status, $filtered_status ); ?>><?php echo esc_html( $status ); ?></option>
|
182 |
<?php endforeach; ?>
|
183 |
</select>
|
184 |
+
<?php echo wp_kses_post( apply_filters( 'new_user_approve_filter_button', $filter_button )); ?>
|
185 |
<style>
|
186 |
#pw-status-query-submit {
|
187 |
float: right;
|
236 |
|
237 |
private function selected_status() {
|
238 |
if ( ! empty( $_REQUEST['new_user_approve_filter-top'] ) || ! empty( $_REQUEST['new_user_approve_filter-bottom'] ) ) {
|
239 |
+
return esc_attr( ( ! empty( $_REQUEST['new_user_approve_filter-top'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['new_user_approve_filter-top'])) : sanitize_text_field( wp_unslash( $_REQUEST['new_user_approve_filter-bottom'])) );
|
240 |
}
|
241 |
|
242 |
return null;
|
253 |
if ( $screen->id == 'users' ) : ?>
|
254 |
<script type="text/javascript">
|
255 |
jQuery(document).ready(function ($) {
|
256 |
+
|
257 |
+
$('<option>').val('approve').text('<?php esc_attr_e( 'Approve', 'new-user-approve' )?>').appendTo("select[name='action']");
|
258 |
+
$('<option>').val('approve').text('<?php esc_attr_e( 'Approve', 'new-user-approve' )?>').appendTo("select[name='action2']");
|
259 |
|
260 |
+
$('<option>').val('deny').text('<?php esc_attr_e( 'Deny', 'new-user-approve' )?>').appendTo("select[name='action']");
|
261 |
+
$('<option>').val('deny').text('<?php esc_attr_e( 'Deny', 'new-user-approve' )?>').appendTo("select[name='action2']");
|
262 |
});
|
263 |
</script>
|
264 |
<?php endif;
|
350 |
$message = null;
|
351 |
|
352 |
if ( isset( $_REQUEST['denied'] ) && (int) $_REQUEST['denied'] ) {
|
353 |
+
$denied = sanitize_text_field(wp_unslash( $_REQUEST['denied'] ) );
|
354 |
$message = sprintf( _n( 'User denied.', '%s users denied.', $denied, 'new-user-approve' ), number_format_i18n( $denied ) );
|
355 |
}
|
356 |
|
357 |
if ( isset( $_REQUEST['approved'] ) && (int) $_REQUEST['approved'] ) {
|
358 |
+
$approved = sanitize_text_field( wp_unslash( $_REQUEST['approved'] ) );
|
359 |
$message = sprintf( _n( 'User approved.', '%s users approved.', $approved, 'new-user-approve' ), number_format_i18n( $approved ) );
|
360 |
}
|
361 |
|
362 |
if ( !empty( $message ) ) {
|
363 |
+
echo ( wp_kses_post( '<div class="updated"><p>' . $message . '</p></div>'));
|
364 |
}
|
365 |
}
|
366 |
|
380 |
?>
|
381 |
<table class="form-table">
|
382 |
<tr>
|
383 |
+
<th><label for="new_user_approve_status"><?php esc_html_e( 'Access Status', 'new-user-approve' ); ?></label>
|
384 |
</th>
|
385 |
<td>
|
386 |
<select id="new_user_approve_status" name="new_user_approve_status">
|
387 |
<?php if ( $user_status == 'pending' ) : ?>
|
388 |
+
<option value=""><?php esc_html_e( '-- Status --', 'new-user-approve' ); ?></option>
|
389 |
<?php endif; ?>
|
390 |
<?php foreach ( array( 'approved', 'denied' ) as $status ) : ?>
|
391 |
<option
|
393 |
<?php endforeach; ?>
|
394 |
</select>
|
395 |
<span
|
396 |
+
class="description"><?php esc_html_e( 'If user has access to sign in or not.', 'new-user-approve' ); ?></span>
|
397 |
<?php if ( $user_status == 'pending' ) : ?>
|
398 |
<br/><span
|
399 |
+
class="description"><?php esc_html_e( 'Current user status is <strong>pending</strong>.', 'new-user-approve' ); ?></span>
|
400 |
<?php endif; ?>
|
401 |
</td>
|
402 |
</tr>
|
412 |
* @return bool
|
413 |
*/
|
414 |
public function save_profile_status_field( $user_id ) {
|
415 |
+
|
416 |
if ( !current_user_can( 'edit_user', $user_id ) ) {
|
417 |
return false;
|
418 |
}
|
419 |
+
$nonce = '';
|
420 |
+
if ( wp_verify_nonce($nonce) ) {return;}
|
421 |
if ( !empty( $_POST['new_user_approve_status'] ) ) {
|
422 |
+
$new_status = sanitize_text_field( wp_unslash( $_POST['new_user_approve_status'] ) );
|
423 |
|
424 |
if ( $new_status == 'approved' )
|
425 |
$new_status = 'approve'; else if ( $new_status == 'denied' )
|
new-user-approve.php
CHANGED
@@ -5,11 +5,16 @@
|
|
5 |
Plugin URI: http://newuserapprove.com/
|
6 |
Description: Allow administrators to approve users once they register. Only approved users will be allowed to access the site. For support, please go to the <a href="http://wordpress.org/support/plugin/new-user-approve">support forums</a> on wordpress.org.
|
7 |
Author: NewUserApprove
|
8 |
-
Version: 2.
|
9 |
Author URI: https://newuserapprove.com/
|
10 |
Text Domain: new-user-approve
|
11 |
*/
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
if ( !function_exists( 'nua_fs' ) ) {
|
14 |
// Create a helper function for easy SDK access.
|
15 |
function nua_fs()
|
@@ -163,7 +168,7 @@ class pw_new_user_approve
|
|
163 |
$min_wp_version = '3.5.1';
|
164 |
$exit_msg = sprintf( __( 'New User Approve requires WordPress %s or newer.', 'new-user-approve' ), $min_wp_version );
|
165 |
if ( version_compare( $wp_version, $min_wp_version, '<' ) ) {
|
166 |
-
|
167 |
}
|
168 |
// since the right version of WordPress is being used, run a hook
|
169 |
do_action( 'new_user_approve_activate' );
|
@@ -216,9 +221,9 @@ class pw_new_user_approve
|
|
216 |
|
217 |
if ( !$show_notice ) {
|
218 |
echo '<div class="error"><p>' ;
|
219 |
-
printf(
|
220 |
'new-user-approve-settings-notice' => 1,
|
221 |
-
) ) );
|
222 |
echo "</p></div>" ;
|
223 |
}
|
224 |
|
@@ -490,12 +495,12 @@ class pw_new_user_approve
|
|
490 |
$pages = array('new-user-approve-auto-approve', 'nua-invitation-code', 'new-user-approve', 'new-user-approve-admin');
|
491 |
|
492 |
if (isset($_GET['page']) && in_array($_GET['page'], $pages)) {
|
493 |
-
wp_enqueue_style( 'nua-admin-style', plugins_url( '/assets/css/nua-admin-style.css', __FILE__ ), array());
|
494 |
|
495 |
$current_user = wp_get_current_user();
|
496 |
|
497 |
-
wp_enqueue_script( 'nua-admin', plugins_url( '/assets/js/admin.js', __FILE__ ), array( 'jquery' ) );
|
498 |
-
|
499 |
'nua-admin',
|
500 |
'nuaAdmin',
|
501 |
array(
|
@@ -508,18 +513,18 @@ class pw_new_user_approve
|
|
508 |
{
|
509 |
$user_status = $this->get_count_of_user_statuses();
|
510 |
?>
|
511 |
-
<div>
|
512 |
<p>
|
513 |
<span style="font-weight:bold;">
|
514 |
<a href="<?php
|
515 |
-
echo apply_filters( 'new_user_approve_dashboard_link', 'users.php' ) ;
|
516 |
?>"><?php
|
517 |
-
|
518 |
?></a>
|
519 |
</span>:
|
520 |
<?php
|
521 |
foreach ( $user_status as $status => $count ) {
|
522 |
-
print
|
523 |
}
|
524 |
?>
|
525 |
</p>
|
@@ -744,8 +749,8 @@ class pw_new_user_approve
|
|
744 |
public function email_message_headers()
|
745 |
{
|
746 |
$admin_email = get_option( 'admin_email' );
|
747 |
-
if ( empty($admin_email) ) {
|
748 |
-
$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
|
749 |
}
|
750 |
$from_name = get_option( 'blogname' );
|
751 |
$headers = array( "From: \"{$from_name}\" <{$admin_email}>\n" );
|
@@ -760,10 +765,12 @@ class pw_new_user_approve
|
|
760 |
*/
|
761 |
public function show_user_pending_message( $errors )
|
762 |
{
|
|
|
|
|
763 |
|
764 |
if ( !empty($_POST['redirect_to']) ) {
|
765 |
// if a redirect_to is set, honor it
|
766 |
-
wp_safe_redirect( $_POST['redirect_to'] );
|
767 |
exit;
|
768 |
}
|
769 |
|
@@ -799,14 +806,15 @@ class pw_new_user_approve
|
|
799 |
* @uses lostpassword_post
|
800 |
*/
|
801 |
public function lost_password( $errors )
|
802 |
-
{
|
803 |
-
|
|
|
804 |
|
805 |
if ( $is_email === false ) {
|
806 |
-
$username = sanitize_user( $_POST['user_login'] );
|
807 |
$user_data = get_user_by( 'login', trim( $username ) );
|
808 |
} else {
|
809 |
-
$email = is_email( $_POST['user_login'] );
|
810 |
$user_data = get_user_by( 'email', $email );
|
811 |
}
|
812 |
|
@@ -837,7 +845,8 @@ class pw_new_user_approve
|
|
837 |
}
|
838 |
}
|
839 |
|
840 |
-
|
|
|
841 |
if ( isset( $_GET['action'] ) && $_GET['action'] == 'register' && !$_POST ) {
|
842 |
$instructions = nua_default_registration_message();
|
843 |
$instructions = nua_do_email_tags( $instructions, array(
|
@@ -945,12 +954,12 @@ if ( nua_fs()->is__premium_only() && nua_fs()->can_use_premium_code() ) {
|
|
945 |
} else {
|
946 |
$class = 'notice notice-error';
|
947 |
$message = __( ' To start using New User Approve Options, please <a href="https://users.freemius.com" target="_blank"> login to your freemius account</a> in order to download the premium version <br /> For more details <a target="_blank" href="https://newuserapprove.com/">Click here</a>!', 'new-user-approve' );
|
948 |
-
printf(
|
949 |
'<br><div class="%1$s"><p>%2$s</p> <a href=' . admin_url() . '>%3$s</a></div>',
|
950 |
esc_attr( $class ),
|
951 |
$message,
|
952 |
esc_html( 'Back!' )
|
953 |
-
);
|
954 |
include_once ABSPATH . 'wp-includes/pluggable.php';
|
955 |
deactivate_plugins( 'new-user-approve/new-user-approve.php' );
|
956 |
wp_die();
|
5 |
Plugin URI: http://newuserapprove.com/
|
6 |
Description: Allow administrators to approve users once they register. Only approved users will be allowed to access the site. For support, please go to the <a href="http://wordpress.org/support/plugin/new-user-approve">support forums</a> on wordpress.org.
|
7 |
Author: NewUserApprove
|
8 |
+
Version: 2.4
|
9 |
Author URI: https://newuserapprove.com/
|
10 |
Text Domain: new-user-approve
|
11 |
*/
|
12 |
|
13 |
+
|
14 |
+
if ( !defined( 'NUA_VERSION' ) ) {
|
15 |
+
define( 'NUA_VERSION', '2.4' );
|
16 |
+
}
|
17 |
+
|
18 |
if ( !function_exists( 'nua_fs' ) ) {
|
19 |
// Create a helper function for easy SDK access.
|
20 |
function nua_fs()
|
168 |
$min_wp_version = '3.5.1';
|
169 |
$exit_msg = sprintf( __( 'New User Approve requires WordPress %s or newer.', 'new-user-approve' ), $min_wp_version );
|
170 |
if ( version_compare( $wp_version, $min_wp_version, '<' ) ) {
|
171 |
+
exit( esc_html( $exit_msg )) ;
|
172 |
}
|
173 |
// since the right version of WordPress is being used, run a hook
|
174 |
do_action( 'new_user_approve_activate' );
|
221 |
|
222 |
if ( !$show_notice ) {
|
223 |
echo '<div class="error"><p>' ;
|
224 |
+
printf( wp_kses_post( 'The Membership setting must be turned on in order for the New User Approve to work correctly. <a href="%1$s">Update in settings</a>. | <a href="%2$s">Hide Notice</a>') , esc_url( admin_url( 'options-general.php' ) ), esc_url(add_query_arg( array(
|
225 |
'new-user-approve-settings-notice' => 1,
|
226 |
+
)) ) );
|
227 |
echo "</p></div>" ;
|
228 |
}
|
229 |
|
495 |
$pages = array('new-user-approve-auto-approve', 'nua-invitation-code', 'new-user-approve', 'new-user-approve-admin');
|
496 |
|
497 |
if (isset($_GET['page']) && in_array($_GET['page'], $pages)) {
|
498 |
+
wp_enqueue_style( 'nua-admin-style', plugins_url( '/assets/css/nua-admin-style.css', __FILE__ ), array(), NUA_VERSION);
|
499 |
|
500 |
$current_user = wp_get_current_user();
|
501 |
|
502 |
+
wp_enqueue_script( 'nua-admin', plugins_url( '/assets/js/admin.js', __FILE__ ), array( 'jquery' ), NUA_VERSION );
|
503 |
+
wp_localize_script(
|
504 |
'nua-admin',
|
505 |
'nuaAdmin',
|
506 |
array(
|
513 |
{
|
514 |
$user_status = $this->get_count_of_user_statuses();
|
515 |
?>
|
516 |
+
<div>
|
517 |
<p>
|
518 |
<span style="font-weight:bold;">
|
519 |
<a href="<?php
|
520 |
+
echo wp_kses_post (apply_filters( 'new_user_approve_dashboard_link', 'users.php' )) ;
|
521 |
?>"><?php
|
522 |
+
esc_html_e( 'Users', 'new-user-approve' );
|
523 |
?></a>
|
524 |
</span>:
|
525 |
<?php
|
526 |
foreach ( $user_status as $status => $count ) {
|
527 |
+
print esc_html_e( ucwords( $status ), 'new-user-approve' ) . "(" . esc_attr($count) . ") ";
|
528 |
}
|
529 |
?>
|
530 |
</p>
|
749 |
public function email_message_headers()
|
750 |
{
|
751 |
$admin_email = get_option( 'admin_email' );
|
752 |
+
if ( isset($_SERVER['SERVER_NAME']) && empty($admin_email) ) {
|
753 |
+
$admin_email = 'support@' . sanitize_text_field(wp_unslash($_SERVER['SERVER_NAME']));
|
754 |
}
|
755 |
$from_name = get_option( 'blogname' );
|
756 |
$headers = array( "From: \"{$from_name}\" <{$admin_email}>\n" );
|
765 |
*/
|
766 |
public function show_user_pending_message( $errors )
|
767 |
{
|
768 |
+
$nonce = '';
|
769 |
+
if ( wp_verify_nonce($nonce) ) {return;}
|
770 |
|
771 |
if ( !empty($_POST['redirect_to']) ) {
|
772 |
// if a redirect_to is set, honor it
|
773 |
+
wp_safe_redirect( wp_unslash($_POST['redirect_to'] ));
|
774 |
exit;
|
775 |
}
|
776 |
|
806 |
* @uses lostpassword_post
|
807 |
*/
|
808 |
public function lost_password( $errors )
|
809 |
+
{ $nonce = '';
|
810 |
+
if (isset($_POST['user_login']) && wp_verify_nonce($nonce) ) {return;}
|
811 |
+
$is_email = strpos( sanitize_text_field(wp_unslash($_POST['user_login'])), '@' );
|
812 |
|
813 |
if ( $is_email === false ) {
|
814 |
+
$username = sanitize_user( wp_unslash($_POST['user_login'] ));
|
815 |
$user_data = get_user_by( 'login', trim( $username ) );
|
816 |
} else {
|
817 |
+
$email = is_email( wp_unslash($_POST['user_login']) );
|
818 |
$user_data = get_user_by( 'email', $email );
|
819 |
}
|
820 |
|
845 |
}
|
846 |
}
|
847 |
|
848 |
+
$nonce = '';
|
849 |
+
if ( wp_verify_nonce($nonce) ) {return;}
|
850 |
if ( isset( $_GET['action'] ) && $_GET['action'] == 'register' && !$_POST ) {
|
851 |
$instructions = nua_default_registration_message();
|
852 |
$instructions = nua_do_email_tags( $instructions, array(
|
954 |
} else {
|
955 |
$class = 'notice notice-error';
|
956 |
$message = __( ' To start using New User Approve Options, please <a href="https://users.freemius.com" target="_blank"> login to your freemius account</a> in order to download the premium version <br /> For more details <a target="_blank" href="https://newuserapprove.com/">Click here</a>!', 'new-user-approve' );
|
957 |
+
printf( wp_kses_post(
|
958 |
'<br><div class="%1$s"><p>%2$s</p> <a href=' . admin_url() . '>%3$s</a></div>',
|
959 |
esc_attr( $class ),
|
960 |
$message,
|
961 |
esc_html( 'Back!' )
|
962 |
+
));
|
963 |
include_once ABSPATH . 'wp-includes/pluggable.php';
|
964 |
deactivate_plugins( 'new-user-approve/new-user-approve.php' );
|
965 |
wp_die();
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://newuserapprove.com
|
|
4 |
Tags: users, registration, sign up, user management, login, user approval
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 6.0
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -193,6 +193,9 @@ We are aware of a few issues with multisite
|
|
193 |
|
194 |
== Changelog ==
|
195 |
|
|
|
|
|
|
|
196 |
= 2.3 =
|
197 |
* Added - Zapier Integration
|
198 |
* Added - Filter Hook to Filter password before user creation.
|
4 |
Tags: users, registration, sign up, user management, login, user approval
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 6.0
|
7 |
+
Stable tag: 2.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
193 |
|
194 |
== Changelog ==
|
195 |
|
196 |
+
= 2.4 =
|
197 |
+
* Tweak - Code improvement
|
198 |
+
|
199 |
= 2.3 =
|
200 |
* Added - Zapier Integration
|
201 |
* Added - Filter Hook to Filter password before user creation.
|