mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Enable html support for user bio
This commit is contained in:
+222
-216
@@ -6,49 +6,49 @@
|
||||
add_action('um_profile_content_main','um_profile_content_main');
|
||||
function um_profile_content_main( $args ) {
|
||||
extract( $args );
|
||||
|
||||
|
||||
if ( !um_get_option('profile_tab_main') && !isset( $_REQUEST['um_action'] ) )
|
||||
return;
|
||||
|
||||
|
||||
$can_view = apply_filters('um_profile_can_view_main', -1, um_profile_id() );
|
||||
|
||||
|
||||
if ( $can_view == -1 ) {
|
||||
|
||||
|
||||
do_action("um_before_form", $args);
|
||||
|
||||
|
||||
do_action("um_before_{$mode}_fields", $args);
|
||||
|
||||
|
||||
do_action("um_main_{$mode}_fields", $args);
|
||||
|
||||
|
||||
do_action("um_after_form_fields", $args);
|
||||
|
||||
|
||||
do_action("um_after_{$mode}_fields", $args);
|
||||
|
||||
|
||||
do_action("um_after_form", $args);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="um-profile-note"><span><i class="um-faicon-lock"></i><?php echo $can_view; ?></span></div>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @update user's profile
|
||||
***/
|
||||
add_action('um_user_edit_profile', 'um_user_edit_profile', 10);
|
||||
function um_user_edit_profile($args){
|
||||
|
||||
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
$to_update = null;
|
||||
$files = null;
|
||||
|
||||
|
||||
if ( isset( $args['user_id'] ) ) {
|
||||
if ( um_current_user_can('edit', $args['user_id'] ) ) {
|
||||
$ultimatemember->user->set( $args['user_id'] );
|
||||
@@ -58,27 +58,27 @@
|
||||
} else if ( isset( $args['_user_id'] ) ) {
|
||||
$ultimatemember->user->set( $args['_user_id'] );
|
||||
}
|
||||
|
||||
|
||||
$userinfo = $ultimatemember->user->profile;
|
||||
|
||||
|
||||
$fields = unserialize( $args['custom_fields'] );
|
||||
|
||||
|
||||
do_action('um_user_before_updating_profile', $userinfo );
|
||||
|
||||
|
||||
// loop through fields
|
||||
if ( isset( $fields ) && is_array( $fields ) ) {
|
||||
foreach( $fields as $key => $array ) {
|
||||
|
||||
|
||||
if ( $fields[$key]['type'] == 'multiselect' || $fields[$key]['type'] == 'checkbox' && !isset($args['submitted'][$key]) ) {
|
||||
delete_user_meta( um_user('ID'), $key );
|
||||
}
|
||||
|
||||
|
||||
if ( isset( $args['submitted'][ $key ] ) ) {
|
||||
|
||||
if ( isset( $fields[$key]['type'] ) && in_array( $fields[$key]['type'], array('image','file') ) && um_is_temp_upload( $args['submitted'][ $key ] ) ) {
|
||||
|
||||
|
||||
$files[ $key ] = $args['submitted'][ $key ];
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
if ( isset( $userinfo[$key]) && $args['submitted'][$key] != $userinfo[$key] ) {
|
||||
@@ -86,23 +86,23 @@
|
||||
} else if ( $args['submitted'][$key] ) {
|
||||
$to_update[ $key ] = $args['submitted'][ $key ];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( isset( $args['submitted']['description'] ) ) {
|
||||
$to_update['description'] = $args['submitted']['description'];
|
||||
}
|
||||
|
||||
|
||||
if ( isset( $args['submitted']['role'] ) && !empty( $args['submitted']['role'] ) ) {
|
||||
$to_update['role'] = $args['submitted']['role'];
|
||||
}
|
||||
|
||||
|
||||
do_action('um_user_pre_updating_profile', $to_update );
|
||||
|
||||
|
||||
$to_update = apply_filters('um_user_pre_updating_profile_array', $to_update);
|
||||
|
||||
if ( is_array( $to_update ) ) {
|
||||
@@ -112,78 +112,78 @@
|
||||
if ( is_array( $files ) ) {
|
||||
$ultimatemember->user->update_files( $files );
|
||||
}
|
||||
|
||||
|
||||
do_action('um_after_user_updated', um_user('ID') );
|
||||
do_action('um_after_user_upload', um_user('ID') );
|
||||
do_action('um_user_after_updating_profile', $to_update );
|
||||
|
||||
|
||||
if ( !isset( $args['is_signup'] ) ) {
|
||||
exit( wp_redirect( um_edit_my_profile_cancel_uri() ) );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @if editing another user
|
||||
***/
|
||||
add_action('um_after_form_fields', 'um_editing_user_id_input');
|
||||
function um_editing_user_id_input($args){
|
||||
function um_editing_user_id_input($args){
|
||||
global $ultimatemember;
|
||||
if ( $ultimatemember->fields->editing == 1 && $ultimatemember->fields->set_mode == 'profile' && $ultimatemember->user->target_id ) { ?>
|
||||
|
||||
|
||||
<input type="hidden" name="user_id" id="user_id" value="<?php echo $ultimatemember->user->target_id; ?>" />
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @meta description
|
||||
***/
|
||||
add_action('wp_head', 'um_profile_dynamic_meta_desc', 9999999);
|
||||
function um_profile_dynamic_meta_desc() {
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
if ( um_is_core_page('user') && um_get_requested_user() ) {
|
||||
|
||||
|
||||
um_fetch_user( um_get_requested_user() );
|
||||
|
||||
|
||||
$content = um_convert_tags( um_get_option('profile_desc') );
|
||||
$user_id = um_user('ID');
|
||||
$url = um_user_profile_url();
|
||||
|
||||
|
||||
if ( um_profile('profile_photo') ) {
|
||||
$avatar = um_user_uploads_uri() . um_profile('profile_photo');
|
||||
} else {
|
||||
$avatar = um_get_default_avatar_uri();
|
||||
}
|
||||
|
||||
|
||||
um_reset_user(); ?>
|
||||
|
||||
|
||||
<meta name="description" content="<?php echo $content; ?>">
|
||||
|
||||
|
||||
<meta property="og:title" content="<?php echo um_get_display_name( $user_id ); ?>" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:image" content="<?php echo $avatar; ?>" />
|
||||
<meta property="og:url" content="<?php echo $url; ?>" />
|
||||
<meta property="og:description" content="<?php echo $content; ?>" />
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @profile header cover
|
||||
***/
|
||||
add_action('um_profile_header_cover_area', 'um_profile_header_cover_area', 9 );
|
||||
function um_profile_header_cover_area( $args ) {
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
if ( $args['cover_enabled'] == 1 ) {
|
||||
|
||||
|
||||
$default_cover = um_get_option('default_cover');
|
||||
|
||||
|
||||
$overlay = '<span class="um-cover-overlay">
|
||||
<span class="um-cover-overlay-s">
|
||||
<ins>
|
||||
@@ -192,36 +192,36 @@
|
||||
</ins>
|
||||
</span>
|
||||
</span>';
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-cover <?php if ( um_profile('cover_photo') || ( $default_cover && $default_cover['url'] ) ) echo 'has-cover'; ?>" data-user_id="<?php echo um_profile_id(); ?>" data-ratio="<?php echo $args['cover_ratio']; ?>">
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
if ( $ultimatemember->fields->editing ) {
|
||||
|
||||
|
||||
$items = 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>',
|
||||
);
|
||||
|
||||
|
||||
echo $ultimatemember->menu->new_ui( 'bc', 'div.um-cover', 'click', $items );
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php $ultimatemember->fields->add_hidden_field( 'cover_photo' ); ?>
|
||||
|
||||
|
||||
<?php echo $overlay; ?>
|
||||
|
||||
|
||||
<div class="um-cover-e">
|
||||
|
||||
|
||||
<?php if ( um_profile('cover_photo') ) { ?>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
if( $ultimatemember->mobile->isMobile() ){
|
||||
if ( $ultimatemember->mobile->isTablet() ) {
|
||||
echo um_user('cover_photo', 1000);
|
||||
@@ -231,35 +231,35 @@
|
||||
} else {
|
||||
echo um_user('cover_photo', 1000);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<?php } elseif ( $default_cover && $default_cover['url'] ) {
|
||||
|
||||
$default_cover = $default_cover['url'];
|
||||
|
||||
|
||||
echo '<img src="'. $default_cover . '" alt="" />';
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if ( !isset( $ultimatemember->user->cannot_edit ) ) { ?>
|
||||
|
||||
|
||||
<a href="#" class="um-cover-add um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="<?php _e('Upload a cover photo','ultimatemember'); ?>"></i></span></a>
|
||||
|
||||
|
||||
<?php }
|
||||
|
||||
|
||||
} ?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Show social links as icons below profile name
|
||||
***/
|
||||
@@ -281,15 +281,15 @@
|
||||
add_action('um_profile_header', 'um_profile_header', 9 );
|
||||
function um_profile_header( $args ) {
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
$classes = null;
|
||||
|
||||
|
||||
if ( !$args['cover_enabled'] ) {
|
||||
$classes .= ' no-cover';
|
||||
}
|
||||
|
||||
|
||||
$default_size = str_replace( 'px', '', $args['photosize'] );
|
||||
|
||||
|
||||
$overlay = '<span class="um-profile-photo-overlay">
|
||||
<span class="um-profile-photo-overlay-s">
|
||||
<ins>
|
||||
@@ -297,115 +297,121 @@
|
||||
</ins>
|
||||
</span>
|
||||
</span>';
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="um-header<?php echo $classes; ?>">
|
||||
|
||||
|
||||
<?php do_action('um_pre_header_editprofile', $args); ?>
|
||||
|
||||
|
||||
<div class="um-profile-photo" data-user_id="<?php echo um_profile_id(); ?>">
|
||||
|
||||
<a href="<?php echo um_user_profile_url(); ?>" class="um-profile-photo-img" title="<?php echo um_user('display_name'); ?>"><?php echo $overlay . get_avatar( um_user('ID'), $default_size ); ?></a>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
if ( !isset( $ultimatemember->user->cannot_edit ) ) {
|
||||
|
||||
|
||||
if ( !isset( $ultimatemember->user->cannot_edit ) ) {
|
||||
|
||||
$ultimatemember->fields->add_hidden_field( 'profile_photo' );
|
||||
|
||||
|
||||
if ( !um_profile('profile_photo') ) { // has profile photo
|
||||
|
||||
|
||||
$items = array(
|
||||
'<a href="#" class="um-manual-trigger" data-parent=".um-profile-photo" data-child=".um-btn-auto-width">'.__('Upload photo','ultimatemember').'</a>',
|
||||
'<a href="#" class="um-dropdown-hide">'.__('Cancel','ultimatemember').'</a>',
|
||||
);
|
||||
|
||||
|
||||
$items = apply_filters('um_user_photo_menu_view', $items );
|
||||
|
||||
|
||||
echo $ultimatemember->menu->new_ui( 'bc', 'div.um-profile-photo', 'click', $items );
|
||||
|
||||
|
||||
} else if ( $ultimatemember->fields->editing == true ) {
|
||||
|
||||
|
||||
$items = array(
|
||||
'<a href="#" class="um-manual-trigger" data-parent=".um-profile-photo" data-child=".um-btn-auto-width">'.__('Change photo','ultimatemember').'</a>',
|
||||
'<a href="#" class="um-reset-profile-photo" data-user_id="'.um_profile_id().'" data-default_src="'.um_get_default_avatar_uri().'">'.__('Remove photo','ultimatemember').'</a>',
|
||||
'<a href="#" class="um-dropdown-hide">'.__('Cancel','ultimatemember').'</a>',
|
||||
);
|
||||
|
||||
|
||||
$items = apply_filters('um_user_photo_menu_edit', $items );
|
||||
|
||||
|
||||
echo $ultimatemember->menu->new_ui( 'bc', 'div.um-profile-photo', 'click', $items );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="um-profile-meta">
|
||||
|
||||
|
||||
<div class="um-main-meta">
|
||||
|
||||
|
||||
<?php if ( $args['show_name'] ) { ?>
|
||||
<div class="um-name">
|
||||
|
||||
|
||||
<a href="<?php echo um_user_profile_url(); ?>" title="<?php echo um_user('display_name'); ?>"><?php echo um_user('display_name', 'html'); ?></a>
|
||||
|
||||
|
||||
<?php do_action('um_after_profile_name_inline', $args ); ?>
|
||||
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<div class="um-clear"></div>
|
||||
|
||||
|
||||
<?php do_action('um_after_profile_header_name_args', $args ); ?>
|
||||
<?php do_action('um_after_profile_header_name'); ?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php if ( isset( $args['metafields'] ) && !empty( $args['metafields'] ) ) { ?>
|
||||
<div class="um-meta">
|
||||
|
||||
|
||||
<?php echo $ultimatemember->profile->show_meta( $args['metafields'] ); ?>
|
||||
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( $ultimatemember->fields->viewing == true && um_user('description') && $args['show_bio'] ) { ?>
|
||||
|
||||
<div class="um-meta-text"><?php echo wp_strip_all_tags( um_filtered_value('description') ); ?></div>
|
||||
|
||||
|
||||
<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 else : ?>
|
||||
<?php echo wp_strip_all_tags( um_filtered_value('description') ); ?>
|
||||
<?php endif; ?>
|
||||
</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>
|
||||
|
||||
|
||||
<?php if ( $ultimatemember->fields->is_error('description') ) {
|
||||
echo $ultimatemember->fields->field_error( $ultimatemember->fields->show_error('description'), true ); }
|
||||
echo $ultimatemember->fields->field_error( $ultimatemember->fields->show_error('description'), true ); }
|
||||
?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<div class="um-profile-status <?php echo um_user('account_status'); ?>">
|
||||
<span><?php printf(__('This user account status is %s','ultimatemember'), um_user('account_status_name') ); ?></span>
|
||||
</div>
|
||||
|
||||
|
||||
<?php do_action('um_after_header_meta', um_user('ID'), $args ); ?>
|
||||
|
||||
|
||||
</div><div class="um-clear"></div>
|
||||
|
||||
|
||||
<?php do_action('um_after_header_info', um_user('ID'), $args); ?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @adds profile permissions to view/edit
|
||||
***/
|
||||
@@ -413,10 +419,10 @@
|
||||
function um_pre_profile_shortcode($args){
|
||||
global $ultimatemember;
|
||||
extract( $args );
|
||||
|
||||
|
||||
if ( $mode == 'profile' && $ultimatemember->fields->editing == false ) {
|
||||
$ultimatemember->fields->viewing = 1;
|
||||
|
||||
|
||||
if ( um_get_requested_user() ) {
|
||||
if ( !um_can_view_profile( um_get_requested_user() ) ) um_redirect_home();
|
||||
if ( !um_current_user_can('edit', um_get_requested_user() ) ) $ultimatemember->user->cannot_edit = 1;
|
||||
@@ -425,21 +431,21 @@
|
||||
if ( !is_user_logged_in() ) um_redirect_home();
|
||||
if ( !um_user('can_edit_profile') ) $ultimatemember->user->cannot_edit = 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ( $mode == 'profile' && $ultimatemember->fields->editing == true ) {
|
||||
$ultimatemember->fields->editing = 1;
|
||||
|
||||
|
||||
if ( um_get_requested_user() ) {
|
||||
if ( !um_current_user_can('edit', um_get_requested_user() ) ) um_redirect_home();
|
||||
um_fetch_user( um_get_requested_user() );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @display the edit profile icon
|
||||
***/
|
||||
@@ -447,160 +453,160 @@
|
||||
function um_add_edit_icon( $args ) {
|
||||
global $ultimatemember;
|
||||
$output = '';
|
||||
|
||||
|
||||
if ( !is_user_logged_in() ) return; // not allowed for guests
|
||||
|
||||
|
||||
if ( isset( $ultimatemember->user->cannot_edit ) && $ultimatemember->user->cannot_edit == 1 ) return; // do not proceed if user cannot edit
|
||||
|
||||
|
||||
if ( $ultimatemember->fields->editing == true ) {
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="um-profile-edit um-profile-headericon">
|
||||
|
||||
|
||||
<a href="#" class="um-profile-edit-a um-profile-save"><i class="um-faicon-check"></i></a>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
|
||||
<div class="um-profile-edit um-profile-headericon">
|
||||
|
||||
|
||||
<a href="#" class="um-profile-edit-a"><i class="um-faicon-cog"></i></a>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
$items = array(
|
||||
'editprofile' => '<a href="'.um_edit_profile_url().'" class="real_url">'.__('Edit Profile','ultimatemember').'</a>',
|
||||
'myaccount' => '<a href="'.um_get_core_page('account').'" class="real_url">'.__('My Account','ultimatemember').'</a>',
|
||||
'logout' => '<a href="'.um_get_core_page('logout').'" class="real_url">'.__('Logout','ultimatemember').'</a>',
|
||||
'cancel' => '<a href="#" class="um-dropdown-hide">'.__('Cancel','ultimatemember').'</a>',
|
||||
);
|
||||
|
||||
|
||||
$cancel = $items['cancel'];
|
||||
|
||||
|
||||
if ( !um_is_myprofile() ) {
|
||||
|
||||
|
||||
$actions = $ultimatemember->user->get_admin_actions();
|
||||
|
||||
|
||||
unset( $items['myaccount'] );
|
||||
unset( $items['logout'] );
|
||||
unset( $items['cancel'] );
|
||||
|
||||
|
||||
if ( is_array( $actions ) ) {
|
||||
$items = array_merge( $items, $actions );
|
||||
}
|
||||
|
||||
|
||||
$items = apply_filters('um_profile_edit_menu_items', $items, um_profile_id() );
|
||||
|
||||
|
||||
$items['cancel'] = $cancel;
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
$items = apply_filters('um_myprofile_edit_menu_items', $items );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo $ultimatemember->menu->new_ui( $args['header_menu'], 'div.um-profile-edit', 'click', $items );
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Show Fields
|
||||
***/
|
||||
add_action('um_main_profile_fields', 'um_add_profile_fields', 100);
|
||||
function um_add_profile_fields($args){
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
if ( $ultimatemember->fields->editing == true ) {
|
||||
|
||||
|
||||
echo $ultimatemember->fields->display( 'profile', $args );
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
$ultimatemember->fields->viewing = true;
|
||||
|
||||
|
||||
echo $ultimatemember->fields->display_view( 'profile', $args );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @form processing
|
||||
***/
|
||||
add_action('um_submit_form_profile', 'um_submit_form_profile', 10);
|
||||
function um_submit_form_profile($args){
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
if ( !isset($ultimatemember->form->errors) ) do_action('um_user_edit_profile', $args);
|
||||
|
||||
do_action('um_user_profile_extra_hook', $args );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Show the submit button (highest priority)
|
||||
***/
|
||||
add_action('um_after_profile_fields', 'um_add_submit_button_to_profile', 1000);
|
||||
function um_add_submit_button_to_profile($args){
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
// DO NOT add when reviewing user's details
|
||||
if ( $ultimatemember->user->preview == true && is_admin() ) return;
|
||||
|
||||
|
||||
// only when editing
|
||||
if ( $ultimatemember->fields->editing == false ) return;
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="um-col-alt">
|
||||
|
||||
|
||||
<?php if ( isset($args['secondary_btn']) && $args['secondary_btn'] != 0 ) { ?>
|
||||
|
||||
|
||||
<div class="um-left um-half"><input type="submit" value="<?php echo $args['primary_btn_word']; ?>" class="um-button" /></div>
|
||||
<div class="um-right um-half"><a href="<?php echo um_edit_my_profile_cancel_uri(); ?>" class="um-button um-alt"><?php echo $args['secondary_btn_word']; ?></a></div>
|
||||
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
|
||||
<div class="um-center"><input type="submit" value="<?php echo $args['primary_btn_word']; ?>" class="um-button" /></div>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<div class="um-clear"></div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @display the available profile tabs
|
||||
***/
|
||||
add_action('um_profile_navbar', 'um_profile_navbar', 9 );
|
||||
function um_profile_navbar( $args ) {
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
if ( !um_get_option('profile_menu') )
|
||||
return;
|
||||
|
||||
|
||||
// get active tabs
|
||||
$tabs = $ultimatemember->profile->tabs_active();
|
||||
|
||||
$tabs = apply_filters('um_user_profile_tabs', $tabs );
|
||||
|
||||
$ultimatemember->user->tabs = $tabs;
|
||||
|
||||
|
||||
// need enough tabs to continue
|
||||
if ( count( $tabs ) <= 1 ) return;
|
||||
|
||||
|
||||
$active_tab = $ultimatemember->profile->active_tab();
|
||||
|
||||
if ( !isset( $tabs[$active_tab] ) ) {
|
||||
@@ -608,7 +614,7 @@
|
||||
$ultimatemember->profile->active_tab = $active_tab;
|
||||
$ultimatemember->profile->active_subnav = null;
|
||||
}
|
||||
|
||||
|
||||
// Move default tab priority
|
||||
$default_tab = um_get_option('profile_menu_default_tab');
|
||||
$dtab = ( isset( $tabs[$default_tab] ) )? $tabs[$default_tab] : 'main';
|
||||
@@ -617,63 +623,63 @@
|
||||
$dtabs[$default_tab] = $dtab;
|
||||
$tabs = $dtabs + $tabs;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="um-profile-nav">
|
||||
|
||||
|
||||
<?php foreach( $tabs as $id => $tab ) {
|
||||
|
||||
|
||||
if ( isset( $tab['hidden'] ) ) continue;
|
||||
|
||||
|
||||
$nav_link = $ultimatemember->permalinks->get_current_url( get_option('permalink_structure') );
|
||||
$nav_link = remove_query_arg( 'um_action', $nav_link );
|
||||
$nav_link = remove_query_arg( 'subnav', $nav_link );
|
||||
$nav_link = add_query_arg('profiletab', $id, $nav_link );
|
||||
|
||||
|
||||
$nav_link = apply_filters("um_profile_menu_link_{$id}", $nav_link);
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="um-profile-nav-item um-profile-nav-<?php echo $id; ?> <?php if ( !um_get_option('profile_menu_icons') ) { echo 'without-icon'; } ?> <?php if ( $id == $active_tab ) { echo 'active'; } ?>">
|
||||
<a href="<?php echo $nav_link; ?>" title="<?php echo $tab['name']; ?>">
|
||||
|
||||
<i class="<?php echo $tab['icon']; ?>"></i>
|
||||
|
||||
|
||||
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
|
||||
<span class="um-tab-notifier uimob500-show uimob340-show uimob800-show"><?php echo $tab['notifier']; ?></span>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<span class="uimob500-hide uimob340-hide uimob800-hide title"><?php echo $tab['name']; ?></span>
|
||||
|
||||
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<div class="um-clear"></div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php foreach( $tabs as $id => $tab ) {
|
||||
|
||||
|
||||
if ( isset( $tab['subnav'] ) && $active_tab == $id ) {
|
||||
|
||||
|
||||
$active_subnav = ( $ultimatemember->profile->active_subnav() ) ? $ultimatemember->profile->active_subnav() : $tab['subnav_default'];
|
||||
|
||||
echo '<div class="um-profile-subnav">';
|
||||
foreach( $tab['subnav'] as $id => $subtab ) {
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<a href="<?php echo add_query_arg('subnav', $id ); ?>" class="<?php if ( $active_subnav == $id ) echo 'active'; ?>"><?php echo $subtab; ?></a>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+67
-66
@@ -5,11 +5,11 @@ class UM_Setup {
|
||||
function __construct() {
|
||||
|
||||
add_action('init', array(&$this, 'install_basics'), 9);
|
||||
|
||||
|
||||
add_action('init', array(&$this, 'install_default_forms'), 9);
|
||||
|
||||
|
||||
add_action('init', array(&$this, 'install_default_roles'), 9);
|
||||
|
||||
|
||||
add_action('init', array(&$this, 'install_posts_roles'), 9);
|
||||
|
||||
$this->core_forms = array(
|
||||
@@ -17,7 +17,7 @@ class UM_Setup {
|
||||
'login',
|
||||
'profile',
|
||||
);
|
||||
|
||||
|
||||
$this->core_directories = array(
|
||||
'members',
|
||||
);
|
||||
@@ -53,7 +53,7 @@ class UM_Setup {
|
||||
'_um_profiles_per_page_mobile' => 6,
|
||||
'_um_core' => 'members',
|
||||
);
|
||||
|
||||
|
||||
$this->core_global_meta_all = array(
|
||||
'_um_primary_btn_color',
|
||||
'_um_primary_btn_hover',
|
||||
@@ -74,7 +74,7 @@ class UM_Setup {
|
||||
'_um_help_tip_color',
|
||||
'_um_secondary_color',
|
||||
);
|
||||
|
||||
|
||||
$this->core_form_meta_all = array(
|
||||
'_um_help_tip_color' => '#ccc',
|
||||
'_um_active_color' => '#3ba1da',
|
||||
@@ -97,6 +97,7 @@ class UM_Setup {
|
||||
'_um_profile_show_name' => 1,
|
||||
'_um_profile_show_social_links' => 0,
|
||||
'_um_profile_show_bio' => 1,
|
||||
'profile_show_html_bio' => 0,
|
||||
'_um_profile_bio_maxchars' => 180,
|
||||
'_um_profile_header_menu' => 'bc',
|
||||
'_um_profile_empty_text' => 1,
|
||||
@@ -162,9 +163,9 @@ class UM_Setup {
|
||||
'_um_directory_header' => __('{total_users} Members','ultimatemember'),
|
||||
'_um_directory_header_single' => __('{total_users} Member','ultimatemember'),
|
||||
);
|
||||
|
||||
|
||||
$this->core_form_meta_all = apply_filters('um_core_form_meta_all', $this->core_form_meta_all );
|
||||
|
||||
|
||||
$this->core_form_meta['register'] = array(
|
||||
'_um_custom_fields' => 'a:6:{s:10:"user_login";a:15:{s:5:"title";s:8:"Username";s:7:"metakey";s:10:"user_login";s:4:"type";s:4:"text";s:5:"label";s:8:"Username";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";i:0;s:8:"validate";s:15:"unique_username";s:9:"min_chars";i:3;s:9:"max_chars";i:24;s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"user_email";a:13:{s:5:"title";s:14:"E-mail Address";s:7:"metakey";s:10:"user_email";s:4:"type";s:4:"text";s:5:"label";s:14:"E-mail Address";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";i:1;s:8:"validate";s:12:"unique_email";s:8:"position";s:1:"4";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";i:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"5";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"first_name";a:12:{s:5:"title";s:10:"First Name";s:7:"metakey";s:10:"first_name";s:4:"type";s:4:"text";s:5:"label";s:10:"First Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";i:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"last_name";a:12:{s:5:"title";s:9:"Last Name";s:7:"metakey";s:9:"last_name";s:4:"type";s:4:"text";s:5:"label";s:9:"Last Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";i:1;s:8:"position";s:1:"3";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
|
||||
'_um_mode' => 'register',
|
||||
@@ -204,7 +205,7 @@ class UM_Setup {
|
||||
'after_login' => 'redirect_admin',
|
||||
'after_logout' => 'redirect_home',
|
||||
);
|
||||
|
||||
|
||||
// non-admin permissions
|
||||
$this->nonadmin_perms = array(
|
||||
'core' => 'member',
|
||||
@@ -216,9 +217,9 @@ class UM_Setup {
|
||||
'can_access_private_profile' => 0,
|
||||
'after_login' => 'redirect_profile',
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Get default permissions
|
||||
***/
|
||||
@@ -232,7 +233,7 @@ class UM_Setup {
|
||||
return $perms;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Basics
|
||||
***/
|
||||
@@ -240,7 +241,7 @@ class UM_Setup {
|
||||
if ( !get_option('__ultimatemember_sitekey') )
|
||||
update_option('__ultimatemember_sitekey', str_replace( array('http://','https://'), '', sanitize_user( get_bloginfo('url') ) ) . '-' . wp_generate_password( 20, false ) );
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Default Forms
|
||||
***/
|
||||
@@ -248,19 +249,19 @@ class UM_Setup {
|
||||
global $wpdb, $ultimatemember;
|
||||
|
||||
if ( current_user_can('manage_options') && um_user('ID') && !get_option('um_is_installed') ) {
|
||||
|
||||
|
||||
update_option('um_is_installed', 1);
|
||||
|
||||
|
||||
// Install Core Forms
|
||||
foreach($this->core_forms as $id ) {
|
||||
|
||||
|
||||
/**
|
||||
If page does not exist
|
||||
Create it
|
||||
**/
|
||||
$page_exists = $ultimatemember->query->find_post_id('um_form','_um_core', $id);
|
||||
if ( !$page_exists ) {
|
||||
|
||||
|
||||
if ( $id == 'register' ) {
|
||||
$title = 'Default Registration';
|
||||
} else if ( $id == 'login' ) {
|
||||
@@ -268,16 +269,16 @@ class UM_Setup {
|
||||
} else {
|
||||
$title = 'Default Profile';
|
||||
}
|
||||
|
||||
|
||||
$form = array(
|
||||
'post_type' => 'um_form',
|
||||
'post_title' => $title,
|
||||
'post_status' => 'publish',
|
||||
'post_author' => um_user('ID'),
|
||||
);
|
||||
|
||||
|
||||
$form_id = wp_insert_post( $form );
|
||||
|
||||
|
||||
foreach( $this->core_form_meta[$id] as $key => $value ) {
|
||||
if ( $key == '_um_custom_fields' ) {
|
||||
$array = unserialize( $value );
|
||||
@@ -286,38 +287,38 @@ class UM_Setup {
|
||||
update_post_meta($form_id, $key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->setup_shortcode[$id] = '[ultimatemember form_id='.$form_id.']';
|
||||
|
||||
$core_forms[ $form_id ] = $form_id;
|
||||
|
||||
|
||||
}
|
||||
/** DONE **/
|
||||
|
||||
|
||||
}
|
||||
if ( isset( $core_forms ) ) update_option('um_core_forms', $core_forms);
|
||||
|
||||
|
||||
// Install Core Directories
|
||||
foreach($this->core_directories as $id ) {
|
||||
|
||||
|
||||
/**
|
||||
If page does not exist
|
||||
Create it
|
||||
**/
|
||||
$page_exists = $ultimatemember->query->find_post_id('um_directory','_um_core', $id);
|
||||
if ( !$page_exists ) {
|
||||
|
||||
|
||||
$title = 'Members';
|
||||
|
||||
|
||||
$form = array(
|
||||
'post_type' => 'um_directory',
|
||||
'post_title' => $title,
|
||||
'post_status' => 'publish',
|
||||
'post_author' => um_user('ID'),
|
||||
);
|
||||
|
||||
|
||||
$form_id = wp_insert_post( $form );
|
||||
|
||||
|
||||
foreach( $this->core_directory_meta[$id] as $key => $value ) {
|
||||
if ( $key == '_um_custom_fields' ) {
|
||||
$array = unserialize( $value );
|
||||
@@ -326,17 +327,17 @@ class UM_Setup {
|
||||
update_post_meta($form_id, $key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->setup_shortcode[$id] = '[ultimatemember form_id='.$form_id.']';
|
||||
|
||||
$core_directories[ $form_id ] = $form_id;
|
||||
|
||||
|
||||
}
|
||||
/** DONE **/
|
||||
|
||||
|
||||
}
|
||||
if ( isset( $core_directories ) ) update_option('um_core_directories', $core_directories);
|
||||
|
||||
|
||||
// Install Core Pages
|
||||
foreach($this->core_pages as $slug => $array ) {
|
||||
|
||||
@@ -346,7 +347,7 @@ class UM_Setup {
|
||||
**/
|
||||
$page_exists = $ultimatemember->query->find_post_id('page','_um_core', $slug);
|
||||
if ( !$page_exists ) {
|
||||
|
||||
|
||||
if ( $slug == 'logout' ) {
|
||||
$content = '';
|
||||
} else if ( $slug == 'account' ) {
|
||||
@@ -358,7 +359,7 @@ class UM_Setup {
|
||||
} else {
|
||||
$content = $this->setup_shortcode[$slug];
|
||||
}
|
||||
|
||||
|
||||
$user_page = array(
|
||||
'post_title' => $array['title'],
|
||||
'post_content' => $content,
|
||||
@@ -368,17 +369,17 @@ class UM_Setup {
|
||||
'post_author' => um_user('ID'),
|
||||
'comment_status' => 'closed'
|
||||
);
|
||||
|
||||
|
||||
$post_id = wp_insert_post( $user_page );
|
||||
wp_update_post( array('ID' => $post_id, 'post_type' => 'page' ) );
|
||||
|
||||
|
||||
update_post_meta($post_id, '_um_core', $slug);
|
||||
|
||||
|
||||
$core_pages[ $slug ] = $post_id;
|
||||
|
||||
|
||||
}
|
||||
/** DONE **/
|
||||
|
||||
|
||||
}
|
||||
if ( isset( $core_pages ) ) {
|
||||
update_option('um_core_pages', $core_pages);
|
||||
@@ -390,28 +391,28 @@ class UM_Setup {
|
||||
update_option('um_options', $options );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @First setup of core roles
|
||||
***/
|
||||
function install_default_roles(){
|
||||
|
||||
|
||||
if ( !get_option('um_first_setup_roles') ) {
|
||||
|
||||
update_option('um_first_setup_roles', 1);
|
||||
|
||||
|
||||
$users = get_users( array('fields' => 'ID') );
|
||||
foreach( $users as $id ) {
|
||||
|
||||
delete_user_meta( $id, 'account_status' );
|
||||
delete_user_meta( $id, 'role' );
|
||||
|
||||
|
||||
update_user_meta( $id, 'account_status', 'approved' );
|
||||
|
||||
|
||||
if ( !is_super_admin( $id ) ) {
|
||||
if ( is_numeric( $id ) ) {
|
||||
update_user_meta( $id, 'role', 'member' );
|
||||
@@ -421,11 +422,11 @@ class UM_Setup {
|
||||
update_user_meta( $id, 'role', 'admin' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ( !get_option('um_hashed_passwords_fix') ) {
|
||||
update_option('um_hashed_passwords_fix', 1);
|
||||
$users = get_users( array('fields' => 'ID') );
|
||||
@@ -433,26 +434,26 @@ class UM_Setup {
|
||||
delete_user_meta( $id, '_um_cool_but_hard_to_guess_plain_pw' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @Build default roles
|
||||
***/
|
||||
function install_posts_roles(){
|
||||
|
||||
|
||||
global $wpdb, $ultimatemember;
|
||||
|
||||
|
||||
if ( !isset( $ultimatemember->query ) || ! method_exists( $ultimatemember->query, 'get_roles' ) ) {
|
||||
return;
|
||||
} else {
|
||||
//die('Method loaded!');
|
||||
}
|
||||
|
||||
|
||||
$admin = $ultimatemember->query->find_post_id('um_role','_um_core','admin');
|
||||
|
||||
if ( !$admin && current_user_can('manage_options') && um_user('ID') ){
|
||||
|
||||
|
||||
$admin_role = array(
|
||||
'post_title' => 'Admin',
|
||||
'post_name' => 'admin',
|
||||
@@ -460,17 +461,17 @@ class UM_Setup {
|
||||
'post_status' => 'publish',
|
||||
'post_author' => um_user('ID'),
|
||||
);
|
||||
|
||||
|
||||
$post_id = wp_insert_post( $admin_role );
|
||||
|
||||
|
||||
foreach( $this->get_initial_permissions('admin') as $key => $value ) update_post_meta($post_id, "_um_" . $key, $value);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$member = $ultimatemember->query->find_post_id('um_role','_um_core','member');
|
||||
|
||||
|
||||
if ( !$member && current_user_can('manage_options') && um_user('ID') ){
|
||||
|
||||
|
||||
$member_role = array(
|
||||
'post_title' => 'Member',
|
||||
'post_name' => 'member',
|
||||
@@ -478,13 +479,13 @@ class UM_Setup {
|
||||
'post_status' => 'publish',
|
||||
'post_author' => um_user('ID'),
|
||||
);
|
||||
|
||||
|
||||
$post_id = wp_insert_post( $member_role );
|
||||
|
||||
|
||||
foreach( $this->get_initial_permissions('member') as $key => $value ) update_post_meta($post_id, "_um_" . $key, $value);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+179
-169
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user