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
# Conflicts: # core/um-short-functions.php
This commit is contained in:
@@ -17,9 +17,6 @@
|
||||
.um-admin.post-type-um_role .manage-column.column-count {width: 150px}
|
||||
.um-admin.post-type-um_role .manage-column.column-core {width: 150px}
|
||||
|
||||
.um-admin.users-php .tablenav.top .bulkactions,
|
||||
.um-admin.users-php .tablenav.bottom .bulkactions{display:none}
|
||||
|
||||
.um-admin.post-type-um_form td.column-shortcode,
|
||||
.um-admin.post-type-um_form td.column-id,
|
||||
.um-admin.post-type-um_directory td.column-shortcode,
|
||||
|
||||
@@ -127,8 +127,12 @@ body.um-admin-modal-open {
|
||||
color: #aaa !important;
|
||||
}
|
||||
|
||||
.um-admin-metabox input[type=text] {
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.um-admin-metabox input[type=text],
|
||||
.um-admin-metabox textarea{
|
||||
.um-admin-metabox textarea {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
@@ -139,13 +143,17 @@ body.um-admin-modal-open {
|
||||
outline: none !important;
|
||||
box-sizing: border-box !important;
|
||||
box-shadow: none !important;
|
||||
|
||||
font-size: 13px !important;
|
||||
height: auto !important;
|
||||
line-height: 1.4em !important;
|
||||
padding: 4px 10px !important;
|
||||
}
|
||||
|
||||
.um-admin-metabox textarea {
|
||||
padding: 8px !important;
|
||||
line-height: 1.6em;
|
||||
color: #888 !important;
|
||||
}
|
||||
|
||||
.um-admin-metabox input[type=text].um-admin-error,
|
||||
.um-admin-metabox textarea.um-admin-error
|
||||
{border-color: #C74A4A!important}
|
||||
|
||||
@@ -1,18 +1,3 @@
|
||||
body.um-admin .actions,
|
||||
body.um-admin .bulkactions {
|
||||
float: left;
|
||||
margin: 0!important;
|
||||
padding:0!important;
|
||||
top: 0!important;
|
||||
}
|
||||
|
||||
body.um-admin .actions .button {
|
||||
height: 29px !important;
|
||||
margin: 0 12px 0 0 !important;
|
||||
display: inline !important;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
body.um-admin .select2-container {margin-right: 2px!important;}
|
||||
|
||||
body.um-admin .select2-drop,
|
||||
|
||||
@@ -81,12 +81,6 @@ jQuery(document).ready(function() {
|
||||
minimumResultsForSearch: 10
|
||||
});
|
||||
|
||||
jQuery("body.um-admin .actions select:not('.umaf-selectjs')").select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: 10,
|
||||
width: '160px'
|
||||
});
|
||||
|
||||
/**
|
||||
Tooltips
|
||||
**/
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
if ( !isset( $array['account_only'] ) && !isset( $array['private_use'] ) ) {
|
||||
?>
|
||||
|
||||
<a href="#" class="button" data-silent_action="um_admin_add_field_from_predefined" data-arg1="<?php echo $field_key; ?>" data-arg2="<?php echo $arg2; ?>"><?php echo stripslashes( $array['title'] ); ?></a>
|
||||
<a href="#" class="button" data-silent_action="um_admin_add_field_from_predefined" data-arg1="<?php echo $field_key; ?>" data-arg2="<?php echo $arg2; ?>"><?php echo um_trim_string( stripslashes( $array['title'] ), 20 ); ?></a>
|
||||
|
||||
<?php } } } else { echo '<p>' . __('None','ultimatemember') . '</p>'; } ?>
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
|
||||
?>
|
||||
|
||||
<a href="#" class="button with-icon" data-silent_action="um_admin_add_field_from_list" data-arg1="<?php echo $field_key; ?>" data-arg2="<?php echo $arg2; ?>"><?php echo stripslashes( $array['title'] ); ?><span class="remove"></span></a>
|
||||
<a href="#" class="button with-icon" data-silent_action="um_admin_add_field_from_list" data-arg1="<?php echo $field_key; ?>" data-arg2="<?php echo $arg2; ?>"><?php echo um_trim_string( stripslashes( $array['title'] ), 20 ); ?><span class="remove"></span></a>
|
||||
|
||||
<?php } } else { echo '<p>' . __('You did not create any custom fields', 'ultimatemember') . '</p>'; } ?>
|
||||
|
||||
|
||||
@@ -6,9 +6,13 @@
|
||||
add_action('um_admin_user_action_hook', 'um_admin_user_action_hook');
|
||||
function um_admin_user_action_hook( $action ){
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
switch ( $action ) {
|
||||
|
||||
default:
|
||||
do_action("um_admin_custom_hook_{$action}", $ultimatemember->user->id );
|
||||
break;
|
||||
|
||||
case 'um_put_as_pending':
|
||||
$ultimatemember->user->pending();
|
||||
break;
|
||||
@@ -31,6 +35,8 @@
|
||||
break;
|
||||
|
||||
case 'um_delete':
|
||||
if ( is_admin() )
|
||||
wp_die('This action is not allowed in backend.','ultimatemember');
|
||||
$ultimatemember->user->delete();
|
||||
break;
|
||||
|
||||
|
||||
@@ -1,5 +1,49 @@
|
||||
<?php
|
||||
|
||||
/***
|
||||
*** @Add community role to user creatino page
|
||||
***/
|
||||
add_action('admin_footer_text', 'um_add_custom_user_profile_fields');
|
||||
function um_add_custom_user_profile_fields() {
|
||||
global $ultimatemember, $pagenow;
|
||||
|
||||
if( $pagenow !== 'user-new.php' )
|
||||
return;
|
||||
|
||||
if( !current_user_can('manage_options') )
|
||||
return false;
|
||||
|
||||
?>
|
||||
<table id="table_my_custom_field" style="display:none;">
|
||||
<tr>
|
||||
<th><label for="um_role"><?php _e( 'Community Role', 'ultimatemember' ); ?></label></th>
|
||||
<td>
|
||||
<select name="um_role" id="um_role">
|
||||
<?php foreach( $ultimatemember->query->get_roles() as $key => $value ) { ?>
|
||||
<option value="<?php echo $key; ?>" <?php selected( um_get_option('default_role'), $key ); ?> ><?php echo $value; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
jQuery(function($){
|
||||
$('#table_my_custom_field tr').insertAfter($('#role').parentsUntil('tr').parent());
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Save the community role in user creation in backend
|
||||
***/
|
||||
add_action('user_register', 'um_save_custom_user_profile_fields');
|
||||
function um_save_custom_user_profile_fields( $user_id ) {
|
||||
if( !current_user_can('manage_options') || !is_admin() || !isset( $_POST['um_role'] ) )
|
||||
return false;
|
||||
update_user_meta($user_id, 'role', sanitize_title_with_dashes( $_POST['um_role'] ) );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Add access settings to category
|
||||
@@ -186,68 +230,6 @@
|
||||
}
|
||||
}
|
||||
add_action('save_post', 'um_admin_delete_role_cache', 1111, 2);
|
||||
|
||||
/***
|
||||
*** @delete users need confirmation
|
||||
***/
|
||||
add_action('um_admin_do_action__delete_users', 'um_admin_do_action__delete_users');
|
||||
function um_admin_do_action__delete_users( $action ){
|
||||
global $ultimatemember;
|
||||
if ( !is_admin() || !current_user_can( 'edit_users' ) ) die();
|
||||
|
||||
$redirect = admin_url('users.php');
|
||||
|
||||
$users = array_map( 'intval', (array) $_REQUEST['user'] );
|
||||
if ( !$users ) exit( wp_redirect( $redirect ) );
|
||||
|
||||
if ( isset( $_REQUEST['confirm'] ) && $_REQUEST['confirm'] == 1 ) { // delete
|
||||
|
||||
$bulk_action = 'um_delete';
|
||||
|
||||
foreach($users as $user_id){
|
||||
$ultimatemember->user->set( $user_id );
|
||||
if ( !um_user('super_admin') ) {
|
||||
|
||||
do_action("um_admin_user_action_hook", $bulk_action);
|
||||
|
||||
do_action("um_admin_user_action_{$bulk_action}_hook");
|
||||
|
||||
} else {
|
||||
$admin_err = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Finished. redirect now
|
||||
if ( $admin_err == 0 ){
|
||||
wp_redirect( admin_url('users.php?update=users_updated') );
|
||||
exit;
|
||||
} else {
|
||||
wp_redirect( admin_url('users.php?update=err_users_updated') );
|
||||
exit;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$redirect = add_query_arg('update','confirm_delete',$redirect);
|
||||
|
||||
foreach( $users as $id ) {
|
||||
$query .= '&user[]='.$id;
|
||||
}
|
||||
|
||||
$uri = $ultimatemember->permalinks->get_current_url( true );
|
||||
$uri = add_query_arg('um_adm_action', 'delete_users', $uri);
|
||||
foreach( $users as $user_id ) {
|
||||
$uri = add_query_arg('user[]', $user_id, $uri);
|
||||
$redirect = add_query_arg('user[]', $user_id, $redirect);
|
||||
}
|
||||
$uri = add_query_arg('_refer', $_POST['_wp_http_referer'], $redirect);
|
||||
$redirect = add_query_arg('confirm', 1, $uri);
|
||||
|
||||
exit( wp_redirect($redirect) );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @clear user cache
|
||||
@@ -433,7 +415,7 @@
|
||||
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");
|
||||
|
||||
|
||||
@@ -327,7 +327,11 @@ class UM_Admin_Metabox {
|
||||
delete_post_meta( $post_id, '_um_reveal_fields' );
|
||||
delete_post_meta( $post_id, '_um_search_fields' );
|
||||
delete_post_meta( $post_id, '_um_roles_can_search' );
|
||||
delete_post_meta( $post_id, '_um_show_these_users' );
|
||||
foreach( $_POST as $k => $v ) {
|
||||
if ( $k == '_um_show_these_users' && trim( $_POST[ $k ] ) ) {
|
||||
$v = preg_split('/[\r\n]+/', $v, -1, PREG_SPLIT_NO_EMPTY);
|
||||
}
|
||||
if (strstr($k, '_um_')){
|
||||
update_post_meta( $post_id, $k, $v);
|
||||
}
|
||||
@@ -1243,6 +1247,26 @@ class UM_Admin_Metabox {
|
||||
<?php
|
||||
break;
|
||||
|
||||
case '_min':
|
||||
?>
|
||||
|
||||
<p><label for="_min">Minimum Number <?php $this->tooltip( __('Minimum number that can be entered in this field','ultimatemember') ); ?></label>
|
||||
<input type="text" name="_min" id="_min" value="<?php echo $this->edit_mode_value; ?>" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
break;
|
||||
|
||||
case '_max':
|
||||
?>
|
||||
|
||||
<p><label for="_max">Maximum Number <?php $this->tooltip( __('Maximum number that can be entered in this field','ultimatemember') ); ?></label>
|
||||
<input type="text" name="_max" id="_max" value="<?php echo $this->edit_mode_value; ?>" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
break;
|
||||
|
||||
case '_min_chars':
|
||||
?>
|
||||
|
||||
|
||||
@@ -7,21 +7,21 @@ class UM_Admin_Users {
|
||||
$this->custom_role = 'um_role';
|
||||
|
||||
add_filter('manage_users_columns', array(&$this, 'manage_users_columns') );
|
||||
|
||||
|
||||
add_action('manage_users_custom_column', array(&$this, 'manage_users_custom_column'), 10, 3);
|
||||
|
||||
|
||||
add_action('restrict_manage_users', array(&$this, 'restrict_manage_users') );
|
||||
|
||||
|
||||
add_action('admin_init', array(&$this, 'um_bulk_users_edit'), 9);
|
||||
|
||||
|
||||
add_filter('views_users', array(&$this, 'views_users') );
|
||||
|
||||
|
||||
add_filter('pre_user_query', array(&$this, 'sort_by_newest') );
|
||||
|
||||
|
||||
add_filter('pre_user_query', array(&$this, 'custom_users_filter') );
|
||||
|
||||
|
||||
add_filter('user_row_actions', array(&$this, 'user_row_actions'), 10, 2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -32,17 +32,14 @@ class UM_Admin_Users {
|
||||
$user_id = $user_object->ID;
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
unset( $actions['edit'] );
|
||||
unset( $actions['delete'] );
|
||||
$actions['frontend_profile'] = "<a class='' href='" . um_user_profile_url() . "'>" . __( 'View profile','ultimatemember') . "</a>";
|
||||
|
||||
$actions['frontend_profile'] = "<a class='' href='" . um_user_profile_url() . "'>" . __( 'Profile','ultimatemember') . "</a>";
|
||||
|
||||
if ( um_user('submitted') ) {
|
||||
$actions['view_info'] = '<a href="#" data-modal="UM_preview_registration" data-modal-size="smaller" data-dynamic-content="um_admin_review_registration" data-arg1="'.$user_id.'" data-arg2="edit_registration">' . __('Info','ultimatemember') . '</a>';
|
||||
}
|
||||
|
||||
|
||||
$actions = apply_filters('um_admin_user_row_actions', $actions, $user_id );
|
||||
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
@@ -208,22 +205,7 @@ class UM_Admin_Users {
|
||||
|
||||
$users = $_REQUEST['users'];
|
||||
$bulk_action = current( array_filter( $_REQUEST['um_bulk_action']) );
|
||||
|
||||
if ( 'um_delete' == $bulk_action ) { // this needs confirmation
|
||||
|
||||
$uri = admin_url('users.php');
|
||||
$userids = array_map( 'intval', (array) $_REQUEST['users'] );
|
||||
|
||||
if ( is_array( $userids ) ) {
|
||||
$uri = add_query_arg('um_adm_action', 'delete_users', $uri);
|
||||
foreach( $userids as $user_id ) {
|
||||
$uri = add_query_arg('user[]', $user_id, $uri);
|
||||
}
|
||||
exit( wp_redirect( $uri ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach($users as $user_id){
|
||||
$ultimatemember->user->set( $user_id );
|
||||
if ( !um_user('super_admin') ) {
|
||||
@@ -273,10 +255,10 @@ class UM_Admin_Users {
|
||||
global $ultimatemember;
|
||||
?>
|
||||
|
||||
<div class="actions">
|
||||
<div style="float:right;margin:0 4px">
|
||||
|
||||
<label class="screen-reader-text" for="um_filter_role"><?php _e('Filter by','ultimatemember'); ?></label>
|
||||
<select name="um_filter_role[]" id="um_filter_role" class="umaf-selectjs" style="width: 120px">
|
||||
<select name="um_filter_role[]" id="um_filter_role" class="" style="width: 120px">
|
||||
<option value="0"><?php _e('Filter by','ultimatemember'); ?></option>
|
||||
<?php
|
||||
$roles = $ultimatemember->query->get_roles();
|
||||
@@ -290,11 +272,11 @@ class UM_Admin_Users {
|
||||
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<div style="float:right;margin:0 4px">
|
||||
|
||||
<label class="screen-reader-text" for="um_bulk_action"><?php _e('Take Action','ultimatemember'); ?></label>
|
||||
<select name="um_bulk_action[]" id="um_bulk_action" class="umaf-selectjs" style="width: 200px">
|
||||
<option value="0"><?php _e('Take Action','ultimatemember'); ?></option>
|
||||
<label class="screen-reader-text" for="um_bulk_action"><?php _e('UM Action','ultimatemember'); ?></label>
|
||||
<select name="um_bulk_action[]" id="um_bulk_action" class="" style="width: 200px">
|
||||
<option value="0"><?php _e('UM Action','ultimatemember'); ?></option>
|
||||
<?php echo $ultimatemember->user->get_bulk_admin_actions(); ?>
|
||||
</select>
|
||||
|
||||
@@ -302,10 +284,10 @@ class UM_Admin_Users {
|
||||
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<div style="float:right;margin:0 4px">
|
||||
|
||||
<label class="screen-reader-text" for="um_change_role"><?php _e('Community role…','ultimatemember'); ?></label>
|
||||
<select name="um_change_role[]" id="um_change_role" class="umaf-selectjs" style="width: 160px">
|
||||
<select name="um_change_role[]" id="um_change_role" class="" style="width: 160px">
|
||||
<?php foreach($ultimatemember->query->get_roles( $add_default = 'Community role…' ) as $key => $value) { ?>
|
||||
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
$show_these_users = get_post_meta( get_the_ID(), '_um_show_these_users', true );
|
||||
if ( $show_these_users ) {
|
||||
$show_these_users = implode("\n", str_replace("\r", "", $show_these_users));
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-admin-metabox">
|
||||
@@ -73,6 +78,15 @@
|
||||
</span>
|
||||
</p><div class="um-admin-clear"></div>
|
||||
|
||||
<p>
|
||||
<label class="um-admin-half"><?php _e('Only show specific users (Enter one username per line)','ultimatemember'); ?></label>
|
||||
<span class="um-admin-half">
|
||||
|
||||
<textarea name="_um_show_these_users" id="_um_show_these_users"><?php echo $show_these_users; ?></textarea>
|
||||
|
||||
</span>
|
||||
</p><div class="um-admin-clear"></div>
|
||||
|
||||
<?php do_action('um_admin_extend_directory_options_general', $this); ?>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -88,4 +88,21 @@
|
||||
animation-timing-function: linear;
|
||||
-webkit-animation-iteration-count: 1;
|
||||
animation-iteration-count: 1;
|
||||
}
|
||||
|
||||
/* content lockers */
|
||||
.um-locked-content {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
border: 2px dotted #cc3000;
|
||||
color: #333;
|
||||
background: #fff;
|
||||
font-size: 14px;
|
||||
padding: 20px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.um-locked-content a {
|
||||
border: none !important;
|
||||
}
|
||||
@@ -287,6 +287,8 @@ font-weight: normal;
|
||||
.um-meta-text {
|
||||
margin: 6px 0 0 0;
|
||||
color: #666;
|
||||
line-height: 1.4em;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.um-meta-text p {
|
||||
|
||||
@@ -381,6 +381,7 @@ p.um-notice.warning {
|
||||
}
|
||||
|
||||
.um-form input[type=text],
|
||||
.um-form input[type=number],
|
||||
.um-form input[type=password] {
|
||||
padding: 0 12px !important;
|
||||
width: 100%;
|
||||
@@ -399,7 +400,14 @@ p.um-notice.warning {
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
.um-form input[type=number] {
|
||||
width: auto;
|
||||
padding: 0 0 0 5px !important;
|
||||
height: 30px !important;
|
||||
}
|
||||
|
||||
.um-form input[type=text]:focus,
|
||||
.um-form input[type=number]:focus,
|
||||
.um-form input[type=password]:focus,
|
||||
.um-form textarea:focus {
|
||||
box-shadow: none !important;
|
||||
@@ -428,6 +436,16 @@ p.um-notice.warning {
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
.um-form .wp-editor-container {
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.um-form .wp-editor-container textarea {
|
||||
background: #ddd !important;
|
||||
color: #222 !important;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
- Radio & Checkboxes
|
||||
*/
|
||||
@@ -550,7 +568,8 @@ p.um-notice.warning {
|
||||
.um div.disabled,
|
||||
.um-disabled,
|
||||
.um input[type=submit]:disabled,
|
||||
.um input[type=text]:disabled {
|
||||
.um input[type=text]:disabled,
|
||||
.um input[type=number]:disabled {
|
||||
opacity: 0.6 !important;
|
||||
cursor: no-drop !important;
|
||||
}
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
@@ -146,6 +146,7 @@ print ".um-$form_id.um .um-button.um-alt,
|
||||
if ( $form_border ) {
|
||||
print "
|
||||
.um-$form_id.um .um-form input[type=text],
|
||||
.um-$form_id.um .um-form input[type=number],
|
||||
.um-$form_id.um .um-form input[type=password],
|
||||
.um-$form_id.um .um-form textarea,
|
||||
.um-$form_id.um .upload-progress,
|
||||
@@ -166,6 +167,7 @@ print "
|
||||
if ( $form_border_hover ) {
|
||||
print "
|
||||
.um-$form_id.um .um-form input[type=text]:focus,
|
||||
.um-$form_id.um .um-form input[type=number]:focus,
|
||||
.um-$form_id.um .um-form input[type=password]:focus,
|
||||
.um-$form_id.um .um-form textarea:focus {
|
||||
border: $form_border_hover !important;
|
||||
@@ -176,6 +178,7 @@ print "
|
||||
if ( $form_bg_color ) {
|
||||
print "
|
||||
.um-$form_id.um .um-form input[type=text],
|
||||
.um-$form_id.um .um-form input[type=number],
|
||||
.um-$form_id.um .um-form input[type=password],
|
||||
.um-$form_id.um .um-form textarea,
|
||||
.select2-container .select2-choice,
|
||||
@@ -189,6 +192,7 @@ print "
|
||||
if ( $form_bg_color_focus ) {
|
||||
print "
|
||||
.um-$form_id.um .um-form input[type=text]:focus,
|
||||
.um-$form_id.um .um-form input[type=number]:focus,
|
||||
.um-$form_id.um .um-form input[type=password]:focus,
|
||||
.um-$form_id.um .um-form textarea:focus {
|
||||
background-color: $form_bg_color_focus;
|
||||
|
||||
@@ -228,10 +228,12 @@
|
||||
|
||||
<?php if ($cover_photos) {
|
||||
|
||||
$sizes = um_get_option('cover_thumb_sizes');
|
||||
|
||||
if ( $ultimatemember->mobile->isTablet() ) {
|
||||
$cover_size = 600;
|
||||
$cover_size = $sizes[1];
|
||||
} else {
|
||||
$cover_size = 300;
|
||||
$cover_size = $sizes[0];
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -378,9 +378,9 @@
|
||||
|
||||
<div class="um-meta-text">
|
||||
<?php if( um_get_option( 'profile_show_html_bio' ) ) : ?>
|
||||
<?php echo strip_tags(um_filtered_value('description'), '<p><a><img><br><strong><b><em><i><quote><sub><sup>'); ?>
|
||||
<?php echo um_clickable_links( strip_tags( um_filtered_value('description'), '<p><a><img><br><strong><b><em><i><quote><sub><sup>') ); ?>
|
||||
<?php else : ?>
|
||||
<?php echo wp_strip_all_tags( um_filtered_value('description') ); ?>
|
||||
<?php echo um_clickable_links( wp_strip_all_tags( um_filtered_value('description') ) ); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -147,6 +147,22 @@ class UM_Builtin {
|
||||
)
|
||||
),
|
||||
|
||||
'number' => array(
|
||||
'name' => __('Number','ultimatemember'),
|
||||
'col1' => array('_title','_metakey','_help','_default','_min','_visibility'),
|
||||
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate','_max'),
|
||||
'col3' => array('_required','_editable','_icon'),
|
||||
'validate' => array(
|
||||
'_title' => array(
|
||||
'mode' => 'required',
|
||||
'error' => __('You must provide a title','ultimatemember')
|
||||
),
|
||||
'_metakey' => array(
|
||||
'mode' => 'unique',
|
||||
),
|
||||
)
|
||||
),
|
||||
|
||||
'textarea' => array(
|
||||
'name' => 'Textarea',
|
||||
'col1' => array('_title','_metakey','_help','_height','_max_chars','_max_words','_visibility'),
|
||||
|
||||
+633
-568
File diff suppressed because it is too large
Load Diff
@@ -143,6 +143,14 @@
|
||||
);
|
||||
}
|
||||
|
||||
// show specific usernames
|
||||
if ( isset( $show_these_users ) && $show_these_users && is_array( $show_these_users ) ) {
|
||||
foreach( $show_these_users as $username ) {
|
||||
$users_array[] = username_exists( $username );
|
||||
}
|
||||
$query_args['include'] = $users_array;
|
||||
}
|
||||
|
||||
// add roles to appear in directory
|
||||
if ( !empty( $roles ) ) {
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
$actions['um_resend_activation'] = array( 'label' => __('Resend Activation E-mail','ultimatemember') );
|
||||
$actions['um_deactivate'] = array( 'label' => __('Deactivate','ultimatemember') );
|
||||
$actions['um_reenable'] = array( 'label' => __('Reactivate','ultimatemember') );
|
||||
$actions['um_delete'] = array( 'label' => __('Delete','ultimatemember') );
|
||||
//$actions['um_delete'] = array( 'label' => __('Delete','ultimatemember') );
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,35 @@
|
||||
$message = um_convert_tags( $message, $args );
|
||||
wp_mail( $email, $subject_line, $message, $headers, $attachments );
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Trim string by char length
|
||||
***/
|
||||
function um_trim_string( $s, $length = 20 ) {
|
||||
$s = strlen($s) > $length ? substr($s,0,$length)."..." : $s;
|
||||
return $s;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Convert urls to clickable links
|
||||
***/
|
||||
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);
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Get where user should be headed after logging
|
||||
***/
|
||||
function um_dynamic_login_page_redirect( $redirect_to = '' ) {
|
||||
global $ultimatemember;
|
||||
$uri = um_get_core_page( 'login' );
|
||||
if ( ! $redirect_to ) {
|
||||
$redirect_to = $ultimatemember->permalinks->get_current_url();
|
||||
}
|
||||
$uri = add_query_arg( 'redirect_to', $redirect_to, $uri );
|
||||
return $uri;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @convert template tags
|
||||
***/
|
||||
@@ -49,6 +77,7 @@
|
||||
'{email}',
|
||||
'{password}',
|
||||
'{login_url}',
|
||||
'{login_referrer}',
|
||||
'{site_name}',
|
||||
'{site_url}',
|
||||
'{account_activation_link}',
|
||||
@@ -71,6 +100,7 @@
|
||||
um_user('user_email'),
|
||||
um_user('_um_cool_but_hard_to_guess_plain_pw'),
|
||||
um_get_core_page('login'),
|
||||
um_dynamic_login_page_redirect(),
|
||||
um_get_option('site_name'),
|
||||
get_bloginfo('url'),
|
||||
um_user('account_activation_link'),
|
||||
@@ -90,6 +120,17 @@
|
||||
$content = str_replace($args['tags'], $args['tags_replace'], $content);
|
||||
}
|
||||
|
||||
$regex = '~\{([^}]*)\}~';
|
||||
preg_match_all($regex, $content, $matches);
|
||||
|
||||
// Support for all usermeta keys
|
||||
if ( isset( $matches[1] ) && is_array( $matches[1] ) && !empty( $matches[1] ) ) {
|
||||
foreach( $matches[1] as $match ) {
|
||||
$strip_key = str_replace('usermeta:','', $match );
|
||||
$content = str_replace( '{' . $match . '}', um_user( $strip_key ), $content);
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
|
||||
}
|
||||
@@ -1168,8 +1209,12 @@ function um_user( $data, $attrs = null ) {
|
||||
case 'display_name':
|
||||
|
||||
$op = um_get_option('display_name');
|
||||
<<<<<<< HEAD
|
||||
$name = '';
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> 8a95eda1ec440cbf18dff26b709c5f163d0c83f9
|
||||
if ( $op == 'default' ) {
|
||||
$name = um_profile('display_name');
|
||||
}
|
||||
@@ -1184,6 +1229,9 @@ function um_user( $data, $attrs = null ) {
|
||||
} else {
|
||||
$name = um_profile( $data );
|
||||
}
|
||||
if ( ! $name ) {
|
||||
$name = um_user('user_login');
|
||||
}
|
||||
}
|
||||
|
||||
if ( $op == 'sur_name' ) {
|
||||
|
||||
+63
-1
@@ -9,7 +9,10 @@ class UM_Shortcodes {
|
||||
$this->loop = '';
|
||||
|
||||
add_shortcode('ultimatemember', array(&$this, 'ultimatemember'), 1);
|
||||
|
||||
|
||||
add_shortcode('um_loggedin', array(&$this, 'um_loggedin') );
|
||||
add_shortcode('um_loggedout', array(&$this, 'um_loggedout') );
|
||||
|
||||
add_filter( 'body_class', array(&$this, 'body_class'), 0 );
|
||||
|
||||
$this->emoji[':)'] = 'https://s.w.org/images/core/emoji/72x72/1f604.png';
|
||||
@@ -175,6 +178,57 @@ class UM_Shortcodes {
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Logged-in only content
|
||||
***/
|
||||
function um_loggedin( $args = array(), $content = "" ) {
|
||||
global $ultimatemember;
|
||||
ob_start();
|
||||
|
||||
$defaults = array(
|
||||
'lock_text' => __('This content has been restricted to logged in users only. Please <a href="{login_referrer}">login</a> to view this content.','ultimatemember' ),
|
||||
'show_lock' => 'yes'
|
||||
);
|
||||
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
//$args['lock_text'] = $this->convert_locker_tags( $args['lock_text'] );
|
||||
|
||||
if ( !is_user_logged_in() ) {
|
||||
if ( $args['show_lock'] == 'no' ) {
|
||||
echo '';
|
||||
} else {
|
||||
$ultimatemember->shortcodes->set_args = $args;
|
||||
$ultimatemember->shortcodes->load_template( 'login-to-view' );
|
||||
}
|
||||
} else {
|
||||
echo do_shortcode( $this->convert_locker_tags( wpautop( $content ) ) );
|
||||
}
|
||||
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $output;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Logged-out only content
|
||||
***/
|
||||
function um_loggedout( $args = array(), $content = "" ) {
|
||||
global $ultimatemember;
|
||||
ob_start();
|
||||
|
||||
// Hide for logged in users
|
||||
if ( is_user_logged_in() ) {
|
||||
echo '';
|
||||
} else {
|
||||
echo do_shortcode( wpautop( $content ) );
|
||||
}
|
||||
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $output;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Shortcode
|
||||
***/
|
||||
@@ -369,6 +423,14 @@ class UM_Shortcodes {
|
||||
$shortcode = '[ultimatemember form_id='.$post_id.']';
|
||||
return $shortcode;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @convert access lock tags
|
||||
***/
|
||||
function convert_locker_tags( $str ) {
|
||||
$str = um_convert_tags( $str );
|
||||
return $str;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @convert user tags in a string
|
||||
|
||||
@@ -44,6 +44,49 @@ class UM_User {
|
||||
add_action('um_when_role_is_set', array(&$this, 'remove_cache') );
|
||||
add_action('um_when_status_is_set', array(&$this, 'remove_cache') );
|
||||
|
||||
add_action( 'show_user_profile', array( $this, 'community_role_edit' ) );
|
||||
add_action( 'edit_user_profile', array( $this, 'community_role_edit' ) );
|
||||
add_action( 'personal_options_update', array( $this, 'community_role_save' ) );
|
||||
add_action( 'edit_user_profile_update', array( $this, 'community_role_save' ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow changing community role
|
||||
*/
|
||||
function community_role_edit( $user ) {
|
||||
global $ultimatemember;
|
||||
if ( current_user_can( 'edit_users' ) && current_user_can( 'edit_user', $user->ID ) ) {
|
||||
$user = get_userdata( $user->ID );
|
||||
?>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="um_role"><?php _e( 'Community Role', 'ultimatemember' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<select name="um_role" id="um_role">
|
||||
<?php foreach( $ultimatemember->query->get_roles() as $key => $value ) { ?>
|
||||
<option value="<?php echo $key; ?>" <?php selected( um_user('role'), $key ); ?> ><?php echo $value; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<span class="description"><?php _e( 'Assign or change the community role for this user', 'ultimatemember' ); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php }
|
||||
}
|
||||
|
||||
/**
|
||||
* Save community role
|
||||
*/
|
||||
public function community_role_save( $user_id ) {
|
||||
if ( current_user_can( 'edit_user', $user_id ) && isset( $_POST['um_role'] ) ) {
|
||||
update_user_meta( $user_id, 'role', sanitize_title_with_dashes( $_POST['um_role'] ) );
|
||||
delete_option( "um_cache_userdata_{$user_id}" );
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="um-locked-content">
|
||||
|
||||
<div class="um-locked-content-msg"><?php echo $lock_text; ?></div>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user