mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Merge branch 'master' of https://github.com/ultimatemember/ultimatemember into fix/wpml_emails_templates
Conflicts: includes/um-deprecated-functions.php includes/um-short-functions.php
This commit is contained in:
@@ -33,6 +33,7 @@ if ( ! class_exists( 'Admin_Forms_Settings' ) ) {
|
||||
return $field_data['value' . $i];
|
||||
} else {
|
||||
$value = UM()->options()->get( $field_data['id' . $i] );
|
||||
$value = is_string( $value ) ? stripslashes( $value ) : $value;
|
||||
return '' !== $value ? $value : $default;
|
||||
}
|
||||
} else {
|
||||
@@ -40,6 +41,7 @@ if ( ! class_exists( 'Admin_Forms_Settings' ) ) {
|
||||
return $field_data['value'. $i];
|
||||
} else {
|
||||
$value = UM()->options()->get( $field_data['id' . $i] );
|
||||
$value = is_string( $value ) ? stripslashes( $value ) : $value;
|
||||
return isset( $value ) ? $value : $default;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -972,6 +972,11 @@ if ( ! class_exists( 'Admin_Forms' ) ) {
|
||||
}
|
||||
|
||||
|
||||
function render_info_text( $field_data ) {
|
||||
return $field_data['value'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get field value
|
||||
*
|
||||
@@ -984,10 +989,14 @@ if ( ! class_exists( 'Admin_Forms' ) ) {
|
||||
$default = isset( $field_data['default' . $i] ) ? $field_data['default' . $i] : $default;
|
||||
|
||||
if ( $field_data['type'] == 'checkbox' || $field_data['type'] == 'multi_checkbox' ) {
|
||||
return ( isset( $field_data['value' . $i] ) && '' !== $field_data['value' . $i] ) ? $field_data['value' . $i] : $default;
|
||||
$value = ( isset( $field_data['value' . $i] ) && '' !== $field_data['value' . $i] ) ? $field_data['value' . $i] : $default;
|
||||
} else {
|
||||
return isset( $field_data['value' . $i] ) ? $field_data['value' . $i] : $default;
|
||||
$value = isset( $field_data['value' . $i] ) ? $field_data['value' . $i] : $default;
|
||||
}
|
||||
|
||||
$value = is_string( $value ) ? stripslashes( $value ) : $value;
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @Put status handler in modal
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @Does an action to user asap
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @modify field args just before it is saved into form
|
||||
|
||||
@@ -126,18 +126,30 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
|
||||
$custom_restrict = apply_filters( 'um_custom_restriction', true, $restriction );
|
||||
|
||||
if ( ! empty( $restriction['_um_access_roles'] ) )
|
||||
if ( empty( $restriction['_um_access_roles'] ) ) {
|
||||
if ( $custom_restrict ) {
|
||||
$this->allow_access = true;
|
||||
return;
|
||||
} else {
|
||||
//restrict terms page by 404 for logged in users with wrong role
|
||||
global $wp_query;
|
||||
$wp_query->set_404();
|
||||
status_header( 404 );
|
||||
nocache_headers();
|
||||
}
|
||||
} else {
|
||||
$user_can = $this->user_can( get_current_user_id(), $restriction['_um_access_roles'] );
|
||||
|
||||
if ( isset( $user_can ) && $user_can && $custom_restrict ) {
|
||||
$this->allow_access = true;
|
||||
return;
|
||||
} else {
|
||||
//restrict terms page by 404 for logged in users with wrong role
|
||||
global $wp_query;
|
||||
$wp_query->set_404();
|
||||
status_header( 404 );
|
||||
nocache_headers();
|
||||
if ( isset( $user_can ) && $user_can && $custom_restrict ) {
|
||||
$this->allow_access = true;
|
||||
return;
|
||||
} else {
|
||||
//restrict terms page by 404 for logged in users with wrong role
|
||||
global $wp_query;
|
||||
$wp_query->set_404();
|
||||
status_header( 404 );
|
||||
nocache_headers();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,6 +199,7 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
if ( $access == 2 ) {
|
||||
//global settings for accessible home page
|
||||
$home_page_accessible = UM()->options()->get( 'home_page_accessible' );
|
||||
|
||||
if ( $home_page_accessible == 0 ) {
|
||||
//get redirect URL if not set get login page by default
|
||||
$redirect = UM()->options()->get( 'access_redirect' );
|
||||
@@ -194,6 +207,9 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
$redirect = um_get_core_page( 'login' );
|
||||
|
||||
$this->redirect_handler = $this->set_referer( $redirect, 'global' );
|
||||
} else {
|
||||
$this->allow_access = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,6 +228,9 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
$redirect = um_get_core_page( 'login' );
|
||||
|
||||
$this->redirect_handler = $this->set_referer( $redirect, 'global' );
|
||||
} else {
|
||||
$this->allow_access = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -223,11 +242,13 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
|
||||
//build exclude URLs pages
|
||||
$redirects = array();
|
||||
$redirects[] = untrailingslashit( UM()->options()->get( 'access_redirect' ) );
|
||||
$redirects[] = trim( untrailingslashit( UM()->options()->get( 'access_redirect' ) ) );
|
||||
|
||||
$exclude_uris = UM()->options()->get( 'access_exclude_uris' );
|
||||
if ( ! empty( $exclude_uris ) )
|
||||
if ( ! empty( $exclude_uris ) ) {
|
||||
$exclude_uris = array_map( 'trim', $exclude_uris );
|
||||
$redirects = array_merge( $redirects, $exclude_uris );
|
||||
}
|
||||
|
||||
$redirects = array_unique( $redirects );
|
||||
|
||||
@@ -235,16 +256,17 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
$current_url = untrailingslashit( $current_url );
|
||||
$current_url_slash = trailingslashit( $current_url );
|
||||
|
||||
//get redirect URL if not set get login page by default
|
||||
$redirect = UM()->options()->get( 'access_redirect' );
|
||||
if ( ! $redirect )
|
||||
$redirect = um_get_core_page( 'login' );
|
||||
|
||||
if ( ! isset( $post->ID ) || ! ( in_array( $current_url, $redirects ) || in_array( $current_url_slash, $redirects ) ) ) {
|
||||
if ( ! ( isset( $post->ID ) && ( in_array( $current_url, $redirects ) || in_array( $current_url_slash, $redirects ) ) ) ) {
|
||||
//if current page not in exclude URLs
|
||||
//get redirect URL if not set get login page by default
|
||||
$redirect = UM()->options()->get( 'access_redirect' );
|
||||
if ( ! $redirect )
|
||||
$redirect = um_get_core_page( 'login' );
|
||||
|
||||
$this->redirect_handler = $this->set_referer( $redirect, 'global' );
|
||||
} else {
|
||||
$this->redirect_handler = false;
|
||||
$this->allow_access = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -285,6 +307,11 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
//check global restrict content options
|
||||
do_action( 'um_access_check_global_settings' );
|
||||
|
||||
/*var_dump($this->allow_access);
|
||||
var_dump($this->redirect_handler);
|
||||
var_dump('12345678');
|
||||
exit;*/
|
||||
|
||||
$this->check_access();
|
||||
}
|
||||
|
||||
@@ -475,9 +502,9 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
if ( ! isset( $restriction['_um_noaccess_action'] ) || '0' == $restriction['_um_noaccess_action'] ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = $restricted_global_message;
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? $restriction['_um_restrict_custom_message'] : '';
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -492,9 +519,9 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
if ( ! isset( $restriction['_um_noaccess_action'] ) || '0' == $restriction['_um_noaccess_action'] ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = $restricted_global_message;
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? $restriction['_um_restrict_custom_message'] : '';
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
}
|
||||
|
||||
$filtered_posts[] = $post;
|
||||
@@ -531,13 +558,19 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
|
||||
$custom_restrict = apply_filters( 'um_custom_restriction', true, $restriction );
|
||||
|
||||
if ( ! empty( $restriction['_um_access_roles'] ) )
|
||||
$user_can = $this->user_can( get_current_user_id(), $restriction['_um_access_roles'] );
|
||||
if ( empty( $restriction['_um_access_roles'] ) ) {
|
||||
if ( $custom_restrict ) {
|
||||
$filtered_posts[] = $post;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
$user_can = $this->user_can( get_current_user_id(), $restriction['_um_access_roles'] );
|
||||
|
||||
if ( isset( $user_can ) && $user_can && $custom_restrict ) {
|
||||
$filtered_posts[] = $post;
|
||||
continue;
|
||||
}
|
||||
if ( isset( $user_can ) && $user_can && $custom_restrict ) {
|
||||
$filtered_posts[] = $post;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $query->is_singular ) ) {
|
||||
//if not single query when exclude if set _um_access_hide_from_queries
|
||||
@@ -546,9 +579,9 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
if ( ! isset( $restriction['_um_noaccess_action'] ) || '0' == $restriction['_um_noaccess_action'] ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = $restricted_global_message;
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? $restriction['_um_restrict_custom_message'] : '';
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -563,13 +596,13 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
if ( ! isset( $restriction['_um_noaccess_action'] ) || '0' == $restriction['_um_noaccess_action'] ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = $restricted_global_message;
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
|
||||
if ( 'attachment' == $post->post_type ) {
|
||||
remove_filter( 'the_content', 'prepend_attachment' );
|
||||
}
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? $restriction['_um_restrict_custom_message'] : '';
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
|
||||
if ( 'attachment' == $post->post_type ) {
|
||||
remove_filter( 'the_content', 'prepend_attachment' );
|
||||
@@ -607,9 +640,9 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
if ( ! isset( $restriction['_um_noaccess_action'] ) || '0' == $restriction['_um_noaccess_action'] ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = $restricted_global_message;
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? $restriction['_um_restrict_custom_message'] : '';
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -624,13 +657,13 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
if ( ! isset( $restriction['_um_noaccess_action'] ) || '0' == $restriction['_um_noaccess_action'] ) {
|
||||
|
||||
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = $restricted_global_message;
|
||||
$post->post_content = stripslashes( $restricted_global_message );
|
||||
|
||||
if ( 'attachment' == $post->post_type ) {
|
||||
remove_filter( 'the_content', 'prepend_attachment' );
|
||||
}
|
||||
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? $restriction['_um_restrict_custom_message'] : '';
|
||||
$post->post_content = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
||||
|
||||
if ( 'attachment' == $post->post_type ) {
|
||||
remove_filter( 'the_content', 'prepend_attachment' );
|
||||
@@ -711,13 +744,19 @@ if ( ! class_exists( 'Access' ) ) {
|
||||
|
||||
$custom_restrict = apply_filters( 'um_custom_restriction', true, $restriction );
|
||||
|
||||
if ( ! empty( $restriction['_um_access_roles'] ) )
|
||||
$user_can = $this->user_can( get_current_user_id(), $restriction['_um_access_roles'] );
|
||||
if ( empty( $restriction['_um_access_roles'] ) ) {
|
||||
if ( $custom_restrict ) {
|
||||
$filtered_items[] = $menu_item;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
$user_can = $this->user_can( get_current_user_id(), $restriction['_um_access_roles'] );
|
||||
|
||||
if ( isset( $user_can ) && $user_can && $custom_restrict ) {
|
||||
$filtered_items[] = $menu_item;
|
||||
continue;
|
||||
}
|
||||
if ( isset( $user_can ) && $user_can && $custom_restrict ) {
|
||||
$filtered_items[] = $menu_item;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//if not single query when exclude if set _um_access_hide_from_queries
|
||||
if ( empty( $restriction['_um_access_hide_from_queries'] ) ) {
|
||||
|
||||
@@ -30,29 +30,12 @@ if ( ! class_exists( 'AJAX_Common' ) ) {
|
||||
* Fallback for ajax urls
|
||||
* @uses action hooks: wp_head, admin_head
|
||||
*/
|
||||
add_action( 'wp_head', array( $this, 'ultimatemember_ajax_urls' ) );
|
||||
add_action( 'admin_head', array( $this, 'ultimatemember_ajax_urls' ) );
|
||||
//add_action( 'wp_head', array( $this, 'ultimatemember_ajax_urls' ) );
|
||||
//add_action( 'admin_head', array( $this, 'ultimatemember_ajax_urls' ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ultimatemember_ajax_urls() {
|
||||
$enable_ajax_urls = apply_filters( "um_enable_ajax_urls", true );
|
||||
|
||||
if ( $enable_ajax_urls ) { ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var ultimatemember_image_upload_url = '<?php echo um_url . 'includes/lib/upload/um-image-upload.php'; ?>';
|
||||
var ultimatemember_file_upload_url = '<?php echo um_url . 'includes/lib/upload/um-file-upload.php'; ?>';
|
||||
var ultimatemember_ajax_url = '<?php echo admin_url('admin-ajax.php'); ?>';
|
||||
|
||||
</script>
|
||||
|
||||
<?php }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Router method
|
||||
*/
|
||||
|
||||
+2719
-2718
File diff suppressed because it is too large
Load Diff
@@ -141,6 +141,18 @@ if ( ! class_exists( 'Roles_Capabilities' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set roles to user (remove all previous roles)
|
||||
* make user only with $roles roles
|
||||
*
|
||||
* @param int $user_id
|
||||
* @param string|array $roles
|
||||
*/
|
||||
function set_roles( $user_id, $roles ) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get user one of UM roles if it has it
|
||||
*
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
/**
|
||||
* Profile Access
|
||||
*
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
/**
|
||||
* Validate for errors in account form
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
/**
|
||||
* Run check if username exists
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
/**
|
||||
* Processes the requests of UM actions
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @Error handling: blocked emails
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @adds a form identifier to form
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/**
|
||||
* Error procesing hook for login
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/**
|
||||
* Member Directory Search
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @add a force redirect to from $_get
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @process a new request
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @um_profile_content_{main_tab}
|
||||
@@ -101,8 +104,16 @@
|
||||
$to_update['description'] = $args['submitted']['description'];
|
||||
}
|
||||
|
||||
if (!empty( $args['submitted']['role'] )) {
|
||||
$to_update['role'] = $args['submitted']['role'];
|
||||
if ( ! empty( $args['submitted']['role'] ) ) {
|
||||
global $wp_roles;
|
||||
$role_keys = array_map( function( $item ) {
|
||||
return 'um_' . $item;
|
||||
}, get_option( 'um_roles' ) );
|
||||
$exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
|
||||
|
||||
if ( ! in_array( $args['submitted']['role'], $exclude_roles ) ) {
|
||||
$to_update['role'] = $args['submitted']['role'];
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'um_user_pre_updating_profile', $to_update );
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/**
|
||||
* Account automatically approved
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @profile name update
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @sync with WP role
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @checks if user can access the backend
|
||||
***/
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/**
|
||||
* Account secure fields
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @conditional logout form
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @Do not apply to backend default avatars
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @Control comment author display
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @field is required?
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @Support multisite
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
add_filter("um_localize_permalink_filter","um_localize_permalink_filter",10,3);
|
||||
function um_localize_permalink_filter( $core_pages, $page_id, $profile_url ){
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @filter to allow whitelisted IP to access the wp-admin login
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @Members Filter Hooks
|
||||
@@ -305,7 +308,7 @@
|
||||
add_filter('pre_user_query','um_modify_sortby_randomly');
|
||||
function um_modify_sortby_randomly( $query ){
|
||||
|
||||
if( um_is_session_started() === FALSE ){
|
||||
if( um_is_session_started() === false ){
|
||||
@session_start();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @formats numbers nicely
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @add dynamic profile headers
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/***
|
||||
*** @dynamic profile page title
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
|
||||
/***
|
||||
*** @Main admin user actions
|
||||
***/
|
||||
|
||||
@@ -11,6 +11,7 @@ while( !file_exists( $wp_config ) );
|
||||
if ( !file_exists( $wp_load ) ) {
|
||||
$dirs = glob( $dirname . '/*' , GLOB_ONLYDIR );
|
||||
|
||||
|
||||
foreach ( $dirs as $key => $value ) {
|
||||
$wp_load = "{$value}/wp-load.php";
|
||||
if ( file_exists( $wp_load ) ) {
|
||||
|
||||
@@ -75,6 +75,269 @@ function um_remove_option( $option_id ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated 2.0
|
||||
*
|
||||
* @param $content_type
|
||||
* @return string
|
||||
*/
|
||||
function um_mail_content_type( $content_type ) {
|
||||
return 'text/html';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert urls to clickable links
|
||||
*
|
||||
* @deprecated 2.0
|
||||
*
|
||||
* @param $s
|
||||
* @return mixed
|
||||
*/
|
||||
function um_clickable_links( $s ) {
|
||||
return preg_replace( '@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1" class="um-link" target="_blank">$1</a>', $s );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set redirect key
|
||||
*
|
||||
* @deprecated 2.0
|
||||
*
|
||||
* @param string $url
|
||||
* @return string $redirect_key
|
||||
*/
|
||||
function um_set_redirect_url( $url ) {
|
||||
|
||||
if (um_is_session_started() === false) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
$redirect_key = wp_generate_password( 12, false );
|
||||
|
||||
$_SESSION['um_redirect_key'] = array( $redirect_key => $url );
|
||||
|
||||
return $redirect_key;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set redirect key
|
||||
*
|
||||
* @deprecated 2.0
|
||||
*
|
||||
* @param string $key
|
||||
* @return string $redirect_key
|
||||
*/
|
||||
function um_get_redirect_url( $key ) {
|
||||
|
||||
if (um_is_session_started() === false) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
if (isset( $_SESSION['um_redirect_key'][$key] )) {
|
||||
|
||||
$url = $_SESSION['um_redirect_key'][$key];
|
||||
|
||||
return $url;
|
||||
|
||||
} else {
|
||||
|
||||
if (isset( $_SESSION['um_redirect_key'] )) {
|
||||
foreach ($_SESSION['um_redirect_key'] as $key => $url) {
|
||||
|
||||
return $url;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get user's last login time
|
||||
*
|
||||
* @deprecated 2.0
|
||||
*
|
||||
* @param $user_id
|
||||
* @return string
|
||||
*/
|
||||
function um_user_last_login_date( $user_id ) {
|
||||
$value = get_user_meta( $user_id, '_um_last_login', true );
|
||||
if ($value)
|
||||
return date_i18n( 'F d, Y', $value );
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if we are on UM page
|
||||
*
|
||||
* @deprecated 2.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_ultimatemember() {
|
||||
global $post;
|
||||
if ( isset( $post->ID ) && in_array( $post->ID, UM()->config()->permalinks ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is core URL
|
||||
*
|
||||
* @deprecated 2.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function um_is_core_uri() {
|
||||
$array = UM()->config()->permalinks;
|
||||
$current_url = UM()->permalinks()->get_current_url( get_option( 'permalink_structure' ) );
|
||||
|
||||
if (!isset( $array ) || !is_array( $array )) return false;
|
||||
|
||||
foreach ($array as $k => $id) {
|
||||
$page_url = get_permalink( $id );
|
||||
if (strstr( $current_url, $page_url ))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if meta_value exists
|
||||
*
|
||||
* @deprecated 2.0
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param mixed $return_user_id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
function um_is_meta_value_exists( $key, $value, $return_user_id = false ) {
|
||||
global $wpdb;
|
||||
|
||||
if (isset( UM()->profile()->arr_user_slugs['is_' . $return_user_id][$key] )) {
|
||||
return UM()->profile()->arr_user_slugs['is_' . $return_user_id][$key];
|
||||
}
|
||||
|
||||
if (!$return_user_id) {
|
||||
$count = $wpdb->get_var( $wpdb->prepare(
|
||||
"SELECT COUNT(*) as count FROM {$wpdb->usermeta} WHERE meta_key = %s AND meta_value = %s ",
|
||||
$key,
|
||||
$value
|
||||
) );
|
||||
|
||||
UM()->profile()->arr_user_slugs['is_' . $return_user_id][$key] = $count;
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
$user_id = $wpdb->get_var( $wpdb->prepare(
|
||||
"SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = %s AND meta_value = %s ",
|
||||
$key,
|
||||
$value
|
||||
) );
|
||||
|
||||
UM()->profile()->arr_user_slugs['is_' . $return_user_id][$key] = $user_id;
|
||||
|
||||
return $user_id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get localization
|
||||
*
|
||||
* @deprecated 2.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function um_get_locale() {
|
||||
|
||||
$lang_code = get_locale();
|
||||
|
||||
if (strpos( $lang_code, 'en_' ) > -1 || empty( $lang_code ) || $lang_code == 0) {
|
||||
return 'en';
|
||||
}
|
||||
|
||||
return $lang_code;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get current page type
|
||||
*
|
||||
* @deprecated 2.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function um_get_current_page_type() {
|
||||
global $wp_query;
|
||||
$loop = 'notfound';
|
||||
|
||||
if ($wp_query->is_page) {
|
||||
//$loop = is_front_page() ? 'front' : 'page';
|
||||
$loop = 'page';
|
||||
} else if ($wp_query->is_home) {
|
||||
$loop = 'home';
|
||||
} else if ($wp_query->is_single) {
|
||||
$loop = ( $wp_query->is_attachment ) ? 'attachment' : 'single';
|
||||
} else if ($wp_query->is_category) {
|
||||
$loop = 'category';
|
||||
} else if ($wp_query->is_tag) {
|
||||
$loop = 'tag';
|
||||
} else if ($wp_query->is_tax) {
|
||||
$loop = 'tax';
|
||||
} else if ($wp_query->is_archive) {
|
||||
if ($wp_query->is_day) {
|
||||
$loop = 'day';
|
||||
} else if ($wp_query->is_month) {
|
||||
$loop = 'month';
|
||||
} else if ($wp_query->is_year) {
|
||||
$loop = 'year';
|
||||
} else if ($wp_query->is_author) {
|
||||
$loop = 'author';
|
||||
} else {
|
||||
$loop = 'archive';
|
||||
}
|
||||
} else if ($wp_query->is_search) {
|
||||
$loop = 'search';
|
||||
} else if ($wp_query->is_404) {
|
||||
$loop = 'notfound';
|
||||
}
|
||||
|
||||
return $loop;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if running local
|
||||
*
|
||||
* @deprecated 2.0
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function um_core_is_local() {
|
||||
if ($_SERVER['HTTP_HOST'] == 'localhost'
|
||||
|| substr( $_SERVER['HTTP_HOST'], 0, 3 ) == '10.'
|
||||
|| substr( $_SERVER['HTTP_HOST'], 0, 7 ) == '192.168'
|
||||
) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a translated core page URL
|
||||
*
|
||||
|
||||
+1730
-1726
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user