Version Description
Download this release
Release Info
Developer | ultimatemember |
Plugin | Ultimate Member – User Profile & Membership Plugin |
Version | 1.3.33 |
Comparing to | |
See all releases |
Code changes from version 1.3.32 to 1.3.33
- admin/assets/css/um-admin-dashboard.css +11 -8
- admin/assets/css/um-admin-redux.css +9 -6
- admin/core/lib/ReduxFramework/ReduxCore/inc/class.redux_helpers.php +1 -1
- admin/core/um-admin-notices.php +73 -68
- core/um-actions-access.php +1 -1
- core/um-actions-members.php +9 -1
- core/um-fields.php +4 -1
- core/um-members.php +62 -59
- core/um-permalinks.php +59 -53
- core/um-shortcodes.php +81 -80
- index.php +3 -3
- readme.txt +8 -2
- um-config.php +1 -1
- um-init.php +9 -1
admin/assets/css/um-admin-dashboard.css
CHANGED
@@ -9,15 +9,18 @@
|
|
9 |
margin-left: 0;
|
10 |
}
|
11 |
|
12 |
-
#um-metaboxes-general
|
13 |
-
font-size:
|
|
|
14 |
font-weight: 400;
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
}
|
22 |
|
23 |
.wrap a.red, .wrap span.red {color:#C74A4A}
|
9 |
margin-left: 0;
|
10 |
}
|
11 |
|
12 |
+
#um-metaboxes-general h2 sup {
|
13 |
+
font-size: 14px;
|
14 |
+
position: relative;
|
15 |
font-weight: 400;
|
16 |
+
background: #3ba1da;
|
17 |
+
color: #fff !important;
|
18 |
+
padding: 2px 4px !important;
|
19 |
+
border-radius: 3px;
|
20 |
+
position: relative;
|
21 |
+
top: 5px;
|
22 |
+
left: 3px;
|
23 |
+
border: none !important;
|
24 |
}
|
25 |
|
26 |
.wrap a.red, .wrap span.red {color:#C74A4A}
|
admin/assets/css/um-admin-redux.css
CHANGED
@@ -68,14 +68,16 @@
|
|
68 |
}
|
69 |
|
70 |
#redux-header .display_header span {
|
71 |
-
font-size:
|
72 |
position: relative;
|
73 |
-
top: -8px;
|
74 |
-
left: -2px;
|
75 |
-
padding-left: 0;
|
76 |
font-weight: 400;
|
77 |
-
|
78 |
-
color: #
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
#redux-header h2 {
|
@@ -86,6 +88,7 @@
|
|
86 |
font-weight: 400;
|
87 |
padding: 1px 15px 4px 0px;
|
88 |
line-height: 29px;
|
|
|
89 |
}
|
90 |
|
91 |
#redux-share {margin-top: 11px !important}
|
68 |
}
|
69 |
|
70 |
#redux-header .display_header span {
|
71 |
+
font-size: 14px;
|
72 |
position: relative;
|
|
|
|
|
|
|
73 |
font-weight: 400;
|
74 |
+
background: #3ba1da;
|
75 |
+
color: #fff !important;
|
76 |
+
padding: 2px 4px !important;
|
77 |
+
border-radius: 3px;
|
78 |
+
position: relative;
|
79 |
+
top: -3px;
|
80 |
+
left: 0;
|
81 |
}
|
82 |
|
83 |
#redux-header h2 {
|
88 |
font-weight: 400;
|
89 |
padding: 1px 15px 4px 0px;
|
90 |
line-height: 29px;
|
91 |
+
margin: 5px 0 0 0;
|
92 |
}
|
93 |
|
94 |
#redux-share {margin-top: 11px !important}
|
admin/core/lib/ReduxFramework/ReduxCore/inc/class.redux_helpers.php
CHANGED
@@ -70,7 +70,7 @@
|
|
70 |
}
|
71 |
|
72 |
public static function isWpDebug() {
|
73 |
-
return
|
74 |
}
|
75 |
|
76 |
public static function getTrackingObject() {
|
70 |
}
|
71 |
|
72 |
public static function isWpDebug() {
|
73 |
+
return 0;
|
74 |
}
|
75 |
|
76 |
public static function getTrackingObject() {
|
admin/core/um-admin-notices.php
CHANGED
@@ -3,152 +3,152 @@
|
|
3 |
class UM_Admin_Notices {
|
4 |
|
5 |
function __construct() {
|
6 |
-
|
7 |
add_action('admin_init', array(&$this, 'create_languages_folder') );
|
8 |
|
9 |
add_action('admin_notices', array(&$this, 'main_notices'), 1);
|
10 |
-
|
11 |
add_action('admin_notices', array(&$this, 'localize_note'), 2);
|
12 |
-
|
13 |
add_action('admin_notices', array(&$this, 'show_update_messages'), 10);
|
14 |
-
|
15 |
}
|
16 |
-
|
17 |
/***
|
18 |
*** @to store plugin languages
|
19 |
***/
|
20 |
function create_languages_folder() {
|
21 |
-
|
22 |
global $ultimatemember;
|
23 |
-
|
24 |
$path = $ultimatemember->files->upload_basedir;
|
25 |
$path = str_replace('/uploads/ultimatemember','',$path);
|
26 |
$path = $path . '/languages/plugins/';
|
27 |
$path = str_replace('//','/',$path);
|
28 |
-
|
29 |
if ( !file_exists( $path ) ) {
|
30 |
$old = umask(0);
|
31 |
@mkdir( $path, 0777, true);
|
32 |
umask($old);
|
33 |
}
|
34 |
-
|
35 |
}
|
36 |
-
|
37 |
/***
|
38 |
*** @show main notices
|
39 |
***/
|
40 |
function main_notices(){
|
41 |
global $ultimatemember;
|
42 |
$hide_register_notice = get_option('um_can_register_notice');
|
43 |
-
|
44 |
if ( !get_option('um_passwords_secured') ) {
|
45 |
echo '<div class="updated error"><p>';
|
46 |
-
|
47 |
echo sprintf(__( 'Secure your database by removing hardcoded user passwords now. Click <a href="%s">here</a> to secure your database.', 'ultimatemember' ), add_query_arg('um_adm_action', 'um_passwords_secured') );
|
48 |
-
|
49 |
echo '</p></div>';
|
50 |
}
|
51 |
-
|
52 |
if ( !get_option('users_can_register') && !$hide_register_notice ) {
|
53 |
-
|
54 |
echo '<div class="updated" style="border-color: #3ba1da;"><p>';
|
55 |
-
|
56 |
echo sprintf(__( 'Registration is disabled. Please go to the <a href="%s">general settings</a> page in the WordPress admin and select anyone can register. <a href="%s">Hide this notice</a>', 'ultimatemember' ), admin_url('options-general.php'), add_query_arg('um_adm_action', 'um_can_register_notice') );
|
57 |
-
|
58 |
echo '</p></div>';
|
59 |
-
|
60 |
}
|
61 |
-
|
62 |
$hide_exif_notice = get_option('um_hide_exif_notice');
|
63 |
-
|
64 |
if ( !extension_loaded('exif') && !$hide_exif_notice ) {
|
65 |
-
|
66 |
echo '<div class="updated" style="border-color: #3ba1da;"><p>';
|
67 |
-
|
68 |
echo sprintf(__( 'Exif is not enabled on your server. Mobile photo uploads will not be rotated correctly until you enable the exif extension. <a href="%s">Hide this notice</a>', 'ultimatemember' ), add_query_arg('um_adm_action', 'um_hide_exif_notice') );
|
69 |
-
|
70 |
echo '</p></div>';
|
71 |
-
|
72 |
}
|
73 |
-
|
74 |
// Regarding page setup
|
75 |
$pages = $ultimatemember->permalinks->core;
|
76 |
if ( $pages && is_array( $pages ) ) {
|
77 |
-
|
78 |
$err = false;
|
79 |
-
|
80 |
foreach( $pages as $slug => $page_id ) {
|
81 |
-
|
82 |
$page = get_post( $page_id );
|
83 |
if ( !isset( $page->ID ) && in_array( $slug, array( 'user','account','members','register','login','logout','password-reset' ) ) ) {
|
84 |
$err = true;
|
85 |
}
|
86 |
-
|
87 |
}
|
88 |
-
|
89 |
if ( $err ) {
|
90 |
echo '<div class="updated" style="border-color: #3ba1da;"><p>' . __('One or more of your Ultimate Member pages are not correctly setup. Please visit <strong>Ultimate Member > Settings</strong> to re-assign your missing pages.','ultimatemember') . '</p></div>';
|
91 |
}
|
92 |
-
|
93 |
if ( isset( $pages['user'] ) ) {
|
94 |
$test = get_post( $pages['user'] );
|
95 |
if ( isset( $test->post_parent ) && $test->post_parent > 0 ) {
|
96 |
echo '<div class="updated" style="border-color: #3ba1da;"><p>' . __('Ultimate Member Setup Error: User page can not be a child page.','ultimatemember') . '</p></div>';
|
97 |
}
|
98 |
}
|
99 |
-
|
100 |
if ( isset( $pages['account'] ) ) {
|
101 |
$test = get_post( $pages['account'] );
|
102 |
if ( isset( $test->post_parent ) && $test->post_parent > 0 ) {
|
103 |
echo '<div class="updated" style="border-color: #3ba1da;"><p>' . __('Ultimate Member Setup Error: Account page can not be a child page.','ultimatemember') . '</p></div>';
|
104 |
}
|
105 |
}
|
106 |
-
|
107 |
}
|
108 |
-
|
109 |
do_action('um_admin_after_main_notices');
|
110 |
-
|
111 |
}
|
112 |
-
|
113 |
-
|
114 |
/***
|
115 |
*** @localization notice
|
116 |
***/
|
117 |
function localize_note() {
|
118 |
global $ultimatemember;
|
119 |
-
|
120 |
$locale = get_option('WPLANG');
|
121 |
if ( !$locale ) return;
|
122 |
if ( strstr( $locale, 'en_' ) ) return; // really, english!
|
123 |
if ( file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) ) return;
|
124 |
-
|
125 |
if ( isset( $ultimatemember->available_languages[$locale] ) ) {
|
126 |
-
|
127 |
$download_uri = add_query_arg('um_adm_action', 'um_language_downloader');
|
128 |
-
|
129 |
echo '<div class="updated" style="border-color: #3ba1da;"><p>';
|
130 |
-
|
131 |
echo sprintf(__('Your site language is <strong>%1$s</strong>. Good news! Ultimate Member is already available in <strong>%2$s language</strong>. <a href="%3$s">Download the translation</a> files and start using the plugin in your language now.','ultimatemember'), $locale, $ultimatemember->available_languages[$locale], $download_uri );
|
132 |
-
|
133 |
echo '</p></div>';
|
134 |
-
|
135 |
} else {
|
136 |
-
|
137 |
$hide_locale_notice = get_option('um_hide_locale_notice');
|
138 |
if ( !$hide_locale_notice ) {
|
139 |
-
|
140 |
echo '<div class="updated" style="border-color: #3ba1da;"><p>';
|
141 |
-
|
142 |
echo sprintf(__('Ultimate Member has not yet been translated to your langeuage: <strong>%1$s</strong>. If you have translated the plugin you need put these files <code>ultimatemember-%1$s.po and ultimatemember-%1$s.mo</code> in <strong>/wp-content/languages/plugins/</strong> for the plugin to be translated in your language. <a href="%2$s">Hide this notice</a>','ultimatemember'), $locale, add_query_arg('um_adm_action', 'um_hide_locale_notice') );
|
143 |
-
|
144 |
echo '</p></div>';
|
145 |
-
|
146 |
}
|
147 |
-
|
148 |
}
|
149 |
-
|
150 |
}
|
151 |
-
|
152 |
/***
|
153 |
*** @updating users
|
154 |
***/
|
@@ -158,56 +158,61 @@ class UM_Admin_Notices {
|
|
158 |
|
159 |
$update = $_REQUEST['update'];
|
160 |
switch($update) {
|
161 |
-
|
162 |
case 'confirm_delete':
|
163 |
$wp_http_referer = isset( $_REQUEST['_wp_http_referer'] ) ? $_REQUEST['_wp_http_referer']: '';
|
164 |
$confirm_uri = sanitize_text_field( urldecode( $wp_http_referer ) );
|
|
|
|
|
|
|
|
|
|
|
165 |
$users = '';
|
166 |
-
|
167 |
if( isset( $_REQUEST['user'] ) ){
|
168 |
foreach( $_REQUEST['user'] as $user_id ) {
|
169 |
$user = get_userdata( $user_id );
|
170 |
$users .= '#' . $user_id . ': ' . $user->user_login . '<br />';
|
171 |
}
|
172 |
}
|
173 |
-
|
174 |
$ignore = admin_url('users.php');
|
175 |
-
|
176 |
$messages[0]['err_content'] = sprintf(__('Are you sure you want to delete the selected user(s)? The following users will be deleted: <p>%s</p> <strong>This cannot be undone!</strong>','ultimatemember'), $users);
|
177 |
$messages[0]['err_content'] .= '<p><a href="'. esc_html( $confirm_uri ) .'" class="button-primary">' . __('Remove','ultimatemember') . '</a> <a href="'.$ignore.'" class="button">' . __('Undo','ultimatemember') . '</a></p>';
|
178 |
-
|
179 |
break;
|
180 |
-
|
181 |
case 'language_updated':
|
182 |
$messages[0]['content'] = __('Your translation files have been updated successfully.','ultimatemember');
|
183 |
break;
|
184 |
-
|
185 |
case 'purged_temp':
|
186 |
$messages[0]['content'] = __('Your temp uploads directory is now clean.','ultimatemember');
|
187 |
break;
|
188 |
-
|
189 |
case 'cleared_cache':
|
190 |
$messages[0]['content'] = __('Your user cache is now removed.','ultimatemember');
|
191 |
break;
|
192 |
-
|
193 |
case 'form_duplicated':
|
194 |
$messages[0]['content'] = __('The form has been duplicated successfully.','ultimatemember');
|
195 |
break;
|
196 |
-
|
197 |
case 'user_updated':
|
198 |
$messages[0]['content'] = __('User has been updated.','ultimatemember');
|
199 |
break;
|
200 |
-
|
201 |
case 'users_updated':
|
202 |
$messages[0]['content'] = __('Users have been updated.','ultimatemember');
|
203 |
break;
|
204 |
-
|
205 |
case 'err_users_updated':
|
206 |
$messages[0]['err_content'] = __('Super administrators cannot be modified.','ultimatemember');
|
207 |
$messages[1]['content'] = __('Other users have been updated.','ultimatemember');
|
208 |
-
|
209 |
}
|
210 |
-
|
211 |
if ( !empty( $messages ) ) {
|
212 |
foreach( $messages as $message ) {
|
213 |
if ( isset($message['err_content'])) {
|
@@ -217,7 +222,7 @@ class UM_Admin_Notices {
|
|
217 |
}
|
218 |
}
|
219 |
}
|
220 |
-
|
221 |
}
|
222 |
|
223 |
-
}
|
3 |
class UM_Admin_Notices {
|
4 |
|
5 |
function __construct() {
|
6 |
+
|
7 |
add_action('admin_init', array(&$this, 'create_languages_folder') );
|
8 |
|
9 |
add_action('admin_notices', array(&$this, 'main_notices'), 1);
|
10 |
+
|
11 |
add_action('admin_notices', array(&$this, 'localize_note'), 2);
|
12 |
+
|
13 |
add_action('admin_notices', array(&$this, 'show_update_messages'), 10);
|
14 |
+
|
15 |
}
|
16 |
+
|
17 |
/***
|
18 |
*** @to store plugin languages
|
19 |
***/
|
20 |
function create_languages_folder() {
|
21 |
+
|
22 |
global $ultimatemember;
|
23 |
+
|
24 |
$path = $ultimatemember->files->upload_basedir;
|
25 |
$path = str_replace('/uploads/ultimatemember','',$path);
|
26 |
$path = $path . '/languages/plugins/';
|
27 |
$path = str_replace('//','/',$path);
|
28 |
+
|
29 |
if ( !file_exists( $path ) ) {
|
30 |
$old = umask(0);
|
31 |
@mkdir( $path, 0777, true);
|
32 |
umask($old);
|
33 |
}
|
34 |
+
|
35 |
}
|
36 |
+
|
37 |
/***
|
38 |
*** @show main notices
|
39 |
***/
|
40 |
function main_notices(){
|
41 |
global $ultimatemember;
|
42 |
$hide_register_notice = get_option('um_can_register_notice');
|
43 |
+
|
44 |
if ( !get_option('um_passwords_secured') ) {
|
45 |
echo '<div class="updated error"><p>';
|
46 |
+
|
47 |
echo sprintf(__( 'Secure your database by removing hardcoded user passwords now. Click <a href="%s">here</a> to secure your database.', 'ultimatemember' ), add_query_arg('um_adm_action', 'um_passwords_secured') );
|
48 |
+
|
49 |
echo '</p></div>';
|
50 |
}
|
51 |
+
|
52 |
if ( !get_option('users_can_register') && !$hide_register_notice ) {
|
53 |
+
|
54 |
echo '<div class="updated" style="border-color: #3ba1da;"><p>';
|
55 |
+
|
56 |
echo sprintf(__( 'Registration is disabled. Please go to the <a href="%s">general settings</a> page in the WordPress admin and select anyone can register. <a href="%s">Hide this notice</a>', 'ultimatemember' ), admin_url('options-general.php'), add_query_arg('um_adm_action', 'um_can_register_notice') );
|
57 |
+
|
58 |
echo '</p></div>';
|
59 |
+
|
60 |
}
|
61 |
+
|
62 |
$hide_exif_notice = get_option('um_hide_exif_notice');
|
63 |
+
|
64 |
if ( !extension_loaded('exif') && !$hide_exif_notice ) {
|
65 |
+
|
66 |
echo '<div class="updated" style="border-color: #3ba1da;"><p>';
|
67 |
+
|
68 |
echo sprintf(__( 'Exif is not enabled on your server. Mobile photo uploads will not be rotated correctly until you enable the exif extension. <a href="%s">Hide this notice</a>', 'ultimatemember' ), add_query_arg('um_adm_action', 'um_hide_exif_notice') );
|
69 |
+
|
70 |
echo '</p></div>';
|
71 |
+
|
72 |
}
|
73 |
+
|
74 |
// Regarding page setup
|
75 |
$pages = $ultimatemember->permalinks->core;
|
76 |
if ( $pages && is_array( $pages ) ) {
|
77 |
+
|
78 |
$err = false;
|
79 |
+
|
80 |
foreach( $pages as $slug => $page_id ) {
|
81 |
+
|
82 |
$page = get_post( $page_id );
|
83 |
if ( !isset( $page->ID ) && in_array( $slug, array( 'user','account','members','register','login','logout','password-reset' ) ) ) {
|
84 |
$err = true;
|
85 |
}
|
86 |
+
|
87 |
}
|
88 |
+
|
89 |
if ( $err ) {
|
90 |
echo '<div class="updated" style="border-color: #3ba1da;"><p>' . __('One or more of your Ultimate Member pages are not correctly setup. Please visit <strong>Ultimate Member > Settings</strong> to re-assign your missing pages.','ultimatemember') . '</p></div>';
|
91 |
}
|
92 |
+
|
93 |
if ( isset( $pages['user'] ) ) {
|
94 |
$test = get_post( $pages['user'] );
|
95 |
if ( isset( $test->post_parent ) && $test->post_parent > 0 ) {
|
96 |
echo '<div class="updated" style="border-color: #3ba1da;"><p>' . __('Ultimate Member Setup Error: User page can not be a child page.','ultimatemember') . '</p></div>';
|
97 |
}
|
98 |
}
|
99 |
+
|
100 |
if ( isset( $pages['account'] ) ) {
|
101 |
$test = get_post( $pages['account'] );
|
102 |
if ( isset( $test->post_parent ) && $test->post_parent > 0 ) {
|
103 |
echo '<div class="updated" style="border-color: #3ba1da;"><p>' . __('Ultimate Member Setup Error: Account page can not be a child page.','ultimatemember') . '</p></div>';
|
104 |
}
|
105 |
}
|
106 |
+
|
107 |
}
|
108 |
+
|
109 |
do_action('um_admin_after_main_notices');
|
110 |
+
|
111 |
}
|
112 |
+
|
113 |
+
|
114 |
/***
|
115 |
*** @localization notice
|
116 |
***/
|
117 |
function localize_note() {
|
118 |
global $ultimatemember;
|
119 |
+
|
120 |
$locale = get_option('WPLANG');
|
121 |
if ( !$locale ) return;
|
122 |
if ( strstr( $locale, 'en_' ) ) return; // really, english!
|
123 |
if ( file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) ) return;
|
124 |
+
|
125 |
if ( isset( $ultimatemember->available_languages[$locale] ) ) {
|
126 |
+
|
127 |
$download_uri = add_query_arg('um_adm_action', 'um_language_downloader');
|
128 |
+
|
129 |
echo '<div class="updated" style="border-color: #3ba1da;"><p>';
|
130 |
+
|
131 |
echo sprintf(__('Your site language is <strong>%1$s</strong>. Good news! Ultimate Member is already available in <strong>%2$s language</strong>. <a href="%3$s">Download the translation</a> files and start using the plugin in your language now.','ultimatemember'), $locale, $ultimatemember->available_languages[$locale], $download_uri );
|
132 |
+
|
133 |
echo '</p></div>';
|
134 |
+
|
135 |
} else {
|
136 |
+
|
137 |
$hide_locale_notice = get_option('um_hide_locale_notice');
|
138 |
if ( !$hide_locale_notice ) {
|
139 |
+
|
140 |
echo '<div class="updated" style="border-color: #3ba1da;"><p>';
|
141 |
+
|
142 |
echo sprintf(__('Ultimate Member has not yet been translated to your langeuage: <strong>%1$s</strong>. If you have translated the plugin you need put these files <code>ultimatemember-%1$s.po and ultimatemember-%1$s.mo</code> in <strong>/wp-content/languages/plugins/</strong> for the plugin to be translated in your language. <a href="%2$s">Hide this notice</a>','ultimatemember'), $locale, add_query_arg('um_adm_action', 'um_hide_locale_notice') );
|
143 |
+
|
144 |
echo '</p></div>';
|
145 |
+
|
146 |
}
|
147 |
+
|
148 |
}
|
149 |
+
|
150 |
}
|
151 |
+
|
152 |
/***
|
153 |
*** @updating users
|
154 |
***/
|
158 |
|
159 |
$update = $_REQUEST['update'];
|
160 |
switch($update) {
|
161 |
+
|
162 |
case 'confirm_delete':
|
163 |
$wp_http_referer = isset( $_REQUEST['_wp_http_referer'] ) ? $_REQUEST['_wp_http_referer']: '';
|
164 |
$confirm_uri = sanitize_text_field( urldecode( $wp_http_referer ) );
|
165 |
+
$confirm_uri = $confirm_uri ?: admin_url('users.php?' . http_build_query(array(
|
166 |
+
'um_adm_action' => 'delete_users',
|
167 |
+
'user' => array_map('intval', (array) $_REQUEST['user']),
|
168 |
+
'confirm' => 1
|
169 |
+
)));
|
170 |
$users = '';
|
171 |
+
|
172 |
if( isset( $_REQUEST['user'] ) ){
|
173 |
foreach( $_REQUEST['user'] as $user_id ) {
|
174 |
$user = get_userdata( $user_id );
|
175 |
$users .= '#' . $user_id . ': ' . $user->user_login . '<br />';
|
176 |
}
|
177 |
}
|
178 |
+
|
179 |
$ignore = admin_url('users.php');
|
180 |
+
|
181 |
$messages[0]['err_content'] = sprintf(__('Are you sure you want to delete the selected user(s)? The following users will be deleted: <p>%s</p> <strong>This cannot be undone!</strong>','ultimatemember'), $users);
|
182 |
$messages[0]['err_content'] .= '<p><a href="'. esc_html( $confirm_uri ) .'" class="button-primary">' . __('Remove','ultimatemember') . '</a> <a href="'.$ignore.'" class="button">' . __('Undo','ultimatemember') . '</a></p>';
|
183 |
+
|
184 |
break;
|
185 |
+
|
186 |
case 'language_updated':
|
187 |
$messages[0]['content'] = __('Your translation files have been updated successfully.','ultimatemember');
|
188 |
break;
|
189 |
+
|
190 |
case 'purged_temp':
|
191 |
$messages[0]['content'] = __('Your temp uploads directory is now clean.','ultimatemember');
|
192 |
break;
|
193 |
+
|
194 |
case 'cleared_cache':
|
195 |
$messages[0]['content'] = __('Your user cache is now removed.','ultimatemember');
|
196 |
break;
|
197 |
+
|
198 |
case 'form_duplicated':
|
199 |
$messages[0]['content'] = __('The form has been duplicated successfully.','ultimatemember');
|
200 |
break;
|
201 |
+
|
202 |
case 'user_updated':
|
203 |
$messages[0]['content'] = __('User has been updated.','ultimatemember');
|
204 |
break;
|
205 |
+
|
206 |
case 'users_updated':
|
207 |
$messages[0]['content'] = __('Users have been updated.','ultimatemember');
|
208 |
break;
|
209 |
+
|
210 |
case 'err_users_updated':
|
211 |
$messages[0]['err_content'] = __('Super administrators cannot be modified.','ultimatemember');
|
212 |
$messages[1]['content'] = __('Other users have been updated.','ultimatemember');
|
213 |
+
|
214 |
}
|
215 |
+
|
216 |
if ( !empty( $messages ) ) {
|
217 |
foreach( $messages as $message ) {
|
218 |
if ( isset($message['err_content'])) {
|
222 |
}
|
223 |
}
|
224 |
}
|
225 |
+
|
226 |
}
|
227 |
|
228 |
+
}
|
core/um-actions-access.php
CHANGED
@@ -63,7 +63,7 @@
|
|
63 |
add_action('um_access_category_settings','um_access_category_settings');
|
64 |
function um_access_category_settings() {
|
65 |
global $post, $wp_query, $ultimatemember;
|
66 |
-
if ( is_single() || get_the_category() ) {
|
67 |
|
68 |
|
69 |
$categories = get_the_category();
|
63 |
add_action('um_access_category_settings','um_access_category_settings');
|
64 |
function um_access_category_settings() {
|
65 |
global $post, $wp_query, $ultimatemember;
|
66 |
+
if ( is_single() || get_the_category() && ! is_front_page() && ! is_home() ) {
|
67 |
|
68 |
|
69 |
$categories = get_the_category();
|
core/um-actions-members.php
CHANGED
@@ -94,7 +94,15 @@
|
|
94 |
global $ultimatemember;
|
95 |
extract( $args );
|
96 |
|
97 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
<div class="um-members-intro">
|
100 |
|
94 |
global $ultimatemember;
|
95 |
extract( $args );
|
96 |
|
97 |
+
if ( isset($_REQUEST['um_search']) ) {
|
98 |
+
$is_filtering = 1;
|
99 |
+
} else if ( $ultimatemember->is_filtering == 1 ) {
|
100 |
+
$is_filtering = 1;
|
101 |
+
} else {
|
102 |
+
$is_filtering = 0;
|
103 |
+
}
|
104 |
+
|
105 |
+
if ( um_members('header') && $is_filtering && um_members('users_per_page') ) { ?>
|
106 |
|
107 |
<div class="um-members-intro">
|
108 |
|
core/um-fields.php
CHANGED
@@ -593,6 +593,7 @@ class UM_Fields {
|
|
593 |
}
|
594 |
|
595 |
$array['classes'] .= ' um-field-' . $key;
|
|
|
596 |
|
597 |
switch( $array['type'] ) {
|
598 |
|
@@ -1558,7 +1559,9 @@ class UM_Fields {
|
|
1558 |
|
1559 |
$v = rtrim($v);
|
1560 |
|
1561 |
-
|
|
|
|
|
1562 |
$opt_value = $k;
|
1563 |
} else {
|
1564 |
$opt_value = $v;
|
593 |
}
|
594 |
|
595 |
$array['classes'] .= ' um-field-' . $key;
|
596 |
+
$array['classes'] .= ' um-field-' . $array['type'];
|
597 |
|
598 |
switch( $array['type'] ) {
|
599 |
|
1559 |
|
1560 |
$v = rtrim($v);
|
1561 |
|
1562 |
+
$use_keyword = apply_filters('um_multiselect_option_value', 0, $data['type'] );
|
1563 |
+
|
1564 |
+
if ( $use_keyword ) {
|
1565 |
$opt_value = $k;
|
1566 |
} else {
|
1567 |
$opt_value = $v;
|
core/um-members.php
CHANGED
@@ -5,18 +5,18 @@ class UM_Members {
|
|
5 |
function __construct() {
|
6 |
|
7 |
add_filter('user_search_columns', array(&$this, 'user_search_columns'), 99 );
|
8 |
-
|
9 |
add_action('template_redirect', array(&$this, 'access_members'), 555);
|
10 |
-
|
11 |
$this->core_search_fields = array(
|
12 |
'user_login',
|
13 |
'username',
|
14 |
'display_name',
|
15 |
'user_email',
|
16 |
);
|
17 |
-
|
18 |
}
|
19 |
-
|
20 |
/***
|
21 |
*** @user_search_columns
|
22 |
***/
|
@@ -28,23 +28,23 @@ class UM_Members {
|
|
28 |
}
|
29 |
return $search_columns;
|
30 |
}
|
31 |
-
|
32 |
/***
|
33 |
*** @Members page allowed?
|
34 |
***/
|
35 |
function access_members() {
|
36 |
-
|
37 |
if ( um_get_option('members_page') == 0 && um_is_core_page('members') ) {
|
38 |
um_redirect_home();
|
39 |
}
|
40 |
-
|
41 |
}
|
42 |
-
|
43 |
/***
|
44 |
*** @tag conversion for member directory
|
45 |
***/
|
46 |
function convert_tags( $string, $array ) {
|
47 |
-
|
48 |
$search = array(
|
49 |
'{total_users}',
|
50 |
);
|
@@ -56,7 +56,7 @@ class UM_Members {
|
|
56 |
$string = str_replace($search, $replace, $string);
|
57 |
return $string;
|
58 |
}
|
59 |
-
|
60 |
/***
|
61 |
*** @show filter
|
62 |
***/
|
@@ -64,103 +64,106 @@ class UM_Members {
|
|
64 |
global $ultimatemember;
|
65 |
|
66 |
$fields = $ultimatemember->builtin->all_user_fields;
|
67 |
-
|
68 |
if ( isset( $fields[$filter] ) ) {
|
69 |
$attrs = $fields[$filter];
|
70 |
} else {
|
71 |
$attrs = apply_filters("um_custom_search_field_{$filter}", array() );
|
72 |
}
|
73 |
-
|
|
|
|
|
|
|
74 |
if ( $ultimatemember->builtin->is_dropdown_field( $filter, $attrs ) ) {
|
75 |
$type = 'select';
|
76 |
} else {
|
77 |
$type = 'text';
|
78 |
}
|
79 |
-
|
80 |
switch( $type ) {
|
81 |
-
|
82 |
case 'select':
|
83 |
|
84 |
?>
|
85 |
-
|
86 |
<select name="<?php echo $filter; ?>" id="<?php echo $filter; ?>" class="um-s1" style="width: 100%" data-placeholder="<?php echo stripslashes( $attrs['label'] ); ?>">
|
87 |
-
|
88 |
<option></option>
|
89 |
-
|
90 |
<?php foreach( $attrs['options'] as $k => $v ) {
|
91 |
-
|
92 |
$v = stripslashes($v);
|
93 |
-
|
94 |
$opt = $v;
|
95 |
-
|
96 |
if ( strstr($filter, 'role_') )
|
97 |
$opt = $k;
|
98 |
-
|
99 |
if ( isset( $attrs['custom'] ) )
|
100 |
$opt = $k;
|
101 |
|
102 |
?>
|
103 |
-
|
104 |
<option value="<?php echo $opt; ?>" <?php um_select_if_in_query_params( $filter, $opt ); ?>><?php echo $v; ?></option>
|
105 |
-
|
106 |
<?php } ?>
|
107 |
|
108 |
</select>
|
109 |
-
|
110 |
<?php
|
111 |
-
|
112 |
break;
|
113 |
-
|
114 |
case 'text':
|
115 |
-
|
116 |
?>
|
117 |
-
|
118 |
<input type="text" name="<?php echo $filter; ?>" id="<?php echo $filter; ?>" placeholder="<?php echo $attrs['label']; ?>" value="<?php um_queried_search_value( $filter ); ?>" />
|
119 |
|
120 |
<?php
|
121 |
-
|
122 |
break;
|
123 |
-
|
124 |
}
|
125 |
|
126 |
}
|
127 |
-
|
128 |
/***
|
129 |
*** @Generate a loop of results
|
130 |
***/
|
131 |
function get_members($args){
|
132 |
-
|
133 |
global $ultimatemember;
|
134 |
-
|
135 |
extract($args);
|
136 |
-
|
137 |
$query_args = array();
|
138 |
$query_args = apply_filters( 'um_prepare_user_query_args', $query_args, $args );
|
139 |
$users = new WP_User_Query( $query_args );
|
140 |
-
|
141 |
// number of profiles for mobile
|
142 |
if ( $ultimatemember->mobile->isMobile() && isset( $profiles_per_page_mobile ) )
|
143 |
$profiles_per_page = $profiles_per_page_mobile;
|
144 |
-
|
145 |
$array['users'] = array_unique( $users->results );
|
146 |
-
|
147 |
$array['total_users'] = (isset( $max_users ) && $max_users && $max_users <= $users->total_users ) ? $max_users : $users->total_users;
|
148 |
|
149 |
$array['page'] = isset($_REQUEST['members_page']) ? $_REQUEST['members_page'] : 1;
|
150 |
-
|
151 |
$array['total_pages'] = ceil( $array['total_users'] / $profiles_per_page );
|
152 |
-
|
153 |
$array['header'] = $this->convert_tags( $header, $array );
|
154 |
$array['header_single'] = $this->convert_tags( $header_single, $array );
|
155 |
-
|
156 |
$array['users_per_page'] = array_slice($array['users'], ( ( $profiles_per_page * $array['page'] ) - $profiles_per_page ), $profiles_per_page );
|
157 |
-
|
158 |
for( $i = $array['page']; $i <= $array['page'] + 2; $i++ ) {
|
159 |
if ( $i <= $array['total_pages'] ) {
|
160 |
$pages_to_show[] = $i;
|
161 |
}
|
162 |
}
|
163 |
-
|
164 |
if ( isset( $pages_to_show ) && count( $pages_to_show ) < 5 ) {
|
165 |
$pages_needed = 5 - count( $pages_to_show );
|
166 |
|
@@ -170,12 +173,12 @@ class UM_Members {
|
|
170 |
}
|
171 |
}
|
172 |
}
|
173 |
-
|
174 |
if ( isset( $pages_to_add ) ) {
|
175 |
-
|
176 |
asort( $pages_to_add );
|
177 |
$pages_to_show = array_merge( (array)$pages_to_add, $pages_to_show );
|
178 |
-
|
179 |
if ( count( $pages_to_show ) < 5 ) {
|
180 |
if ( max($pages_to_show) - $array['page'] >= 2 ) {
|
181 |
$pages_to_show[] = max($pages_to_show) + 1;
|
@@ -189,13 +192,13 @@ class UM_Members {
|
|
189 |
}
|
190 |
}
|
191 |
}
|
192 |
-
|
193 |
asort( $pages_to_show );
|
194 |
-
|
195 |
$array['pages_to_show'] = $pages_to_show;
|
196 |
-
|
197 |
} else {
|
198 |
-
|
199 |
if ( isset( $pages_to_show ) && count( $pages_to_show ) < 5 ) {
|
200 |
if ( max($pages_to_show) - $array['page'] >= 2 ) {
|
201 |
$pages_to_show[] = max($pages_to_show) + 1;
|
@@ -209,34 +212,34 @@ class UM_Members {
|
|
209 |
}
|
210 |
}
|
211 |
}
|
212 |
-
|
213 |
if ( isset( $pages_to_show ) && is_array( $pages_to_show ) ) {
|
214 |
-
|
215 |
asort( $pages_to_show );
|
216 |
-
|
217 |
$array['pages_to_show'] = $pages_to_show;
|
218 |
-
|
219 |
}
|
220 |
-
|
221 |
}
|
222 |
-
|
223 |
if ( isset( $array['pages_to_show'] ) ) {
|
224 |
-
|
225 |
if ( $array['total_pages'] < count( $array['pages_to_show'] ) ) {
|
226 |
foreach( $array['pages_to_show'] as $k => $v ) {
|
227 |
if ( $v > $array['total_pages'] ) unset( $array['pages_to_show'][$k] );
|
228 |
}
|
229 |
}
|
230 |
-
|
231 |
foreach( $array['pages_to_show'] as $k => $v ) {
|
232 |
if ( (int)$v <= 0 ) {
|
233 |
unset( $array['pages_to_show'][$k] );
|
234 |
}
|
235 |
}
|
236 |
-
|
237 |
}
|
238 |
|
239 |
return apply_filters('um_prepare_user_results_array', $array );
|
240 |
}
|
241 |
|
242 |
-
}
|
5 |
function __construct() {
|
6 |
|
7 |
add_filter('user_search_columns', array(&$this, 'user_search_columns'), 99 );
|
8 |
+
|
9 |
add_action('template_redirect', array(&$this, 'access_members'), 555);
|
10 |
+
|
11 |
$this->core_search_fields = array(
|
12 |
'user_login',
|
13 |
'username',
|
14 |
'display_name',
|
15 |
'user_email',
|
16 |
);
|
17 |
+
|
18 |
}
|
19 |
+
|
20 |
/***
|
21 |
*** @user_search_columns
|
22 |
***/
|
28 |
}
|
29 |
return $search_columns;
|
30 |
}
|
31 |
+
|
32 |
/***
|
33 |
*** @Members page allowed?
|
34 |
***/
|
35 |
function access_members() {
|
36 |
+
|
37 |
if ( um_get_option('members_page') == 0 && um_is_core_page('members') ) {
|
38 |
um_redirect_home();
|
39 |
}
|
40 |
+
|
41 |
}
|
42 |
+
|
43 |
/***
|
44 |
*** @tag conversion for member directory
|
45 |
***/
|
46 |
function convert_tags( $string, $array ) {
|
47 |
+
|
48 |
$search = array(
|
49 |
'{total_users}',
|
50 |
);
|
56 |
$string = str_replace($search, $replace, $string);
|
57 |
return $string;
|
58 |
}
|
59 |
+
|
60 |
/***
|
61 |
*** @show filter
|
62 |
***/
|
64 |
global $ultimatemember;
|
65 |
|
66 |
$fields = $ultimatemember->builtin->all_user_fields;
|
67 |
+
|
68 |
if ( isset( $fields[$filter] ) ) {
|
69 |
$attrs = $fields[$filter];
|
70 |
} else {
|
71 |
$attrs = apply_filters("um_custom_search_field_{$filter}", array() );
|
72 |
}
|
73 |
+
|
74 |
+
// additional filter for search field attributes
|
75 |
+
$attrs = apply_filters("um_search_field_{$filter}", $attrs);
|
76 |
+
|
77 |
if ( $ultimatemember->builtin->is_dropdown_field( $filter, $attrs ) ) {
|
78 |
$type = 'select';
|
79 |
} else {
|
80 |
$type = 'text';
|
81 |
}
|
82 |
+
|
83 |
switch( $type ) {
|
84 |
+
|
85 |
case 'select':
|
86 |
|
87 |
?>
|
88 |
+
|
89 |
<select name="<?php echo $filter; ?>" id="<?php echo $filter; ?>" class="um-s1" style="width: 100%" data-placeholder="<?php echo stripslashes( $attrs['label'] ); ?>">
|
90 |
+
|
91 |
<option></option>
|
92 |
+
|
93 |
<?php foreach( $attrs['options'] as $k => $v ) {
|
94 |
+
|
95 |
$v = stripslashes($v);
|
96 |
+
|
97 |
$opt = $v;
|
98 |
+
|
99 |
if ( strstr($filter, 'role_') )
|
100 |
$opt = $k;
|
101 |
+
|
102 |
if ( isset( $attrs['custom'] ) )
|
103 |
$opt = $k;
|
104 |
|
105 |
?>
|
106 |
+
|
107 |
<option value="<?php echo $opt; ?>" <?php um_select_if_in_query_params( $filter, $opt ); ?>><?php echo $v; ?></option>
|
108 |
+
|
109 |
<?php } ?>
|
110 |
|
111 |
</select>
|
112 |
+
|
113 |
<?php
|
114 |
+
|
115 |
break;
|
116 |
+
|
117 |
case 'text':
|
118 |
+
|
119 |
?>
|
120 |
+
|
121 |
<input type="text" name="<?php echo $filter; ?>" id="<?php echo $filter; ?>" placeholder="<?php echo $attrs['label']; ?>" value="<?php um_queried_search_value( $filter ); ?>" />
|
122 |
|
123 |
<?php
|
124 |
+
|
125 |
break;
|
126 |
+
|
127 |
}
|
128 |
|
129 |
}
|
130 |
+
|
131 |
/***
|
132 |
*** @Generate a loop of results
|
133 |
***/
|
134 |
function get_members($args){
|
135 |
+
|
136 |
global $ultimatemember;
|
137 |
+
|
138 |
extract($args);
|
139 |
+
|
140 |
$query_args = array();
|
141 |
$query_args = apply_filters( 'um_prepare_user_query_args', $query_args, $args );
|
142 |
$users = new WP_User_Query( $query_args );
|
143 |
+
|
144 |
// number of profiles for mobile
|
145 |
if ( $ultimatemember->mobile->isMobile() && isset( $profiles_per_page_mobile ) )
|
146 |
$profiles_per_page = $profiles_per_page_mobile;
|
147 |
+
|
148 |
$array['users'] = array_unique( $users->results );
|
149 |
+
|
150 |
$array['total_users'] = (isset( $max_users ) && $max_users && $max_users <= $users->total_users ) ? $max_users : $users->total_users;
|
151 |
|
152 |
$array['page'] = isset($_REQUEST['members_page']) ? $_REQUEST['members_page'] : 1;
|
153 |
+
|
154 |
$array['total_pages'] = ceil( $array['total_users'] / $profiles_per_page );
|
155 |
+
|
156 |
$array['header'] = $this->convert_tags( $header, $array );
|
157 |
$array['header_single'] = $this->convert_tags( $header_single, $array );
|
158 |
+
|
159 |
$array['users_per_page'] = array_slice($array['users'], ( ( $profiles_per_page * $array['page'] ) - $profiles_per_page ), $profiles_per_page );
|
160 |
+
|
161 |
for( $i = $array['page']; $i <= $array['page'] + 2; $i++ ) {
|
162 |
if ( $i <= $array['total_pages'] ) {
|
163 |
$pages_to_show[] = $i;
|
164 |
}
|
165 |
}
|
166 |
+
|
167 |
if ( isset( $pages_to_show ) && count( $pages_to_show ) < 5 ) {
|
168 |
$pages_needed = 5 - count( $pages_to_show );
|
169 |
|
173 |
}
|
174 |
}
|
175 |
}
|
176 |
+
|
177 |
if ( isset( $pages_to_add ) ) {
|
178 |
+
|
179 |
asort( $pages_to_add );
|
180 |
$pages_to_show = array_merge( (array)$pages_to_add, $pages_to_show );
|
181 |
+
|
182 |
if ( count( $pages_to_show ) < 5 ) {
|
183 |
if ( max($pages_to_show) - $array['page'] >= 2 ) {
|
184 |
$pages_to_show[] = max($pages_to_show) + 1;
|
192 |
}
|
193 |
}
|
194 |
}
|
195 |
+
|
196 |
asort( $pages_to_show );
|
197 |
+
|
198 |
$array['pages_to_show'] = $pages_to_show;
|
199 |
+
|
200 |
} else {
|
201 |
+
|
202 |
if ( isset( $pages_to_show ) && count( $pages_to_show ) < 5 ) {
|
203 |
if ( max($pages_to_show) - $array['page'] >= 2 ) {
|
204 |
$pages_to_show[] = max($pages_to_show) + 1;
|
212 |
}
|
213 |
}
|
214 |
}
|
215 |
+
|
216 |
if ( isset( $pages_to_show ) && is_array( $pages_to_show ) ) {
|
217 |
+
|
218 |
asort( $pages_to_show );
|
219 |
+
|
220 |
$array['pages_to_show'] = $pages_to_show;
|
221 |
+
|
222 |
}
|
223 |
+
|
224 |
}
|
225 |
+
|
226 |
if ( isset( $array['pages_to_show'] ) ) {
|
227 |
+
|
228 |
if ( $array['total_pages'] < count( $array['pages_to_show'] ) ) {
|
229 |
foreach( $array['pages_to_show'] as $k => $v ) {
|
230 |
if ( $v > $array['total_pages'] ) unset( $array['pages_to_show'][$k] );
|
231 |
}
|
232 |
}
|
233 |
+
|
234 |
foreach( $array['pages_to_show'] as $k => $v ) {
|
235 |
if ( (int)$v <= 0 ) {
|
236 |
unset( $array['pages_to_show'][$k] );
|
237 |
}
|
238 |
}
|
239 |
+
|
240 |
}
|
241 |
|
242 |
return apply_filters('um_prepare_user_results_array', $array );
|
243 |
}
|
244 |
|
245 |
+
}
|
core/um-permalinks.php
CHANGED
@@ -3,27 +3,27 @@
|
|
3 |
class UM_Permalinks {
|
4 |
|
5 |
function __construct() {
|
6 |
-
|
7 |
global $wp;
|
8 |
-
|
9 |
$this->core = get_option('um_core_pages');
|
10 |
-
|
11 |
add_action('init', array(&$this, 'check_for_querystrings'), 1);
|
12 |
-
|
13 |
add_action('init', array(&$this, 'activate_account_via_email_link'), 1);
|
14 |
-
|
15 |
$this->current_url = $this->get_current_url();
|
16 |
-
|
17 |
}
|
18 |
-
|
19 |
/***
|
20 |
*** @Get query as array
|
21 |
***/
|
22 |
function get_query_array() {
|
23 |
$parts = parse_url( $this->get_current_url() );
|
24 |
-
if ( isset( $parts['query'] ) ){
|
25 |
-
|
26 |
-
|
27 |
}
|
28 |
}
|
29 |
|
@@ -32,26 +32,32 @@ class UM_Permalinks {
|
|
32 |
***/
|
33 |
function get_current_url( $no_query_params = false ) {
|
34 |
global $post;
|
35 |
-
|
36 |
$server_name_method = ( um_get_option('current_url_method') ) ? um_get_option('current_url_method') : 'SERVER_NAME';
|
37 |
-
|
38 |
if ( !isset( $_SERVER['SERVER_NAME'] ) )
|
39 |
return '';
|
40 |
|
41 |
-
if ( is_front_page() )
|
42 |
$page_url = home_url();
|
43 |
-
|
|
|
|
|
|
|
|
|
44 |
$page_url = 'http';
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
48 |
$page_url .= "://";
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
55 |
|
56 |
if ( $no_query_params == true ) {
|
57 |
$page_url = strtok($page_url, '?');
|
@@ -59,7 +65,7 @@ class UM_Permalinks {
|
|
59 |
|
60 |
return apply_filters( 'um_get_current_page_url', $page_url );
|
61 |
}
|
62 |
-
|
63 |
/***
|
64 |
*** @activates an account via email
|
65 |
***/
|
@@ -68,53 +74,53 @@ class UM_Permalinks {
|
|
68 |
|
69 |
if ( isset($_REQUEST['act']) && $_REQUEST['act'] == 'activate_via_email' && isset($_REQUEST['hash']) && strlen($_REQUEST['hash']) == 40 &&
|
70 |
isset($_REQUEST['user_id']) && is_numeric($_REQUEST['user_id']) ) { // valid token
|
71 |
-
|
72 |
$user_id = absint( $_REQUEST['user_id'] );
|
73 |
delete_option( "um_cache_userdata_{$user_id}" );
|
74 |
-
|
75 |
um_fetch_user( $user_id );
|
76 |
|
77 |
if ( um_user('account_status') != 'awaiting_email_confirmation' ) wp_die('The activation link you used is invalid or has expired.');
|
78 |
-
|
79 |
if ( $_REQUEST['hash'] != um_user('account_secret_hash') ) wp_die('The secret key provided does not match this one for the user.');
|
80 |
|
81 |
$ultimatemember->user->approve();
|
82 |
$redirect = ( um_user('url_email_activate') ) ? um_user('url_email_activate') : um_get_core_page('login', 'account_active');
|
83 |
-
|
84 |
um_reset_user();
|
85 |
-
|
86 |
do_action('um_after_email_confirmation', $user_id );
|
87 |
|
88 |
exit( wp_redirect( $redirect ) );
|
89 |
-
|
90 |
}
|
91 |
-
|
92 |
}
|
93 |
-
|
94 |
/***
|
95 |
*** @makes an activate link for any user
|
96 |
***/
|
97 |
function activate_url(){
|
98 |
global $ultimatemember;
|
99 |
-
|
100 |
if ( !um_user('account_secret_hash') ) return false;
|
101 |
-
|
102 |
$url = add_query_arg( 'act', 'activate_via_email', home_url() );
|
103 |
$url = add_query_arg( 'hash', um_user('account_secret_hash'), $url );
|
104 |
$url = add_query_arg( 'user_id', um_user('ID'), $url );
|
105 |
-
|
106 |
return $url;
|
107 |
}
|
108 |
-
|
109 |
/***
|
110 |
*** @checks for UM query strings
|
111 |
***/
|
112 |
function check_for_querystrings(){
|
113 |
global $ultimatemember;
|
114 |
-
if ( isset($_REQUEST['message']) )
|
115 |
$ultimatemember->shortcodes->message_mode = true;
|
116 |
}
|
117 |
-
|
118 |
/***
|
119 |
*** @add a query param to url
|
120 |
***/
|
@@ -129,7 +135,7 @@ class UM_Permalinks {
|
|
129 |
$this->current_url = remove_query_arg( $key, $this->current_url );
|
130 |
return $this->current_url;
|
131 |
}
|
132 |
-
|
133 |
/***
|
134 |
*** @get profile url for set user
|
135 |
***/
|
@@ -138,16 +144,16 @@ class UM_Permalinks {
|
|
138 |
|
139 |
$page_id = $this->core['user'];
|
140 |
$profile_url = get_permalink( $page_id );
|
141 |
-
|
142 |
if ( function_exists('icl_get_current_language') && icl_get_current_language() != icl_get_default_language() ) {
|
143 |
if ( get_the_ID() > 0 && get_post_meta( get_the_ID(), '_um_wpml_user', true ) == 1 ) {
|
144 |
$profile_url = get_permalink( get_the_ID() );
|
145 |
}
|
146 |
}
|
147 |
-
|
148 |
if ( um_get_option('permalink_base') == 'user_login' ) {
|
149 |
$user_in_url = um_user('user_login');
|
150 |
-
|
151 |
if ( is_email($user_in_url) ) {
|
152 |
$user_in_url = str_replace('@','',$user_in_url);
|
153 |
if( ( $pos = strrpos( $user_in_url , '.' ) ) !== false ) {
|
@@ -155,35 +161,35 @@ class UM_Permalinks {
|
|
155 |
$user_in_url = substr_replace( $user_in_url , '-' , $pos , $search_length );
|
156 |
}
|
157 |
} else {
|
158 |
-
|
159 |
$user_in_url = sanitize_title( $user_in_url );
|
160 |
|
161 |
}
|
162 |
-
|
163 |
}
|
164 |
-
|
165 |
if ( um_get_option('permalink_base') == 'user_id' ) {
|
166 |
$user_in_url = um_user('ID');
|
167 |
}
|
168 |
-
|
169 |
if ( um_get_option('permalink_base') == 'name' ) {
|
170 |
$user_in_url = rawurlencode( strtolower( um_user('full_name') ) );
|
171 |
}
|
172 |
-
|
173 |
if ( get_option('permalink_structure') ) {
|
174 |
-
|
175 |
$profile_url = trailingslashit( untrailingslashit( $profile_url ) );
|
176 |
$profile_url = $profile_url . $user_in_url . '/';
|
177 |
-
|
178 |
} else {
|
179 |
-
|
180 |
$profile_url = add_query_arg( 'um_user', $user_in_url, $profile_url );
|
181 |
-
|
182 |
}
|
183 |
|
184 |
return $profile_url;
|
185 |
}
|
186 |
-
|
187 |
/***
|
188 |
*** @get action url for admin use
|
189 |
***/
|
@@ -195,4 +201,4 @@ class UM_Permalinks {
|
|
195 |
return $url;
|
196 |
}
|
197 |
|
198 |
-
}
|
3 |
class UM_Permalinks {
|
4 |
|
5 |
function __construct() {
|
6 |
+
|
7 |
global $wp;
|
8 |
+
|
9 |
$this->core = get_option('um_core_pages');
|
10 |
+
|
11 |
add_action('init', array(&$this, 'check_for_querystrings'), 1);
|
12 |
+
|
13 |
add_action('init', array(&$this, 'activate_account_via_email_link'), 1);
|
14 |
+
|
15 |
$this->current_url = $this->get_current_url();
|
16 |
+
|
17 |
}
|
18 |
+
|
19 |
/***
|
20 |
*** @Get query as array
|
21 |
***/
|
22 |
function get_query_array() {
|
23 |
$parts = parse_url( $this->get_current_url() );
|
24 |
+
if ( isset( $parts['query'] ) ) {
|
25 |
+
parse_str($parts['query'], $query);
|
26 |
+
return $query;
|
27 |
}
|
28 |
}
|
29 |
|
32 |
***/
|
33 |
function get_current_url( $no_query_params = false ) {
|
34 |
global $post;
|
35 |
+
|
36 |
$server_name_method = ( um_get_option('current_url_method') ) ? um_get_option('current_url_method') : 'SERVER_NAME';
|
37 |
+
|
38 |
if ( !isset( $_SERVER['SERVER_NAME'] ) )
|
39 |
return '';
|
40 |
|
41 |
+
if ( is_front_page() ) {
|
42 |
$page_url = home_url();
|
43 |
+
|
44 |
+
if( isset( $_SERVER['QUERY_STRING'] ) && trim( $_SERVER['QUERY_STRING'] ) ) {
|
45 |
+
$page_url .= '?' . $_SERVER['QUERY_STRING'];
|
46 |
+
}
|
47 |
+
} else {
|
48 |
$page_url = 'http';
|
49 |
+
|
50 |
+
if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
|
51 |
+
$page_url .= "s";
|
52 |
+
}
|
53 |
$page_url .= "://";
|
54 |
+
|
55 |
+
if ( isset( $_SERVER["SERVER_PORT"] ) && $_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443" ) {
|
56 |
+
$page_url .= $_SERVER[ $server_name_method ].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
57 |
+
} else {
|
58 |
+
$page_url .= $_SERVER[ $server_name_method ].$_SERVER["REQUEST_URI"];
|
59 |
+
}
|
60 |
+
}
|
61 |
|
62 |
if ( $no_query_params == true ) {
|
63 |
$page_url = strtok($page_url, '?');
|
65 |
|
66 |
return apply_filters( 'um_get_current_page_url', $page_url );
|
67 |
}
|
68 |
+
|
69 |
/***
|
70 |
*** @activates an account via email
|
71 |
***/
|
74 |
|
75 |
if ( isset($_REQUEST['act']) && $_REQUEST['act'] == 'activate_via_email' && isset($_REQUEST['hash']) && strlen($_REQUEST['hash']) == 40 &&
|
76 |
isset($_REQUEST['user_id']) && is_numeric($_REQUEST['user_id']) ) { // valid token
|
77 |
+
|
78 |
$user_id = absint( $_REQUEST['user_id'] );
|
79 |
delete_option( "um_cache_userdata_{$user_id}" );
|
80 |
+
|
81 |
um_fetch_user( $user_id );
|
82 |
|
83 |
if ( um_user('account_status') != 'awaiting_email_confirmation' ) wp_die('The activation link you used is invalid or has expired.');
|
84 |
+
|
85 |
if ( $_REQUEST['hash'] != um_user('account_secret_hash') ) wp_die('The secret key provided does not match this one for the user.');
|
86 |
|
87 |
$ultimatemember->user->approve();
|
88 |
$redirect = ( um_user('url_email_activate') ) ? um_user('url_email_activate') : um_get_core_page('login', 'account_active');
|
89 |
+
|
90 |
um_reset_user();
|
91 |
+
|
92 |
do_action('um_after_email_confirmation', $user_id );
|
93 |
|
94 |
exit( wp_redirect( $redirect ) );
|
95 |
+
|
96 |
}
|
97 |
+
|
98 |
}
|
99 |
+
|
100 |
/***
|
101 |
*** @makes an activate link for any user
|
102 |
***/
|
103 |
function activate_url(){
|
104 |
global $ultimatemember;
|
105 |
+
|
106 |
if ( !um_user('account_secret_hash') ) return false;
|
107 |
+
|
108 |
$url = add_query_arg( 'act', 'activate_via_email', home_url() );
|
109 |
$url = add_query_arg( 'hash', um_user('account_secret_hash'), $url );
|
110 |
$url = add_query_arg( 'user_id', um_user('ID'), $url );
|
111 |
+
|
112 |
return $url;
|
113 |
}
|
114 |
+
|
115 |
/***
|
116 |
*** @checks for UM query strings
|
117 |
***/
|
118 |
function check_for_querystrings(){
|
119 |
global $ultimatemember;
|
120 |
+
if ( isset($_REQUEST['message']) )
|
121 |
$ultimatemember->shortcodes->message_mode = true;
|
122 |
}
|
123 |
+
|
124 |
/***
|
125 |
*** @add a query param to url
|
126 |
***/
|
135 |
$this->current_url = remove_query_arg( $key, $this->current_url );
|
136 |
return $this->current_url;
|
137 |
}
|
138 |
+
|
139 |
/***
|
140 |
*** @get profile url for set user
|
141 |
***/
|
144 |
|
145 |
$page_id = $this->core['user'];
|
146 |
$profile_url = get_permalink( $page_id );
|
147 |
+
|
148 |
if ( function_exists('icl_get_current_language') && icl_get_current_language() != icl_get_default_language() ) {
|
149 |
if ( get_the_ID() > 0 && get_post_meta( get_the_ID(), '_um_wpml_user', true ) == 1 ) {
|
150 |
$profile_url = get_permalink( get_the_ID() );
|
151 |
}
|
152 |
}
|
153 |
+
|
154 |
if ( um_get_option('permalink_base') == 'user_login' ) {
|
155 |
$user_in_url = um_user('user_login');
|
156 |
+
|
157 |
if ( is_email($user_in_url) ) {
|
158 |
$user_in_url = str_replace('@','',$user_in_url);
|
159 |
if( ( $pos = strrpos( $user_in_url , '.' ) ) !== false ) {
|
161 |
$user_in_url = substr_replace( $user_in_url , '-' , $pos , $search_length );
|
162 |
}
|
163 |
} else {
|
164 |
+
|
165 |
$user_in_url = sanitize_title( $user_in_url );
|
166 |
|
167 |
}
|
168 |
+
|
169 |
}
|
170 |
+
|
171 |
if ( um_get_option('permalink_base') == 'user_id' ) {
|
172 |
$user_in_url = um_user('ID');
|
173 |
}
|
174 |
+
|
175 |
if ( um_get_option('permalink_base') == 'name' ) {
|
176 |
$user_in_url = rawurlencode( strtolower( um_user('full_name') ) );
|
177 |
}
|
178 |
+
|
179 |
if ( get_option('permalink_structure') ) {
|
180 |
+
|
181 |
$profile_url = trailingslashit( untrailingslashit( $profile_url ) );
|
182 |
$profile_url = $profile_url . $user_in_url . '/';
|
183 |
+
|
184 |
} else {
|
185 |
+
|
186 |
$profile_url = add_query_arg( 'um_user', $user_in_url, $profile_url );
|
187 |
+
|
188 |
}
|
189 |
|
190 |
return $profile_url;
|
191 |
}
|
192 |
+
|
193 |
/***
|
194 |
*** @get action url for admin use
|
195 |
***/
|
201 |
return $url;
|
202 |
}
|
203 |
|
204 |
+
}
|
core/um-shortcodes.php
CHANGED
@@ -3,15 +3,15 @@
|
|
3 |
class UM_Shortcodes {
|
4 |
|
5 |
function __construct() {
|
6 |
-
|
7 |
$this->message_mode = false;
|
8 |
-
|
9 |
$this->loop = '';
|
10 |
|
11 |
add_shortcode('ultimatemember', array(&$this, 'ultimatemember'), 1);
|
12 |
|
13 |
add_filter( 'body_class', array(&$this, 'body_class'), 0 );
|
14 |
-
|
15 |
$this->emoji[':)'] = 'https://s.w.org/images/core/emoji/72x72/1f604.png';
|
16 |
$this->emoji[':smiley:'] = 'https://s.w.org/images/core/emoji/72x72/1f603.png';
|
17 |
$this->emoji[':D'] = 'https://s.w.org/images/core/emoji/72x72/1f600.png';
|
@@ -72,18 +72,19 @@ class UM_Shortcodes {
|
|
72 |
$this->emoji[':expressionless:'] = 'https://s.w.org/images/core/emoji/72x72/1f611.png';
|
73 |
|
74 |
}
|
75 |
-
|
76 |
/***
|
77 |
*** @emoji support
|
78 |
***/
|
79 |
function emotize( $content ) {
|
80 |
$content = stripslashes( $content );
|
81 |
foreach( $this->emoji as $code => $val ) {
|
82 |
-
$
|
|
|
83 |
}
|
84 |
return $content;
|
85 |
}
|
86 |
-
|
87 |
/***
|
88 |
*** @extend body classes
|
89 |
***/
|
@@ -92,24 +93,24 @@ class UM_Shortcodes {
|
|
92 |
|
93 |
$array = $ultimatemember->permalinks->core;
|
94 |
if ( !$array ) return $classes;
|
95 |
-
|
96 |
foreach( $array as $slug => $info ) {
|
97 |
if ( um_is_core_page( $slug ) ) {
|
98 |
-
|
99 |
$classes[] = 'um-page-' . $slug;
|
100 |
-
|
101 |
if ( is_user_logged_in() ) {
|
102 |
$classes[] = 'um-page-loggedin';
|
103 |
} else {
|
104 |
$classes[] = 'um-page-loggedout';
|
105 |
}
|
106 |
-
|
107 |
}
|
108 |
}
|
109 |
-
|
110 |
return $classes;
|
111 |
}
|
112 |
-
|
113 |
/***
|
114 |
*** @Retrieve core login form
|
115 |
***/
|
@@ -117,15 +118,15 @@ class UM_Shortcodes {
|
|
117 |
$forms = get_posts( array( 'post_type' => 'um_form', 'posts_per_page' => 1, 'meta_key' => '_um_core', 'meta_value' => 'login' ) );
|
118 |
return $forms[0]->ID;
|
119 |
}
|
120 |
-
|
121 |
/***
|
122 |
*** @load a compatible template
|
123 |
***/
|
124 |
function load_template( $tpl ) {
|
125 |
global $ultimatemember;
|
126 |
-
|
127 |
$loop = ( $this->loop ) ? $this->loop : '';
|
128 |
-
|
129 |
if ( isset( $this->set_args ) && is_array( $this->set_args ) ) {
|
130 |
$args = $this->set_args;
|
131 |
extract( $args );
|
@@ -136,51 +137,51 @@ class UM_Shortcodes {
|
|
136 |
|
137 |
if ( file_exists( $theme_file ) )
|
138 |
$file = $theme_file;
|
139 |
-
|
140 |
if ( file_exists( $file ) )
|
141 |
include $file;
|
142 |
}
|
143 |
-
|
144 |
/***
|
145 |
*** @Add class based on shortcode
|
146 |
***/
|
147 |
function get_class( $mode, $args = array() ){
|
148 |
-
|
149 |
global $ultimatemember;
|
150 |
-
|
151 |
$classes = 'um-'.$mode;
|
152 |
-
|
153 |
if ( is_admin() ) {
|
154 |
$classes .= ' um-in-admin';
|
155 |
}
|
156 |
-
|
157 |
if ( isset( $ultimatemember->form->errors ) && $ultimatemember->form->errors ) {
|
158 |
$classes .= ' um-err';
|
159 |
}
|
160 |
-
|
161 |
if ( $ultimatemember->fields->editing == true ) {
|
162 |
$classes .= ' um-editing';
|
163 |
}
|
164 |
-
|
165 |
if ( $ultimatemember->fields->viewing == true ) {
|
166 |
$classes .= ' um-viewing';
|
167 |
}
|
168 |
-
|
169 |
if ( isset( $args['template'] ) && $args['template'] != $args['mode'] ) {
|
170 |
$classes .= ' um-' . $args['template'];
|
171 |
}
|
172 |
-
|
173 |
$classes = apply_filters('um_form_official_classes__hook', $classes);
|
174 |
return $classes;
|
175 |
}
|
176 |
-
|
177 |
/***
|
178 |
*** @Shortcode
|
179 |
***/
|
180 |
function ultimatemember( $args = array() ) {
|
181 |
return $this->load( $args );
|
182 |
}
|
183 |
-
|
184 |
/***
|
185 |
*** @Load a module with global function
|
186 |
***/
|
@@ -190,16 +191,16 @@ class UM_Shortcodes {
|
|
190 |
|
191 |
$defaults = array();
|
192 |
$args = wp_parse_args( $args, $defaults );
|
193 |
-
|
194 |
// when to not continue
|
195 |
$this->form_id = (isset($args['form_id'])) ? $args['form_id'] : null;
|
196 |
if (!$this->form_id) return;
|
197 |
$this->form_status = get_post_status( $this->form_id );
|
198 |
if ( $this->form_status != 'publish' ) return;
|
199 |
-
|
200 |
// get data into one global array
|
201 |
$post_data = $ultimatemember->query->post_data( $this->form_id );
|
202 |
-
|
203 |
$args = apply_filters('um_pre_args_setup', $post_data );
|
204 |
|
205 |
if ( !isset( $args['template'] ) ) $args['template'] = '';
|
@@ -207,7 +208,7 @@ class UM_Shortcodes {
|
|
207 |
if ( !$this->template_exists( $args['template'] ) ) $args['template'] = $post_data['mode'];
|
208 |
if ( !isset( $post_data['template'] ) ) $post_data['template'] = $post_data['mode'];
|
209 |
$args = array_merge( $post_data, $args );
|
210 |
-
|
211 |
if ( isset( $args['use_globals'] ) && $args['use_globals'] == 1 ) {
|
212 |
$args = array_merge( $args, $this->get_css_args( $args ) );
|
213 |
} else {
|
@@ -220,32 +221,32 @@ class UM_Shortcodes {
|
|
220 |
extract( $args, EXTR_SKIP );
|
221 |
|
222 |
// for profiles only
|
223 |
-
if ( $mode == 'profile' && um_profile_id() && isset( $args['role'] ) && $args['role'] &&
|
224 |
$args['role'] != $ultimatemember->query->get_role_by_userid( um_profile_id() ) )
|
225 |
return;
|
226 |
|
227 |
// start loading the template here
|
228 |
do_action("um_pre_{$mode}_shortcode", $args);
|
229 |
-
|
230 |
do_action("um_before_form_is_loaded", $args);
|
231 |
-
|
232 |
do_action("um_before_{$mode}_form_is_loaded", $args);
|
233 |
|
234 |
$this->template_load( $template, $args );
|
235 |
-
|
236 |
$this->dynamic_css( $args );
|
237 |
-
|
238 |
if ( um_get_requested_user() || $mode == 'logout' ) {
|
239 |
um_reset_user();
|
240 |
}
|
241 |
-
|
242 |
do_action('um_after_everything_output');
|
243 |
|
244 |
$output = ob_get_contents();
|
245 |
ob_end_clean();
|
246 |
return $output;
|
247 |
}
|
248 |
-
|
249 |
/***
|
250 |
*** @Get dynamic css args
|
251 |
***/
|
@@ -254,32 +255,32 @@ class UM_Shortcodes {
|
|
254 |
$arr = array_merge( $arr, array( 'form_id' => $args['form_id'], 'mode' => $args['mode'] ) );
|
255 |
return $arr;
|
256 |
}
|
257 |
-
|
258 |
/***
|
259 |
*** @Load dynamic css
|
260 |
***/
|
261 |
function dynamic_css( $args=array() ) {
|
262 |
global $ultimatemember;
|
263 |
extract($args);
|
264 |
-
|
265 |
$global = um_path . 'assets/dynamic_css/dynamic_global.php';
|
266 |
-
|
267 |
if ( isset( $mode ) ) {
|
268 |
$file = um_path . 'assets/dynamic_css/dynamic_'.$mode.'.php';
|
269 |
}
|
270 |
-
|
271 |
include $global;
|
272 |
-
|
273 |
if ( isset( $file ) && file_exists( $file ) )
|
274 |
include $file;
|
275 |
-
|
276 |
if ( isset( $args['custom_css'] ) ) {
|
277 |
$css = $args['custom_css'];
|
278 |
?><!-- ULTIMATE MEMBER FORM INLINE CSS BEGIN --><style type="text/css"><?php print $ultimatemember->styles->minify( $css ); ?></style><!-- ULTIMATE MEMBER FORM INLINE CSS END --><?php
|
279 |
}
|
280 |
-
|
281 |
}
|
282 |
-
|
283 |
/***
|
284 |
*** @Loads a template file
|
285 |
***/
|
@@ -290,20 +291,20 @@ class UM_Shortcodes {
|
|
290 |
}
|
291 |
$ultimatemember->shortcodes->load_template( $template );
|
292 |
}
|
293 |
-
|
294 |
/***
|
295 |
*** @Checks if a template file exists
|
296 |
***/
|
297 |
function template_exists( $template ) {
|
298 |
-
|
299 |
$file = um_path . 'templates/'. $template . '.php';
|
300 |
$theme_file = get_stylesheet_directory() . '/ultimate-member/templates/' . $template . '.php';
|
301 |
-
|
302 |
if ( file_exists( $theme_file ) || file_exists( $file ) )
|
303 |
return true;
|
304 |
return false;
|
305 |
}
|
306 |
-
|
307 |
/***
|
308 |
*** @Get File Name without path and extension
|
309 |
***/
|
@@ -312,35 +313,35 @@ class UM_Shortcodes {
|
|
312 |
$file = preg_replace('/\\.[^.\\s]{3,4}$/', '', $file);
|
313 |
return $file;
|
314 |
}
|
315 |
-
|
316 |
/***
|
317 |
*** @Get Templates
|
318 |
***/
|
319 |
function get_templates( $excluded = null ) {
|
320 |
-
|
321 |
if ($excluded) {
|
322 |
$array[$excluded] = __('Default Template','ultimatemember');
|
323 |
}
|
324 |
-
|
325 |
$paths[] = glob( um_path . 'templates/' . '*.php');
|
326 |
-
|
327 |
if ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/' ) ) {
|
328 |
$paths[] = glob( get_stylesheet_directory() . '/ultimate-member/templates/' . '*.php' );
|
329 |
}
|
330 |
-
|
331 |
foreach($paths as $k => $files){
|
332 |
-
|
333 |
foreach( $files as $file ) {
|
334 |
-
|
335 |
$clean_filename = $this->get_template_name($file);
|
336 |
-
|
337 |
if (0 === strpos($clean_filename, $excluded)) {
|
338 |
-
|
339 |
$source = file_get_contents( $file );
|
340 |
$tokens = token_get_all( $source );
|
341 |
$comment = array(
|
342 |
T_COMMENT, // All comments since PHP5
|
343 |
-
T_DOC_COMMENT // PHPDoc comments
|
344 |
);
|
345 |
foreach( $tokens as $token ) {
|
346 |
if( in_array($token[0], $comment) && strstr( $token[1], '/* Template:' ) && $clean_filename != $excluded ) {
|
@@ -350,17 +351,17 @@ class UM_Shortcodes {
|
|
350 |
$array[ $clean_filename ] = $txt;
|
351 |
}
|
352 |
}
|
353 |
-
|
354 |
}
|
355 |
-
|
356 |
}
|
357 |
-
|
358 |
}
|
359 |
|
360 |
return $array;
|
361 |
-
|
362 |
}
|
363 |
-
|
364 |
/***
|
365 |
*** @Get Shortcode for given form ID
|
366 |
***/
|
@@ -368,14 +369,14 @@ class UM_Shortcodes {
|
|
368 |
$shortcode = '[ultimatemember form_id='.$post_id.']';
|
369 |
return $shortcode;
|
370 |
}
|
371 |
-
|
372 |
/***
|
373 |
*** @convert user tags in a string
|
374 |
***/
|
375 |
function convert_user_tags( $str ) {
|
376 |
-
|
377 |
$value = '';
|
378 |
-
|
379 |
$pattern_array = array(
|
380 |
'{first_name}',
|
381 |
'{last_name}',
|
@@ -383,38 +384,38 @@ class UM_Shortcodes {
|
|
383 |
'{user_avatar_small}',
|
384 |
'{username}',
|
385 |
);
|
386 |
-
|
387 |
$pattern_array = apply_filters('um_allowed_user_tags_patterns', $pattern_array);
|
388 |
-
|
389 |
$matches = false;
|
390 |
foreach ( $pattern_array as $pattern ) {
|
391 |
-
|
392 |
if (preg_match($pattern, $str)) {
|
393 |
-
|
394 |
$usermeta = str_replace('{','',$pattern);
|
395 |
$usermeta = str_replace('}','',$usermeta);
|
396 |
-
|
397 |
if ( $usermeta == 'user_avatar_small' ) {
|
398 |
$value = get_avatar( um_user('ID'), 40 );
|
399 |
} elseif ( um_user( $usermeta ) ){
|
400 |
$value = um_user( $usermeta );
|
401 |
}
|
402 |
-
|
403 |
if ( $usermeta == 'username' ) {
|
404 |
$value = um_user('user_login');
|
405 |
}
|
406 |
-
|
407 |
$value = apply_filters("um_profile_tag_hook__{$usermeta}", $value, um_user('ID') );
|
408 |
-
|
409 |
if ( $value ) {
|
410 |
$str = preg_replace('/'.$pattern.'/', $value , $str );
|
411 |
}
|
412 |
-
|
413 |
}
|
414 |
-
|
415 |
}
|
416 |
-
|
417 |
return $str;
|
418 |
}
|
419 |
|
420 |
-
}
|
3 |
class UM_Shortcodes {
|
4 |
|
5 |
function __construct() {
|
6 |
+
|
7 |
$this->message_mode = false;
|
8 |
+
|
9 |
$this->loop = '';
|
10 |
|
11 |
add_shortcode('ultimatemember', array(&$this, 'ultimatemember'), 1);
|
12 |
|
13 |
add_filter( 'body_class', array(&$this, 'body_class'), 0 );
|
14 |
+
|
15 |
$this->emoji[':)'] = 'https://s.w.org/images/core/emoji/72x72/1f604.png';
|
16 |
$this->emoji[':smiley:'] = 'https://s.w.org/images/core/emoji/72x72/1f603.png';
|
17 |
$this->emoji[':D'] = 'https://s.w.org/images/core/emoji/72x72/1f600.png';
|
72 |
$this->emoji[':expressionless:'] = 'https://s.w.org/images/core/emoji/72x72/1f611.png';
|
73 |
|
74 |
}
|
75 |
+
|
76 |
/***
|
77 |
*** @emoji support
|
78 |
***/
|
79 |
function emotize( $content ) {
|
80 |
$content = stripslashes( $content );
|
81 |
foreach( $this->emoji as $code => $val ) {
|
82 |
+
$regex = str_replace( array( '(', ')' ), array( "\\" . '(', "\\" . ')'), $code );
|
83 |
+
$content = preg_replace( '/(' . $regex . ')(\s|$)/', '<img src="'.$val.'" alt="'.$code.'" title="'.$code.'" class="emoji" />$2', $content );
|
84 |
}
|
85 |
return $content;
|
86 |
}
|
87 |
+
|
88 |
/***
|
89 |
*** @extend body classes
|
90 |
***/
|
93 |
|
94 |
$array = $ultimatemember->permalinks->core;
|
95 |
if ( !$array ) return $classes;
|
96 |
+
|
97 |
foreach( $array as $slug => $info ) {
|
98 |
if ( um_is_core_page( $slug ) ) {
|
99 |
+
|
100 |
$classes[] = 'um-page-' . $slug;
|
101 |
+
|
102 |
if ( is_user_logged_in() ) {
|
103 |
$classes[] = 'um-page-loggedin';
|
104 |
} else {
|
105 |
$classes[] = 'um-page-loggedout';
|
106 |
}
|
107 |
+
|
108 |
}
|
109 |
}
|
110 |
+
|
111 |
return $classes;
|
112 |
}
|
113 |
+
|
114 |
/***
|
115 |
*** @Retrieve core login form
|
116 |
***/
|
118 |
$forms = get_posts( array( 'post_type' => 'um_form', 'posts_per_page' => 1, 'meta_key' => '_um_core', 'meta_value' => 'login' ) );
|
119 |
return $forms[0]->ID;
|
120 |
}
|
121 |
+
|
122 |
/***
|
123 |
*** @load a compatible template
|
124 |
***/
|
125 |
function load_template( $tpl ) {
|
126 |
global $ultimatemember;
|
127 |
+
|
128 |
$loop = ( $this->loop ) ? $this->loop : '';
|
129 |
+
|
130 |
if ( isset( $this->set_args ) && is_array( $this->set_args ) ) {
|
131 |
$args = $this->set_args;
|
132 |
extract( $args );
|
137 |
|
138 |
if ( file_exists( $theme_file ) )
|
139 |
$file = $theme_file;
|
140 |
+
|
141 |
if ( file_exists( $file ) )
|
142 |
include $file;
|
143 |
}
|
144 |
+
|
145 |
/***
|
146 |
*** @Add class based on shortcode
|
147 |
***/
|
148 |
function get_class( $mode, $args = array() ){
|
149 |
+
|
150 |
global $ultimatemember;
|
151 |
+
|
152 |
$classes = 'um-'.$mode;
|
153 |
+
|
154 |
if ( is_admin() ) {
|
155 |
$classes .= ' um-in-admin';
|
156 |
}
|
157 |
+
|
158 |
if ( isset( $ultimatemember->form->errors ) && $ultimatemember->form->errors ) {
|
159 |
$classes .= ' um-err';
|
160 |
}
|
161 |
+
|
162 |
if ( $ultimatemember->fields->editing == true ) {
|
163 |
$classes .= ' um-editing';
|
164 |
}
|
165 |
+
|
166 |
if ( $ultimatemember->fields->viewing == true ) {
|
167 |
$classes .= ' um-viewing';
|
168 |
}
|
169 |
+
|
170 |
if ( isset( $args['template'] ) && $args['template'] != $args['mode'] ) {
|
171 |
$classes .= ' um-' . $args['template'];
|
172 |
}
|
173 |
+
|
174 |
$classes = apply_filters('um_form_official_classes__hook', $classes);
|
175 |
return $classes;
|
176 |
}
|
177 |
+
|
178 |
/***
|
179 |
*** @Shortcode
|
180 |
***/
|
181 |
function ultimatemember( $args = array() ) {
|
182 |
return $this->load( $args );
|
183 |
}
|
184 |
+
|
185 |
/***
|
186 |
*** @Load a module with global function
|
187 |
***/
|
191 |
|
192 |
$defaults = array();
|
193 |
$args = wp_parse_args( $args, $defaults );
|
194 |
+
|
195 |
// when to not continue
|
196 |
$this->form_id = (isset($args['form_id'])) ? $args['form_id'] : null;
|
197 |
if (!$this->form_id) return;
|
198 |
$this->form_status = get_post_status( $this->form_id );
|
199 |
if ( $this->form_status != 'publish' ) return;
|
200 |
+
|
201 |
// get data into one global array
|
202 |
$post_data = $ultimatemember->query->post_data( $this->form_id );
|
203 |
+
|
204 |
$args = apply_filters('um_pre_args_setup', $post_data );
|
205 |
|
206 |
if ( !isset( $args['template'] ) ) $args['template'] = '';
|
208 |
if ( !$this->template_exists( $args['template'] ) ) $args['template'] = $post_data['mode'];
|
209 |
if ( !isset( $post_data['template'] ) ) $post_data['template'] = $post_data['mode'];
|
210 |
$args = array_merge( $post_data, $args );
|
211 |
+
|
212 |
if ( isset( $args['use_globals'] ) && $args['use_globals'] == 1 ) {
|
213 |
$args = array_merge( $args, $this->get_css_args( $args ) );
|
214 |
} else {
|
221 |
extract( $args, EXTR_SKIP );
|
222 |
|
223 |
// for profiles only
|
224 |
+
if ( $mode == 'profile' && um_profile_id() && isset( $args['role'] ) && $args['role'] &&
|
225 |
$args['role'] != $ultimatemember->query->get_role_by_userid( um_profile_id() ) )
|
226 |
return;
|
227 |
|
228 |
// start loading the template here
|
229 |
do_action("um_pre_{$mode}_shortcode", $args);
|
230 |
+
|
231 |
do_action("um_before_form_is_loaded", $args);
|
232 |
+
|
233 |
do_action("um_before_{$mode}_form_is_loaded", $args);
|
234 |
|
235 |
$this->template_load( $template, $args );
|
236 |
+
|
237 |
$this->dynamic_css( $args );
|
238 |
+
|
239 |
if ( um_get_requested_user() || $mode == 'logout' ) {
|
240 |
um_reset_user();
|
241 |
}
|
242 |
+
|
243 |
do_action('um_after_everything_output');
|
244 |
|
245 |
$output = ob_get_contents();
|
246 |
ob_end_clean();
|
247 |
return $output;
|
248 |
}
|
249 |
+
|
250 |
/***
|
251 |
*** @Get dynamic css args
|
252 |
***/
|
255 |
$arr = array_merge( $arr, array( 'form_id' => $args['form_id'], 'mode' => $args['mode'] ) );
|
256 |
return $arr;
|
257 |
}
|
258 |
+
|
259 |
/***
|
260 |
*** @Load dynamic css
|
261 |
***/
|
262 |
function dynamic_css( $args=array() ) {
|
263 |
global $ultimatemember;
|
264 |
extract($args);
|
265 |
+
|
266 |
$global = um_path . 'assets/dynamic_css/dynamic_global.php';
|
267 |
+
|
268 |
if ( isset( $mode ) ) {
|
269 |
$file = um_path . 'assets/dynamic_css/dynamic_'.$mode.'.php';
|
270 |
}
|
271 |
+
|
272 |
include $global;
|
273 |
+
|
274 |
if ( isset( $file ) && file_exists( $file ) )
|
275 |
include $file;
|
276 |
+
|
277 |
if ( isset( $args['custom_css'] ) ) {
|
278 |
$css = $args['custom_css'];
|
279 |
?><!-- ULTIMATE MEMBER FORM INLINE CSS BEGIN --><style type="text/css"><?php print $ultimatemember->styles->minify( $css ); ?></style><!-- ULTIMATE MEMBER FORM INLINE CSS END --><?php
|
280 |
}
|
281 |
+
|
282 |
}
|
283 |
+
|
284 |
/***
|
285 |
*** @Loads a template file
|
286 |
***/
|
291 |
}
|
292 |
$ultimatemember->shortcodes->load_template( $template );
|
293 |
}
|
294 |
+
|
295 |
/***
|
296 |
*** @Checks if a template file exists
|
297 |
***/
|
298 |
function template_exists( $template ) {
|
299 |
+
|
300 |
$file = um_path . 'templates/'. $template . '.php';
|
301 |
$theme_file = get_stylesheet_directory() . '/ultimate-member/templates/' . $template . '.php';
|
302 |
+
|
303 |
if ( file_exists( $theme_file ) || file_exists( $file ) )
|
304 |
return true;
|
305 |
return false;
|
306 |
}
|
307 |
+
|
308 |
/***
|
309 |
*** @Get File Name without path and extension
|
310 |
***/
|
313 |
$file = preg_replace('/\\.[^.\\s]{3,4}$/', '', $file);
|
314 |
return $file;
|
315 |
}
|
316 |
+
|
317 |
/***
|
318 |
*** @Get Templates
|
319 |
***/
|
320 |
function get_templates( $excluded = null ) {
|
321 |
+
|
322 |
if ($excluded) {
|
323 |
$array[$excluded] = __('Default Template','ultimatemember');
|
324 |
}
|
325 |
+
|
326 |
$paths[] = glob( um_path . 'templates/' . '*.php');
|
327 |
+
|
328 |
if ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/' ) ) {
|
329 |
$paths[] = glob( get_stylesheet_directory() . '/ultimate-member/templates/' . '*.php' );
|
330 |
}
|
331 |
+
|
332 |
foreach($paths as $k => $files){
|
333 |
+
|
334 |
foreach( $files as $file ) {
|
335 |
+
|
336 |
$clean_filename = $this->get_template_name($file);
|
337 |
+
|
338 |
if (0 === strpos($clean_filename, $excluded)) {
|
339 |
+
|
340 |
$source = file_get_contents( $file );
|
341 |
$tokens = token_get_all( $source );
|
342 |
$comment = array(
|
343 |
T_COMMENT, // All comments since PHP5
|
344 |
+
T_DOC_COMMENT // PHPDoc comments
|
345 |
);
|
346 |
foreach( $tokens as $token ) {
|
347 |
if( in_array($token[0], $comment) && strstr( $token[1], '/* Template:' ) && $clean_filename != $excluded ) {
|
351 |
$array[ $clean_filename ] = $txt;
|
352 |
}
|
353 |
}
|
354 |
+
|
355 |
}
|
356 |
+
|
357 |
}
|
358 |
+
|
359 |
}
|
360 |
|
361 |
return $array;
|
362 |
+
|
363 |
}
|
364 |
+
|
365 |
/***
|
366 |
*** @Get Shortcode for given form ID
|
367 |
***/
|
369 |
$shortcode = '[ultimatemember form_id='.$post_id.']';
|
370 |
return $shortcode;
|
371 |
}
|
372 |
+
|
373 |
/***
|
374 |
*** @convert user tags in a string
|
375 |
***/
|
376 |
function convert_user_tags( $str ) {
|
377 |
+
|
378 |
$value = '';
|
379 |
+
|
380 |
$pattern_array = array(
|
381 |
'{first_name}',
|
382 |
'{last_name}',
|
384 |
'{user_avatar_small}',
|
385 |
'{username}',
|
386 |
);
|
387 |
+
|
388 |
$pattern_array = apply_filters('um_allowed_user_tags_patterns', $pattern_array);
|
389 |
+
|
390 |
$matches = false;
|
391 |
foreach ( $pattern_array as $pattern ) {
|
392 |
+
|
393 |
if (preg_match($pattern, $str)) {
|
394 |
+
|
395 |
$usermeta = str_replace('{','',$pattern);
|
396 |
$usermeta = str_replace('}','',$usermeta);
|
397 |
+
|
398 |
if ( $usermeta == 'user_avatar_small' ) {
|
399 |
$value = get_avatar( um_user('ID'), 40 );
|
400 |
} elseif ( um_user( $usermeta ) ){
|
401 |
$value = um_user( $usermeta );
|
402 |
}
|
403 |
+
|
404 |
if ( $usermeta == 'username' ) {
|
405 |
$value = um_user('user_login');
|
406 |
}
|
407 |
+
|
408 |
$value = apply_filters("um_profile_tag_hook__{$usermeta}", $value, um_user('ID') );
|
409 |
+
|
410 |
if ( $value ) {
|
411 |
$str = preg_replace('/'.$pattern.'/', $value , $str );
|
412 |
}
|
413 |
+
|
414 |
}
|
415 |
+
|
416 |
}
|
417 |
+
|
418 |
return $str;
|
419 |
}
|
420 |
|
421 |
+
}
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Ultimate Member
|
4 |
Plugin URI: http://ultimatemember.com/
|
5 |
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
|
6 |
-
Version: 1.3.
|
7 |
Author: Ultimate Member
|
8 |
Author URI: http://ultimatemember.com/
|
9 |
*/
|
@@ -46,8 +46,8 @@ Author URI: http://ultimatemember.com/
|
|
46 |
***/
|
47 |
function ultimatemember_plugin_links( $links ) {
|
48 |
|
49 |
-
$more_links[] = '<a href="http://ultimatemember.com/
|
50 |
-
$more_links[] = '<a href="
|
51 |
$more_links[] = '<a href="'.admin_url().'admin.php?page=um_options">' . __('Settings','ultimatemember') . '</a>';
|
52 |
|
53 |
$links = $more_links + $links;
|
3 |
Plugin Name: Ultimate Member
|
4 |
Plugin URI: http://ultimatemember.com/
|
5 |
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
|
6 |
+
Version: 1.3.33
|
7 |
Author: Ultimate Member
|
8 |
Author URI: http://ultimatemember.com/
|
9 |
*/
|
46 |
***/
|
47 |
function ultimatemember_plugin_links( $links ) {
|
48 |
|
49 |
+
$more_links[] = '<a href="http://docs.ultimatemember.com/">' . __('Docs','ultimatemember') . '</a>';
|
50 |
+
$more_links[] = '<a href="https://ultimatemember.com/support-contact/">' . __('Support','ultimatemember') . '</a>';
|
51 |
$more_links[] = '<a href="'.admin_url().'admin.php?page=um_options">' . __('Settings','ultimatemember') . '</a>';
|
52 |
|
53 |
$links = $more_links + $links;
|
readme.txt
CHANGED
@@ -7,7 +7,7 @@ Tags: access control, author, authors, author profile, comments, community, comm
|
|
7 |
Requires at least: 4.1
|
8 |
Tested up to: 4.4
|
9 |
|
10 |
-
Stable Tag: 1.3.
|
11 |
|
12 |
License: GNU Version 2 or Any Later Version
|
13 |
|
@@ -37,7 +37,6 @@ Ultimate Member is a powerful and flexible plugin that makes it a breeze for use
|
|
37 |
* Developer friendly with dozens of actions and filters
|
38 |
* Multi-site compatibility
|
39 |
* Mandrill compatibility
|
40 |
-
* WPML Support
|
41 |
|
42 |
Read about all of the plugin's features at [Ultimate Member](https://ultimatemember.com)
|
43 |
|
@@ -147,6 +146,13 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
|
|
147 |
|
148 |
== Changelog ==
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
= 1.3.32: December 10, 2015 =
|
151 |
|
152 |
* Fixed: array format and notices
|
7 |
Requires at least: 4.1
|
8 |
Tested up to: 4.4
|
9 |
|
10 |
+
Stable Tag: 1.3.33
|
11 |
|
12 |
License: GNU Version 2 or Any Later Version
|
13 |
|
37 |
* Developer friendly with dozens of actions and filters
|
38 |
* Multi-site compatibility
|
39 |
* Mandrill compatibility
|
|
|
40 |
|
41 |
Read about all of the plugin's features at [Ultimate Member](https://ultimatemember.com)
|
42 |
|
146 |
|
147 |
== Changelog ==
|
148 |
|
149 |
+
= 1.3.33: December 15, 2015 =
|
150 |
+
|
151 |
+
* Fixed: Member search on homepage
|
152 |
+
* Fixed: emoticons support
|
153 |
+
* Fixed: redux notices, css styles in admin
|
154 |
+
* Fixed: users not being deleted
|
155 |
+
|
156 |
= 1.3.32: December 10, 2015 =
|
157 |
|
158 |
* Fixed: array format and notices
|
um-config.php
CHANGED
@@ -226,7 +226,7 @@ $this->sections[] = array(
|
|
226 |
|
227 |
array(
|
228 |
'id' => 'delete_account_text',
|
229 |
-
'type' => '
|
230 |
'title' => __( 'Account Deletion Custom Text','ultimatemember' ),
|
231 |
'default' => __('Are you sure you want to delete your account? This will erase all of your account data from the site. To delete your account enter your password below','ultimatemember'),
|
232 |
'desc' => __('This is custom text that will be displayed to users before they delete their accounts from your site','ultimatemember'),
|
226 |
|
227 |
array(
|
228 |
'id' => 'delete_account_text',
|
229 |
+
'type' => 'textarea', // bug with wp 4.4? should be editor
|
230 |
'title' => __( 'Account Deletion Custom Text','ultimatemember' ),
|
231 |
'default' => __('Are you sure you want to delete your account? This will erase all of your account data from the site. To delete your account enter your password below','ultimatemember'),
|
232 |
'desc' => __('This is custom text that will be displayed to users before they delete their accounts from your site','ultimatemember'),
|
um-init.php
CHANGED
@@ -2,7 +2,11 @@
|
|
2 |
|
3 |
class UM_API {
|
4 |
|
|
|
|
|
5 |
function __construct() {
|
|
|
|
|
6 |
|
7 |
require_once um_path . 'core/um-short-functions.php';
|
8 |
|
@@ -11,6 +15,7 @@ class UM_API {
|
|
11 |
}
|
12 |
|
13 |
add_action('init', array(&$this, 'init'), 0);
|
|
|
14 |
|
15 |
add_action('init', array(&$this, 'load_addons') );
|
16 |
|
@@ -154,7 +159,6 @@ class UM_API {
|
|
154 |
$this->datetime = new UM_DateTime();
|
155 |
$this->chart = new UM_Chart();
|
156 |
$this->builtin = new UM_Builtin();
|
157 |
-
$this->form = new UM_Form();
|
158 |
$this->files = new UM_Files();
|
159 |
$this->taxonomies = new UM_Taxonomies();
|
160 |
$this->validation = new UM_Validation();
|
@@ -182,6 +186,10 @@ class UM_API {
|
|
182 |
|
183 |
}
|
184 |
|
|
|
|
|
|
|
|
|
185 |
}
|
186 |
|
187 |
$ultimatemember = new UM_API();
|
2 |
|
3 |
class UM_API {
|
4 |
|
5 |
+
public $is_filtering;
|
6 |
+
|
7 |
function __construct() {
|
8 |
+
|
9 |
+
$this->is_filtering = 0;
|
10 |
|
11 |
require_once um_path . 'core/um-short-functions.php';
|
12 |
|
15 |
}
|
16 |
|
17 |
add_action('init', array(&$this, 'init'), 0);
|
18 |
+
add_action('init', array(&$this, 'form'), 10);
|
19 |
|
20 |
add_action('init', array(&$this, 'load_addons') );
|
21 |
|
159 |
$this->datetime = new UM_DateTime();
|
160 |
$this->chart = new UM_Chart();
|
161 |
$this->builtin = new UM_Builtin();
|
|
|
162 |
$this->files = new UM_Files();
|
163 |
$this->taxonomies = new UM_Taxonomies();
|
164 |
$this->validation = new UM_Validation();
|
186 |
|
187 |
}
|
188 |
|
189 |
+
function form() {
|
190 |
+
$this->form = new UM_Form();
|
191 |
+
}
|
192 |
+
|
193 |
}
|
194 |
|
195 |
$ultimatemember = new UM_API();
|