mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Update 1.2.92
This commit is contained in:
@@ -41,4 +41,34 @@
|
||||
.um-admin-drag-fld-title, .um-admin-drag-fld-type {
|
||||
float: right;
|
||||
margin: 0 20px 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.redux-main {
|
||||
margin-left: 0!important;
|
||||
margin-right: 201px !important;
|
||||
}
|
||||
|
||||
#redux-header h2 {
|
||||
padding: 2px 0 4px 15px;
|
||||
}
|
||||
|
||||
.redux-container #redux-header .display_header {float: right}
|
||||
|
||||
.admin-color-fresh .redux-sidebar .redux-group-menu li.hasSubSections a .extraIconSubsections {float: left}
|
||||
|
||||
.select2-container .select2-choice > .select2-chosen {
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
.select2-container .select2-choice .select2-arrow {
|
||||
border: none !important;
|
||||
right: auto !important;
|
||||
left: 0 !important;
|
||||
}
|
||||
|
||||
.select2-container .select2-choice > .select2-chosen {
|
||||
margin-right: 10px !important;
|
||||
margin-left: 26px !important;
|
||||
}
|
||||
|
||||
.redux-container-switch .switch-options {float: right;margin-right:0!important}
|
||||
@@ -13,6 +13,57 @@ class UM_Admin_Dashboard {
|
||||
add_action('admin_menu', array(&$this, 'secondary_menu_items'), 1000);
|
||||
add_action('admin_menu', array(&$this, 'extension_menu'), 9999);
|
||||
|
||||
add_action( 'admin_head', array( $this, 'menu_order_count' ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pending users (in queue)
|
||||
*/
|
||||
function get_pending_users_count() {
|
||||
|
||||
if ( get_option('um_cached_users_queue') > 0 ) {
|
||||
return get_option('um_cached_users_queue');
|
||||
}
|
||||
|
||||
$args = array( 'fields' => 'ID', 'number' => 20 );
|
||||
$args['meta_query']['relation'] = 'OR';
|
||||
$args['meta_query'][] = array(
|
||||
'key' => 'account_status',
|
||||
'value' => 'awaiting_email_confirmation',
|
||||
'compare' => '='
|
||||
);
|
||||
$args['meta_query'][] = array(
|
||||
'key' => 'account_status',
|
||||
'value' => 'awaiting_admin_review',
|
||||
'compare' => '='
|
||||
);
|
||||
$users = new WP_User_Query( $args );
|
||||
|
||||
delete_option('um_cached_users_queue');
|
||||
add_option('um_cached_users_queue', count($users->results), '', 'no' );
|
||||
|
||||
return count($users->results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage order of admin menu items
|
||||
*/
|
||||
public function menu_order_count() {
|
||||
global $menu, $submenu;
|
||||
|
||||
$count = $this->get_pending_users_count();
|
||||
|
||||
foreach( $menu as $key => $menu_item ) {
|
||||
if ( 0 === strpos( $menu_item[0], _x( 'Users', 'Admin menu name' ) ) ) {
|
||||
$menu[ $key ][0] .= ' <span class="update-plugins count-'.$count.'"><span class="processing-count">'.$count.'</span></span>';
|
||||
}
|
||||
}
|
||||
foreach ( $submenu['users.php'] as $key => $menu_item ) {
|
||||
if ( 0 === strpos( $menu_item[0], _x( 'All Users', 'Admin menu name' ) ) ) {
|
||||
$submenu['users.php'][ $key ][0] .= ' <span class="update-plugins count-'.$count.'"><span class="processing-count">'.$count.'</span></span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -51,7 +102,7 @@ class UM_Admin_Dashboard {
|
||||
*** @extension menu
|
||||
***/
|
||||
function extension_menu() {
|
||||
add_submenu_page( $this->slug, __('Extensions', $this->slug), '<span style="color: #3dc3e5">' .__('Extensions', $this->slug) . '</span>', 'manage_options', $this->slug . '-extensions', array(&$this, 'admin_page') );
|
||||
add_submenu_page( $this->slug, __('Extensions', $this->slug), '<span style="color: #00B9EB">' .__('Extensions', $this->slug) . '</span>', 'manage_options', $this->slug . '-extensions', array(&$this, 'admin_page') );
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
@@ -117,12 +117,17 @@ class UM_Admin_Notices {
|
||||
case 'confirm_delete':
|
||||
|
||||
$confirm_uri = urldecode($_REQUEST['_refer']);
|
||||
$users = implode(', ', $_REQUEST['user']);
|
||||
$users = '';
|
||||
|
||||
foreach( $_REQUEST['user'] as $user_id ) {
|
||||
$user = get_userdata( $user_id );
|
||||
$users .= '#' . $user_id . ': ' . $user->user_login . '<br />';
|
||||
}
|
||||
|
||||
$ignore = admin_url('users.php');
|
||||
|
||||
$messages[0]['err_content'] = sprintf(__('Are you sure you want to delete the selected user(s)? The following users will be deleted: (%s) <strong>This cannot be undone!</strong>','ultimatemember'), $users);
|
||||
$messages[0]['err_content'] .= ' <a href="'.$confirm_uri.'" class="button-primary">' . __('Yes! Delete','ultimatemember') . '</a> <a href="'.$ignore.'" class="button">' . __('Cancel','ultimatemember') . '</a>';
|
||||
$messages[0]['err_content'] = sprintf(__('Are you sure you want to delete the selected user(s)? The following users will be deleted: <p>%s</p> <strong>This cannot be undone!</strong>','ultimatemember'), $users);
|
||||
$messages[0]['err_content'] .= '<p><a href="'.$confirm_uri.'" class="button-primary">' . __('Remove','ultimatemember') . '</a> <a href="'.$ignore.'" class="button">' . __('Undo','ultimatemember') . '</a></p>';
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<?php
|
||||
|
||||
$premium['followers'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/followers/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/2015/04/followers-01-copy.png',
|
||||
'name' => 'Followers',
|
||||
'desc' => ' With the followers extension you can increase user interaction on your site by allowing users to follow each other.',
|
||||
);
|
||||
|
||||
$premium['profile-completeness'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/profile-completeness/',
|
||||
'image' => 'https://ultimatemember.com/wp-content/uploads/2015/04/pc3-01-copy.png',
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
.um .um-single-image-preview > img {
|
||||
max-height: 300px;
|
||||
display: block;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
margin: auto;
|
||||
-moz-border-radius: 3px;
|
||||
|
||||
+16
-5
@@ -5,7 +5,12 @@
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1564;
|
||||
z-index: 1999992;
|
||||
}
|
||||
|
||||
.um-popup * {
|
||||
-webkit-font-smoothing: antialiased !important;
|
||||
-moz-osx-font-smoothing: grayscale !important;
|
||||
}
|
||||
|
||||
.um-popup {
|
||||
@@ -19,11 +24,13 @@
|
||||
width: 500px;
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 3px #111;
|
||||
z-index: 1565;
|
||||
z-index: 1999993;
|
||||
box-sizing: border-box;
|
||||
overflow: auto;
|
||||
color: #888;
|
||||
padding: 10px 0;
|
||||
padding: 0 !important;
|
||||
-webkit-font-smoothing: antialiased !important;
|
||||
-moz-osx-font-smoothing: grayscale !important;
|
||||
}
|
||||
|
||||
.um-popup.loading {
|
||||
@@ -31,6 +38,10 @@
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
.um-popup a {
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
/*
|
||||
- Overlay
|
||||
*/
|
||||
@@ -42,7 +53,7 @@
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 100000;
|
||||
z-index: 1999992;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -76,7 +87,7 @@
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
display: none;
|
||||
z-index: 100010;
|
||||
z-index: 1999993;
|
||||
box-sizing: border-box;
|
||||
bottom: -50px;
|
||||
}
|
||||
|
||||
@@ -341,6 +341,8 @@ font-weight: normal;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.um-profile-note a{border:none!important}
|
||||
|
||||
.um-profile-note a:hover {
|
||||
text-decoration: underline !important;
|
||||
}
|
||||
@@ -380,7 +382,7 @@ font-weight: normal;
|
||||
.um-profile-nav-item.without-icon i {display: none}
|
||||
|
||||
.um-profile-nav-item a:hover {background: #555}
|
||||
.um-profile-nav-item i {font-size: 18px;height: 18px;line-height: 18px;position: absolute;display: block;top: 8px;left: 10px}
|
||||
.um-profile-nav-item i {font-size: 18px;height: 18px;line-height: 18px;position: absolute;display: block;top: 7px;left: 10px}
|
||||
.um-profile-nav-item span.title {padding-left: 5px}
|
||||
.um-profile-nav-item span.count {
|
||||
font-size: 12px;
|
||||
@@ -509,4 +511,19 @@ font-weight: normal;
|
||||
max-width: 250px;
|
||||
display: inline-block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.um-tab-notifier {
|
||||
position: absolute;
|
||||
background: none repeat scroll 0% 0% rgb(198, 81, 81);
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 999px;
|
||||
line-height: 18px;
|
||||
top: 2px;
|
||||
right: 8px;
|
||||
font-size: 11px;
|
||||
font-weight: 400;
|
||||
}
|
||||
@@ -731,10 +731,10 @@ div.uimob960 .um-gutter-sizer {width: 4%}
|
||||
@media screen and (max-width: 600px) {
|
||||
|
||||
.um-popup {
|
||||
width: 90%;
|
||||
margin-left: 5%;
|
||||
width: 96%;
|
||||
margin-left: 2%;
|
||||
left: 0;
|
||||
top: 5%;
|
||||
top: 15px;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -115,7 +115,7 @@ Version: 3.4.8 Timestamp: Thu May 1 09:50:32 EDT 2014
|
||||
height: auto !important;
|
||||
width: auto !important;
|
||||
opacity: 0 !important;
|
||||
z-index: 100030 !important;
|
||||
z-index: 1999997 !important;
|
||||
/* styles required for IE to work */
|
||||
background-color: #fff !important;
|
||||
filter: alpha(opacity=0) !important;
|
||||
@@ -125,7 +125,7 @@ Version: 3.4.8 Timestamp: Thu May 1 09:50:32 EDT 2014
|
||||
width: 100%;
|
||||
margin-top: -1px;
|
||||
position: absolute;
|
||||
z-index: 100040 !important;
|
||||
z-index: 1999998 !important;
|
||||
top: 100%;
|
||||
|
||||
background: #fff;
|
||||
@@ -216,7 +216,7 @@ Version: 3.4.8 Timestamp: Thu May 1 09:50:32 EDT 2014
|
||||
padding-right: 4px !important;
|
||||
|
||||
position: relative !important;
|
||||
z-index: 100050 !important;
|
||||
z-index: 1999999 !important;
|
||||
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.tipsy { padding: 5px; position: absolute; z-index: 100020; }
|
||||
.tipsy { padding: 5px; position: absolute; z-index: 9999999999; }
|
||||
|
||||
.tipsy-inner {
|
||||
font-size: 13px !important;
|
||||
@@ -6,7 +6,7 @@
|
||||
background-color: #333333 !important;
|
||||
color: #fff !important;
|
||||
max-width: 250px !important;
|
||||
padding: 10px 12px !important;
|
||||
padding: 6px 10px !important;
|
||||
text-align: left !important;
|
||||
word-wrap: break-word !important;
|
||||
-webkit-font-smoothing: antialiased !important;
|
||||
|
||||
Vendored
+2
-1
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -770,16 +770,22 @@ function remove_Modal() {
|
||||
function show_Modal( contents ) {
|
||||
if ( jQuery('.um-popup-overlay').length ) {
|
||||
jQuery('.um-popup').removeClass('loading').html( contents );
|
||||
jQuery('.um-popup').mCustomScrollbar({
|
||||
theme:"dark-3"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function responsive_Modal() {
|
||||
if ( jQuery('.um-popup-overlay').length ) {
|
||||
jQuery('.um-popup').css({
|
||||
'max-height': ( 80 / 100 ) * jQuery(window).height() + 'px'
|
||||
|
||||
ag_height = jQuery(window).height() - jQuery('.um-popup-header').outerHeight() - jQuery('.um-popup-footer').outerHeight() - 40;
|
||||
if ( ag_height > 350 ) {
|
||||
ag_height = 350;
|
||||
}
|
||||
|
||||
jQuery('.um-popup-autogrow').css({
|
||||
'height': ag_height + 'px'
|
||||
});
|
||||
jQuery('.um-popup-autogrow').mCustomScrollbar({
|
||||
theme:"dark-3"
|
||||
}).mCustomScrollbar("scrollTo", "bottom",{ scrollInertia:0});
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ jQuery(window).load(function() {
|
||||
});
|
||||
|
||||
jQuery(window).resize(function() {
|
||||
|
||||
responsive_Modal();
|
||||
jQuery('.um-modal .um-single-image-preview.crop:visible img').cropper("destroy");
|
||||
|
||||
um_responsive();
|
||||
|
||||
@@ -25,10 +25,10 @@ jQuery(document).ready(function() {
|
||||
jQuery(this).parents( parent ).find( child ).trigger('click');
|
||||
});
|
||||
|
||||
jQuery('.um-tip-n').tipsy({gravity: 'n', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-w').tipsy({gravity: 'w', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-e').tipsy({gravity: 'e', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-s').tipsy({gravity: 's', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-n').tipsy({gravity: 'n', opacity: 1, live: 'a.live', offset: 3, delayIn: 500 });
|
||||
jQuery('.um-tip-w').tipsy({gravity: 'w', opacity: 1, live: 'a.live', offset: 3, delayIn: 500 });
|
||||
jQuery('.um-tip-e').tipsy({gravity: 'e', opacity: 1, live: 'a.live', offset: 3, delayIn: 500 });
|
||||
jQuery('.um-tip-s').tipsy({gravity: 's', opacity: 1, live: 'a.live', offset: 3, delayIn: 500 });
|
||||
|
||||
jQuery(document).on('change', '.um-field input[type=radio]', function(){
|
||||
var field = jQuery(this).parents('.um-field');
|
||||
|
||||
Vendored
+3
-3
File diff suppressed because one or more lines are too long
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
class Array2XML {
|
||||
|
||||
private static $xml = null;
|
||||
private static $encoding = 'UTF-8';
|
||||
|
||||
/**
|
||||
* Initialize the root XML node [optional]
|
||||
* @param $version
|
||||
* @param $encoding
|
||||
* @param $format_output
|
||||
*/
|
||||
public static function init($version = '1.0', $encoding = 'UTF-8', $format_output = true) {
|
||||
self::$xml = new DomDocument($version, $encoding);
|
||||
self::$xml->formatOutput = $format_output;
|
||||
self::$encoding = $encoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an Array to XML
|
||||
* @param string $node_name - name of the root node to be converted
|
||||
* @param array $arr - aray to be converterd
|
||||
* @return DomDocument
|
||||
*/
|
||||
public static function &createXML($node_name, $arr=array()) {
|
||||
$xml = self::getXMLRoot();
|
||||
$xml->appendChild(self::convert($node_name, $arr));
|
||||
|
||||
self::$xml = null; // clear the xml node in the class for 2nd time use.
|
||||
return $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an Array to XML
|
||||
* @param string $node_name - name of the root node to be converted
|
||||
* @param array $arr - aray to be converterd
|
||||
* @return DOMNode
|
||||
*/
|
||||
private static function &convert($node_name, $arr=array()) {
|
||||
|
||||
//print_arr($node_name);
|
||||
$xml = self::getXMLRoot();
|
||||
$node = $xml->createElement($node_name);
|
||||
|
||||
if(is_array($arr)){
|
||||
// get the attributes first.;
|
||||
if(isset($arr['@attributes'])) {
|
||||
foreach($arr['@attributes'] as $key => $value) {
|
||||
if(!self::isValidTagName($key)) {
|
||||
throw new Exception('[Array2XML] Illegal character in attribute name. attribute: '.$key.' in node: '.$node_name);
|
||||
}
|
||||
$node->setAttribute($key, self::bool2str($value));
|
||||
}
|
||||
unset($arr['@attributes']); //remove the key from the array once done.
|
||||
}
|
||||
|
||||
// check if it has a value stored in @value, if yes store the value and return
|
||||
// else check if its directly stored as string
|
||||
if(isset($arr['@value'])) {
|
||||
$node->appendChild($xml->createTextNode(self::bool2str($arr['@value'])));
|
||||
unset($arr['@value']); //remove the key from the array once done.
|
||||
//return from recursion, as a note with value cannot have child nodes.
|
||||
return $node;
|
||||
} else if(isset($arr['@cdata'])) {
|
||||
$node->appendChild($xml->createCDATASection(self::bool2str($arr['@cdata'])));
|
||||
unset($arr['@cdata']); //remove the key from the array once done.
|
||||
//return from recursion, as a note with cdata cannot have child nodes.
|
||||
return $node;
|
||||
}
|
||||
}
|
||||
|
||||
//create subnodes using recursion
|
||||
if(is_array($arr)){
|
||||
// recurse to get the node for that key
|
||||
foreach($arr as $key=>$value){
|
||||
if(!self::isValidTagName($key)) {
|
||||
throw new Exception('[Array2XML] Illegal character in tag name. tag: '.$key.' in node: '.$node_name);
|
||||
}
|
||||
if(is_array($value) && is_numeric(key($value))) {
|
||||
// MORE THAN ONE NODE OF ITS KIND;
|
||||
// if the new array is numeric index, means it is array of nodes of the same kind
|
||||
// it should follow the parent key name
|
||||
foreach($value as $k=>$v){
|
||||
$node->appendChild(self::convert($key, $v));
|
||||
}
|
||||
} else {
|
||||
// ONLY ONE NODE OF ITS KIND
|
||||
$node->appendChild(self::convert($key, $value));
|
||||
}
|
||||
unset($arr[$key]); //remove the key from the array once done.
|
||||
}
|
||||
}
|
||||
|
||||
// after we are done with all the keys in the array (if it is one)
|
||||
// we check if it has any text value, if yes, append it.
|
||||
if(!is_array($arr)) {
|
||||
$node->appendChild($xml->createTextNode(self::bool2str($arr)));
|
||||
}
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the root XML node, if there isn't one, create it.
|
||||
*/
|
||||
private static function getXMLRoot(){
|
||||
if(empty(self::$xml)) {
|
||||
self::init();
|
||||
}
|
||||
return self::$xml;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get string representation of boolean value
|
||||
*/
|
||||
private static function bool2str($v){
|
||||
//convert boolean to text value.
|
||||
$v = $v === true ? 'true' : $v;
|
||||
$v = $v === false ? 'false' : $v;
|
||||
return $v;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the tag name or attribute name contains illegal characters
|
||||
* Ref: http://www.w3.org/TR/xml/#sec-common-syn
|
||||
*/
|
||||
private static function isValidTagName($tag){
|
||||
$pattern = '/^[a-z_]+[a-z0-9\:\-\.\_]*[^:]*$/i';
|
||||
return preg_match($pattern, $tag, $matches) && $matches[0] == $tag;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,6 +1,13 @@
|
||||
<?php
|
||||
|
||||
require_once("../../../../../../wp-load.php");
|
||||
$i = 0;
|
||||
$dirname = dirname( __FILE__ );
|
||||
do {
|
||||
$dirname = dirname( $dirname );
|
||||
$wp_load = "{$dirname}/wp-load.php";
|
||||
}
|
||||
while( ++$i < 10 && !file_exists( $wp_load ) );
|
||||
require_once( $wp_load );
|
||||
global $ultimatemember;
|
||||
|
||||
$id = $_POST['key'];
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
<?php
|
||||
|
||||
require_once("../../../../../../wp-load.php");
|
||||
$i = 0;
|
||||
$dirname = dirname( __FILE__ );
|
||||
do {
|
||||
$dirname = dirname( $dirname );
|
||||
$wp_load = "{$dirname}/wp-load.php";
|
||||
}
|
||||
while( ++$i < 10 && !file_exists( $wp_load ) );
|
||||
require_once( $wp_load );
|
||||
global $ultimatemember;
|
||||
|
||||
$id = $_POST['key'];
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Error processing hook : standard
|
||||
***/
|
||||
@@ -159,12 +159,12 @@
|
||||
$ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
|
||||
}
|
||||
|
||||
if ( isset( $array['type'] ) && $array['type'] == 'radio' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) ) {
|
||||
if ( isset( $array['type'] ) && $array['type'] == 'radio' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) && !in_array($key, array('role_radio','role_select') ) ) {
|
||||
$ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
|
||||
}
|
||||
|
||||
if ( $key == 'role_select' || $key == 'role_radio' ) {
|
||||
if ( isset($args['role']) && empty($args['role']) && isset( $array['required'] ) && $array['required'] == 1 ) {
|
||||
if ( isset( $array['required'] ) && $array['required'] == 1 && ( !isset( $args['role'] ) || empty( $args['role'] ) ) ) {
|
||||
$ultimatemember->form->add_error('role', __('Please specify account type.','ultimatemember') );
|
||||
}
|
||||
}
|
||||
@@ -232,6 +232,11 @@
|
||||
|
||||
switch( $array['validate'] ) {
|
||||
|
||||
case 'custom':
|
||||
$custom = $array['custom_validate'];
|
||||
do_action("um_custom_field_validation_{$custom}", $key, $array );
|
||||
break;
|
||||
|
||||
case 'numeric':
|
||||
if ( $args[$key] && !is_numeric( $args[$key] ) ) {
|
||||
$ultimatemember->form->add_error($key, __('Please enter numbers only in this field','ultimatemember') );
|
||||
|
||||
@@ -171,18 +171,18 @@
|
||||
add_action('um_after_login_fields', 'um_add_submit_button_to_login', 1000);
|
||||
function um_add_submit_button_to_login($args){
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
// DO NOT add when reviewing user's details
|
||||
if ( $ultimatemember->user->preview == true && is_admin() ) return;
|
||||
|
||||
$primary_btn_word = $args['primary_btn_word'];
|
||||
$primary_btn_word = apply_filters('um_login_form_button_one', $primary_btn_word);
|
||||
$primary_btn_word = apply_filters('um_login_form_button_one', $primary_btn_word, $args );
|
||||
|
||||
$secondary_btn_word = $args['secondary_btn_word'];
|
||||
$secondary_btn_word = apply_filters('um_login_form_button_two', $secondary_btn_word);
|
||||
$secondary_btn_word = apply_filters('um_login_form_button_two', $secondary_btn_word, $args );
|
||||
|
||||
$secondary_btn_url = ( isset( $args['secondary_btn_url'] ) && $args['secondary_btn_url'] ) ? $args['secondary_btn_url'] : um_get_core_page('register');
|
||||
$secondary_btn_url = apply_filters('um_login_form_button_two_url', $secondary_btn_url);
|
||||
$secondary_btn_url = apply_filters('um_login_form_button_two_url', $secondary_btn_url, $args );
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
function um_profile_content_main( $args ) {
|
||||
extract( $args );
|
||||
|
||||
if ( !um_get_option('profile_tab_main') && !isset( $_REQUEST['um_action'] ) )
|
||||
return;
|
||||
|
||||
$can_view = apply_filters('um_profile_can_view_main', -1, um_profile_id() );
|
||||
|
||||
if ( $can_view == -1 ) {
|
||||
@@ -374,8 +377,9 @@
|
||||
<div class="um-meta-text">
|
||||
<textarea placeholder="<?php _e('Tell us a bit about yourself...','ultimatemember'); ?>" name="<?php echo 'description-' . $args['form_id']; ?>" id="<?php echo 'description-' . $args['form_id']; ?>"><?php if ( um_user('description') ) { echo um_user('description'); } ?></textarea>
|
||||
|
||||
<?php if ( $ultimatemember->fields->is_error('description') )
|
||||
echo $ultimatemember->fields->field_error( $ultimatemember->fields->show_error('description') ); ?>
|
||||
<?php if ( $ultimatemember->fields->is_error('description') ) {
|
||||
echo $ultimatemember->fields->field_error( $ultimatemember->fields->show_error('description'), true ); }
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -581,7 +585,7 @@
|
||||
$tabs = $ultimatemember->profile->tabs_active();
|
||||
|
||||
$tabs = apply_filters('um_user_profile_tabs', $tabs );
|
||||
|
||||
|
||||
$ultimatemember->user->tabs = $tabs;
|
||||
|
||||
// need enough tabs to continue
|
||||
@@ -614,6 +618,8 @@
|
||||
|
||||
<i class="<?php echo $tab['icon']; ?>"></i>
|
||||
|
||||
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?><span class="um-tab-notifier uimob500-show uimob340-show uimob800-show"><?php echo $tab['notifier']; ?></span><?php } ?>
|
||||
|
||||
<span class="uimob500-hide uimob340-hide uimob800-hide title"><?php echo $tab['name']; ?></span>
|
||||
|
||||
<?php if ( um_get_option('profile_menu_counts') && isset( $tab['count'] ) ) { ?>
|
||||
|
||||
@@ -99,6 +99,8 @@
|
||||
|
||||
$ultimatemember->user->set_plain_password( $args['user_password'] );
|
||||
|
||||
do_action('um_new_user_registration_plain');
|
||||
|
||||
do_action('um_post_registration_save', $user_id, $args);
|
||||
|
||||
do_action('um_post_registration_listener', $user_id, $args);
|
||||
@@ -237,13 +239,13 @@
|
||||
if ( isset( $ultimatemember->user->preview ) && $ultimatemember->user->preview == true && is_admin() ) return;
|
||||
|
||||
$primary_btn_word = $args['primary_btn_word'];
|
||||
$primary_btn_word = apply_filters('um_register_form_button_one', $primary_btn_word);
|
||||
$primary_btn_word = apply_filters('um_register_form_button_one', $primary_btn_word, $args );
|
||||
|
||||
$secondary_btn_word = $args['secondary_btn_word'];
|
||||
$secondary_btn_word = apply_filters('um_register_form_button_two', $secondary_btn_word);
|
||||
$secondary_btn_word = apply_filters('um_register_form_button_two', $secondary_btn_word, $args );
|
||||
|
||||
$secondary_btn_url = ( isset( $args['secondary_btn_url'] ) && $args['secondary_btn_url'] ) ? $args['secondary_btn_url'] : um_get_core_page('login');
|
||||
$secondary_btn_url = apply_filters('um_register_form_button_two_url', $secondary_btn_url);
|
||||
$secondary_btn_url = apply_filters('um_register_form_button_two_url', $secondary_btn_url, $args );
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+727
@@ -0,0 +1,727 @@
|
||||
<?php
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
class UM_REST_API {
|
||||
|
||||
const VERSION = '1.0';
|
||||
|
||||
private $pretty_print = false;
|
||||
public $log_requests = true;
|
||||
private $is_valid_request = false;
|
||||
private $user_id = 0;
|
||||
private $stats;
|
||||
private $data = array();
|
||||
private $override = true;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
add_action( 'init', array( $this, 'add_endpoint' ) );
|
||||
add_action( 'template_redirect', array( $this, 'process_query' ), -1 );
|
||||
add_filter( 'query_vars', array( $this, 'query_vars' ) );
|
||||
add_action( 'show_user_profile', array( $this, 'user_key_field' ) );
|
||||
add_action( 'edit_user_profile', array( $this, 'user_key_field' ) );
|
||||
add_action( 'personal_options_update', array( $this, 'update_key' ) );
|
||||
add_action( 'edit_user_profile_update', array( $this, 'update_key' ) );
|
||||
|
||||
// Determine if JSON_PRETTY_PRINT is available
|
||||
$this->pretty_print = defined( 'JSON_PRETTY_PRINT' ) ? JSON_PRETTY_PRINT : null;
|
||||
|
||||
// Allow API request logging to be turned off
|
||||
$this->log_requests = apply_filters( 'um_api_log_requests', $this->log_requests );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new rewrite endpoint for accessing the API
|
||||
*/
|
||||
public function add_endpoint( $rewrite_rules ) {
|
||||
add_rewrite_endpoint( 'um-api', EP_ALL );
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers query vars for API access
|
||||
*/
|
||||
public function query_vars( $vars ) {
|
||||
|
||||
$vars[] = 'key';
|
||||
$vars[] = 'token';
|
||||
$vars[] = 'format';
|
||||
$vars[] = 'query';
|
||||
$vars[] = 'type';
|
||||
$vars[] = 'data';
|
||||
$vars[] = 'fields';
|
||||
$vars[] = 'number';
|
||||
$vars[] = 'id';
|
||||
$vars[] = 'email';
|
||||
$vars[] = 'orderby';
|
||||
$vars[] = 'order';
|
||||
$vars[] = 'include';
|
||||
$vars[] = 'exclude';
|
||||
|
||||
$this->vars = $vars;
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the API request
|
||||
*/
|
||||
private function validate_request() {
|
||||
global $wp_query;
|
||||
|
||||
$this->override = false;
|
||||
|
||||
// Make sure we have both user and api key
|
||||
if ( ! empty( $wp_query->query_vars['um-api'] ) ) {
|
||||
|
||||
if ( empty( $wp_query->query_vars['token'] ) || empty( $wp_query->query_vars['key'] ) )
|
||||
$this->missing_auth();
|
||||
|
||||
// Retrieve the user by public API key and ensure they exist
|
||||
if ( ! ( $user = $this->get_user( $wp_query->query_vars['key'] ) ) ) :
|
||||
$this->invalid_key();
|
||||
else :
|
||||
$token = urldecode( $wp_query->query_vars['token'] );
|
||||
$secret = get_user_meta( $user, 'um_user_secret_key', true );
|
||||
$public = urldecode( $wp_query->query_vars['key'] );
|
||||
|
||||
if ( hash_equals( md5( $secret . $public ), $token ) )
|
||||
$this->is_valid_request = true;
|
||||
else
|
||||
$this->invalid_auth();
|
||||
endif;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the user ID based on the public key provided
|
||||
*/
|
||||
public function get_user( $key = '' ) {
|
||||
global $wpdb, $wp_query;
|
||||
|
||||
if( empty( $key ) )
|
||||
$key = urldecode( $wp_query->query_vars['key'] );
|
||||
|
||||
if ( empty( $key ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$user = get_transient( md5( 'um_api_user_' . $key ) );
|
||||
|
||||
if ( false === $user ) {
|
||||
$user = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'um_user_public_key' AND meta_value = %s LIMIT 1", $key ) );
|
||||
set_transient( md5( 'um_api_user_' . $key ) , $user, DAY_IN_SECONDS );
|
||||
}
|
||||
|
||||
if ( $user != NULL ) {
|
||||
$this->user_id = $user;
|
||||
return $user;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a missing authentication error if all the parameters aren't
|
||||
* provided
|
||||
*/
|
||||
private function missing_auth() {
|
||||
$error = array();
|
||||
$error['error'] = __( 'You must specify both a token and API key!', 'ultimatemember' );
|
||||
|
||||
$this->data = $error;
|
||||
$this->output( 401 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an authentication failed error if the user failed to provide valid credentials
|
||||
*/
|
||||
private function invalid_auth() {
|
||||
$error = array();
|
||||
$error['error'] = __( 'Your request could not be authenticated', 'ultimatemember' );
|
||||
|
||||
$this->data = $error;
|
||||
$this->output( 401 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an invalid API key error if the API key provided couldn't be validated
|
||||
*/
|
||||
private function invalid_key() {
|
||||
$error = array();
|
||||
$error['error'] = __( 'Invalid API key', 'ultimatemember' );
|
||||
|
||||
$this->data = $error;
|
||||
$this->output( 401 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Listens for the API and then processes the API requests
|
||||
*/
|
||||
public function process_query() {
|
||||
global $wp_query;
|
||||
|
||||
// Check for um-api var. Get out if not present
|
||||
if ( ! isset( $wp_query->query_vars['um-api'] ) )
|
||||
return;
|
||||
|
||||
// Check for a valid user and set errors if necessary
|
||||
$this->validate_request();
|
||||
|
||||
// Only proceed if no errors have been noted
|
||||
if( ! $this->is_valid_request )
|
||||
return;
|
||||
|
||||
if( ! defined( 'UM_DOING_API' ) ) {
|
||||
define( 'UM_DOING_API', true );
|
||||
}
|
||||
|
||||
// Determine the kind of query
|
||||
$query_mode = $this->get_query_mode();
|
||||
foreach( $this->vars as $k ) {
|
||||
$args[ $k ] = isset( $wp_query->query_vars[ $k ] ) ? $wp_query->query_vars[ $k ] : null;
|
||||
}
|
||||
|
||||
$data = array();
|
||||
|
||||
switch( $query_mode ) :
|
||||
|
||||
case 'get.users':
|
||||
$data = $this->get_users( $args );
|
||||
break;
|
||||
|
||||
case 'get.user':
|
||||
$data = $this->get_auser( $args );
|
||||
break;
|
||||
|
||||
case 'get.following':
|
||||
$data = $this->get_following( $args );
|
||||
break;
|
||||
|
||||
case 'get.followers':
|
||||
$data = $this->get_followers( $args );
|
||||
break;
|
||||
|
||||
endswitch;
|
||||
|
||||
// Allow extensions to setup their own return data
|
||||
$this->data = apply_filters( 'um_api_output_data', $data, $query_mode, $this );
|
||||
|
||||
// Log this API request, if enabled. We log it here because we have access to errors.
|
||||
$this->log_request( $this->data );
|
||||
|
||||
// Send out data to the output function
|
||||
$this->output();
|
||||
}
|
||||
|
||||
/**
|
||||
* Process Get followers users API Request
|
||||
*/
|
||||
public function get_followers( $args ) {
|
||||
global $ultimatemember;
|
||||
extract( $args );
|
||||
|
||||
$response = array();
|
||||
$error = array();
|
||||
|
||||
if ( !$id ) {
|
||||
$error['error'] = __('You must provide a user ID','ultimatemember');
|
||||
return $error;
|
||||
}
|
||||
|
||||
if ( class_exists( 'UM_Followers_API' ) ) {
|
||||
global $um_followers;
|
||||
$results = $um_followers->api->followers( $id );
|
||||
if ( !$results ) {
|
||||
$error['error'] = __('No users were found','ultimatemember');
|
||||
return $error;
|
||||
}
|
||||
$response['followers']['count'] = $um_followers->api->count_followers_plain( $id );
|
||||
foreach( $results as $k => $v ) {
|
||||
$user = get_userdata( $v['user_id2'] );
|
||||
$response['followers']['users'][$k]['ID'] = $v['user_id2'];
|
||||
$response['followers']['users'][$k]['username'] = $user->user_login;
|
||||
$response['followers']['users'][$k]['display_name'] = $user->display_name;
|
||||
}
|
||||
} else {
|
||||
$error['error'] = __('Invalid request','ultimatemember');
|
||||
return $error;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process Get following users API Request
|
||||
*/
|
||||
public function get_following( $args ) {
|
||||
global $ultimatemember;
|
||||
extract( $args );
|
||||
|
||||
$response = array();
|
||||
$error = array();
|
||||
|
||||
if ( !$id ) {
|
||||
$error['error'] = __('You must provide a user ID','ultimatemember');
|
||||
return $error;
|
||||
}
|
||||
|
||||
if ( class_exists( 'UM_Followers_API' ) ) {
|
||||
global $um_followers;
|
||||
$results = $um_followers->api->following( $id );
|
||||
if ( !$results ) {
|
||||
$error['error'] = __('No users were found','ultimatemember');
|
||||
return $error;
|
||||
}
|
||||
$response['following']['count'] = $um_followers->api->count_following_plain( $id );
|
||||
foreach( $results as $k => $v ) {
|
||||
$user = get_userdata( $v['user_id1'] );
|
||||
$response['following']['users'][$k]['ID'] = $v['user_id1'];
|
||||
$response['following']['users'][$k]['username'] = $user->user_login;
|
||||
$response['following']['users'][$k]['display_name'] = $user->display_name;
|
||||
}
|
||||
} else {
|
||||
$error['error'] = __('Invalid request','ultimatemember');
|
||||
return $error;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process Get users API Request
|
||||
*/
|
||||
public function get_users( $args ) {
|
||||
global $ultimatemember;
|
||||
extract( $args );
|
||||
|
||||
$response = array();
|
||||
$error = array();
|
||||
|
||||
if ( !$number )
|
||||
$number = 10;
|
||||
|
||||
if ( !$orderby )
|
||||
$orderby = 'user_registered';
|
||||
|
||||
if ( !$order )
|
||||
$order = 'desc';
|
||||
|
||||
$loop_a = array('number' => $number, 'orderby' => $orderby, 'order' => $order );
|
||||
|
||||
if ( $include ) {
|
||||
$include = explode(',', $include );
|
||||
$loop_a['include'] = $include;
|
||||
}
|
||||
|
||||
if ( $exclude ) {
|
||||
$exclude = explode(',', $exclude );
|
||||
$loop_a['exclude'] = $exclude;
|
||||
}
|
||||
|
||||
$loop = get_users( $loop_a );
|
||||
|
||||
foreach( $loop as $user ) {
|
||||
|
||||
unset( $user->data->user_status );
|
||||
unset( $user->data->user_activation_key );
|
||||
unset( $user->data->user_pass );
|
||||
|
||||
um_fetch_user( $user->ID );
|
||||
|
||||
foreach( $user as $key => $val ) {
|
||||
if ( $key != 'data' ) continue;
|
||||
if ( $key == 'data' ) {
|
||||
$key = 'profile';
|
||||
$val->roles = $user->roles;
|
||||
$val->first_name = um_user('first_name');
|
||||
$val->last_name = um_user('last_name');
|
||||
$val->community_role = um_user('role');
|
||||
$val->account_status = um_user('account_status');
|
||||
$val->profile_pic_original = $this->getsrc( um_user('profile_photo', 'original') );
|
||||
$val->profile_pic_normal = $this->getsrc( um_user('profile_photo', 200) );
|
||||
$val->profile_pic_small = $this->getsrc( um_user('profile_photo', 40) );
|
||||
$val->cover_photo = $this->getsrc( um_user('cover_photo', 1000) );
|
||||
|
||||
if ( class_exists('UM_Followers_API') ) {
|
||||
global $um_followers;
|
||||
$val->followers_count = $um_followers->api->count_followers_plain( $user->ID );
|
||||
$val->following_count = $um_followers->api->count_following_plain( $user->ID );
|
||||
}
|
||||
|
||||
}
|
||||
$response[ $user->ID ] = $val;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process Get user API Request
|
||||
*/
|
||||
public function get_auser( $args ) {
|
||||
global $ultimatemember;
|
||||
extract( $args );
|
||||
|
||||
$response = array();
|
||||
$error = array();
|
||||
|
||||
if ( !isset( $id ) ) {
|
||||
$error['error'] = __('You must provide a user ID','ultimatemember');
|
||||
return $error;
|
||||
}
|
||||
|
||||
$user = get_userdata( $id );
|
||||
if ( !$user ) {
|
||||
$error['error'] = __('Invalid user specified','ultimatemember');
|
||||
return $error;
|
||||
}
|
||||
|
||||
unset( $user->data->user_status );
|
||||
unset( $user->data->user_activation_key );
|
||||
unset( $user->data->user_pass );
|
||||
|
||||
um_fetch_user( $user->ID );
|
||||
|
||||
if ( isset( $fields ) && $fields ) {
|
||||
$fields = explode(',', $fields );
|
||||
$response['ID'] = $user->ID;
|
||||
$response['username'] = $user->user_login;
|
||||
foreach( $fields as $field ) {
|
||||
|
||||
switch( $field ) {
|
||||
|
||||
default:
|
||||
$response[$field] = ( um_profile( $field ) ) ? um_profile( $field ) : '';
|
||||
break;
|
||||
|
||||
case 'mycred_points':
|
||||
$response['mycred_points'] = number_format( (int)get_user_meta( $user->ID, 'mycred_default', true ), 2 );
|
||||
break;
|
||||
|
||||
case 'cover_photo':
|
||||
$response['cover_photo'] = $this->getsrc( um_user('cover_photo', 1000) );
|
||||
break;
|
||||
|
||||
case 'profile_pic':
|
||||
$response['profile_pic_original'] = $this->getsrc( um_user('profile_photo', 'original') );
|
||||
$response['profile_pic_normal'] = $this->getsrc( um_user('profile_photo', 200) );
|
||||
$response['profile_pic_small'] = $this->getsrc( um_user('profile_photo', 40) );
|
||||
break;
|
||||
|
||||
case 'status':
|
||||
$response['status'] = um_user('account_status');
|
||||
break;
|
||||
|
||||
case 'role':
|
||||
$response['role'] = um_user('role');
|
||||
break;
|
||||
|
||||
case 'email':
|
||||
case 'user_email':
|
||||
$response['email'] = um_user('user_email');
|
||||
break;
|
||||
|
||||
case 'followers':
|
||||
if ( class_exists('UM_Followers_API') ) {
|
||||
global $um_followers;
|
||||
$response['followers_count'] = $um_followers->api->count_followers_plain( $user->ID );
|
||||
$response['following_count'] = $um_followers->api->count_following_plain( $user->ID );
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
foreach( $user as $key => $val ) {
|
||||
if ( $key != 'data' ) continue;
|
||||
if ( $key == 'data' ) {
|
||||
$key = 'profile';
|
||||
$val->roles = $user->roles;
|
||||
$val->first_name = um_user('first_name');
|
||||
$val->last_name = um_user('last_name');
|
||||
$val->community_role = um_user('role');
|
||||
$val->account_status = um_user('account_status');
|
||||
$val->profile_pic_original = $this->getsrc( um_user('profile_photo', 'original') );
|
||||
$val->profile_pic_normal = $this->getsrc( um_user('profile_photo', 200) );
|
||||
$val->profile_pic_small = $this->getsrc( um_user('profile_photo', 40) );
|
||||
$val->cover_photo = $this->getsrc( um_user('cover_photo', 1000) );
|
||||
|
||||
if ( class_exists('UM_Followers_API') ) {
|
||||
global $um_followers;
|
||||
$val->followers_count = $um_followers->api->count_followers_plain( $user->ID );
|
||||
$val->following_count = $um_followers->api->count_following_plain( $user->ID );
|
||||
}
|
||||
|
||||
}
|
||||
$response = $val;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get source
|
||||
*/
|
||||
public function getsrc( $image ) {
|
||||
if (preg_match('/<img.+?src(?: )*=(?: )*[\'"](.*?)[\'"]/si', $image, $arrResult)) {
|
||||
return $arrResult[1];
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the kind of query requested and also ensure it is a valid query
|
||||
*/
|
||||
public function get_query_mode() {
|
||||
global $wp_query;
|
||||
|
||||
// Whitelist our query options
|
||||
$accepted = apply_filters( 'um_api_valid_query_modes', array(
|
||||
'get.users',
|
||||
'get.user',
|
||||
'get.following',
|
||||
'get.followers',
|
||||
) );
|
||||
|
||||
$query = isset( $wp_query->query_vars['um-api'] ) ? $wp_query->query_vars['um-api'] : null;
|
||||
$error = array();
|
||||
// Make sure our query is valid
|
||||
if ( ! in_array( $query, $accepted ) ) {
|
||||
$error['error'] = __( 'Invalid query!', 'ultimatemember' );
|
||||
|
||||
$this->data = $error;
|
||||
$this->output();
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get page number
|
||||
*/
|
||||
public function get_paged() {
|
||||
global $wp_query;
|
||||
|
||||
return isset( $wp_query->query_vars['page'] ) ? $wp_query->query_vars['page'] : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the output format
|
||||
*/
|
||||
public function get_output_format() {
|
||||
global $wp_query;
|
||||
|
||||
$format = isset( $wp_query->query_vars['format'] ) ? $wp_query->query_vars['format'] : 'json';
|
||||
|
||||
return apply_filters( 'um_api_output_format', $format );
|
||||
}
|
||||
|
||||
/**
|
||||
* Log each API request, if enabled
|
||||
*/
|
||||
private function log_request( $data = array() ) {
|
||||
if ( ! $this->log_requests )
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve the output data
|
||||
*/
|
||||
public function get_output() {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output Query in either JSON/XML. The query data is outputted as JSON
|
||||
* by default
|
||||
*/
|
||||
public function output( $status_code = 200 ) {
|
||||
global $wp_query;
|
||||
|
||||
$format = $this->get_output_format();
|
||||
|
||||
status_header( $status_code );
|
||||
|
||||
do_action( 'um_api_output_before', $this->data, $this, $format );
|
||||
|
||||
switch ( $format ) :
|
||||
|
||||
case 'xml' :
|
||||
|
||||
require_once um_path . 'core/lib/array2xml.php';
|
||||
$xml = Array2XML::createXML( 'um', $this->data );
|
||||
echo $xml->saveXML();
|
||||
|
||||
break;
|
||||
|
||||
case 'json' :
|
||||
case '' :
|
||||
|
||||
header( 'Content-Type: application/json' );
|
||||
if ( ! empty( $this->pretty_print ) )
|
||||
echo json_encode( $this->data, $this->pretty_print );
|
||||
else
|
||||
echo json_encode( $this->data );
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default :
|
||||
|
||||
// Allow other formats to be added via extensions
|
||||
do_action( 'um_api_output_' . $format, $this->data, $this );
|
||||
|
||||
break;
|
||||
|
||||
endswitch;
|
||||
|
||||
do_action( 'um_api_output_after', $this->data, $this, $format );
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify User Profile
|
||||
*/
|
||||
function user_key_field( $user ) {
|
||||
if ( current_user_can( 'edit_users' ) && current_user_can( 'edit_user', $user->ID ) ) {
|
||||
$user = get_userdata( $user->ID );
|
||||
?>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="um_set_api_key"><?php _e( 'Ultimate Member REST API', 'ultimatemember' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php if ( empty( $user->um_user_public_key ) ) { ?>
|
||||
<p><input name="um_set_api_key" type="checkbox" id="um_set_api_key" value="0" />
|
||||
<span class="description"><?php _e( 'Generate API Key', 'ultimatemember' ); ?></span></p>
|
||||
<?php } else { ?>
|
||||
<p>
|
||||
<strong><?php _e( 'Public key:', 'ultimatemember' ); ?> </strong><span id="publickey"><?php echo $user->um_user_public_key; ?></span><br/>
|
||||
<strong><?php _e( 'Secret key:', 'ultimatemember' ); ?> </strong><span id="privatekey"><?php echo $user->um_user_secret_key; ?></span><br/>
|
||||
<strong><?php _e( 'Token:', 'ultimatemember' ); ?> </strong><span id="token"><?php echo $this->get_token( $user->ID ); ?></span>
|
||||
</p>
|
||||
<p><input name="um_set_api_key" type="checkbox" id="um_set_api_key" value="0" />
|
||||
<span class="description"><?php _e( 'Revoke API Keys', 'ultimatemember' ); ?></span></p>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php }
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate new API keys for a user
|
||||
*/
|
||||
public function generate_api_key( $user_id = 0, $regenerate = false ) {
|
||||
|
||||
if( empty( $user_id ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$user = get_userdata( $user_id );
|
||||
|
||||
if( ! $user ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( empty( $user->um_user_public_key ) ) {
|
||||
update_user_meta( $user_id, 'um_user_public_key', $this->generate_public_key( $user->user_email ) );
|
||||
update_user_meta( $user_id, 'um_user_secret_key', $this->generate_private_key( $user->ID ) );
|
||||
} elseif( $regenerate == true ) {
|
||||
$this->revoke_api_key( $user->ID );
|
||||
update_user_meta( $user_id, 'um_user_public_key', $this->generate_public_key( $user->user_email ) );
|
||||
update_user_meta( $user_id, 'um_user_secret_key', $this->generate_private_key( $user->ID ) );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Revoke a users API keys
|
||||
*/
|
||||
public function revoke_api_key( $user_id = 0 ) {
|
||||
|
||||
if( empty( $user_id ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$user = get_userdata( $user_id );
|
||||
|
||||
if( ! $user ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! empty( $user->um_user_public_key ) ) {
|
||||
delete_transient( md5( 'um_api_user_' . $user->um_user_public_key ) );
|
||||
delete_user_meta( $user_id, 'um_user_public_key' );
|
||||
delete_user_meta( $user_id, 'um_user_secret_key' );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate and Save API key
|
||||
*/
|
||||
public function update_key( $user_id ) {
|
||||
if ( current_user_can( 'edit_user', $user_id ) && isset( $_POST['um_set_api_key'] ) ) {
|
||||
|
||||
$user = get_userdata( $user_id );
|
||||
|
||||
if ( empty( $user->um_user_public_key ) ) {
|
||||
update_user_meta( $user_id, 'um_user_public_key', $this->generate_public_key( $user->user_email ) );
|
||||
update_user_meta( $user_id, 'um_user_secret_key', $this->generate_private_key( $user->ID ) );
|
||||
} else {
|
||||
$this->revoke_api_key( $user_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the public key for a user
|
||||
*/
|
||||
private function generate_public_key( $user_email = '' ) {
|
||||
$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
|
||||
$public = hash( 'md5', $user_email . $auth_key . date( 'U' ) );
|
||||
return $public;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the secret key for a user
|
||||
*/
|
||||
private function generate_private_key( $user_id = 0 ) {
|
||||
$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
|
||||
$secret = hash( 'md5', $user_id . $auth_key . date( 'U' ) );
|
||||
return $secret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the user's token
|
||||
*/
|
||||
private function get_token( $user_id = 0 ) {
|
||||
$user = get_userdata( $user_id );
|
||||
return hash( 'md5', $user->um_user_secret_key . $user->um_user_public_key );
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -86,7 +86,7 @@ class UM_Enqueue {
|
||||
) );
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
wp_register_script('um_minified', um_url . 'assets/js/um.min.js', array('jquery'), ultimatemember_version, true );
|
||||
wp_enqueue_script('um_minified');
|
||||
|
||||
|
||||
+26
-35
@@ -245,8 +245,12 @@ class UM_Fields {
|
||||
/***
|
||||
*** @Print field error
|
||||
***/
|
||||
function field_error($text) {
|
||||
function field_error($text, $force_show = false ) {
|
||||
global $ultimatemember;
|
||||
if ( $force_show ) {
|
||||
$output = '<div class="um-field-error"><span class="um-field-arrow"><i class="um-faicon-caret-up"></i></span>'.$text.'</div>';
|
||||
return $output;
|
||||
}
|
||||
if ( isset( $this->set_id ) && $ultimatemember->form->processing == $this->set_id ) {
|
||||
$output = '<div class="um-field-error"><span class="um-field-arrow"><i class="um-faicon-caret-up"></i></span>'.$text.'</div>';
|
||||
} else {
|
||||
@@ -598,30 +602,18 @@ class UM_Fields {
|
||||
|
||||
$array['input'] = 'text';
|
||||
|
||||
if (!isset($array['autocomplete'])) $array['autocomplete'] = 'on';
|
||||
|
||||
if ( $key == 'user_login' ) $array['autocomplete'] = 'off';
|
||||
|
||||
break;
|
||||
|
||||
case 'password':
|
||||
|
||||
$array['input'] = 'password';
|
||||
|
||||
if (!isset($array['autocomplete'])) $array['autocomplete'] = 'on';
|
||||
|
||||
$array['autocomplete'] = 'off';
|
||||
|
||||
break;
|
||||
|
||||
case 'url':
|
||||
|
||||
$array['input'] = 'text';
|
||||
|
||||
if (!isset($array['autocomplete'])) $array['autocomplete'] = 'on';
|
||||
|
||||
if ( $key == 'user_login' ) $array['autocomplete'] = 'off';
|
||||
|
||||
break;
|
||||
|
||||
case 'date':
|
||||
@@ -697,9 +689,7 @@ class UM_Fields {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!isset($array['autocomplete'])) $array['autocomplete'] = 'on';
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'time':
|
||||
@@ -723,8 +713,6 @@ class UM_Fields {
|
||||
$array['js_format'] = $js_format;
|
||||
|
||||
if ( !isset( $array['intervals'] ) ) $array['intervals'] = 60;
|
||||
|
||||
if (!isset($array['autocomplete'])) $array['autocomplete'] = 'on';
|
||||
|
||||
break;
|
||||
|
||||
@@ -946,7 +934,7 @@ class UM_Fields {
|
||||
|
||||
}
|
||||
|
||||
$output .= '<input '.$disabled.' class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" autocomplete="'.$autocomplete.'" />
|
||||
$output .= '<input '.$disabled.' class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" />
|
||||
|
||||
</div>';
|
||||
|
||||
@@ -980,7 +968,7 @@ class UM_Fields {
|
||||
|
||||
}
|
||||
|
||||
$output .= '<input class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" autocomplete="'.$autocomplete.'" />
|
||||
$output .= '<input class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" />
|
||||
|
||||
</div>';
|
||||
|
||||
@@ -1009,7 +997,7 @@ class UM_Fields {
|
||||
|
||||
}
|
||||
|
||||
$output .= '<input class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="' . $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" autocomplete="'.$autocomplete.'" />
|
||||
$output .= '<input class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="' . $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" />
|
||||
|
||||
</div>';
|
||||
|
||||
@@ -1043,7 +1031,7 @@ class UM_Fields {
|
||||
|
||||
}
|
||||
|
||||
$output .= '<input class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" autocomplete="'.$autocomplete.'" />
|
||||
$output .= '<input class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" />
|
||||
|
||||
</div>';
|
||||
|
||||
@@ -1070,7 +1058,7 @@ class UM_Fields {
|
||||
|
||||
}
|
||||
|
||||
$output .= '<input class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="' . $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" autocomplete="'.$autocomplete.'" />
|
||||
$output .= '<input class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="' . $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" />
|
||||
|
||||
</div>';
|
||||
|
||||
@@ -1103,7 +1091,7 @@ class UM_Fields {
|
||||
|
||||
}
|
||||
|
||||
$output .= '<input class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" autocomplete="'.$autocomplete.'" />
|
||||
$output .= '<input class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" />
|
||||
|
||||
</div>';
|
||||
|
||||
@@ -1131,7 +1119,7 @@ class UM_Fields {
|
||||
|
||||
}
|
||||
|
||||
$output .= '<input class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" autocomplete="'.$autocomplete.'" data-range="'.$range.'" data-years="'.$years.'" data-years_x="'.$years_x.'" data-disabled_weekdays="'.$disabled_weekdays.'" data-date_min="'.$date_min.'" data-date_max="'.$date_max.'" data-format="'.$js_format.'" data-value="'. $this->field_value( $key, $default, $data ) .'" />
|
||||
$output .= '<input class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" data-range="'.$range.'" data-years="'.$years.'" data-years_x="'.$years_x.'" data-disabled_weekdays="'.$disabled_weekdays.'" data-date_min="'.$date_min.'" data-date_max="'.$date_max.'" data-format="'.$js_format.'" data-value="'. $this->field_value( $key, $default, $data ) .'" />
|
||||
|
||||
</div>';
|
||||
|
||||
@@ -1159,7 +1147,7 @@ class UM_Fields {
|
||||
|
||||
}
|
||||
|
||||
$output .= '<input class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" autocomplete="'.$autocomplete.'" data-format="'.$js_format.'" data-intervals="'.$intervals.'" data-value="'. $this->field_value( $key, $default, $data ) .'" />
|
||||
$output .= '<input class="'.$this->get_class($key, $data).'" type="'.$input.'" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. $this->field_value( $key, $default, $data ) .'" placeholder="'.$placeholder.'" data-validate="'.$validate.'" data-key="'.$key.'" data-format="'.$js_format.'" data-intervals="'.$intervals.'" data-value="'. $this->field_value( $key, $default, $data ) .'" />
|
||||
|
||||
</div>';
|
||||
|
||||
@@ -1232,7 +1220,13 @@ class UM_Fields {
|
||||
case 'image':
|
||||
$output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="'.$key.'">';
|
||||
|
||||
$output .= '<input type="hidden" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. $this->field_value( $key, $default, $data ) . '" />';
|
||||
if ( in_array( $key, array('profile_photo','cover_photo') ) ) {
|
||||
$field_value = '';
|
||||
} else {
|
||||
$field_value = $this->field_value( $key, $default, $data );
|
||||
}
|
||||
|
||||
$output .= '<input type="hidden" name="'.$key.$ultimatemember->form->form_suffix.'" id="'.$key.$ultimatemember->form->form_suffix.'" value="'. $field_value . '" />';
|
||||
|
||||
if ( isset( $data['label'] ) ) {
|
||||
$output .= $this->field_label($label, $key, $data);
|
||||
@@ -1244,17 +1238,14 @@ class UM_Fields {
|
||||
|
||||
if ( $this->field_value( $key, $default, $data ) ) {
|
||||
|
||||
$uri = um_user_uploads_uri() . $this->field_value( $key, $default, $data );
|
||||
|
||||
if ( isset( $ultimatemember->form->errors ) && !empty( $ultimatemember->form->errors ) ) {
|
||||
if ( isset( $this->set_mode ) && $this->set_mode == 'register' ) {
|
||||
$uri = $this->field_value( $key, $default, $data );
|
||||
}
|
||||
if ( !in_array( $key, array('profile_photo','cover_photo') ) ) {
|
||||
$img = '<img src="' . um_user_uploads_uri() . $this->field_value( $key, $default, $data ) . '" alt="" />';
|
||||
} else {
|
||||
$img = '';
|
||||
}
|
||||
|
||||
$output .= '<div class="um-single-image-preview show '. $crop_class .'" data-crop="'.$crop_data.'" data-key="'.$key.'">
|
||||
<a href="#" class="cancel"><i class="um-icon-close"></i></a>
|
||||
<img src="' . $uri . '" alt="" />
|
||||
<a href="#" class="cancel"><i class="um-icon-close"></i></a>' . $img . '
|
||||
</div><a href="#" data-modal="um_upload_single" data-modal-size="'.$modal_size.'" data-modal-copy="1" class="um-button um-btn-auto-width">'. __('Change photo') . '</a>';
|
||||
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ class UM_Form {
|
||||
if ( $form_timestamp == '' && um_get_option('enable_timebot') == 1 )
|
||||
wp_die( __('Hello, spam bot!') );
|
||||
|
||||
if ( $live_timestamp - $form_timestamp < 6 && um_get_option('enable_timebot') == 1 )
|
||||
if ( !current_user_can('manage_options') && $live_timestamp - $form_timestamp < 6 && um_get_option('enable_timebot') == 1 )
|
||||
wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!') );
|
||||
|
||||
}
|
||||
|
||||
+17
-2
@@ -41,13 +41,28 @@ class UM_Profile {
|
||||
return $primary;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Activated tabs in backend
|
||||
***/
|
||||
function tabs_enabled(){
|
||||
$tabs = $this->tabs();
|
||||
foreach( $tabs as $id => $info ){
|
||||
if ( isset( $info['name'] ) ) {
|
||||
if ( um_get_option('profile_tab_'.$id) || isset( $info['_builtin'] ) ) {
|
||||
$primary[$id] = $info['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return ( isset( $primary ) ) ? $primary : '';
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Get active_tab
|
||||
***/
|
||||
function active_tab() {
|
||||
|
||||
|
||||
$this->active_tab = um_get_option('profile_menu_default_tab');
|
||||
|
||||
|
||||
if ( get_query_var('profiletab') ) {
|
||||
$this->active_tab = get_query_var('profiletab');
|
||||
}
|
||||
|
||||
@@ -22,12 +22,18 @@
|
||||
*
|
||||
*/
|
||||
function um_user_ip() {
|
||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||
return $_SERVER['HTTP_CLIENT_IP'];
|
||||
} else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
return $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
$ip = '127.0.0.1';
|
||||
|
||||
if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
|
||||
//check ip from share internet
|
||||
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
||||
} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
|
||||
//to check ip is pass from proxy
|
||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
} elseif( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
return $_SERVER['REMOTE_ADDR'];
|
||||
return apply_filters( 'um_user_ip', $ip );
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -490,6 +496,7 @@ function um_reset_user() {
|
||||
***/
|
||||
function um_edit_my_profile_cancel_uri() {
|
||||
$url = remove_query_arg( 'um_action' );
|
||||
$url = remove_query_arg( 'profiletab', $url );
|
||||
return $url;
|
||||
}
|
||||
|
||||
@@ -873,6 +880,10 @@ function um_fetch_user( $user_id ) {
|
||||
|
||||
}
|
||||
|
||||
if ( $attrs == 'original' ) {
|
||||
$uri = um_user_uploads_uri() . 'profile_photo.jpg?' . current_time( 'timestamp' );
|
||||
}
|
||||
|
||||
}
|
||||
return $uri;
|
||||
}
|
||||
|
||||
+20
-2
@@ -30,9 +30,21 @@ class UM_User {
|
||||
);
|
||||
|
||||
$this->target_id = null;
|
||||
|
||||
// When the cache should be cleared
|
||||
add_action('um_delete_user_hook', array(&$this, 'remove_cached_queue') );
|
||||
add_action('um_new_user_registration_plain', array(&$this, 'remove_cached_queue') );
|
||||
add_action('um_after_user_status_is_changed_hook', array(&$this, 'remove_cached_queue') );
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Remove cached queue from Users backend
|
||||
***/
|
||||
function remove_cached_queue() {
|
||||
delete_option('um_cached_users_queue');
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Converts object to array
|
||||
***/
|
||||
@@ -305,7 +317,9 @@ class UM_User {
|
||||
|
||||
$this->update_usermeta_info('account_status');
|
||||
|
||||
do_action('um_after_user_status_is_changed', $status);
|
||||
do_action( 'um_after_user_status_is_changed_hook' );
|
||||
|
||||
do_action( 'um_after_user_status_is_changed', $status);
|
||||
|
||||
}
|
||||
|
||||
@@ -481,15 +495,19 @@ class UM_User {
|
||||
function delete( $send_mail = true ) {
|
||||
global $ultimatemember;
|
||||
|
||||
do_action( 'um_delete_user_hook' );
|
||||
do_action( 'um_delete_user', um_user('ID') );
|
||||
|
||||
// send email notifications
|
||||
if ( $send_mail ) {
|
||||
$ultimatemember->mail->send( um_user('user_email'), 'deletion_email' );
|
||||
$ultimatemember->mail->send( um_admin_email(), 'notification_deletion', array('admin' => true ) );
|
||||
}
|
||||
|
||||
// remove uploads
|
||||
$ultimatemember->files->remove_dir( um_user_uploads_dir() );
|
||||
|
||||
|
||||
// remove user
|
||||
if ( is_multisite() ) {
|
||||
|
||||
if ( !function_exists('wpmu_delete_user') ) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Plugin Name: Ultimate Member
|
||||
Plugin URI: http://ultimatemember.com/
|
||||
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
|
||||
Version: 1.2.8
|
||||
Version: 1.2.92
|
||||
Author: Ultimate Member
|
||||
Author URI: http://ultimatemember.com/
|
||||
*/
|
||||
|
||||
+25
-2
@@ -5,9 +5,9 @@ Contributors: ultimatemember
|
||||
Donate link:
|
||||
Tags: access control, author, authors, author profile, comments, community, communities, conditional fields, conditional logic, conditional menus, content protection, custom fields, file uploads, form builder, front-end login, front-end registration, gravatar, hide wp-admin, login, login page, logged-in users, mandrill, member, members, membership, member directory, online users, profile, profiles, profile builder, registration, restriction, restrict content, role creation, role menus, search filters, sign in, sign up, social network, star ratings, toolbar, user, users, user fields, user profile, user-profile, user profiles, user roles
|
||||
Requires at least: 4.1
|
||||
Tested up to: 4.2
|
||||
Tested up to: 4.2.1
|
||||
|
||||
Stable Tag: 1.2.8
|
||||
Stable Tag: 1.2.92
|
||||
|
||||
License: GNU Version 2 or Any Later Version
|
||||
|
||||
@@ -45,6 +45,7 @@ Read about all of the plugin's features at [Ultimate Member](https://ultimatemem
|
||||
|
||||
Ultimate Member has a range of extensions that allow you to extend the power of the plugin
|
||||
|
||||
* [Followers](https://ultimatemember.com/extensions/followers/) - Allow users to follow each other on your site and protect their profile information
|
||||
* [Real-time Notifications](https://ultimatemember.com/extensions/real-time-notifications/) - Add a notifications system to your site so users can receive real-time notifications
|
||||
* [Social Login](https://ultimatemember.com/extensions/social-login/) - Let users register & login to your site via Facebook, Twitter, G+, LinkedIn, Instagram and Vkontakte (VK.com)
|
||||
* [bbPress](https://ultimatemember.com/extensions/bbpress/) - With the bbPress extension you can beautifully integrate Ultimate Member with bbPress
|
||||
@@ -140,6 +141,28 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.2.92: May 2, 2015 =
|
||||
|
||||
* New: Important: Introduces the Ultimate Member RESTful API
|
||||
* Tweak: improved um_user_ip() function
|
||||
* Fixed: issue with invalid html on profile photo and cover photo
|
||||
|
||||
= 1.2.91: April 30, 2015 =
|
||||
|
||||
* New: added custom field validation support via hooks um_custom_field_validation_{$hook}
|
||||
* Fixed: important bug with profile menu tabs / system
|
||||
|
||||
= 1.2.9: April 29, 2015 =
|
||||
|
||||
* New: display pending users count in backend
|
||||
* Tweak: improved user deletion process from backend
|
||||
* Tweak: tweaked filter for register/login buttons
|
||||
* Tweak: disabled registration timebot for admins
|
||||
* Fixed: wp-load.php path in image and file upload scripts
|
||||
* Fixed: RTL compatibility bugs
|
||||
* Fixed: bug with registration and role field
|
||||
* Fixed: bug with edit profile and biography length in header
|
||||
|
||||
= 1.2.8: April 25, 2015 =
|
||||
|
||||
* Fixed: Important WP 4.2 conflict resolved: filtering users in backend
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<div class="um <?php echo $this->get_class( $mode ); ?> um-<?php echo $form_id; ?>" data-error_required="This field is required" data-password_not_match="Passwords do not match" data-password_not_long="Password must be 8 characters at least">
|
||||
<div class="um <?php echo $this->get_class( $mode ); ?> um-<?php echo $form_id; ?>">
|
||||
|
||||
<div class="um-form">
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="um <?php echo $this->get_class( $mode, $args ); ?> um-<?php echo $form_id; ?>" data-error_required="This field is required" data-password_not_match="Passwords do not match" data-password_not_long="Password must be 8 characters at least">
|
||||
<div class="um <?php echo $this->get_class( $mode, $args ); ?> um-<?php echo $form_id; ?>">
|
||||
|
||||
<div class="um-form">
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="um <?php echo $this->get_class( $mode ); ?> um-<?php echo $form_id; ?>" data-error_required="This field is required" data-password_not_match="Passwords do not match" data-password_not_long="Password must be 8 characters at least">
|
||||
<div class="um <?php echo $this->get_class( $mode ); ?> um-<?php echo $form_id; ?>">
|
||||
|
||||
<div class="um-form">
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="um <?php echo $this->get_class( $mode ); ?> um-<?php echo $form_id; ?>">
|
||||
|
||||
<div class="um-notification">
|
||||
<div class="um-postmessage">
|
||||
|
||||
<?php echo $this->custom_message; ?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="um <?php echo $this->get_class( $mode ); ?> um-<?php echo $form_id; ?>" data-error_required="This field is required" data-password_not_match="Passwords do not match" data-password_not_long="Password must be 8 characters at least">
|
||||
<div class="um <?php echo $this->get_class( $mode ); ?> um-<?php echo $form_id; ?>">
|
||||
|
||||
<div class="um-form">
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="um <?php echo $this->get_class( $mode ); ?> um-<?php echo $form_id; ?>" data-error_required="This field is required" data-password_not_match="Passwords do not match" data-password_not_long="Password must be 8 characters at least">
|
||||
<div class="um <?php echo $this->get_class( $mode ); ?> um-<?php echo $form_id; ?>">
|
||||
|
||||
<div class="um-form">
|
||||
|
||||
|
||||
+1
-3
@@ -1482,8 +1482,6 @@ $tab_options[] = array(
|
||||
);
|
||||
|
||||
foreach( $tabs as $id => $tab ) {
|
||||
|
||||
if ( isset( $tab['_builtin'] ) ) continue;
|
||||
|
||||
$tab_options[] = array(
|
||||
'id' => 'profile_tab_' . $id,
|
||||
@@ -1504,7 +1502,7 @@ $tab_options[] = array(
|
||||
'title' => __( 'Profile menu default tab','ultimatemember' ),
|
||||
'desc' => __( 'This will be the default tab on user profile page','ultimatemember' ),
|
||||
'default' => 'main',
|
||||
'options' => $ultimatemember->profile->tabs_primary(),
|
||||
'options' => $ultimatemember->profile->tabs_enabled(),
|
||||
'required' => array( 'profile_menu', '=', 1 ),
|
||||
);
|
||||
|
||||
|
||||
+3
-4
@@ -61,6 +61,7 @@ class UM_API {
|
||||
|
||||
ob_start();
|
||||
|
||||
require_once um_path . 'core/um-api.php';
|
||||
require_once um_path . 'core/um-rewrite.php';
|
||||
require_once um_path . 'core/um-setup.php';
|
||||
require_once um_path . 'core/um-uninstall.php';
|
||||
@@ -109,15 +110,12 @@ class UM_API {
|
||||
require_once um_path . 'core/um-actions-password.php';
|
||||
require_once um_path . 'core/um-actions-members.php';
|
||||
require_once um_path . 'core/um-actions-global.php';
|
||||
require_once um_path . 'core/um-actions-tracking.php';
|
||||
require_once um_path . 'core/um-actions-user.php';
|
||||
require_once um_path . 'core/um-actions-save-profile.php';
|
||||
require_once um_path . 'core/um-actions-modal.php';
|
||||
require_once um_path . 'core/um-actions-misc.php';
|
||||
require_once um_path . 'core/um-actions-posts.php';
|
||||
|
||||
|
||||
require_once um_path . 'core/um-filters-login.php';
|
||||
require_once um_path . 'core/um-filters-register.php';
|
||||
require_once um_path . 'core/um-filters-fields.php';
|
||||
require_once um_path . 'core/um-filters-files.php';
|
||||
require_once um_path . 'core/um-filters-navmenu.php';
|
||||
@@ -132,6 +130,7 @@ class UM_API {
|
||||
require_once um_path . 'core/um-filters-commenting.php';
|
||||
|
||||
/* initialize UM */
|
||||
$this->api = new UM_REST_API();
|
||||
$this->rewrite = new UM_Rewrite();
|
||||
$this->setup = new UM_Setup();
|
||||
$this->uninstall = new UM_Uninstall();
|
||||
|
||||
Reference in New Issue
Block a user