mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Recent code changes (update)
This commit is contained in:
@@ -2,6 +2,13 @@
|
||||
- General
|
||||
*/
|
||||
|
||||
.um-admin.toplevel_page_ultimatemember div.error,
|
||||
.um-admin.toplevel_page_ultimatemember div.updated
|
||||
{
|
||||
display: none;
|
||||
margin: 0 0 1px 0 !important;
|
||||
}
|
||||
|
||||
.um-admin-dash-container {
|
||||
box-sizing: border-box;
|
||||
margin: 18px 20px 20px 2px !important;
|
||||
@@ -9,11 +16,27 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.um-admin-dash-container *{
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
.um-admin-dash-container * {
|
||||
-webkit-font-smoothing: antialiased !important;
|
||||
-moz-osx-font-smoothing: grayscale !important;
|
||||
}
|
||||
|
||||
.um-admin-dash-container a.ok {color: #7ACF58}
|
||||
.um-admin-dash-container a.red {color: #C74A4A}
|
||||
|
||||
.um-admin-dash-count {
|
||||
background: #7ACF58;
|
||||
color: #fff;
|
||||
padding: 2px 6px;
|
||||
border-radius: 3px;
|
||||
font-family: Open Sans;
|
||||
font-weight: 700;
|
||||
font-size: 12px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.um-admin-dash-count.count-0 {background: #ddd !important}
|
||||
.um-admin-dash-count.red {background:#C74A4A}
|
||||
|
||||
.um-admin-dash-head {
|
||||
background: #3ba1da;
|
||||
padding: 0 0 0 20px;
|
||||
@@ -103,23 +126,9 @@
|
||||
vertical-align: middle;
|
||||
font-size: 1.35em;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.um-admin-dash-count {
|
||||
background: #7ACF58;
|
||||
color: #fff;
|
||||
padding: 2px 6px;
|
||||
border-radius: 3px;
|
||||
font-family: Open Sans;
|
||||
font-weight: 700;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 8px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.um-admin-dash-count.red {background:#cb3838}
|
||||
|
||||
/*
|
||||
- Main
|
||||
*/
|
||||
@@ -131,15 +140,15 @@
|
||||
.um-admin-dash-main {
|
||||
margin-left: 201px;
|
||||
border-left: 1px solid #D8D8D8;
|
||||
padding: 10px 20px;
|
||||
padding: 0 30px;
|
||||
box-shadow: 0px 1px 0px #FFF inset;
|
||||
min-height: 300px;
|
||||
}
|
||||
|
||||
.um-admin-dash-main h3{
|
||||
font-weight: 500;
|
||||
padding: 0 0 10px 0;
|
||||
margin-bottom: 0 !important;
|
||||
padding: 30px 0 10px 0;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -159,4 +168,68 @@
|
||||
color: #777 !important;
|
||||
font-size: 22px !important;
|
||||
}
|
||||
.um-admin-dash-share a:hover {color: #3ba1da !important}
|
||||
.um-admin-dash-share a:hover {color: #3ba1da !important}
|
||||
|
||||
/*
|
||||
- Dashboard styles
|
||||
*/
|
||||
|
||||
.um-admin-dash-two-col .um-admin-dash-col {
|
||||
float: left;
|
||||
width: 42%;
|
||||
margin-right: 4%;
|
||||
}
|
||||
|
||||
.um-admin-dash-col a:hover {text-decoration: underline}
|
||||
|
||||
.um-admin-dash-item {
|
||||
padding: 5px 0;
|
||||
vertical-align: middle;
|
||||
border-top: 1px solid #e5e5e5;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.um-admin-dash-item * {vertical-align: middle}
|
||||
|
||||
.um-admin-dash-col a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.um-admin-dash-thumb {
|
||||
display: inline-block;
|
||||
width: 30px;
|
||||
margin-right: 14px;
|
||||
}
|
||||
|
||||
.um-admin-dash-thumb a,
|
||||
.um-admin-dash-thumb img {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.um-admin-dash-info {
|
||||
display: inline-block;
|
||||
width: 130px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.um-admin-dash-meta {
|
||||
display: inline-block;
|
||||
width: 120px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.um-admin-dash-more {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/*
|
||||
- Colorful user status
|
||||
*/
|
||||
|
||||
.um-status-awaiting_admin_review {color: #C74A4A}
|
||||
.um-status-approved {color: #7ACF58}
|
||||
.um-status-inactive {color: #888}
|
||||
.um-status-rejected {color: #aaa}
|
||||
@@ -20,4 +20,8 @@ jQuery(document).ready(function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
if ( jQuery('.um-admin-dash-body').length && ( jQuery('.updated').length || jQuery('.error').length ) ) {
|
||||
jQuery('.updated,.error').prependTo('.um-admin-dash-body').show();
|
||||
}
|
||||
|
||||
});
|
||||
@@ -10,4 +10,28 @@
|
||||
|
||||
$ultimatemember->uninstall->remove_um();
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @various user actions
|
||||
***/
|
||||
add_action('um_admin_do_action__user_action', 'um_admin_do_action__user_action');
|
||||
function um_admin_do_action__user_action( $action ){
|
||||
global $ultimatemember;
|
||||
if ( !is_admin() || !current_user_can('manage_options') ) die();
|
||||
if ( !isset( $_REQUEST['sub'] ) ) die();
|
||||
if ( !isset($_REQUEST['user_id']) ) die();
|
||||
|
||||
um_fetch_user( $_REQUEST['user_id'] );
|
||||
|
||||
$subaction = $_REQUEST['sub'];
|
||||
|
||||
do_action("um_admin_user_action_hook", $subaction);
|
||||
do_action("um_admin_user_action_{$subaction}_hook");
|
||||
|
||||
um_reset_user();
|
||||
|
||||
wp_redirect( add_query_arg( 'update', 'user_updated', admin_url('?page=ultimatemember') ) );
|
||||
exit;
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ class UM_Admin_Notices {
|
||||
|
||||
function __construct() {
|
||||
|
||||
add_action('admin_notices', array(&$this, 'admin_notices'));
|
||||
add_action('admin_notices', array(&$this, 'admin_notices'), 10);
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
<?php
|
||||
|
||||
global $ultimatemember;
|
||||
|
||||
?>
|
||||
<?php global $ultimatemember; ?>
|
||||
|
||||
<div class="um-admin-dash-container">
|
||||
|
||||
@@ -21,7 +17,7 @@ global $ultimatemember;
|
||||
|
||||
<div class="um-admin-dash-nav">
|
||||
|
||||
<a href="#" class="active" data-rel="overview"><i class="um-icon-home-3"></i><span class="um-admin-dash-nav-title">Dashboard Overview</span></a>
|
||||
<a href="#" class="active" data-rel="overview"><i class="um-icon-home-6"></i><span class="um-admin-dash-nav-title">Dashboard Overview</span></a>
|
||||
<a href="#" data-rel="analytics"><i class="um-icon-analytics-chart-graph"></i><span class="um-admin-dash-nav-title">Analytics</span></a>
|
||||
|
||||
</div>
|
||||
@@ -30,12 +26,13 @@ global $ultimatemember;
|
||||
|
||||
<div class="um-admin-dash-content" id="overview">
|
||||
|
||||
<?php include_once um_path . 'admin/templates/dashboard/overview.php'; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-dash-content" id="analytics">
|
||||
|
||||
<h3>New Registrations over last 30 days</h3>
|
||||
<?php echo $ultimatemember->chart->create('data=new_users&x_label=Day&y_label=Daily Signups'); ?>
|
||||
<?php include_once um_path . 'admin/templates/dashboard/analytics.php'; ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<h3>New Registrations over last 30 days</h3>
|
||||
|
||||
<?php echo $ultimatemember->chart->create('data=new_users&x_label=Day&y_label=Daily Signups'); ?>
|
||||
@@ -0,0 +1,81 @@
|
||||
<div class="um-admin-dash-two-col">
|
||||
|
||||
<div class="um-admin-dash-col">
|
||||
|
||||
<h3>Latest 5 Users</h3>
|
||||
|
||||
<?php foreach( $ultimatemember->query->get_recent_users() as $user_id ) { um_fetch_user( $user_id ); ?>
|
||||
|
||||
<div class="um-admin-dash-item">
|
||||
|
||||
<div class="um-admin-dash-thumb">
|
||||
<a href="<?php echo um_user_profile_url(); ?>" target="_blank"><?php echo um_user('profile_photo', 30 ); ?></a>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-dash-info">
|
||||
<a href="<?php echo um_user_profile_url(); ?>" target="_blank"><?php echo um_user('display_name'); ?></a>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-dash-meta">
|
||||
<?php echo date( "j M Y", strtotime( um_user('user_registered') ) ); ?>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-dash-more um-status-<?php echo um_user('account_status'); ?>">
|
||||
<?php echo um_user('account_status_name'); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php um_reset_user(); } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-dash-col">
|
||||
|
||||
<?php $users = $ultimatemember->query->get_users_by_meta('awaiting_admin_review'); ?>
|
||||
<h3>Users Awaiting Review<span class="um-admin-dash-count red count-<?php echo um_notify('awaiting_admin_review'); ?>"><?php echo um_notify('awaiting_admin_review'); ?></span></h3>
|
||||
|
||||
<?php foreach( $users as $user_id ) { um_fetch_user( $user_id ); ?>
|
||||
|
||||
<div class="um-admin-dash-item">
|
||||
|
||||
<div class="um-admin-dash-thumb">
|
||||
<a href="<?php echo um_user_profile_url(); ?>" target="_blank"><?php echo um_user('profile_photo', 30 ); ?></a>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-dash-info">
|
||||
<a href="<?php echo um_user_profile_url(); ?>" target="_blank"><?php echo um_user('display_name'); ?></a>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-dash-meta">
|
||||
|
||||
<?php
|
||||
|
||||
if ( um_user('submitted') ) {
|
||||
|
||||
echo '<a href="#" class="um-admin-tipsy-n" data-modal="UM_preview_registration" data-modal-size="smaller" data-dynamic-content="um_admin_review_registration" data-arg1="'.$user_id.'" data-arg2="edit_registration" title="Review/update registration info">Review details</a>';
|
||||
|
||||
} else {
|
||||
|
||||
echo '<em>No information available</em>';
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-dash-more">
|
||||
<a href="<?php echo $ultimatemember->permalinks->admin_act_url('user_action','um_approve_membership'); ?>" class="ok">Approve</a> | <a href="<?php echo $ultimatemember->permalinks->admin_act_url('user_action','um_reject_membership'); ?>" class="red">Reject</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php um_reset_user(); } ?>
|
||||
|
||||
<?php if ( !$users ) { ?>
|
||||
<div class="um-admin-dash-item"><?php _e('No users are awaiting manual verification so far.','ultimatemember'); ?></div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -160,16 +160,7 @@
|
||||
|
||||
</span>
|
||||
</p><div class="um-admin-clear"></div>
|
||||
|
||||
<p>
|
||||
<label class="um-admin-half"><?php _e('Show stats section in the bottom','ultimatemember'); ?></label>
|
||||
<span class="um-admin-half">
|
||||
|
||||
<?php $this->ui_on_off('_um_show_stats', 0); ?>
|
||||
|
||||
</span>
|
||||
</p><div class="um-admin-clear"></div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
@@ -0,0 +1,460 @@
|
||||
<?php
|
||||
/**
|
||||
* Users administration panel.
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Administration
|
||||
*/
|
||||
|
||||
/** WordPress Administration Bootstrap */
|
||||
require_once( dirname( __FILE__ ) . '/admin.php' );
|
||||
|
||||
if ( ! current_user_can( 'list_users' ) )
|
||||
wp_die( __( 'Cheatin’ uh?' ), 403 );
|
||||
|
||||
$wp_list_table = _get_list_table('WP_Users_List_Table');
|
||||
$pagenum = $wp_list_table->get_pagenum();
|
||||
$title = __('Users');
|
||||
$parent_file = 'users.php';
|
||||
|
||||
add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
|
||||
|
||||
// contextual help - choose Help on the top right of admin panel to preview this.
|
||||
get_current_screen()->add_help_tab( array(
|
||||
'id' => 'overview',
|
||||
'title' => __('Overview'),
|
||||
'content' => '<p>' . __('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options in the dashboard navigation when they are logged in, based on their role.') . '</p>' .
|
||||
'<p>' . __('To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section.') . '</p>'
|
||||
) ) ;
|
||||
|
||||
get_current_screen()->add_help_tab( array(
|
||||
'id' => 'screen-display',
|
||||
'title' => __('Screen Display'),
|
||||
'content' => '<p>' . __('You can customize the display of this screen in a number of ways:') . '</p>' .
|
||||
'<ul>' .
|
||||
'<li>' . __('You can hide/display columns based on your needs and decide how many users to list per screen using the Screen Options tab.') . '</li>' .
|
||||
'<li>' . __('You can filter the list of users by User Role using the text links in the upper left to show All, Administrator, Editor, Author, Contributor, or Subscriber. The default view is to show all users. Unused User Roles are not listed.') . '</li>' .
|
||||
'<li>' . __('You can view all posts made by a user by clicking on the number under the Posts column.') . '</li>' .
|
||||
'</ul>'
|
||||
) );
|
||||
|
||||
$help = '<p>' . __('Hovering over a row in the users list will display action links that allow you to manage users. You can perform the following actions:') . '</p>' .
|
||||
'<ul>' .
|
||||
'<li>' . __('Edit takes you to the editable profile screen for that user. You can also reach that screen by clicking on the username.') . '</li>';
|
||||
|
||||
if ( is_multisite() )
|
||||
$help .= '<li>' . __( 'Remove allows you to remove a user from your site. It does not delete their content. You can also remove multiple users at once by using Bulk Actions.' ) . '</li>';
|
||||
else
|
||||
$help .= '<li>' . __( 'Delete brings you to the Delete Users screen for confirmation, where you can permanently remove a user from your site and delete their content. You can also delete multiple users at once by using Bulk Actions.' ) . '</li>';
|
||||
|
||||
$help .= '</ul>';
|
||||
|
||||
get_current_screen()->add_help_tab( array(
|
||||
'id' => 'actions',
|
||||
'title' => __('Actions'),
|
||||
'content' => $help,
|
||||
) );
|
||||
unset( $help );
|
||||
|
||||
get_current_screen()->set_help_sidebar(
|
||||
'<p><strong>' . __('For more information:') . '</strong></p>' .
|
||||
'<p>' . __('<a href="http://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>') . '</p>' .
|
||||
'<p>' . __('<a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>') . '</p>' .
|
||||
'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
|
||||
);
|
||||
|
||||
if ( empty($_REQUEST) ) {
|
||||
$referer = '<input type="hidden" name="wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
|
||||
} elseif ( isset($_REQUEST['wp_http_referer']) ) {
|
||||
$redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), wp_unslash( $_REQUEST['wp_http_referer'] ) );
|
||||
$referer = '<input type="hidden" name="wp_http_referer" value="' . esc_attr($redirect) . '" />';
|
||||
} else {
|
||||
$redirect = 'users.php';
|
||||
$referer = '';
|
||||
}
|
||||
|
||||
$update = '';
|
||||
|
||||
/**
|
||||
* @since 3.5.0
|
||||
* @access private
|
||||
*/
|
||||
function delete_users_add_js() { ?>
|
||||
<script>
|
||||
jQuery(document).ready( function($) {
|
||||
var submit = $('#submit').prop('disabled', true);
|
||||
$('input[name=delete_option]').one('change', function() {
|
||||
submit.prop('disabled', false);
|
||||
});
|
||||
$('#reassign_user').focus( function() {
|
||||
$('#delete_option1').prop('checked', true).trigger('change');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
switch ( $wp_list_table->current_action() ) {
|
||||
|
||||
/* Bulk Dropdown menu Role changes */
|
||||
case 'promote':
|
||||
check_admin_referer('bulk-users');
|
||||
|
||||
if ( ! current_user_can( 'promote_users' ) )
|
||||
wp_die( __( 'You can’t edit that user.' ) );
|
||||
|
||||
if ( empty($_REQUEST['users']) ) {
|
||||
wp_redirect($redirect);
|
||||
exit();
|
||||
}
|
||||
|
||||
$editable_roles = get_editable_roles();
|
||||
if ( empty( $editable_roles[$_REQUEST['new_role']] ) )
|
||||
wp_die(__('You can’t give users that role.'));
|
||||
|
||||
$userids = $_REQUEST['users'];
|
||||
$update = 'promote';
|
||||
foreach ( $userids as $id ) {
|
||||
$id = (int) $id;
|
||||
|
||||
if ( ! current_user_can('promote_user', $id) )
|
||||
wp_die(__('You can’t edit that user.'));
|
||||
// The new role of the current user must also have the promote_users cap or be a multisite super admin
|
||||
if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $_REQUEST['new_role'] ]->has_cap('promote_users')
|
||||
&& ! ( is_multisite() && is_super_admin() ) ) {
|
||||
$update = 'err_admin_role';
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the user doesn't already belong to the blog, bail.
|
||||
if ( is_multisite() && !is_user_member_of_blog( $id ) )
|
||||
wp_die( __( 'Cheatin’ uh?' ), 403 );
|
||||
|
||||
$user = get_userdata( $id );
|
||||
$user->set_role($_REQUEST['new_role']);
|
||||
}
|
||||
|
||||
wp_redirect(add_query_arg('update', $update, $redirect));
|
||||
exit();
|
||||
|
||||
case 'dodelete':
|
||||
if ( is_multisite() )
|
||||
wp_die( __('User deletion is not allowed from this screen.') );
|
||||
|
||||
check_admin_referer('delete-users');
|
||||
|
||||
if ( empty($_REQUEST['users']) ) {
|
||||
wp_redirect($redirect);
|
||||
exit();
|
||||
}
|
||||
|
||||
$userids = array_map( 'intval', (array) $_REQUEST['users'] );
|
||||
|
||||
if ( empty( $_REQUEST['delete_option'] ) ) {
|
||||
$url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) . '&error=true' );
|
||||
$url = str_replace( '&', '&', wp_nonce_url( $url, 'bulk-users' ) );
|
||||
wp_redirect( $url );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'delete_users' ) )
|
||||
wp_die(__('You can’t delete users.'));
|
||||
|
||||
$update = 'del';
|
||||
$delete_count = 0;
|
||||
|
||||
foreach ( $userids as $id ) {
|
||||
if ( ! current_user_can( 'delete_user', $id ) )
|
||||
wp_die(__( 'You can’t delete that user.' ) );
|
||||
|
||||
if ( $id == $current_user->ID ) {
|
||||
$update = 'err_admin_del';
|
||||
continue;
|
||||
}
|
||||
switch ( $_REQUEST['delete_option'] ) {
|
||||
case 'delete':
|
||||
wp_delete_user( $id );
|
||||
break;
|
||||
case 'reassign':
|
||||
wp_delete_user( $id, $_REQUEST['reassign_user'] );
|
||||
break;
|
||||
}
|
||||
++$delete_count;
|
||||
}
|
||||
|
||||
$redirect = add_query_arg( array('delete_count' => $delete_count, 'update' => $update), $redirect);
|
||||
wp_redirect($redirect);
|
||||
exit();
|
||||
|
||||
case 'delete':
|
||||
if ( is_multisite() )
|
||||
wp_die( __('User deletion is not allowed from this screen.') );
|
||||
|
||||
check_admin_referer('bulk-users');
|
||||
|
||||
if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
|
||||
wp_redirect($redirect);
|
||||
exit();
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'delete_users' ) )
|
||||
$errors = new WP_Error( 'edit_users', __( 'You can’t delete users.' ) );
|
||||
|
||||
if ( empty($_REQUEST['users']) )
|
||||
$userids = array( intval( $_REQUEST['user'] ) );
|
||||
else
|
||||
$userids = array_map( 'intval', (array) $_REQUEST['users'] );
|
||||
|
||||
add_action( 'admin_head', 'delete_users_add_js' );
|
||||
|
||||
include( ABSPATH . 'wp-admin/admin-header.php' );
|
||||
?>
|
||||
<form action="" method="post" name="updateusers" id="updateusers">
|
||||
<?php wp_nonce_field('delete-users') ?>
|
||||
<?php echo $referer; ?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Delete Users'); ?></h2>
|
||||
<?php if ( isset( $_REQUEST['error'] ) ) : ?>
|
||||
<div class="error">
|
||||
<p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<p><?php echo _n( 'You have specified this user for deletion:', 'You have specified these users for deletion:', count( $userids ) ); ?></p>
|
||||
<ul>
|
||||
<?php
|
||||
$go_delete = 0;
|
||||
foreach ( $userids as $id ) {
|
||||
$user = get_userdata( $id );
|
||||
if ( $id == $current_user->ID ) {
|
||||
echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n";
|
||||
} else {
|
||||
echo "<li><input type=\"hidden\" name=\"users[]\" value=\"" . esc_attr($id) . "\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
|
||||
$go_delete++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php if ( $go_delete ) : ?>
|
||||
<fieldset><p><legend><?php echo _n( 'What should be done with content owned by this user?', 'What should be done with content owned by these users?', $go_delete ); ?></legend></p>
|
||||
<ul style="list-style:none;">
|
||||
<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" />
|
||||
<?php _e('Delete all content.'); ?></label></li>
|
||||
<li><input type="radio" id="delete_option1" name="delete_option" value="reassign" />
|
||||
<?php echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> ';
|
||||
wp_dropdown_users( array( 'name' => 'reassign_user', 'exclude' => array_diff( $userids, array($current_user->ID) ) ) ); ?></li>
|
||||
</ul></fieldset>
|
||||
<?php
|
||||
/**
|
||||
* Fires at the end of the delete users form prior to the confirm button.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @param WP_User $current_user WP_User object for the user being deleted.
|
||||
*/
|
||||
do_action( 'delete_user_form', $current_user );
|
||||
?>
|
||||
<input type="hidden" name="action" value="dodelete" />
|
||||
<?php submit_button( __('Confirm Deletion'), 'secondary' ); ?>
|
||||
<?php else : ?>
|
||||
<p><?php _e('There are no valid users selected for deletion.'); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
break;
|
||||
|
||||
case 'doremove':
|
||||
check_admin_referer('remove-users');
|
||||
|
||||
if ( ! is_multisite() )
|
||||
wp_die( __( 'You can’t remove users.' ) );
|
||||
|
||||
if ( empty($_REQUEST['users']) ) {
|
||||
wp_redirect($redirect);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'remove_users' ) )
|
||||
wp_die( __( 'You can’t remove users.' ) );
|
||||
|
||||
$userids = $_REQUEST['users'];
|
||||
|
||||
$update = 'remove';
|
||||
foreach ( $userids as $id ) {
|
||||
$id = (int) $id;
|
||||
if ( $id == $current_user->ID && !is_super_admin() ) {
|
||||
$update = 'err_admin_remove';
|
||||
continue;
|
||||
}
|
||||
if ( !current_user_can('remove_user', $id) ) {
|
||||
$update = 'err_admin_remove';
|
||||
continue;
|
||||
}
|
||||
remove_user_from_blog($id, $blog_id);
|
||||
}
|
||||
|
||||
$redirect = add_query_arg( array('update' => $update), $redirect);
|
||||
wp_redirect($redirect);
|
||||
exit;
|
||||
|
||||
case 'remove':
|
||||
|
||||
check_admin_referer('bulk-users');
|
||||
|
||||
if ( ! is_multisite() )
|
||||
wp_die( __( 'You can’t remove users.' ) );
|
||||
|
||||
if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
|
||||
wp_redirect($redirect);
|
||||
exit();
|
||||
}
|
||||
|
||||
if ( !current_user_can('remove_users') )
|
||||
$error = new WP_Error('edit_users', __('You can’t remove users.'));
|
||||
|
||||
if ( empty($_REQUEST['users']) )
|
||||
$userids = array(intval($_REQUEST['user']));
|
||||
else
|
||||
$userids = $_REQUEST['users'];
|
||||
|
||||
include( ABSPATH . 'wp-admin/admin-header.php' );
|
||||
?>
|
||||
<form action="" method="post" name="updateusers" id="updateusers">
|
||||
<?php wp_nonce_field('remove-users') ?>
|
||||
<?php echo $referer; ?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Remove Users from Site'); ?></h2>
|
||||
<p><?php _e('You have specified these users for removal:'); ?></p>
|
||||
<ul>
|
||||
<?php
|
||||
$go_remove = false;
|
||||
foreach ( $userids as $id ) {
|
||||
$id = (int) $id;
|
||||
$user = get_userdata( $id );
|
||||
if ( $id == $current_user->ID && !is_super_admin() ) {
|
||||
echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n";
|
||||
} elseif ( !current_user_can('remove_user', $id) ) {
|
||||
echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>You don\'t have permission to remove this user.</strong>'), $id, $user->user_login) . "</li>\n";
|
||||
} else {
|
||||
echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
|
||||
$go_remove = true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php if ( $go_remove ) : ?>
|
||||
<input type="hidden" name="action" value="doremove" />
|
||||
<?php submit_button( __('Confirm Removal'), 'secondary' ); ?>
|
||||
<?php else : ?>
|
||||
<p><?php _e('There are no valid users selected for removal.'); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
if ( !empty($_GET['_wp_http_referer']) ) {
|
||||
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
$wp_list_table->prepare_items();
|
||||
$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
|
||||
if ( $pagenum > $total_pages && $total_pages > 0 ) {
|
||||
wp_redirect( add_query_arg( 'paged', $total_pages ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
include( ABSPATH . 'wp-admin/admin-header.php' );
|
||||
|
||||
$messages = array();
|
||||
if ( isset($_GET['update']) ) :
|
||||
switch($_GET['update']) {
|
||||
case 'del':
|
||||
case 'del_many':
|
||||
$delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0;
|
||||
$messages[] = '<div id="message" class="updated"><p>' . sprintf( _n( 'User deleted.', '%s users deleted.', $delete_count ), number_format_i18n( $delete_count ) ) . '</p></div>';
|
||||
break;
|
||||
case 'add':
|
||||
if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {
|
||||
$messages[] = '<div id="message" class="updated"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ),
|
||||
esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
|
||||
self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>';
|
||||
} else {
|
||||
$messages[] = '<div id="message" class="updated"><p>' . __( 'New user created.' ) . '</p></div>';
|
||||
}
|
||||
break;
|
||||
case 'promote':
|
||||
$messages[] = '<div id="message" class="updated"><p>' . __('Changed roles.') . '</p></div>';
|
||||
break;
|
||||
case 'err_admin_role':
|
||||
$messages[] = '<div id="message" class="error"><p>' . __('The current user’s role must have user editing capabilities.') . '</p></div>';
|
||||
$messages[] = '<div id="message" class="updated"><p>' . __('Other user roles have been changed.') . '</p></div>';
|
||||
break;
|
||||
case 'err_admin_del':
|
||||
$messages[] = '<div id="message" class="error"><p>' . __('You can’t delete the current user.') . '</p></div>';
|
||||
$messages[] = '<div id="message" class="updated"><p>' . __('Other users have been deleted.') . '</p></div>';
|
||||
break;
|
||||
case 'remove':
|
||||
$messages[] = '<div id="message" class="updated fade"><p>' . __('User removed from this site.') . '</p></div>';
|
||||
break;
|
||||
case 'err_admin_remove':
|
||||
$messages[] = '<div id="message" class="error"><p>' . __("You can't remove the current user.") . '</p></div>';
|
||||
$messages[] = '<div id="message" class="updated fade"><p>' . __('Other users have been removed.') . '</p></div>';
|
||||
break;
|
||||
}
|
||||
endif; ?>
|
||||
|
||||
<?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
|
||||
<div class="error">
|
||||
<ul>
|
||||
<?php
|
||||
foreach ( $errors->get_error_messages() as $err )
|
||||
echo "<li>$err</li>\n";
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif;
|
||||
|
||||
if ( ! empty($messages) ) {
|
||||
foreach ( $messages as $msg )
|
||||
echo $msg;
|
||||
} ?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2>
|
||||
<?php
|
||||
echo esc_html( $title );
|
||||
if ( current_user_can( 'create_users' ) ) { ?>
|
||||
<a href="user-new.php" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
|
||||
<?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?>
|
||||
<a href="user-new.php" class="add-new-h2"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
|
||||
<?php }
|
||||
|
||||
if ( $usersearch )
|
||||
printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( $usersearch ) ); ?>
|
||||
</h2>
|
||||
|
||||
<?php $wp_list_table->views(); ?>
|
||||
|
||||
<form action="" method="get">
|
||||
|
||||
<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
|
||||
|
||||
<?php $wp_list_table->display(); ?>
|
||||
</form>
|
||||
|
||||
<br class="clear" />
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
|
||||
} // end of the $doaction switch
|
||||
|
||||
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
||||
@@ -166,7 +166,7 @@
|
||||
}
|
||||
|
||||
.um-member-card {
|
||||
padding-bottom: 25px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.um-member-name {
|
||||
@@ -218,8 +218,8 @@
|
||||
|
||||
.um-member-meta {
|
||||
display: none;
|
||||
margin: 30px 30px 0 30px;
|
||||
padding: 20px 0 15px 0;
|
||||
margin: 20px 30px 0 30px;
|
||||
padding: 15px 0 15px 0;
|
||||
text-align: left;
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
@@ -229,27 +229,16 @@
|
||||
}
|
||||
|
||||
.um-member-metaline {
|
||||
font-size: 13px;
|
||||
font-size: 14px;
|
||||
color: #888;
|
||||
padding: 12px 0 0 0;
|
||||
line-height: 16px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.um-member-metaline i {
|
||||
vertical-align: middle;
|
||||
font-size: 16px;
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
width: 16px;
|
||||
margin-right: 20px;
|
||||
color: #666;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.um-member-metaline span {
|
||||
padding-left: 36px;
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -257,7 +246,7 @@
|
||||
*/
|
||||
|
||||
.um-member-connect {
|
||||
padding: 20px 0 0 0;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.um-member-connect a{
|
||||
@@ -282,41 +271,6 @@
|
||||
|
||||
.um-member-connect a:hover {opacity: 1}
|
||||
|
||||
/*
|
||||
- Member stats
|
||||
*/
|
||||
|
||||
.um-member-stats {
|
||||
border-top: 1px solid #eee;
|
||||
background: #fcfcfc;
|
||||
}
|
||||
|
||||
.um-member-stat {
|
||||
float: left;
|
||||
text-align: center;
|
||||
width: 33%;
|
||||
padding: 14px 10px;
|
||||
box-sizing: border-box;
|
||||
border-right: 1px solid #eee;
|
||||
text-transform: lowercase;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
font-weight: 700;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.um-member-stat a{color: #666;}
|
||||
.um-member-stat a:hover {color: #3ba1da}
|
||||
|
||||
.um-member-statname {
|
||||
display: block;
|
||||
letter-spacing: -1px;
|
||||
font-size: 15px;
|
||||
font-weight: 300;
|
||||
line-height: 18px;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
/*
|
||||
- Members pagination
|
||||
*/
|
||||
|
||||
+26
-1
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
.um-modal-overlay {
|
||||
background: rgba(0,0,0, 0.80);
|
||||
background: rgba(0,0,0, 0.85);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
@@ -25,6 +25,17 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
.um-modal-close {
|
||||
display: block;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 0;
|
||||
font-size: 24px;
|
||||
text-decoration: none !important;
|
||||
color: #fff !important;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
|
||||
.um-modal {
|
||||
border-radius: 3px;
|
||||
position: fixed;
|
||||
@@ -47,6 +58,20 @@
|
||||
border-radius: 0 0 3px 3px;
|
||||
}
|
||||
|
||||
.um-modal-body.photo {
|
||||
border-radius: 3px;
|
||||
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1), 0px 0px 0px 1px rgba(255, 255, 255, 0.12) inset;
|
||||
background: #888;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.um-modal-body.photo img {
|
||||
border-radius: 3px;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.um-modal.loading .um-modal-body {
|
||||
background: #fff url(../img/loading.gif) no-repeat center;
|
||||
min-height: 150px;
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
position: relative;
|
||||
padding: 0 0 25px 0;
|
||||
border-bottom: solid 2px #eee;
|
||||
min-height: 85px;
|
||||
}
|
||||
|
||||
.um-profile-edit {
|
||||
@@ -263,6 +264,7 @@
|
||||
.um-meta span {
|
||||
margin: 0 5px;
|
||||
font-size: 14px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.um-meta-text {
|
||||
|
||||
@@ -520,7 +520,7 @@ div.uimob960 .um-gutter-sizer {width: 4%}
|
||||
display: none;
|
||||
}
|
||||
|
||||
.um-modal {
|
||||
.um-modal.no-photo {
|
||||
width: 100% !important;
|
||||
margin: 0 !important;
|
||||
left: 0 !important;
|
||||
@@ -528,14 +528,14 @@ div.uimob960 .um-gutter-sizer {width: 4%}
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.um-modal,
|
||||
.um-modal .um-modal-body,
|
||||
.um-modal .um-modal-header {
|
||||
.um-modal.no-photo,
|
||||
.um-modal.no-photo .um-modal-body,
|
||||
.um-modal.no-photo .um-modal-header {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.um-modal .um-modal-header {text-align: center; font-size: 14px}
|
||||
.um-modal .um-modal-footer {
|
||||
.um-modal.no-photo .um-modal-header {text-align: center; font-size: 14px}
|
||||
.um-modal.no-photo .um-modal-footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
@@ -545,12 +545,12 @@ div.uimob960 .um-gutter-sizer {width: 4%}
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.um-modal .um-modal-right {
|
||||
.um-modal.no-photo .um-modal-right {
|
||||
width: 100%;
|
||||
float: none;
|
||||
}
|
||||
|
||||
.um-modal .um-modal-footer a.um-modal-btn {
|
||||
.um-modal.no-photo .um-modal-footer a.um-modal-btn {
|
||||
width: 48%;
|
||||
margin: 0 1%;
|
||||
float: left;
|
||||
@@ -563,7 +563,7 @@ div.uimob960 .um-gutter-sizer {width: 4%}
|
||||
|
||||
@media screen and (max-height: 300px) {
|
||||
|
||||
.um-modal-header {
|
||||
.um-modal.no-photo .um-modal-header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -330,6 +330,7 @@ p.um-notice.err {
|
||||
background: #fff;
|
||||
border-radius: 2px;
|
||||
box-sizing: border-box;
|
||||
min-height: 80px;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -560,6 +561,8 @@ a.um-link-alt:hover {text-decoration: underline !important;}
|
||||
div.um-photo {
|
||||
margin: 20px auto 0 auto;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
div.um-photo,
|
||||
@@ -575,6 +578,7 @@ div.um-photo a {
|
||||
display: inline-block;
|
||||
box-shadow: 0 1px 1px #eee;
|
||||
margin: 0 auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
div.um-photo img {max-height: 300px}
|
||||
div.um-photo img {max-height: 300px; max-width: 100%;}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB |
@@ -14,6 +14,20 @@ jQuery(document).ready(function() {
|
||||
UM_Member_Grid( jQuery(this) );
|
||||
});
|
||||
|
||||
/* Users with empty user meta */
|
||||
jQuery('.um-member-meta-main').each(function(){
|
||||
if ( jQuery(this).find('.um-member-metaline').length == 0 ) {
|
||||
jQuery(this).remove();
|
||||
}
|
||||
});
|
||||
|
||||
/* Users with empty user social */
|
||||
jQuery('.um-member-connect').each(function(){
|
||||
if ( jQuery(this).find('a').length == 0 ) {
|
||||
jQuery(this).remove();
|
||||
}
|
||||
});
|
||||
|
||||
/* load member's meta */
|
||||
jQuery(document).on('click', '.um-member-more a', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
+84
-17
@@ -85,40 +85,105 @@ function initCrop_UM() {
|
||||
|
||||
}
|
||||
|
||||
function um_new_modal( id, size ){
|
||||
function um_new_modal( id, size, isPhoto, source ){
|
||||
|
||||
var modal = jQuery('body').find('.um-modal-overlay');
|
||||
|
||||
if ( modal.length == 0 ) { // when new Modal is fired
|
||||
|
||||
jQuery('.tipsy').hide();
|
||||
|
||||
jQuery('.um-dropdown').hide();
|
||||
|
||||
jQuery('body,html').css("overflow", "hidden");
|
||||
jQuery('body,html,textarea').css("overflow", "hidden");
|
||||
|
||||
jQuery(document).bind("touchmove", function(e){e.preventDefault();});
|
||||
jQuery('.um-modal').on('touchmove', function(e){e.stopPropagation();});
|
||||
|
||||
jQuery('body').append('<div class="um-modal-overlay" /><div class="um-modal" />');
|
||||
|
||||
if ( isPhoto ) {
|
||||
jQuery('body').append('<div class="um-modal-overlay" /><div class="um-modal is-photo" />');
|
||||
} else {
|
||||
jQuery('body').append('<div class="um-modal-overlay" /><div class="um-modal no-photo" />');
|
||||
}
|
||||
|
||||
jQuery('#' + id).prependTo('.um-modal');
|
||||
jQuery('#' + id).show();
|
||||
jQuery('.um-modal').show();
|
||||
|
||||
um_modal_size( size );
|
||||
|
||||
initImageUpload_UM( jQuery('.um-modal:visible').find('.um-single-image-upload') );
|
||||
|
||||
initFileUpload_UM( jQuery('.um-modal:visible').find('.um-single-file-upload') );
|
||||
if ( isPhoto ) {
|
||||
|
||||
um_modal_responsive();
|
||||
jQuery('.um-modal').find('.um-modal-photo').html('<img />');
|
||||
|
||||
var photo_ = jQuery('.um-modal-photo img');
|
||||
var photo_maxw = jQuery(window).width() - 60;
|
||||
var photo_maxh = jQuery(window).height() - ( jQuery(window).height() * 0.25 );
|
||||
|
||||
photo_.attr("src", source);
|
||||
photo_.load(function(){
|
||||
|
||||
jQuery('#' + id).show();
|
||||
jQuery('.um-modal').show();
|
||||
|
||||
photo_.css({'opacity': 0});
|
||||
photo_.css({'max-width': photo_maxw });
|
||||
photo_.css({'max-height': photo_maxh });
|
||||
|
||||
jQuery('.um-modal').css({
|
||||
'width': photo_.width(),
|
||||
'margin-left': '-' + photo_.width() / 2 + 'px',
|
||||
});
|
||||
|
||||
photo_.animate({'opacity' : 1}, 1000);
|
||||
|
||||
um_modal_responsive();
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
jQuery('#' + id).show();
|
||||
jQuery('.um-modal').show();
|
||||
|
||||
um_modal_size( size );
|
||||
|
||||
initImageUpload_UM( jQuery('.um-modal:visible').find('.um-single-image-upload') );
|
||||
initFileUpload_UM( jQuery('.um-modal:visible').find('.um-single-file-upload') );
|
||||
|
||||
um_modal_responsive();
|
||||
|
||||
}
|
||||
|
||||
} // when new Modal is fired
|
||||
|
||||
}
|
||||
|
||||
function um_modal_responsive() {
|
||||
|
||||
var modal = jQuery('.um-modal:visible');
|
||||
var photo_modal = jQuery('.um-modal-body.photo:visible');
|
||||
|
||||
if ( photo_modal.length ) {
|
||||
|
||||
modal.removeClass('uimob340');
|
||||
modal.removeClass('uimob500');
|
||||
|
||||
var photo_ = jQuery('.um-modal-photo img');
|
||||
var photo_maxw = jQuery(window).width() - 60;
|
||||
var photo_maxh = jQuery(window).height() - ( jQuery(window).height() * 0.25 );
|
||||
|
||||
photo_.css({'opacity': 0});
|
||||
photo_.css({'max-width': photo_maxw });
|
||||
photo_.css({'max-height': photo_maxh });
|
||||
|
||||
jQuery('.um-modal').css({
|
||||
'width': photo_.width(),
|
||||
'margin-left': '-' + photo_.width() / 2 + 'px',
|
||||
});
|
||||
|
||||
photo_.animate({'opacity' : 1}, 1000);
|
||||
|
||||
if ( modal.length ) {
|
||||
var half_gap = ( jQuery(window).height() - modal.innerHeight() ) / 2 + 'px';
|
||||
modal.animate({ 'bottom' : half_gap }, 300);
|
||||
|
||||
} else if ( modal.length ) {
|
||||
|
||||
var element_width = jQuery(window).width();
|
||||
|
||||
@@ -164,7 +229,7 @@ function um_remove_modal(){
|
||||
|
||||
jQuery('.um-modal .um-single-image-preview img').cropper("destroy");
|
||||
|
||||
jQuery('body,html').css("overflow", "auto");
|
||||
jQuery('body,html,textarea').css("overflow", "auto");
|
||||
|
||||
jQuery(document).unbind('touchmove');
|
||||
|
||||
@@ -302,8 +367,7 @@ jQuery(document).ready(function() {
|
||||
}
|
||||
|
||||
if ( key == 'cover_photo') {
|
||||
jQuery('.um-cover-e').empty().html('<a href="#"><img src="' + data + "?"+d.getTime() + '" alt="" /></a>');
|
||||
jQuery('.um-cover-overlay').show();
|
||||
jQuery('.um-cover-e').empty().html('<img src="' + data + "?"+d.getTime() + '" alt="" />');
|
||||
}
|
||||
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').fadeIn().find('img').attr('src', data + "?"+d.getTime());
|
||||
@@ -343,6 +407,7 @@ jQuery(document).ready(function() {
|
||||
}
|
||||
|
||||
if ( jQuery(this).data('modal-copy') ) {
|
||||
|
||||
jQuery('#' + modal_id).html( jQuery(this).parents('.um-field').find('.um-modal-hidden-content').html() );
|
||||
|
||||
if ( jQuery(this).parents('.um-profile-photo').attr('data-user_id') ) {
|
||||
@@ -356,10 +421,12 @@ jQuery(document).ready(function() {
|
||||
if ( jQuery(this).parents('.um-cover').attr('data-user_id') ) {
|
||||
jQuery('#' + modal_id).attr('data-user_id', jQuery(this).parents('.um-cover').attr('data-user_id') );
|
||||
}
|
||||
um_new_modal( modal_id, size );
|
||||
|
||||
um_new_modal( modal_id, size );
|
||||
} else {
|
||||
|
||||
um_new_modal( modal_id, size );
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -10,11 +10,17 @@ jQuery(document).ready(function() {
|
||||
});
|
||||
|
||||
/* No need to allow # */
|
||||
jQuery(document).on('click', '.um-cover a', function(e){
|
||||
jQuery(document).on('click', '.um-cover a, .um-photo a', function(e){
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
/* built-in modal support for images */
|
||||
jQuery(document).on('click', '.um-photo-modal', function(e){
|
||||
var photo_src = jQuery(this).attr('data-src');
|
||||
um_new_modal('um_view_photo', 'fit', true, photo_src );
|
||||
});
|
||||
|
||||
/* Reset profile photo */
|
||||
jQuery(document).on('click', '.um-reset-profile-photo', function(e){
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
|
||||
/* dropdown menu links */
|
||||
jQuery(document).on('click', '.um-dropdown a', function(e){
|
||||
e.preventDefault();
|
||||
@@ -145,6 +145,7 @@ jQuery(document).ready(function() {
|
||||
jQuery(document).on('click', '.um .um-single-image-preview a.cancel', function(e){
|
||||
e.preventDefault();
|
||||
var parent = jQuery(this).parents('.um-field');
|
||||
parent.find('.um-single-image-preview img').attr('src','');
|
||||
parent.find('.um-single-image-preview').hide();
|
||||
parent.find('.um-btn-auto-width').html('Upload');
|
||||
parent.find('input[type=hidden]').val('');
|
||||
|
||||
+33
-1
@@ -47,7 +47,7 @@ class UM_Account {
|
||||
global $ultimatemember;
|
||||
|
||||
if ( um_is_core_page('account') && !is_user_logged_in() ) {
|
||||
exit( wp_redirect( home_url() ) );
|
||||
um_redirect_home();
|
||||
}
|
||||
|
||||
if ( um_is_core_page('account') ) {
|
||||
@@ -108,6 +108,38 @@ class UM_Account {
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @get tab output
|
||||
***/
|
||||
function get_tab_output( $id ) {
|
||||
global $ultimatemember;
|
||||
|
||||
switch( $id ) {
|
||||
case 'privacy' :
|
||||
$args = 'profile_privacy,show_in_members';
|
||||
break;
|
||||
case 'delete' :
|
||||
$args = 'single_user_password';
|
||||
break;
|
||||
case 'general' :
|
||||
$args = 'user_login,first_name,last_name,user_email';
|
||||
break;
|
||||
case 'password' :
|
||||
$args = 'user_password';
|
||||
break;
|
||||
default :
|
||||
$args = null;
|
||||
break;
|
||||
}
|
||||
|
||||
$fields = $ultimatemember->builtin->get_specific_fields( $args );
|
||||
$output = null;
|
||||
foreach( $fields as $key => $data ){
|
||||
$output .= $ultimatemember->fields->edit_field( $key, $data );
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Shortcode
|
||||
***/
|
||||
|
||||
+27
-21
@@ -25,7 +25,7 @@
|
||||
if ( !um_user('super_admin') ) {
|
||||
$ultimatemember->user->delete();
|
||||
if ( um_user('after_delete') == 'redirect_home' ) {
|
||||
exit( wp_redirect( home_url() ) );
|
||||
um_redirect_home();
|
||||
} else {
|
||||
exit( wp_redirect( um_user('delete_redirect_url') ) );
|
||||
}
|
||||
@@ -123,21 +123,22 @@
|
||||
function um_account_tab__delete( $info ) {
|
||||
global $ultimatemember;
|
||||
extract( $info );
|
||||
$fields = $ultimatemember->builtin->get_specific_fields('single_user_password'); ?>
|
||||
|
||||
$output = $ultimatemember->account->get_tab_output('delete');
|
||||
|
||||
if ( $output ) { ?>
|
||||
|
||||
<div class="um-account-heading uimob500-hide"><i class="<?php echo $icon; ?>"></i><?php echo $title; ?></div>
|
||||
|
||||
<?php echo wpautop( um_get_option('delete_account_text') ); ?>
|
||||
|
||||
<?php $output = null;
|
||||
foreach( $fields as $key => $data ) {
|
||||
$output .= $ultimatemember->fields->edit_field( $key, $data );
|
||||
}echo $output; ?>
|
||||
<?php echo $output; ?>
|
||||
|
||||
<div class="um-col-alt um-col-alt-b"><div class="um-left"><input type="submit" name="um_account_submit" id="um_account_submit" value="<?php _e('Delete Account'); ?>" class="um-button" /></div><div class="um-clear"></div></div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -147,19 +148,20 @@
|
||||
function um_account_tab__privacy( $info ) {
|
||||
global $ultimatemember;
|
||||
extract( $info );
|
||||
$fields = $ultimatemember->builtin->get_specific_fields('profile_privacy,show_in_members'); ?>
|
||||
|
||||
$output = $ultimatemember->account->get_tab_output('privacy');
|
||||
|
||||
if ( $output ) { ?>
|
||||
|
||||
<div class="um-account-heading uimob500-hide"><i class="<?php echo $icon; ?>"></i><?php echo $title; ?></div>
|
||||
|
||||
<?php $output = null;
|
||||
foreach( $fields as $key => $data ) {
|
||||
$output .= $ultimatemember->fields->edit_field( $key, $data );
|
||||
}echo $output; ?>
|
||||
<?php echo $output; ?>
|
||||
|
||||
<div class="um-col-alt um-col-alt-b"><div class="um-left"><input type="submit" name="um_account_submit" id="um_account_submit" value="Update Privacy" class="um-button" /></div><div class="um-clear"></div></div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -169,19 +171,20 @@
|
||||
function um_account_tab__general( $info ) {
|
||||
global $ultimatemember;
|
||||
extract( $info );
|
||||
$fields = $ultimatemember->builtin->get_specific_fields('user_login,first_name,last_name,user_email'); ?>
|
||||
|
||||
$output = $ultimatemember->account->get_tab_output('general');
|
||||
|
||||
if ( $output ) { ?>
|
||||
|
||||
<div class="um-account-heading uimob500-hide"><i class="<?php echo $icon; ?>"></i><?php echo $title; ?></div>
|
||||
|
||||
<?php $output = null;
|
||||
foreach( $fields as $key => $data ) {
|
||||
$output .= $ultimatemember->fields->edit_field( $key, $data );
|
||||
}echo $output; ?>
|
||||
<?php echo $output; ?>
|
||||
|
||||
<div class="um-col-alt um-col-alt-b"><div class="um-left"><input type="submit" name="um_account_submit" id="um_account_submit" value="Update Account" class="um-button" /></div><div class="um-clear"></div></div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -191,18 +194,21 @@
|
||||
function um_account_tab__password( $info ) {
|
||||
global $ultimatemember;
|
||||
extract( $info );
|
||||
$fields = $ultimatemember->builtin->get_specific_fields('user_password'); ?>
|
||||
extract( $info );
|
||||
|
||||
$output = $ultimatemember->account->get_tab_output('password');
|
||||
|
||||
if ( $output ) { ?>
|
||||
|
||||
<div class="um-account-heading uimob500-hide"><i class="<?php echo $icon; ?>"></i><?php echo $title; ?></div>
|
||||
|
||||
<?php $output = null;
|
||||
foreach( $fields as $key => $data ) {
|
||||
$output .= $ultimatemember->fields->edit_field( $key, $data );
|
||||
}echo $output; ?>
|
||||
<?php echo $output; ?>
|
||||
|
||||
<div class="um-col-alt um-col-alt-b"><div class="um-left"><input type="submit" name="um_account_submit" id="um_account_submit" value="Update Password" class="um-button" /></div><div class="um-clear"></div></div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
@@ -1,32 +1,5 @@
|
||||
<?php
|
||||
|
||||
/***
|
||||
*** @Customize WP logo in login screen
|
||||
***/
|
||||
function um_custom_wplogo() {
|
||||
$logo_url = um_url . 'admin/assets/img/logo_small.png';
|
||||
print "<style type='text/css'>
|
||||
h1 a { background-image:url($logo_url) !important; border-radius: 999px !important }
|
||||
</style>";
|
||||
}
|
||||
add_action('login_head', 'um_custom_wplogo', 999 );
|
||||
|
||||
/***
|
||||
*** @Customize WP logo url in login screen
|
||||
***/
|
||||
function um_custom_wplogo_url() {
|
||||
return home_url();
|
||||
}
|
||||
add_filter('login_headerurl', 'um_custom_wplogo_url', 999 );
|
||||
|
||||
/***
|
||||
*** @Customize WP logo title in login screen
|
||||
***/
|
||||
function um_custom_wplogo_title() {
|
||||
return get_option('blogname');
|
||||
}
|
||||
add_filter('login_headertitle', 'um_custom_wplogo_title', 999 );
|
||||
|
||||
/***
|
||||
*** @Error processing hook : login
|
||||
***/
|
||||
|
||||
+27
-41
@@ -221,11 +221,13 @@
|
||||
|
||||
<?php
|
||||
if ( $show_tagline && is_array( $tagline_fields ) ) {
|
||||
foreach( $tagline_fields as $tagline_field ) {
|
||||
if ( $tagline_field && um_user( $tagline_field ) ) {
|
||||
foreach( $tagline_fields as $key ) {
|
||||
if ( $key && um_user( $key ) ) {
|
||||
$value = um_filtered_value( $key );
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-member-tagline"><?php echo um_user( $tagline_field ); ?></div>
|
||||
<div class="um-member-tagline"><?php echo $value; ?></div>
|
||||
|
||||
<?php
|
||||
}
|
||||
@@ -237,35 +239,28 @@
|
||||
|
||||
<div class="um-member-meta-main">
|
||||
|
||||
<?php if ( $userinfo_animate ) { ?>
|
||||
<div class="um-member-more"><a href="#"><i class="um-icon-chevron-down-1"></i></a></div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="um-member-meta <?php if ( !$userinfo_animate ) { echo 'no-animate'; } ?>">
|
||||
|
||||
<?php foreach( $reveal_fields as $key ) {
|
||||
if ( $key && um_user( $key ) ) {
|
||||
|
||||
$value = um_user( $key );
|
||||
$data = $ultimatemember->builtin->get_specific_field( $key );
|
||||
$type = (isset($data['type']))?$data['type']:'';
|
||||
|
||||
$value = apply_filters("um_profile_field_filter_hook__", $value, $data );
|
||||
$value = apply_filters("um_profile_field_filter_hook__{$key}", $value, $data );
|
||||
$value = apply_filters("um_profile_field_filter_hook__{$type}", $value, $data );
|
||||
|
||||
?>
|
||||
<?php if ( $userinfo_animate ) { ?>
|
||||
<div class="um-member-more"><a href="#"><i class="um-icon-chevron-down-1"></i></a></div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="um-member-metaline"><i class="<?php echo $ultimatemember->fields->get_field_icon( $key ); ?>"></i><span><?php echo $value; ?></span></div>
|
||||
<div class="um-member-meta <?php if ( !$userinfo_animate ) { echo 'no-animate'; } ?>">
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php foreach( $reveal_fields as $key ) {
|
||||
if ( $key && um_user( $key ) ) {
|
||||
$value = um_filtered_value( $key );
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-member-metaline"><span><?php echo $value; ?></span></div>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-member-less"><a href="#"><i class="um-icon-chevron-up-1"></i></a></div>
|
||||
<div class="um-member-less"><a href="#"><i class="um-icon-chevron-up-1"></i></a></div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -273,23 +268,14 @@
|
||||
|
||||
<?php if ( $show_social ) { ?>
|
||||
<div class="um-member-connect">
|
||||
<a href="#" style="background: #3B5999;"><i class="um-icon-facebook-2"></i></a>
|
||||
<a href="#" style="background: #4099FF;"><i class="um-icon-twitter"></i></a>
|
||||
<a href="#" style="background: #dd4b39;"><i class="um-icon-google-plus"></i></a>
|
||||
|
||||
<?php $ultimatemember->fields->show_social_urls(); ?>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ( $show_stats ) { ?>
|
||||
<div class="um-member-stats">
|
||||
<div class="um-member-stat"><a href="#">0<span class="um-member-statname">Views</span></a></div>
|
||||
<div class="um-member-stat"><a href="#"><?php echo (int) um_user('post_count'); ?><span class="um-member-statname">Posts</span></a></div>
|
||||
<div class="um-member-stat" style="border-right:0"><a href="#"><?php echo (int) um_user('comment_count'); ?><span class="um-member-statname">Comments</span></a></div>
|
||||
<div class="um-clear"></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -64,11 +64,13 @@
|
||||
|
||||
<?php
|
||||
|
||||
if ( $ultimatemember->fields->editing ) {
|
||||
echo $ultimatemember->menu->new_ui( 'bc', 'div.um-cover', 'click', array(
|
||||
'<a href="#" class="um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width">'.__('Change cover photo','ultimatemember').'</a>',
|
||||
'<a href="#" class="um-reset-cover-photo" data-user_id="'.um_profile_id().'">'.__('Remove','ultimatemember').'</a>',
|
||||
'<a href="#" class="um-dropdown-hide">'.__('Cancel','ultimatemember').'</a>',
|
||||
), 'can_edit_user' );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -186,8 +188,16 @@
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( um_user('description') && $args['show_bio'] ) { ?>
|
||||
<?php if ( $ultimatemember->fields->viewing == true && um_user('description') && $args['show_bio'] ) { ?>
|
||||
|
||||
<div class="um-meta-text"><?php echo um_user('description'); ?></div>
|
||||
|
||||
<?php } else if ( $ultimatemember->fields->editing == true && $args['show_bio'] ) { ?>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div><div class="um-clear"></div>
|
||||
@@ -209,11 +219,11 @@
|
||||
$ultimatemember->fields->viewing = 1;
|
||||
|
||||
if ( um_get_requested_user() ) {
|
||||
if ( !um_can_view_profile( um_get_requested_user() ) ) exit( wp_redirect( home_url() ) );
|
||||
if ( !um_can_view_profile( um_get_requested_user() ) ) um_redirect_home();
|
||||
if ( !um_can_edit_profile( um_get_requested_user() ) ) $ultimatemember->user->cannot_edit = 1;
|
||||
um_fetch_user( um_get_requested_user() );
|
||||
} else {
|
||||
if ( !is_user_logged_in() ) exit( wp_redirect( home_url() ) );
|
||||
if ( !is_user_logged_in() ) um_redirect_home();
|
||||
if ( !um_user('can_edit_profile') ) $ultimatemember->user->cannot_edit = 1;
|
||||
}
|
||||
|
||||
@@ -223,7 +233,7 @@
|
||||
$ultimatemember->fields->editing = 1;
|
||||
|
||||
if ( um_get_requested_user() ) {
|
||||
if ( !um_can_edit_profile( um_get_requested_user() ) ) exit( wp_redirect( home_url() ) );
|
||||
if ( !um_can_edit_profile( um_get_requested_user() ) ) um_redirect_home();
|
||||
um_fetch_user( um_get_requested_user() );
|
||||
}
|
||||
|
||||
@@ -277,6 +287,7 @@
|
||||
|
||||
do_action('um_user_before_updating_profile', $userinfo );
|
||||
|
||||
// loop through fields
|
||||
foreach( $fields as $key => $array ) {
|
||||
|
||||
if ( $fields[$key]['type'] == 'multiselect' || $fields[$key]['type'] == 'checkbox' && !isset($args['submitted'][$key]) ) {
|
||||
@@ -298,6 +309,10 @@
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $args['submitted']['description'] ) ) {
|
||||
$to_update['description'] = $args['submitted']['description'];
|
||||
}
|
||||
|
||||
if ( is_array( $to_update ) ) {
|
||||
$ultimatemember->user->update_profile( $to_update );
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
function um_block_wpadmin_by_user_role(){
|
||||
global $ultimatemember;
|
||||
if( is_admin() && !defined('DOING_AJAX') && um_user('ID') && !um_user('can_access_wpadmin')){
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
um_redirect_home();
|
||||
}
|
||||
}
|
||||
add_action('init','um_block_wpadmin_by_user_role', 99);
|
||||
|
||||
+22
-5
@@ -584,9 +584,12 @@ class UM_Builtin {
|
||||
'editable' => 1,
|
||||
'url_target' => '_blank',
|
||||
'url_rel' => 'nofollow',
|
||||
'icon' => 'um-icon-facebook-alt',
|
||||
'icon' => 'um-icon-facebook-2',
|
||||
'validate' => 'facebook_url',
|
||||
'url_text' => 'Facebook',
|
||||
'advanced' => 'social',
|
||||
'color' => '#3B5999',
|
||||
'match' => 'https://facebook.com/',
|
||||
),
|
||||
|
||||
'twitter' => array(
|
||||
@@ -602,6 +605,9 @@ class UM_Builtin {
|
||||
'icon' => 'um-icon-twitter',
|
||||
'validate' => 'twitter_url',
|
||||
'url_text' => 'Twitter',
|
||||
'advanced' => 'social',
|
||||
'color' => '#4099FF',
|
||||
'match' => 'https://twitter.com/',
|
||||
),
|
||||
|
||||
'linkedin' => array(
|
||||
@@ -617,6 +623,9 @@ class UM_Builtin {
|
||||
'icon' => 'um-icon-linkedin-alt-1',
|
||||
'validate' => 'linkedin_url',
|
||||
'url_text' => 'LinkedIn',
|
||||
'advanced' => 'social',
|
||||
'color' => '#0976b4',
|
||||
'match' => 'https://linkedin.com/in/',
|
||||
),
|
||||
|
||||
'googleplus' => array(
|
||||
@@ -632,6 +641,9 @@ class UM_Builtin {
|
||||
'icon' => 'um-icon-google-plus',
|
||||
'validate' => 'google_url',
|
||||
'url_text' => 'Google+',
|
||||
'advanced' => 'social',
|
||||
'color' => '#dd4b39',
|
||||
'match' => 'https://google.com/+',
|
||||
),
|
||||
|
||||
'instagram' => array(
|
||||
@@ -647,6 +659,9 @@ class UM_Builtin {
|
||||
'icon' => 'um-icon-instagrem',
|
||||
'validate' => 'instagram_url',
|
||||
'url_text' => 'Instagram',
|
||||
'advanced' => 'social',
|
||||
'color' => '#3f729b',
|
||||
'match' => 'https://instagram.com/',
|
||||
),
|
||||
|
||||
'skype' => array(
|
||||
@@ -781,24 +796,26 @@ class UM_Builtin {
|
||||
'required' => 0,
|
||||
'public' => 1,
|
||||
'editable' => 1,
|
||||
'default' => 'Everyone',
|
||||
'default' => __('Everyone'),
|
||||
'options' => array( __('Everyone'), __('Only me') ),
|
||||
'allowclear' => 0,
|
||||
'account_only' => true,
|
||||
'required_perm' => 'can_make_private_profile',
|
||||
),
|
||||
|
||||
'show_in_members' => array(
|
||||
'title' => 'Show me in the Directory',
|
||||
'title' => __('Show me in the Directory','ultimatemember'),
|
||||
'metakey' => 'show_in_members',
|
||||
'type' => 'radio',
|
||||
'label' => 'Show me in the Directory',
|
||||
'help' => 'Choose whether you want to appear in public member directories or not',
|
||||
'label' => __('Show me in the Directory','ultimatemember'),
|
||||
'help' => __('Choose whether you want to appear in public member directories or not','ultimatemember'),
|
||||
'required' => 0,
|
||||
'public' => 1,
|
||||
'editable' => 1,
|
||||
'default' => 'Yes',
|
||||
'options' => array('Yes','No'),
|
||||
'account_only' => true,
|
||||
'required_opt' => array( 'members_page', 1 ),
|
||||
),
|
||||
|
||||
'delete_account' => array(
|
||||
|
||||
+38
-6
@@ -11,6 +11,27 @@ class UM_Fields {
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @show user social links
|
||||
***/
|
||||
function show_social_urls(){
|
||||
global $ultimatemember;
|
||||
$fields = $ultimatemember->builtin->all_user_fields;
|
||||
foreach( $fields as $field => $args ) {
|
||||
if ( isset( $args['advanced'] ) && $args['advanced'] == 'social' ) {
|
||||
$social[$field] = $args;
|
||||
}
|
||||
}
|
||||
foreach( $social as $k => $arr ) {
|
||||
if ( um_profile( $k ) ) { ?>
|
||||
|
||||
<a href="<?php echo um_filtered_social_link( $k , $arr['match'] ); ?>" style="background: <?php echo $arr['color']; ?>;" target="_blank"><i class="<?php echo $arr['icon']; ?>"></i></a>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
*** @hidden fields inside shortcode
|
||||
***/
|
||||
@@ -341,11 +362,7 @@ class UM_Fields {
|
||||
|
||||
} else if ( um_user( $key ) && $this->viewing == true ) {
|
||||
|
||||
$value = um_user( $key );
|
||||
$value = apply_filters("um_profile_field_filter_hook__", $value, $data );
|
||||
$value = apply_filters("um_profile_field_filter_hook__{$key}", $value, $data );
|
||||
$value = apply_filters("um_profile_field_filter_hook__{$type}", $value, $data );
|
||||
|
||||
$value = um_filtered_value( $key, $data );
|
||||
return $value;
|
||||
|
||||
} else if ($default) {
|
||||
@@ -473,7 +490,7 @@ class UM_Fields {
|
||||
$fields = $ultimatemember->builtin->all_user_fields;
|
||||
if ( isset( $fields[$key]['icon'] ) )
|
||||
return $fields[$key]['icon'];
|
||||
return 'um-icon-user';
|
||||
return '';
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -756,6 +773,21 @@ class UM_Fields {
|
||||
|
||||
if ( !um_can_view_field( $data ) ) return;
|
||||
if ( !um_can_edit_field( $data ) ) return;
|
||||
|
||||
if ( isset( $data['required_opt'] ) ) {
|
||||
$opt = $data['required_opt'];
|
||||
if ( um_get_option( $opt[0] ) != $opt[1] ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $data['required_perm'] ) ) {
|
||||
if ( !um_user( $data['required_perm'] ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Begin by field type */
|
||||
|
||||
switch( $type ) {
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
|
||||
foreach ($tabs as $k => $arr ) {
|
||||
foreach( $arr as $id => $info ) {
|
||||
if ( $id == 'delete' ) {
|
||||
if ( !um_user('can_delete_profile') && !um_user('can_delete_everyone') ) {
|
||||
unset( $tabs[$k][$id] );
|
||||
}
|
||||
|
||||
$output = $ultimatemember->account->get_tab_output( $id );
|
||||
if ( !$output ) {
|
||||
unset( $tabs[$k][$id] );
|
||||
}
|
||||
|
||||
if ( $id == 'privacy' ) {
|
||||
if ( !um_user('can_make_private_profile') ) {
|
||||
if ( $id == 'delete' ) {
|
||||
if ( !um_user('can_delete_profile') && !um_user('can_delete_everyone') ) {
|
||||
unset( $tabs[$k][$id] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
if ( !file_exists( um_user_uploads_dir() . $value ) ) {
|
||||
$value = __('Image has been removed.');
|
||||
} else {
|
||||
$value = '<div class="um-photo"><a href="#"><img src="'. $uri .'" alt="'.$title.'" title="'.$title.'" class="" /></a></div>';
|
||||
$value = '<div class="um-photo"><a href="#" class="um-photo-modal" data-src="'.$uri.'"><img src="'. $uri .'" alt="'.$title.'" title="'.$title.'" class="" /></a></div>';
|
||||
}
|
||||
|
||||
return $value;
|
||||
@@ -120,7 +120,7 @@
|
||||
$mode = (isset( $ultimatemember->fields->set_mode ) ) ? $ultimatemember->fields->set_mode : null;
|
||||
|
||||
if ( $form_id && $mode ) {
|
||||
$array = $ultimatemember->query->get_attr('custom_fields', $form_id );
|
||||
$array = $ultimatemember->query->get_attr('custom_fields', $form_id );
|
||||
} else {
|
||||
$array = '';
|
||||
}
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ class UM_Logout {
|
||||
exit( wp_redirect( $redirect_to ) );
|
||||
|
||||
} else {
|
||||
exit( wp_redirect( home_url() ) );
|
||||
um_redirect_home();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,19 @@ class UM_Members {
|
||||
|
||||
add_filter('pre_user_query', array(&$this, 'custom_order_query') );
|
||||
|
||||
add_action('template_redirect', array(&$this, 'access_members'), 555);
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Members page allowed?
|
||||
***/
|
||||
function access_members() {
|
||||
|
||||
if ( um_get_option('members_page') == 0 && um_is_core_page('members') ) {
|
||||
um_redirect_home();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
@@ -153,5 +153,16 @@ class UM_Permalinks {
|
||||
|
||||
return $profile_url;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @get action url for admin use
|
||||
***/
|
||||
function admin_act_url( $action, $subaction ) {
|
||||
$url = $this->get_current_url();
|
||||
$url = add_query_arg( 'um_adm_action', $action, $url );
|
||||
$url = add_query_arg( 'sub', $subaction, $url );
|
||||
$url = add_query_arg( 'user_id', um_user('ID'), $url );
|
||||
return $url;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-7
@@ -14,13 +14,7 @@ class UM_Profile {
|
||||
$data = '';
|
||||
if ( $key && um_user( $key ) ) {
|
||||
|
||||
$value = um_user( $key );
|
||||
$data = $ultimatemember->builtin->get_specific_field( $key );
|
||||
$type = (isset($data['type']))?$data['type']:'';
|
||||
|
||||
$value = apply_filters("um_profile_field_filter_hook__", $value, $data );
|
||||
$value = apply_filters("um_profile_field_filter_hook__{$key}", $value, $data );
|
||||
$value = apply_filters("um_profile_field_filter_hook__{$type}", $value, $data );
|
||||
$value = um_filtered_value( $key );
|
||||
|
||||
$items[] = '<span>' . $value . '</span>';
|
||||
$items[] = '<span class="b">•</span>';
|
||||
|
||||
@@ -6,6 +6,38 @@ class UM_Query {
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Get last users
|
||||
***/
|
||||
function get_recent_users($number = 5){
|
||||
global $wpdb;
|
||||
|
||||
$args = array( 'fields' => 'ID', 'number' => $number, 'orderby' => 'user_registered', 'order' => 'desc' );
|
||||
|
||||
$users = new WP_User_Query( $args );
|
||||
return $users->results;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Get users by meta
|
||||
***/
|
||||
function get_users_by_meta($rule, $number = 5){
|
||||
global $wpdb;
|
||||
|
||||
$args = array( 'fields' => 'ID', 'number' => $number, 'orderby' => 'user_registered', 'order' => 'desc' );
|
||||
|
||||
$args['meta_query'][] = array(
|
||||
array(
|
||||
'key' => 'account_status',
|
||||
'value' => $rule,
|
||||
'compare' => '='
|
||||
)
|
||||
);
|
||||
|
||||
$users = new WP_User_Query( $args );
|
||||
return $users->results;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @get user's role
|
||||
***/
|
||||
|
||||
@@ -34,7 +34,6 @@ class UM_Setup {
|
||||
'_um_template' => 'members',
|
||||
'_um_mode' => 'directory',
|
||||
'_um_has_profile_photo' => 0,
|
||||
'_um_show_stats' => 0,
|
||||
'_um_show_social' => 0,
|
||||
'_um_show_userinfo' => 0,
|
||||
'_um_show_tagline' => 0,
|
||||
|
||||
@@ -1,5 +1,56 @@
|
||||
<?php
|
||||
|
||||
/***
|
||||
*** @Exit and redirect to home
|
||||
***/
|
||||
function um_redirect_home() {
|
||||
exit( wp_redirect( home_url() ) );
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Show filtered social link
|
||||
***/
|
||||
function um_filtered_social_link( $key, $match ) {
|
||||
$value = um_profile( $key );
|
||||
$submatch = str_replace( 'https://', '', $match );
|
||||
$submatch = str_replace( 'http://', '', $submatch );
|
||||
if ( strstr( $value, $submatch ) ) {
|
||||
$value = 'https://' . $value;
|
||||
} else if ( strpos($value, 'http') !== 0 ) {
|
||||
$value = $match . $value;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Get filtered meta value after applying hooks
|
||||
***/
|
||||
function um_filtered_value( $key, $data = false ) {
|
||||
global $ultimatemember;
|
||||
$value = um_user( $key );
|
||||
|
||||
if ( !$data ){
|
||||
$data = $ultimatemember->builtin->get_specific_field( $key );
|
||||
}
|
||||
|
||||
$type = (isset($data['type']))?$data['type']:'';
|
||||
|
||||
$value = apply_filters("um_profile_field_filter_hook__", $value, $data );
|
||||
$value = apply_filters("um_profile_field_filter_hook__{$key}", $value, $data );
|
||||
$value = apply_filters("um_profile_field_filter_hook__{$type}", $value, $data );
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Get number of pending notifications for a meta
|
||||
***/
|
||||
function um_notify( $rule ) {
|
||||
global $ultimatemember;
|
||||
$results = $ultimatemember->query->get_users_by_meta( $rule, 100 );
|
||||
return count($results);
|
||||
}
|
||||
|
||||
/***
|
||||
*** @profile user ID
|
||||
***/
|
||||
@@ -524,7 +575,7 @@
|
||||
$uri = um_get_option('default_avatar');
|
||||
$uri = $uri['url'];
|
||||
if ( !$uri )
|
||||
$uri = um_url . 'assets/img/default_avatar.png';
|
||||
$uri = um_url . 'assets/img/default_avatar.jpg';
|
||||
return $uri;
|
||||
}
|
||||
|
||||
@@ -671,7 +722,7 @@
|
||||
case 'cover_photo':
|
||||
if ( um_profile('cover_photo') ) {
|
||||
$cover_uri = um_get_cover_uri( um_profile('cover_photo'), $attrs );
|
||||
return '<a href="#"><img src="'. $cover_uri .'" alt="" /></a>';
|
||||
return '<img src="'. $cover_uri .'" alt="" />';
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
+6
-3
@@ -196,14 +196,17 @@ class UM_User {
|
||||
/***
|
||||
*** @Set user's account status
|
||||
***/
|
||||
function set_status( $status, $email_tpl = false ){
|
||||
function set_status( $status ){
|
||||
|
||||
do_action('um_before_user_status_is_changed');
|
||||
$old_status = ( isset( $this->profile['account_status'] ) ) ? $this->profile['account_status'] : 'null';
|
||||
|
||||
do_action('um_before_user_status_is_changed', $old_status );
|
||||
|
||||
$this->profile['account_status'] = $status;
|
||||
|
||||
$this->update_usermeta_info('account_status');
|
||||
|
||||
do_action('um_after_user_status_is_changed');
|
||||
do_action('um_after_user_status_is_changed', $status);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+458
-226
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
<div id="um_view_photo" style="display:none">
|
||||
|
||||
<a href="#" data-action="um_remove_modal" class="um-modal-close"><i class="um-icon-remove-delete-two"></i></a>
|
||||
|
||||
<div class="um-modal-body photo">
|
||||
|
||||
<div class="um-modal-photo">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
+11
-1
@@ -173,12 +173,21 @@ $this->sections[] = array(
|
||||
'title' => __( 'Members Directory'),
|
||||
'fields' => array(
|
||||
|
||||
array(
|
||||
'id' => 'members_page',
|
||||
'type' => 'switch',
|
||||
'title' => __( 'Members page status' ),
|
||||
'default' => 1,
|
||||
'desc' => 'Control whether to enable or disable the core Members directory page',
|
||||
),
|
||||
|
||||
array(
|
||||
'id' => 'directory_header',
|
||||
'type' => 'text',
|
||||
'title' => __( 'General Results Text' ),
|
||||
'default' => um_get_metadefault('directory_header'),
|
||||
'desc' => __('Customize the search result text . e.g. Found 3,000 Members. Leave this blank to not show result text','ultimatemember'),
|
||||
'required' => array( 'members_page', '=', '1' ),
|
||||
),
|
||||
|
||||
array(
|
||||
@@ -187,6 +196,7 @@ $this->sections[] = array(
|
||||
'title' => __( 'Custom text If no users were found' ),
|
||||
'default' => um_get_metadefault('directory_no_users'),
|
||||
'desc' => __('This is the text that is displayed if no users are found during a search','ultimatemember'),
|
||||
'required' => array( 'members_page', '=', '1' ),
|
||||
),
|
||||
|
||||
)
|
||||
@@ -872,7 +882,7 @@ $this->sections[] = array(
|
||||
'title' => __('Default Profile Picture', 'ultimatemember'),
|
||||
'desc' => __('You can change the default profile picture globally here. Please make sure photo is 300x300px.', 'ultimatemember'),
|
||||
'default' => array(
|
||||
'url' => um_url . 'assets/img/default_avatar.png',
|
||||
'url' => um_url . 'assets/img/default_avatar.jpg',
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user