Version Description
Download this release
Release Info
Developer | Tomdever |
Plugin | ![]() |
Version | 1.7.5 |
Comparing to | |
See all releases |
Code changes from version 1.7.4 to 1.7.5
- readme.txt +27 -9
- wpf-admin/css/admin.css +1 -0
- wpf-admin/includes/member-listtable.php +1 -1
- wpf-admin/options-tabs/accesses.php +1 -1
- wpf-admin/options-tabs/emails.php +1 -0
- wpf-admin/options-tabs/features.php +15 -11
- wpf-admin/options-tabs/members.php +3 -3
- wpf-assets/js/ajax.js +6 -4
- wpf-assets/js/frontend.js +5 -5
- wpf-assets/js/widgets.js +9 -3
- wpf-includes/class-actions.php +6 -5
- wpf-includes/class-feed.php +2 -2
- wpf-includes/class-forms.php +132 -131
- wpf-includes/class-forums.php +3 -2
- wpf-includes/class-logs.php +2 -2
- wpf-includes/class-members.php +726 -775
- wpf-includes/class-permissions.php +15 -15
- wpf-includes/class-posts.php +25 -18
- wpf-includes/class-revisions.php +2 -2
- wpf-includes/class-template.php +667 -232
- wpf-includes/class-topics.php +3 -3
- wpf-includes/class-usergroups.php +11 -9
- wpf-includes/functions-installation.php +29 -11
- wpf-includes/functions-integration.php +4 -3
- wpf-includes/functions-template.php +151 -95
- wpf-includes/functions.php +179 -677
- wpf-includes/integration/ultimate-member.php +3 -3
- wpf-includes/wpf-hooks.php +44 -43
- wpf-languages/wpforo-de_DE.mo +0 -0
- wpf-languages/wpforo-de_DE.po +8725 -6545
- wpf-languages/wpforo.pot +366 -393
- wpf-themes/classic/footer.php +4 -4
- wpf-themes/classic/forum.php +1 -1
- wpf-themes/classic/index.php +8 -20
- wpf-themes/classic/login.php +1 -1
- wpf-themes/classic/members.php +4 -4
- wpf-themes/classic/post.php +1 -1
- wpf-themes/classic/profile-account.php +4 -5
- wpf-themes/classic/profile-activity.php +38 -33
- wpf-themes/classic/profile-home.php +15 -10
- wpf-themes/classic/profile-subscriptions.php +35 -30
- wpf-themes/classic/profile.php +22 -22
- wpf-themes/classic/recent.php +18 -9
- wpf-themes/classic/register.php +1 -1
- wpf-themes/classic/search.php +1 -1
- wpf-themes/classic/style-rtl.css +8 -8
- wpf-themes/classic/style.css +1 -2
- wpforo.php +155 -121
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: gVectors Team
|
|
3 |
Tags: forum, forums, forum plugin, WordPress forum plugin, community, discussion
|
4 |
Requires at least: 4.1
|
5 |
Tested up to: 5.4
|
6 |
-
Stable tag: 1.7.
|
7 |
Requires PHP: 5.6 and higher
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -165,6 +165,32 @@ Find wpForo forum plugin addons on [gVectors Team website...](https://gvectors.c
|
|
165 |
|
166 |
== Changelog ==
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
= wpForo Forum 1.7.3 / 1.7.4 | 23.04.2020 =
|
169 |
|
170 |
[wpForo Forum v1.7.3 / v1.7.4 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-7-3-is-released/)
|
@@ -195,14 +221,6 @@ Find wpForo forum plugin addons on [gVectors Team website...](https://gvectors.c
|
|
195 |
* Fixed Bug: new hook to stop conflicts with Page builder plugins, such as Flatsome theme page builder. In this case you should enable the hook with this code: `add_filter('on_wpforo_load_remove_the_content_all_filters', '__return_true');`
|
196 |
|
197 |
|
198 |
-
IMPORTANT NOTES for UPDATE
|
199 |
-
|
200 |
-
- After the update, please delete all caches.
|
201 |
-
- If you have a Minifier/Optimizer plugins please delete all caches.
|
202 |
-
- If you use CDN and found some issues please purge it.
|
203 |
-
- Some JS and CSS files are changed, please refresh (press Ctrl+F5) on forum front-end twice to reset browser cache, otherwise you'll see crashed design.
|
204 |
-
|
205 |
-
|
206 |
= wpForo Forum 1.7.2 | 28.03.2020 =
|
207 |
|
208 |
[wpForo Forum v1.7.2 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-7-2-is-released/)
|
3 |
Tags: forum, forums, forum plugin, WordPress forum plugin, community, discussion
|
4 |
Requires at least: 4.1
|
5 |
Tested up to: 5.4
|
6 |
+
Stable tag: 1.7.5
|
7 |
Requires PHP: 5.6 and higher
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
165 |
|
166 |
== Changelog ==
|
167 |
|
168 |
+
= wpForo Forum 1.7.5 | 29.05.2020 =
|
169 |
+
|
170 |
+
[wpForo Forum v1.7.5 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-7-5-is-released/)
|
171 |
+
|
172 |
+
With this version of wpForo, we've improved the [wpForo - User Custom Fields](https://gvectors.com/product/wpforo-user-custom-fields/) addon. Besides the ability to create custom fields for users, now this addon allows you to create Custom Profile Tabs. This is a major change in the addon which required wpForo core update as well.
|
173 |
+
|
174 |
+
* Added: New permission `Can reply to own topic` in Forum Accesses
|
175 |
+
* Added: New `[post-desc]` shortcode for user mentioning email template
|
176 |
+
* Added: New merged Profile Page option [ Default | wpForo | BP | UM ]
|
177 |
+
* Fixed Bug: Compatibility issues with Rank Math plugin
|
178 |
+
* Fixed Bug: User couldn't edit topic title in Threaded Layout
|
179 |
+
* Fixed Bug: User couldn't delete own topic if there are some replies in it
|
180 |
+
* Fixed Bug: Admin can manage his subscriptions without confirming his email
|
181 |
+
* Fixed Bug: PHP Notice; undefined userid in widgets for Banned Users
|
182 |
+
* Fixed Bug: Issues with Secondary Usergroups
|
183 |
+
* Fixed Bug: Lots of small bugs
|
184 |
+
|
185 |
+
|
186 |
+
IMPORTANT NOTES for UPDATE
|
187 |
+
|
188 |
+
- After the update, please delete all caches.
|
189 |
+
- If you have a Minifier/Optimizer plugins please delete all caches.
|
190 |
+
- If you use CDN and found some issues please purge it.
|
191 |
+
- Some JS and CSS files are changed, please refresh (press Ctrl+F5) on forum front-end twice to reset browser cache, otherwise you'll see crashed design.
|
192 |
+
|
193 |
+
|
194 |
= wpForo Forum 1.7.3 / 1.7.4 | 23.04.2020 =
|
195 |
|
196 |
[wpForo Forum v1.7.3 / v1.7.4 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-7-3-is-released/)
|
221 |
* Fixed Bug: new hook to stop conflicts with Page builder plugins, such as Flatsome theme page builder. In this case you should enable the hook with this code: `add_filter('on_wpforo_load_remove_the_content_all_filters', '__return_true');`
|
222 |
|
223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
= wpForo Forum 1.7.2 | 28.03.2020 =
|
225 |
|
226 |
[wpForo Forum v1.7.2 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-7-2-is-released/)
|
wpf-admin/css/admin.css
CHANGED
@@ -166,6 +166,7 @@
|
|
166 |
.wpf-switch-field label:hover {cursor: pointer;}
|
167 |
.wpf-switch-field input:checked + label {background-color: #43A6DF; -webkit-box-shadow: none; box-shadow: none; color:#fff;} /* #66DD8D */
|
168 |
/* .wpf-switch-field input:last-of-type:checked + label {background-color:#F77059; -webkit-box-shadow: none; box-shadow: none;} */
|
|
|
169 |
.wpf-switch-field label:first-of-type {border-radius: 4px 0 0 4px;}
|
170 |
.wpf-switch-field label:last-of-type {border-radius: 0 4px 4px 0;}
|
171 |
|
166 |
.wpf-switch-field label:hover {cursor: pointer;}
|
167 |
.wpf-switch-field input:checked + label {background-color: #43A6DF; -webkit-box-shadow: none; box-shadow: none; color:#fff;} /* #66DD8D */
|
168 |
/* .wpf-switch-field input:last-of-type:checked + label {background-color:#F77059; -webkit-box-shadow: none; box-shadow: none;} */
|
169 |
+
.wpf-switch-field input[disabled] + label {opacity: 0.5;} /* #66DD8D */
|
170 |
.wpf-switch-field label:first-of-type {border-radius: 4px 0 0 4px;}
|
171 |
.wpf-switch-field label:last-of-type {border-radius: 0 4px 4px 0;}
|
172 |
|
wpf-admin/includes/member-listtable.php
CHANGED
@@ -79,7 +79,7 @@ class wpForoMembersListTable extends WP_List_Table {
|
|
79 |
**************************************************************************/
|
80 |
function column_userid($item){
|
81 |
$edit_user = admin_url( 'user-edit.php?user_id=' . intval($item['userid']));
|
82 |
-
$edit_profile = WPF()->member->get_profile_url($item['userid'],
|
83 |
$ban = wp_nonce_url(admin_url( sprintf('admin.php?page=%1$s&wpfaction=%2$s&userid=%3$s','wpforo-members', 'wpforo_user_ban', $item['userid']) ), 'wpforo-user-ban-' . $item['userid']);
|
84 |
$unban = wp_nonce_url(admin_url( sprintf('admin.php?page=%1$s&wpfaction=%2$s&userid=%3$s','wpforo-members', 'wpforo_user_unban', $item['userid']) ), 'wpforo-user-unban-' . $item['userid']);
|
85 |
$delete = wp_nonce_url( "users.php?action=delete&user=".intval($item['userid']), 'bulk-users' );
|
79 |
**************************************************************************/
|
80 |
function column_userid($item){
|
81 |
$edit_user = admin_url( 'user-edit.php?user_id=' . intval($item['userid']));
|
82 |
+
$edit_profile = WPF()->member->get_profile_url($item['userid'], 'account');
|
83 |
$ban = wp_nonce_url(admin_url( sprintf('admin.php?page=%1$s&wpfaction=%2$s&userid=%3$s','wpforo-members', 'wpforo_user_ban', $item['userid']) ), 'wpforo-user-ban-' . $item['userid']);
|
84 |
$unban = wp_nonce_url(admin_url( sprintf('admin.php?page=%1$s&wpfaction=%2$s&userid=%3$s','wpforo-members', 'wpforo_user_unban', $item['userid']) ), 'wpforo-user-unban-' . $item['userid']);
|
85 |
$delete = wp_nonce_url( "users.php?action=delete&user=".intval($item['userid']), 'bulk-users' );
|
wpf-admin/options-tabs/accesses.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
if( !defined( 'ABSPATH' ) ) exit;
|
4 |
if( !WPF()->perm->usergroup_can('ms') ) exit;
|
5 |
$nocan = array(
|
6 |
-
'no_access' => array('et', 'dt', 'dot', 'er', 'dr', 'dor', 'l', 's', 'at', 'cot', 'p', 'op', 'vp', 'au', 'sv', 'mt', 'ccp' ,'r', 'ct', 'cr', 'eot', 'eor', 'oat', 'osv', 'cvp', 'v', 'a'),
|
7 |
'read_only' => array('et', 'dt', 'dot', 'er', 'dr', 'dor', 'l', 's', 'at', 'cot', 'p', 'op', 'vp', 'au', 'sv', 'mt', 'ccp' ,'r'),
|
8 |
'standard' => array('et', 'dt', 'er', 'dr', 'at', 'cot', 'p', 'vp', 'au', 'sv', 'mt')
|
9 |
);
|
3 |
if( !defined( 'ABSPATH' ) ) exit;
|
4 |
if( !WPF()->perm->usergroup_can('ms') ) exit;
|
5 |
$nocan = array(
|
6 |
+
'no_access' => array('et', 'dt', 'dot', 'er', 'dr', 'dor', 'l', 's', 'at', 'cot', 'p', 'op', 'vp', 'au', 'sv', 'mt', 'ccp' ,'r', 'ct', 'cr', 'ocr', 'eot', 'eor', 'oat', 'osv', 'cvp', 'v', 'a'),
|
7 |
'read_only' => array('et', 'dt', 'dot', 'er', 'dr', 'dor', 'l', 's', 'at', 'cot', 'p', 'op', 'vp', 'au', 'sv', 'mt', 'ccp' ,'r'),
|
8 |
'standard' => array('et', 'dt', 'er', 'dr', 'at', 'cot', 'p', 'vp', 'au', 'sv', 'mt')
|
9 |
);
|
wpf-admin/options-tabs/emails.php
CHANGED
@@ -281,6 +281,7 @@ $wpe_args = array(
|
|
281 |
<li>[author-user-name] - <?php _e('Post author display name', 'wpforo') ?></li>
|
282 |
<li>[topic-title] - <?php _e('Topic title', 'wpforo') ?></li>
|
283 |
<li>[post-url] - <?php _e('Link to the post', 'wpforo') ?></li>
|
|
|
284 |
</ul>
|
285 |
</th>
|
286 |
<td>
|
281 |
<li>[author-user-name] - <?php _e('Post author display name', 'wpforo') ?></li>
|
282 |
<li>[topic-title] - <?php _e('Topic title', 'wpforo') ?></li>
|
283 |
<li>[post-url] - <?php _e('Link to the post', 'wpforo') ?></li>
|
284 |
+
<li>[post-desc] - <?php _e('Mentioned post excerpt', 'wpforo') ?></li>
|
285 |
</ul>
|
286 |
</th>
|
287 |
<td>
|
wpf-admin/options-tabs/features.php
CHANGED
@@ -18,8 +18,7 @@ $options = array(
|
|
18 |
'track-logging' => array( 'label' => __('Track Forum and Topic Current Viewers', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1),
|
19 |
'goto-unread' => array( 'label' => __('Topic Links Jump to First Unread Post', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('If this option is enabled, all topic links on forums page and on topics page will refer to the first unread post. This behavior is only enabled for logged-in users.', 'wpforo')),
|
20 |
'goto-unread-button' => array( 'label' => __('Jump to First Unread Post with [new] Button in Topic Link', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Adds [new] button at the and of topic links, which jumps to the first unread post.', 'wpforo')),
|
21 |
-
'
|
22 |
-
'comment-author-link' => array( 'label' => __('Replace Comment Author Link to Forum Profile', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0, 'help' => 'https://wpforo.com/docs/root/wpforo-settings/features/#replace-author-data' ),
|
23 |
'user-register' => array( 'label' => __('Enable User Registration', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('This option is not synced with WordPress "Anyone can register" option in Dashboard > Settings > General admin page. If this option is enabled new users will always be able to register.', 'wpforo'), 'help' => 'https://wpforo.com/docs/root/wpforo-settings/features/#user-registration' ),
|
24 |
'user-register-email-confirm' => array( 'label' => __('Enable User Registration email confirmation', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('If you have enabled this option, after registering, user can not login without confirming the email.', 'wpforo'), 'help' => 'https://wpforo.com/docs/root/wpforo-settings/features/#registration-email-confirmation' ),
|
25 |
'disable_new_user_admin_notification' => array( 'label' => __('Stop Sending Emails to Admins on New User Registration', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0, 'description' => __('If you have enabled this option, after registering, the admin will not receive an email notification for newly registered user.', 'wpforo'), 'help' => '' ),
|
@@ -47,10 +46,8 @@ $options = array(
|
|
47 |
'bp_activity' => array( 'label' => __('BuddyPress Activity Integration', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Posts members activity (new topic, new reply, post like) to BuddyPress Profile Activity page.', 'wpforo')),
|
48 |
'bp_notification' => array( 'label' => __('BuddyPress Notification Integration', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Creates notification on new forum reply in BuddyPress Profile Notification page.', 'wpforo')),
|
49 |
'bp_forum_tab' => array( 'label' => __('BuddyPress Profile Forum Tab Integration', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Adds "Forums" tab with "Created Topics", "Posted Replies", "Liked Posts" and "Subscriptions" sub-tabs to BuddyPress Profile page.', 'wpforo')),
|
50 |
-
'bp_profile' => array( 'label' => __('Replace Forum Profile with BuddyPress Profile', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0, 'description' => __('Replaces wpForo Member Profile page with BuddyPress Profile Page.', 'wpforo')),
|
51 |
'um_notification' => array( 'label' => __('Ultimate Member Notification Integration', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Creates notification on new forum reply in Ultimate Member Real-time Notification system.', 'wpforo')),
|
52 |
'um_forum_tab' => array( 'label' => __('Ultimate Member Profile Forum Tab Integration', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Adds "Forums" tab with "Created Topics", "Posted Replies", "Liked Posts" and "Subscriptions" sub-tabs to Ultimate Member Profile page.', 'wpforo')),
|
53 |
-
'um_profile' => array( 'label' => __('Replace Forum Profile with Ultimate Member Profile', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0, 'description' => __('Replaces wpForo Member Profile page with Ultimate Member Profile Page.', 'wpforo')),
|
54 |
'font-awesome' => array( 'label' => __('Enable wpForo Font-Awesome Lib', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'help' => 'https://wpforo.com/docs/root/wpforo-settings/features/#font-awesome-lib'),
|
55 |
'output-buffer' => array( 'label' => __('Enable Output Buffer', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('This feature is useful if you\'re adding content before or after [wpforo] shortcode in page content. Also it useful if forum is loaded before website header, on top of the front-end.', 'wpforo'), 'help' => 'https://wpforo.com/docs/root/wpforo-settings/features/#output-buffer'),
|
56 |
'wp-date-format' => array( 'label' => __('Enable WordPress Date/Time Format', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0, 'description' => __('You can manage WordPress date and time format in WordPress Settings > General admin page.', 'wpforo'), 'help' => 'https://wpforo.com/docs/root/wpforo-settings/features/#wp-date'),
|
@@ -79,14 +76,21 @@ $options = array(
|
|
79 |
</th>
|
80 |
<td>
|
81 |
<div class="wpf-switch-field">
|
82 |
-
<?php if( $key
|
83 |
-
<input type="radio" value="
|
84 |
-
<input type="radio" value="
|
|
|
|
|
85 |
<?php else : ?>
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
90 |
</div>
|
91 |
</td>
|
92 |
</tr>
|
18 |
'track-logging' => array( 'label' => __('Track Forum and Topic Current Viewers', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1),
|
19 |
'goto-unread' => array( 'label' => __('Topic Links Jump to First Unread Post', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('If this option is enabled, all topic links on forums page and on topics page will refer to the first unread post. This behavior is only enabled for logged-in users.', 'wpforo')),
|
20 |
'goto-unread-button' => array( 'label' => __('Jump to First Unread Post with [new] Button in Topic Link', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Adds [new] button at the and of topic links, which jumps to the first unread post.', 'wpforo')),
|
21 |
+
'profile' => array( 'label' => __('Profile Page', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0, 'help' => '' ),
|
|
|
22 |
'user-register' => array( 'label' => __('Enable User Registration', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('This option is not synced with WordPress "Anyone can register" option in Dashboard > Settings > General admin page. If this option is enabled new users will always be able to register.', 'wpforo'), 'help' => 'https://wpforo.com/docs/root/wpforo-settings/features/#user-registration' ),
|
23 |
'user-register-email-confirm' => array( 'label' => __('Enable User Registration email confirmation', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('If you have enabled this option, after registering, user can not login without confirming the email.', 'wpforo'), 'help' => 'https://wpforo.com/docs/root/wpforo-settings/features/#registration-email-confirmation' ),
|
24 |
'disable_new_user_admin_notification' => array( 'label' => __('Stop Sending Emails to Admins on New User Registration', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0, 'description' => __('If you have enabled this option, after registering, the admin will not receive an email notification for newly registered user.', 'wpforo'), 'help' => '' ),
|
46 |
'bp_activity' => array( 'label' => __('BuddyPress Activity Integration', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Posts members activity (new topic, new reply, post like) to BuddyPress Profile Activity page.', 'wpforo')),
|
47 |
'bp_notification' => array( 'label' => __('BuddyPress Notification Integration', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Creates notification on new forum reply in BuddyPress Profile Notification page.', 'wpforo')),
|
48 |
'bp_forum_tab' => array( 'label' => __('BuddyPress Profile Forum Tab Integration', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Adds "Forums" tab with "Created Topics", "Posted Replies", "Liked Posts" and "Subscriptions" sub-tabs to BuddyPress Profile page.', 'wpforo')),
|
|
|
49 |
'um_notification' => array( 'label' => __('Ultimate Member Notification Integration', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Creates notification on new forum reply in Ultimate Member Real-time Notification system.', 'wpforo')),
|
50 |
'um_forum_tab' => array( 'label' => __('Ultimate Member Profile Forum Tab Integration', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Adds "Forums" tab with "Created Topics", "Posted Replies", "Liked Posts" and "Subscriptions" sub-tabs to Ultimate Member Profile page.', 'wpforo')),
|
|
|
51 |
'font-awesome' => array( 'label' => __('Enable wpForo Font-Awesome Lib', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'help' => 'https://wpforo.com/docs/root/wpforo-settings/features/#font-awesome-lib'),
|
52 |
'output-buffer' => array( 'label' => __('Enable Output Buffer', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('This feature is useful if you\'re adding content before or after [wpforo] shortcode in page content. Also it useful if forum is loaded before website header, on top of the front-end.', 'wpforo'), 'help' => 'https://wpforo.com/docs/root/wpforo-settings/features/#output-buffer'),
|
53 |
'wp-date-format' => array( 'label' => __('Enable WordPress Date/Time Format', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0, 'description' => __('You can manage WordPress date and time format in WordPress Settings > General admin page.', 'wpforo'), 'help' => 'https://wpforo.com/docs/root/wpforo-settings/features/#wp-date'),
|
76 |
</th>
|
77 |
<td>
|
78 |
<div class="wpf-switch-field">
|
79 |
+
<?php if( $key === 'profile' ) : ?>
|
80 |
+
<input type="radio" value="1" name="wpforo_features[<?php echo esc_attr($key); ?>]" id="wpf_<?php echo esc_attr($key); ?>_1" <?php wpfo_check(WPF()->features[$key], 1); ?>><label for="wpf_<?php echo esc_attr($key); ?>_1" title="<?php _e('wpForo Profile only for the forum, WordPress Profile for others, including comment authors, post authors and etc...', 'wpforo') ?>"><?php _e('Default', 'wpforo'); ?></label>
|
81 |
+
<input type="radio" value="2" name="wpforo_features[<?php echo esc_attr($key); ?>]" id="wpf_<?php echo esc_attr($key); ?>_2" <?php wpfo_check(WPF()->features[$key], 2); ?>><label for="wpf_<?php echo esc_attr($key); ?>_2" title="<?php _e('wpForo Profile for the whole website including forum, comment authors, post authors and etc...', 'wpforo') ?>"><?php _e('wpForo', 'wpforo'); ?></label>
|
82 |
+
<input type="radio" value="3" <?php echo !class_exists('BP_Component') ? ' disabled ' : '' ?> name="wpforo_features[<?php echo esc_attr($key); ?>]" id="wpf_<?php echo esc_attr($key); ?>_3" <?php wpfo_check(WPF()->features[$key], 3); ?>><label for="wpf_<?php echo esc_attr($key); ?>_3" title="<?php _e('BuddyPress Profile for the whole website including forum.', 'wpforo') ?>"><?php _e('BuddyPress', 'wpforo'); ?></label>
|
83 |
+
<input type="radio" value="4" <?php echo !function_exists('UM') ? ' disabled ' : '' ?> name="wpforo_features[<?php echo esc_attr($key); ?>]" id="wpf_<?php echo esc_attr($key); ?>_4" <?php wpfo_check(WPF()->features[$key], 4); ?>><label for="wpf_<?php echo esc_attr($key); ?>_4" title="<?php _e('Ultimate Member Profile for the whole website including forum.', 'wpforo') ?>"><?php _e('Ultimate Member', 'wpforo'); ?></label>
|
84 |
<?php else : ?>
|
85 |
+
<?php if( $key === 'font-awesome' ) : ?>
|
86 |
+
<input type="radio" value="2" name="wpforo_features[<?php echo esc_attr($key); ?>]" id="wpf_<?php echo esc_attr($key); ?>_2" <?php wpfo_check(WPF()->features[$key], 2); ?>><label for="wpf_<?php echo esc_attr($key); ?>_2"><?php _e('Sitewide', 'wpforo'); ?></label>
|
87 |
+
<input type="radio" value="1" name="wpforo_features[<?php echo esc_attr($key); ?>]" id="wpf_<?php echo esc_attr($key); ?>_1" <?php wpfo_check(WPF()->features[$key], 1); ?>><label for="wpf_<?php echo esc_attr($key); ?>_1"><?php _e('Forum', 'wpforo'); ?></label>
|
88 |
+
<?php else : ?>
|
89 |
+
<input type="radio" value="1" name="wpforo_features[<?php echo esc_attr($key); ?>]" id="wpf_<?php echo esc_attr($key); ?>_1" <?php wpfo_check(WPF()->features[$key], 1); ?>><label for="wpf_<?php echo esc_attr($key); ?>_1"><?php _e('Yes', 'wpforo'); ?></label>
|
90 |
+
<?php endif; ?>
|
91 |
+
<input type="radio" value="0" name="wpforo_features[<?php echo esc_attr($key); ?>]" id="wpf_<?php echo esc_attr($key); ?>_0" <?php wpfo_check(WPF()->features[$key], 0); ?>><label for="wpf_<?php echo esc_attr($key); ?>_0"><?php _e('No', 'wpforo'); ?></label>
|
92 |
+
<?php if($key === 'copyright') echo '<span style="color:#009900; font-weight:400; font-size:14px;"> '. __('Thank you!', 'wpforo') . '</span>'; ?>
|
93 |
+
<?php endif ?>
|
94 |
</div>
|
95 |
</td>
|
96 |
</tr>
|
wpf-admin/options-tabs/members.php
CHANGED
@@ -67,11 +67,11 @@
|
|
67 |
<p class="wpf-info">
|
68 |
<?php _e('For member profile, account and subscription pages use following URLs:', 'wpforo');
|
69 |
echo "<br/>";
|
70 |
-
echo urldecode( wpforo_home_url(
|
71 |
echo "<br/>";
|
72 |
-
echo urldecode( wpforo_home_url(
|
73 |
echo "<br/>";
|
74 |
-
echo urldecode( wpforo_home_url(
|
75 |
?>
|
76 |
</p>
|
77 |
</th>
|
67 |
<p class="wpf-info">
|
68 |
<?php _e('For member profile, account and subscription pages use following URLs:', 'wpforo');
|
69 |
echo "<br/>";
|
70 |
+
echo urldecode( wpforo_home_url( wpforo_get_template_slug('profile') ) );
|
71 |
echo "<br/>";
|
72 |
+
echo urldecode( wpforo_home_url( wpforo_get_template_slug('account') ) );
|
73 |
echo "<br/>";
|
74 |
+
echo urldecode( wpforo_home_url( wpforo_get_template_slug('subscriptions') ) );
|
75 |
?>
|
76 |
</p>
|
77 |
</th>
|
wpf-assets/js/ajax.js
CHANGED
@@ -687,7 +687,7 @@ jQuery(document).ready(function ($) {
|
|
687 |
if( $( "#wpf_user_name" ).length ) { $( "#wpf_user_name" ).attr('name', 'post[name]'); }
|
688 |
if( $( "#wpf_user_email" ).length ) { $( "#wpf_user_email" ).attr('name', 'post[email]'); }
|
689 |
}else{
|
690 |
-
$( "#wpf_title").val( response.topic_title
|
691 |
$( "#wpf_tags" ).val( response.topic_tags );
|
692 |
$( ".wpf-topic-tags" ).show();
|
693 |
$('input[name=wpfaction]', main_form).val('wpforo_topic_save');
|
@@ -731,9 +731,11 @@ jQuery(document).ready(function ($) {
|
|
731 |
status_value = 'topic';
|
732 |
}
|
733 |
|
734 |
-
var forumid =
|
735 |
-
|
736 |
-
|
|
|
|
|
737 |
type: 'POST',
|
738 |
url: wpforo.ajax_url,
|
739 |
data:{
|
687 |
if( $( "#wpf_user_name" ).length ) { $( "#wpf_user_name" ).attr('name', 'post[name]'); }
|
688 |
if( $( "#wpf_user_email" ).length ) { $( "#wpf_user_email" ).attr('name', 'post[email]'); }
|
689 |
}else{
|
690 |
+
$( "#wpf_title").val( response.topic_title ).show();
|
691 |
$( "#wpf_tags" ).val( response.topic_tags );
|
692 |
$( ".wpf-topic-tags" ).show();
|
693 |
$('input[name=wpfaction]', main_form).val('wpforo_topic_save');
|
731 |
status_value = 'topic';
|
732 |
}
|
733 |
|
734 |
+
var forumid = 0;
|
735 |
+
var wpf_parent = $("input[type='hidden']#wpf_parent");
|
736 |
+
if( wpf_parent.length ) forumid = wpf_parent.val();
|
737 |
+
|
738 |
+
$.ajax({
|
739 |
type: 'POST',
|
740 |
url: wpforo.ajax_url,
|
741 |
data:{
|
wpf-assets/js/frontend.js
CHANGED
@@ -488,10 +488,10 @@ jQuery(document).ready(function($){
|
|
488 |
* prevent multi submitting
|
489 |
* disable form elements for 10 seconds
|
490 |
*/
|
491 |
-
|
492 |
wpforo_wrap.on('submit', 'form', function () {
|
493 |
-
if( wpforo_prev_submit_time ){
|
494 |
-
if( Date.now() - wpforo_prev_submit_time < 10000 ) return false;
|
495 |
}else{
|
496 |
var textareaid = $(this).data('textareaid');
|
497 |
if( textareaid ){
|
@@ -515,10 +515,10 @@ jQuery(document).ready(function($){
|
|
515 |
}
|
516 |
|
517 |
wpforo_load_show();
|
518 |
-
wpforo_prev_submit_time = Date.now();
|
519 |
window.onbeforeunload = null;
|
520 |
setTimeout(function () {
|
521 |
-
wpforo_prev_submit_time = 0;
|
522 |
wpforo_load_hide();
|
523 |
}, 10000);
|
524 |
}
|
488 |
* prevent multi submitting
|
489 |
* disable form elements for 10 seconds
|
490 |
*/
|
491 |
+
window.wpforo_prev_submit_time = 0;
|
492 |
wpforo_wrap.on('submit', 'form', function () {
|
493 |
+
if( window.wpforo_prev_submit_time ){
|
494 |
+
if( Date.now() - window.wpforo_prev_submit_time < 10000 ) return false;
|
495 |
}else{
|
496 |
var textareaid = $(this).data('textareaid');
|
497 |
if( textareaid ){
|
515 |
}
|
516 |
|
517 |
wpforo_load_show();
|
518 |
+
window.wpforo_prev_submit_time = Date.now();
|
519 |
window.onbeforeunload = null;
|
520 |
setTimeout(function () {
|
521 |
+
window.wpforo_prev_submit_time = 0;
|
522 |
wpforo_load_hide();
|
523 |
}, 10000);
|
524 |
}
|
wpf-assets/js/widgets.js
CHANGED
@@ -1,4 +1,8 @@
|
|
1 |
jQuery(document).ready(function ($) {
|
|
|
|
|
|
|
|
|
2 |
$(document).on("keydown", function (e) {
|
3 |
if( e.which === 27 ) $('.wpf-notifications').slideUp(250, 'linear');
|
4 |
});
|
@@ -35,7 +39,7 @@ jQuery(document).ready(function ($) {
|
|
35 |
$('.wpf-notifications').slideUp(250, 'linear');
|
36 |
$.ajax({
|
37 |
type: 'POST',
|
38 |
-
url:
|
39 |
data:{
|
40 |
foro_n: foro_n,
|
41 |
action: 'wpforo_clear_all_notifications'
|
@@ -76,10 +80,12 @@ function wpforo_bell( wpf_alerts ){
|
|
76 |
|
77 |
var wpforo_check_notifications_timeout;
|
78 |
function wpforo_check_notifications( wpforo_check_interval ) {
|
|
|
|
|
79 |
var getdata = jQuery('.wpf-notifications').is(':visible');
|
80 |
jQuery.ajax({
|
81 |
type: 'POST',
|
82 |
-
url:
|
83 |
data:{
|
84 |
getdata: getdata,
|
85 |
action: 'wpforo_notifications'
|
@@ -98,7 +104,7 @@ function wpforo_load_notifications() {
|
|
98 |
jQuery('.wpf-notifications .wpf-notification-content').html('<div class="wpf-nspin"><i class="fas fa-spinner fa-spin"></i></div>');
|
99 |
jQuery.ajax({
|
100 |
type: 'POST',
|
101 |
-
url:
|
102 |
data:{
|
103 |
getdata: 1,
|
104 |
action: 'wpforo_notifications'
|
1 |
jQuery(document).ready(function ($) {
|
2 |
+
if( parseInt(wpforo_widgets.is_live_notifications_on) && typeof wpforo_check_notifications === 'function'){
|
3 |
+
setTimeout(wpforo_check_notifications, parseInt(wpforo_widgets.live_notifications_start), parseInt(wpforo_widgets.live_notifications_interval));
|
4 |
+
}
|
5 |
+
|
6 |
$(document).on("keydown", function (e) {
|
7 |
if( e.which === 27 ) $('.wpf-notifications').slideUp(250, 'linear');
|
8 |
});
|
39 |
$('.wpf-notifications').slideUp(250, 'linear');
|
40 |
$.ajax({
|
41 |
type: 'POST',
|
42 |
+
url: wpforo_widgets.ajax_url,
|
43 |
data:{
|
44 |
foro_n: foro_n,
|
45 |
action: 'wpforo_clear_all_notifications'
|
80 |
|
81 |
var wpforo_check_notifications_timeout;
|
82 |
function wpforo_check_notifications( wpforo_check_interval ) {
|
83 |
+
wpforo_check_interval = parseInt(wpforo_check_interval);
|
84 |
+
if( isNaN(wpforo_check_interval) ) wpforo_check_interval = 60000;
|
85 |
var getdata = jQuery('.wpf-notifications').is(':visible');
|
86 |
jQuery.ajax({
|
87 |
type: 'POST',
|
88 |
+
url: wpforo_widgets.ajax_url,
|
89 |
data:{
|
90 |
getdata: getdata,
|
91 |
action: 'wpforo_notifications'
|
104 |
jQuery('.wpf-notifications .wpf-notification-content').html('<div class="wpf-nspin"><i class="fas fa-spinner fa-spin"></i></div>');
|
105 |
jQuery.ajax({
|
106 |
type: 'POST',
|
107 |
+
url: wpforo_widgets.ajax_url,
|
108 |
data:{
|
109 |
getdata: 1,
|
110 |
action: 'wpforo_notifications'
|
wpf-includes/class-actions.php
CHANGED
@@ -399,7 +399,7 @@ class wpForoAction {
|
|
399 |
if( wpfval($_POST, 'member', 'userid') ){
|
400 |
wpforo_verify_form();
|
401 |
$uid = intval($_POST['member']['userid']);
|
402 |
-
if( !(
|
403 |
( WPF()->perm->usergroup_can('em') && WPF()->perm->user_can_manage_user( WPF()->current_userid, $uid )) ) ){
|
404 |
WPF()->notice->clear();
|
405 |
WPF()->notice->add('Permission denied', 'error');
|
@@ -489,7 +489,7 @@ class wpForoAction {
|
|
489 |
$redirect_to = wpforo_get_request_uri();
|
490 |
if( WPF()->current_object['topic'] && !empty($_POST['wpforo']) && !empty($_POST['wpforo']['target_topic_url']) ){
|
491 |
$target_slug = esc_url($_POST['wpforo']['target_topic_url']);
|
492 |
-
if( preg_match('#^[\r\n\t\s]*https?://[^\r\n\t\s]+?/[^/]+?/([^/]+?)(?:/'.
|
493 |
if( is_wpforo_url($target_slug) ) $target_slug = $match[1];
|
494 |
}
|
495 |
if ( strpos($target_slug, '/') === false && $target = WPF()->topic->get_topic($target_slug) ){
|
@@ -525,7 +525,7 @@ class wpForoAction {
|
|
525 |
}else{
|
526 |
if( !empty($_POST['wpforo']['target_topic_url']) && !empty($_POST['wpforo']['posts']) ){
|
527 |
$target_slug = esc_url( $_POST['wpforo']['target_topic_url'] );
|
528 |
-
if( preg_match('#^[\r\n\t\s]*https?://[^\r\n\t\s]+?/[^/]+?/([^/]+?)(?:/'.
|
529 |
if( is_wpforo_url($target_slug) ) $target_slug = $match[1];
|
530 |
if ( strpos($target_slug, '/') === false && $target = WPF()->topic->get_topic($target_slug) ){
|
531 |
$append = (empty($_POST['wpforo']['update_date_and_append']) ? 0 : 1);
|
@@ -579,7 +579,7 @@ class wpForoAction {
|
|
579 |
$all = ( !empty($_POST['wpforo']['check_all']) ? sanitize_title($_POST['wpforo']['check_all']) : '' );
|
580 |
|
581 |
WPF()->sbscrb->reset($data, $all);
|
582 |
-
wp_redirect( wpforo_home_url(
|
583 |
exit();
|
584 |
}
|
585 |
|
@@ -953,7 +953,8 @@ class wpForoAction {
|
|
953 |
if ( ! empty( $_POST['wpforo_tpl_slugs'] ) ) {
|
954 |
$wpforo_tpl_slugs = array_filter( array_map( 'sanitize_title', $_POST['wpforo_tpl_slugs'] ) );
|
955 |
$wpforo_tpl_slugs = array_merge( WPF()->tpl->slugs, $wpforo_tpl_slugs );
|
956 |
-
|
|
|
957 |
update_option( 'wpforo_tpl_slugs', $wpforo_tpl_slugs );
|
958 |
} else {
|
959 |
WPF()->notice->add( 'Please save "Forum template slugs" uniqueness', 'error' );
|
399 |
if( wpfval($_POST, 'member', 'userid') ){
|
400 |
wpforo_verify_form();
|
401 |
$uid = intval($_POST['member']['userid']);
|
402 |
+
if( !( $uid === WPF()->current_userid ||
|
403 |
( WPF()->perm->usergroup_can('em') && WPF()->perm->user_can_manage_user( WPF()->current_userid, $uid )) ) ){
|
404 |
WPF()->notice->clear();
|
405 |
WPF()->notice->add('Permission denied', 'error');
|
489 |
$redirect_to = wpforo_get_request_uri();
|
490 |
if( WPF()->current_object['topic'] && !empty($_POST['wpforo']) && !empty($_POST['wpforo']['target_topic_url']) ){
|
491 |
$target_slug = esc_url($_POST['wpforo']['target_topic_url']);
|
492 |
+
if( preg_match('#^[\r\n\t\s]*https?://[^\r\n\t\s]+?/[^/]+?/([^/]+?)(?:/'. wpforo_get_template_slug('paged') .'/\d+/?)?(?:/?\#post-\d+)?/?[\r\n\t\s]*$#isu', $target_slug, $match) ){
|
493 |
if( is_wpforo_url($target_slug) ) $target_slug = $match[1];
|
494 |
}
|
495 |
if ( strpos($target_slug, '/') === false && $target = WPF()->topic->get_topic($target_slug) ){
|
525 |
}else{
|
526 |
if( !empty($_POST['wpforo']['target_topic_url']) && !empty($_POST['wpforo']['posts']) ){
|
527 |
$target_slug = esc_url( $_POST['wpforo']['target_topic_url'] );
|
528 |
+
if( preg_match('#^[\r\n\t\s]*https?://[^\r\n\t\s]+?/[^/]+?/([^/]+?)(?:/'. wpforo_get_template_slug('paged') .'/\d+/?)?(?:/?\#post-\d+)?/?[\r\n\t\s]*$#isu', $target_slug, $match) )
|
529 |
if( is_wpforo_url($target_slug) ) $target_slug = $match[1];
|
530 |
if ( strpos($target_slug, '/') === false && $target = WPF()->topic->get_topic($target_slug) ){
|
531 |
$append = (empty($_POST['wpforo']['update_date_and_append']) ? 0 : 1);
|
579 |
$all = ( !empty($_POST['wpforo']['check_all']) ? sanitize_title($_POST['wpforo']['check_all']) : '' );
|
580 |
|
581 |
WPF()->sbscrb->reset($data, $all);
|
582 |
+
wp_redirect( wpforo_home_url(wpforo_get_template_slug('subscriptions')) );
|
583 |
exit();
|
584 |
}
|
585 |
|
953 |
if ( ! empty( $_POST['wpforo_tpl_slugs'] ) ) {
|
954 |
$wpforo_tpl_slugs = array_filter( array_map( 'sanitize_title', $_POST['wpforo_tpl_slugs'] ) );
|
955 |
$wpforo_tpl_slugs = array_merge( WPF()->tpl->slugs, $wpforo_tpl_slugs );
|
956 |
+
$wpforo_tpl_slugs = array_intersect_key($wpforo_tpl_slugs, WPF()->tpl->default->slugs);
|
957 |
+
if ( $wpforo_tpl_slugs == array_unique( $wpforo_tpl_slugs ) ) {
|
958 |
update_option( 'wpforo_tpl_slugs', $wpforo_tpl_slugs );
|
959 |
} else {
|
960 |
WPF()->notice->add( 'Please save "Forum template slugs" uniqueness', 'error' );
|
wpf-includes/class-feed.php
CHANGED
@@ -113,7 +113,7 @@ class wpForoFeed{
|
|
113 |
<?php if(!isset($topic['title']) || !$topic['title']): ?>
|
114 |
<?php echo esc_html(WPF()->general_options['title']) . ' - ' . wpforo_phrase('Recent Posts', false); ?>
|
115 |
<?php else: ?>
|
116 |
-
<?php echo esc_html($topic['title']); ?> - <?php echo esc_html($forum
|
117 |
<?php endif; ?>
|
118 |
</title>
|
119 |
<link><?php echo esc_url($topic['topicurl']); ?></link>
|
@@ -130,7 +130,7 @@ class wpForoFeed{
|
|
130 |
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', $post['created'], false); ?></pubDate>
|
131 |
<description><![CDATA[<?php echo wpforo_removebb(esc_html($post['description'])) ?>]]></description>
|
132 |
<content:encoded><![CDATA[<?php echo wpforo_removebb($post['content']) ?>]]></content:encoded>
|
133 |
-
<?php if($forum
|
134 |
<dc:creator><?php echo esc_html($post['author']); ?></dc:creator>
|
135 |
<guid isPermaLink="true"><?php echo esc_url($post['posturl']); ?></guid>
|
136 |
</item>
|
113 |
<?php if(!isset($topic['title']) || !$topic['title']): ?>
|
114 |
<?php echo esc_html(WPF()->general_options['title']) . ' - ' . wpforo_phrase('Recent Posts', false); ?>
|
115 |
<?php else: ?>
|
116 |
+
<?php echo esc_html($topic['title']); ?> - <?php echo esc_html(wpfval($forum, 'title')); ?>
|
117 |
<?php endif; ?>
|
118 |
</title>
|
119 |
<link><?php echo esc_url($topic['topicurl']); ?></link>
|
130 |
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', $post['created'], false); ?></pubDate>
|
131 |
<description><![CDATA[<?php echo wpforo_removebb(esc_html($post['description'])) ?>]]></description>
|
132 |
<content:encoded><![CDATA[<?php echo wpforo_removebb($post['content']) ?>]]></content:encoded>
|
133 |
+
<?php if(wpfval($forum,'forumurl') != '#'): ?><category domain="<?php echo esc_url(wpfval($forum,'forumurl')); ?>"><?php echo esc_html(wpfval($forum,'title')); ?></category><?php endif; ?>
|
134 |
<dc:creator><?php echo esc_html($post['author']); ?></dc:creator>
|
135 |
<guid isPermaLink="true"><?php echo esc_url($post['posturl']); ?></guid>
|
136 |
</item>
|
wpf-includes/class-forms.php
CHANGED
@@ -41,7 +41,7 @@ class wpForoForm{
|
|
41 |
'html' => '',
|
42 |
'varname' => '',
|
43 |
'template' => '',
|
44 |
-
'
|
45 |
'canEdit' => array(1),
|
46 |
'canView' => array(1, 2, 3, 5),
|
47 |
'can' => '',
|
@@ -53,27 +53,6 @@ class wpForoForm{
|
|
53 |
return wpforo_array_args_cast_and_merge((array) $field, $this->default);
|
54 |
}
|
55 |
|
56 |
-
/**
|
57 |
-
* The varname of custom fields in forms:
|
58 |
-
* $varname = 'member' user account
|
59 |
-
* $varname = 'wpfreg' register forms
|
60 |
-
* $varname = '' member search
|
61 |
-
* $varname = 'data' custom fields (by default)
|
62 |
-
*
|
63 |
-
* @return string
|
64 |
-
*/
|
65 |
-
public function varname(){
|
66 |
-
$template = ( isset(WPF()->data['template']) ) ? WPF()->data['template'] : WPF()->current_object['template'];
|
67 |
-
if( $template === 'members' ){
|
68 |
-
$varname = WPF()->data['varname'];
|
69 |
-
} else {
|
70 |
-
$varname = ( wpfval( WPF()->data, 'varname') ) ? WPF()->data['varname'] : 'data';
|
71 |
-
$varname = apply_filters( 'wpforo_user_custom_field_varname', $varname);
|
72 |
-
$varname = ( $varname ) ? $varname : 'data';
|
73 |
-
}
|
74 |
-
return $varname;
|
75 |
-
}
|
76 |
-
|
77 |
/**
|
78 |
* Form builder
|
79 |
* for form layout and field building
|
@@ -106,6 +85,7 @@ class wpForoForm{
|
|
106 |
* @return string field HTML
|
107 |
*/
|
108 |
public function build_field($args){
|
|
|
109 |
|
110 |
$html = '';
|
111 |
if( !is_array($args) || empty($args) ) return '';
|
@@ -127,16 +107,16 @@ class wpForoForm{
|
|
127 |
}
|
128 |
}
|
129 |
elseif( $f['template'] === 'profile' ){
|
130 |
-
if( $this->can_view( $f ) ){
|
131 |
$f = $this->esc_field( $f );
|
132 |
$html = $this->field_wrap_profile( $field_html, $f );
|
133 |
}
|
134 |
}
|
135 |
elseif( $f['template'] === 'members' ){
|
136 |
-
$html = $this->field_wrap_members( $field_html, $f );
|
137 |
}
|
138 |
else{
|
139 |
-
$html = $this->field_wrap_default( $field_html, $f );
|
140 |
}
|
141 |
return $html;
|
142 |
}
|
@@ -163,6 +143,7 @@ class wpForoForm{
|
|
163 |
case 'password': $field_html = $this->field_password($f); break;
|
164 |
case 'checkbox': $field_html = $this->field_checkbox($f); break;
|
165 |
case 'usergroup': $field_html = $this->field_usergroup($f); break;
|
|
|
166 |
case 'user_nicename': $field_html = $this->field_nicename($f); break;
|
167 |
default: $field_html = $this->field_text($f);
|
168 |
}
|
@@ -218,7 +199,7 @@ class wpForoForm{
|
|
218 |
$html .= '<span class="wpf-username">' . $f['value'] . '</span>';
|
219 |
$html .= '</div>';
|
220 |
}
|
221 |
-
elseif( !$f['isEditable'] && !$this->can_moderate($f) && WPF()->current_user_groupid !== 1 ){
|
222 |
$f = $this->esc_field( $f );
|
223 |
$html .= '<div class="wpf-label-wrap">';
|
224 |
$html .= '<p class="wpf-label wpfcl-1">' . stripslashes($f['label']) . '</p>';
|
@@ -252,7 +233,7 @@ class wpForoForm{
|
|
252 |
*/
|
253 |
public function field_wrap_profile($field_html, $f){
|
254 |
|
255 |
-
if(
|
256 |
return false;
|
257 |
}
|
258 |
|
@@ -266,12 +247,12 @@ class wpForoForm{
|
|
266 |
}
|
267 |
$html .= '</div>';
|
268 |
}
|
269 |
-
if( isset($f['value']) && !empty($f['value
|
270 |
if( is_array($f['value']) ){
|
271 |
$html .= esc_html(implode( ', ', $f['value']));
|
272 |
}
|
273 |
else{
|
274 |
-
$f = $this->prepare_values( $f );
|
275 |
$html .= '<div class="wpf-field-wrap">';
|
276 |
$html .= $f['value'];
|
277 |
$html .= '</div>';
|
@@ -478,28 +459,27 @@ class wpForoForm{
|
|
478 |
* @return string field HTML
|
479 |
*/
|
480 |
public function field_checkbox($f){
|
481 |
-
$i = 0; $
|
482 |
$f['value'] = $this->build_array_value( $f['value'] );
|
483 |
if( !is_array($f['values']) ) $f['values'] = $this->build_array_using_string_rows( $f['values'] );
|
484 |
if( !empty($f['values']) ){
|
485 |
$item_field_name = $f['fieldName'] . '[]';
|
486 |
$use_default_selected = (trim($f['isRequired']) && !$f['value']);
|
487 |
$f['isRequired'] = ( count($f['values']) == 1 ) ? $f['isRequired'] : '';
|
|
|
488 |
foreach( $f['values'] as $row ){
|
489 |
$item = $this->build_item_value_lable($row);
|
490 |
-
$
|
491 |
$field_html .= '<div class="wpf-field-item">';
|
492 |
$item_html = '<input type="checkbox" ' . ($use_default_selected ? ($item['default_selected'] ? ' checked ' : '') : $this->check($item['value'], $f['value'])) . '
|
493 |
name="' . esc_attr( $item_field_name ) . '"
|
494 |
value="' . esc_attr( $item['value'] ) . '"
|
495 |
-
id="' . esc_attr( $
|
496 |
class="wpf-input-checkbox ' . esc_attr( $f['class'] ) . '"
|
497 |
' . $f['isDisabled'] . ' ' . $f['isRequired'] . ' ' . $f['attributes'] . '>';
|
498 |
-
$field_html .= $this->build_label($item['label'], $item_html, $f);
|
499 |
$field_html .= '</div>';
|
500 |
-
$i++;
|
501 |
}
|
502 |
-
if( $field_zero ) $field_html .= '<input type="hidden" name="' . esc_attr( $item_field_name ) . '" value="0">';
|
503 |
}
|
504 |
return $field_html;
|
505 |
}
|
@@ -518,16 +498,16 @@ class wpForoForm{
|
|
518 |
if( !empty($f['values']) ){
|
519 |
foreach( $f['values'] as $row ){
|
520 |
$item = $this->build_item_value_lable($row);
|
|
|
521 |
$field_html .= '<div class="wpf-field-item">';
|
522 |
$item_html = '<input type="radio" ' . ($use_default_selected ? ($item['default_selected'] ? ' checked ' : '') : $this->check($item['value'], $f['value'])) . '
|
523 |
name="' . esc_attr( $f['fieldName'] ) . '"
|
524 |
value="' . esc_attr( $item['value'] ) . '"
|
525 |
-
id="' . esc_attr( $
|
526 |
class="wpf-input-radio ' . esc_attr( $f['class'] ) . '"
|
527 |
' . $f['isDisabled'] . ' ' . $f['isRequired'] . ' ' . $f['attributes'] . ' />';
|
528 |
-
$field_html .= $this->build_label($item['label'], $item_html, $f);
|
529 |
$field_html .= '</div>';
|
530 |
-
$i++;
|
531 |
}
|
532 |
}
|
533 |
return $field_html;
|
@@ -597,6 +577,29 @@ class wpForoForm{
|
|
597 |
return $field_html;
|
598 |
}
|
599 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
600 |
/**
|
601 |
* Avatar - Field builder
|
602 |
*
|
@@ -636,7 +639,7 @@ class wpForoForm{
|
|
636 |
* @return string field HTML
|
637 |
*/
|
638 |
public function field_html($f){
|
639 |
-
return stripslashes( do_shortcode(
|
640 |
}
|
641 |
|
642 |
/**
|
@@ -689,28 +692,29 @@ class wpForoForm{
|
|
689 |
* Prepares displayed values for Profile fields
|
690 |
*
|
691 |
* @param array $f field arguments
|
|
|
692 |
* @return array prepared values
|
693 |
*/
|
694 |
-
public function prepare_values($f){
|
695 |
switch ( $f['type'] ){
|
696 |
case 'textarea':
|
697 |
$f['value'] = wpforo_kses(wpforo_decode($f['value']));
|
698 |
-
|
699 |
case 'date':
|
700 |
$f['value'] = wpforo_date($f['value'], 'date', false);
|
701 |
-
|
702 |
case 'datetime':
|
703 |
$f['value'] = wpforo_date($f['value'], 'datetime', false);
|
704 |
-
|
705 |
case 'url':
|
706 |
$f['value'] = sprintf('<a href="%1$s" target="_blank" rel="nofollow">%2$s</a>', $f['value'], $f['value']);
|
707 |
-
|
708 |
case 'email':
|
709 |
$f['value'] = sprintf('<a href="mailto:%1$s" rel="nofollow">%2$s</a>', $f['value'], $f['value']);
|
710 |
-
|
711 |
case 'phone':
|
712 |
$f['value'] = sprintf('<a href="tel:%1$s" rel="nofollow">%2$s</a>', $f['value'], $f['value']);
|
713 |
-
|
714 |
case 'file':
|
715 |
if( !empty($f['value']) ){
|
716 |
$wp_upload_dir = wp_upload_dir();
|
@@ -724,7 +728,15 @@ class wpForoForm{
|
|
724 |
$f['value'] = sprintf('<a href="%s" target="_blank">%s</a>', $file_url, $file_name );
|
725 |
}
|
726 |
}
|
727 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
728 |
}
|
729 |
switch ( $f['name'] ){
|
730 |
case 'skype':
|
@@ -757,7 +769,8 @@ class wpForoForm{
|
|
757 |
$f['field_class'] = sanitize_text_field( $f['name'] );
|
758 |
|
759 |
//varname
|
760 |
-
|
|
|
761 |
|
762 |
//template
|
763 |
$f['template'] = ( isset(WPF()->data['template']) ) ? WPF()->data['template'] : WPF()->current_object['template'];
|
@@ -768,21 +781,21 @@ class wpForoForm{
|
|
768 |
$f['value'] = ( isset(WPF()->data['value'][$f['varname']][$f['name']]) ) ? WPF()->data['value'][$f['varname']][$f['name']] : $f['value'];
|
769 |
}
|
770 |
$f['value'] = wpforo_unslashe( $f['value'] );
|
|
|
771 |
|
772 |
-
|
773 |
$f['value'] = urldecode($f['value']);
|
774 |
}
|
775 |
|
776 |
//allowedGroupIds
|
777 |
$groups = array();
|
778 |
-
if ( !empty($f['allowedGroupIds']) )
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
$groups = array();
|
786 |
}
|
787 |
$f['allowedGroupIds'] = array_filter( $groups );
|
788 |
|
@@ -814,13 +827,18 @@ class wpForoForm{
|
|
814 |
//isDisabled
|
815 |
$f['isDisabled'] = ( $f['isDisabled'] ) ? ' disabled="disabled" ' : '';
|
816 |
|
817 |
-
//isMultiChoice
|
818 |
-
$f['isMultiChoice'] = ( $f['isMultiChoice'] ) ? ' multiple="multiple" ' : '';
|
819 |
-
|
820 |
//fieldName | new key in args
|
821 |
$f['fieldName'] = ( !empty($f['varname'] ) ? $f['varname'] . '[' . $f['name'] . ']' : $f['name'] );
|
822 |
|
823 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
824 |
$f['fieldId'] = ( !empty($f['varname'] ) ? $f['varname'] . '_' : '' ) . ( ($f['id']) ? $f['id'] : $f['name'] );
|
825 |
|
826 |
//minLength & maxLength
|
@@ -863,6 +881,7 @@ class wpForoForm{
|
|
863 |
}
|
864 |
|
865 |
public function check($needle, $haystack){
|
|
|
866 |
return in_array($needle, (array) $haystack) ? 'checked' : '';
|
867 |
}
|
868 |
|
@@ -870,24 +889,10 @@ class wpForoForm{
|
|
870 |
return in_array($needle, (array) $haystack) ? 'selected' : '';
|
871 |
}
|
872 |
|
873 |
-
public function build_label( $item_label, $item_html, $f ){
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
if ($f['isLabelFirst']) {
|
878 |
-
$field_html .= '<span class="wpf-' . $f['type'] . '-label">' . stripslashes($item_label) . '</span> ' . $item_html;
|
879 |
-
} else {
|
880 |
-
$field_html .= $item_html . ' <span class="wpf-' . $f['type'] . '-label">' . stripslashes($item_label) . '</span>';
|
881 |
-
}
|
882 |
-
$field_html .= '</label>';
|
883 |
-
}
|
884 |
-
else {
|
885 |
-
if ($f['isLabelFirst']) {
|
886 |
-
$field_html .= '<span class="wpf-' . $f['type'] . '-label">' . stripslashes($item_label) . '</span> ' . $item_html;
|
887 |
-
} else {
|
888 |
-
$field_html .= $item_html . ' <span class="wpf-' . $f['type'] . '-label">' . stripslashes($item_label) . '</span>';
|
889 |
-
}
|
890 |
-
}
|
891 |
return $field_html;
|
892 |
}
|
893 |
|
@@ -903,15 +908,18 @@ class wpForoForm{
|
|
903 |
return $item;
|
904 |
}
|
905 |
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
|
|
|
|
|
|
915 |
|
916 |
public function build_array_using_string_rows( $string, $regexp = '' ){
|
917 |
if( !$regexp ) $regexp = '#' . preg_quote(PHP_EOL) . '#isu';
|
@@ -999,20 +1007,17 @@ class wpForoForm{
|
|
999 |
$f['value'] = wpforo_trim($f['value']);
|
1000 |
if( wpfval($f, 'type') && $f['type'] === 'textarea' ) {
|
1001 |
$f['value'] = wpautop( wpforo_kses( stripslashes( $f['value'] ) ) );
|
1002 |
-
} elseif( $f['
|
1003 |
-
$f['value'] =
|
1004 |
-
}
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
}
|
1014 |
-
}
|
1015 |
-
else{
|
1016 |
$f['value'] = esc_html($f['value']);
|
1017 |
}
|
1018 |
}
|
@@ -1027,7 +1032,6 @@ class wpForoForm{
|
|
1027 |
$error = array();
|
1028 |
$return = array();
|
1029 |
$is_owner = $this->owner();
|
1030 |
-
$varname = $this->varname();
|
1031 |
$template = ( isset(WPF()->data['template']) ) ? WPF()->data['template'] : WPF()->current_object['template'];
|
1032 |
if( empty($data) ) $error[] = 'No data submitted';
|
1033 |
if( empty($fields) ) $error[] = 'User profile fields not found';
|
@@ -1125,7 +1129,7 @@ class wpForoForm{
|
|
1125 |
}
|
1126 |
}
|
1127 |
if( wpfval( $field, 'fileSize' ) ){
|
1128 |
-
if ( wpfval( $_FILES,
|
1129 |
$error[] = $label . ' ' . wpforo_phrase('file is too large', false, false);
|
1130 |
$error[] = sprintf( 'Maximum allowed file size is %s MB', $field['fileSize'] );
|
1131 |
}
|
@@ -1150,7 +1154,7 @@ class wpForoForm{
|
|
1150 |
$error[] = 'You have no permission to edit Usergroup field';
|
1151 |
}
|
1152 |
} else {
|
1153 |
-
if(
|
1154 |
$error[] = 'Admin and Moderator Usergroups are not permitted';
|
1155 |
} else {
|
1156 |
if( wpfval($field, 'allowedGroupIds') ){
|
@@ -1165,32 +1169,21 @@ class wpForoForm{
|
|
1165 |
}
|
1166 |
}
|
1167 |
if( $name === 'secondary_groups' ){
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
$error[] = 'Admin and Moderator Usergroups are not permitted';
|
1184 |
-
} else {
|
1185 |
-
if( !empty($value) && is_array($value) ){
|
1186 |
-
foreach( $value as $secondary_usergroup_id ){
|
1187 |
-
if( $secondary_usergroup_id && !in_array( $secondary_usergroup_id, $secondary_usergroups) ){
|
1188 |
-
$error[] = 'One of the selected Usergroups cannot be set as Secondary';
|
1189 |
-
}
|
1190 |
-
}
|
1191 |
-
}
|
1192 |
-
}
|
1193 |
-
}
|
1194 |
}
|
1195 |
}
|
1196 |
}
|
@@ -1324,4 +1317,12 @@ class wpForoForm{
|
|
1324 |
$usergroups_who_can_edit = !empty($f['canEdit']) ? (array) $f['canEdit'] : array(1);
|
1325 |
return in_array(WPF()->current_user_groupid, $usergroups_who_can_edit);
|
1326 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1327 |
}
|
41 |
'html' => '',
|
42 |
'varname' => '',
|
43 |
'template' => '',
|
44 |
+
'cantBeInactive' => array(),
|
45 |
'canEdit' => array(1),
|
46 |
'canView' => array(1, 2, 3, 5),
|
47 |
'can' => '',
|
53 |
return wpforo_array_args_cast_and_merge((array) $field, $this->default);
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
/**
|
57 |
* Form builder
|
58 |
* for form layout and field building
|
85 |
* @return string field HTML
|
86 |
*/
|
87 |
public function build_field($args){
|
88 |
+
if( is_string($args) ) $args = WPF()->member->get_field($args);
|
89 |
|
90 |
$html = '';
|
91 |
if( !is_array($args) || empty($args) ) return '';
|
107 |
}
|
108 |
}
|
109 |
elseif( $f['template'] === 'profile' ){
|
110 |
+
if( $this->can_view( $f ) && $this->can_show_value($f) ){
|
111 |
$f = $this->esc_field( $f );
|
112 |
$html = $this->field_wrap_profile( $field_html, $f );
|
113 |
}
|
114 |
}
|
115 |
elseif( $f['template'] === 'members' ){
|
116 |
+
if( $this->can_show_value($f) ) $html = $this->field_wrap_members( $field_html, $f );
|
117 |
}
|
118 |
else{
|
119 |
+
if( $this->can_show_value($f) ) $html = $this->field_wrap_default( $field_html, $f );
|
120 |
}
|
121 |
return $html;
|
122 |
}
|
143 |
case 'password': $field_html = $this->field_password($f); break;
|
144 |
case 'checkbox': $field_html = $this->field_checkbox($f); break;
|
145 |
case 'usergroup': $field_html = $this->field_usergroup($f); break;
|
146 |
+
case 'secondary_groups': $field_html = $this->field_secondary_groups($f); break;
|
147 |
case 'user_nicename': $field_html = $this->field_nicename($f); break;
|
148 |
default: $field_html = $this->field_text($f);
|
149 |
}
|
199 |
$html .= '<span class="wpf-username">' . $f['value'] . '</span>';
|
200 |
$html .= '</div>';
|
201 |
}
|
202 |
+
elseif( $f['type'] !== 'password' && !$f['isEditable'] && !$this->can_moderate($f) && WPF()->current_user_groupid !== 1 ){
|
203 |
$f = $this->esc_field( $f );
|
204 |
$html .= '<div class="wpf-label-wrap">';
|
205 |
$html .= '<p class="wpf-label wpfcl-1">' . stripslashes($f['label']) . '</p>';
|
233 |
*/
|
234 |
public function field_wrap_profile($field_html, $f){
|
235 |
|
236 |
+
if( !in_array($f['type'], array('html', 'avatar')) && !($f['isRequired'] && $f['isDisplayDefaultValues']) && ( !isset($f['value']) || (!is_numeric($f['value']) && empty($f['value']))) ){
|
237 |
return false;
|
238 |
}
|
239 |
|
247 |
}
|
248 |
$html .= '</div>';
|
249 |
}
|
250 |
+
if( $f['type'] === 'avatar' || (isset($f['value']) && !empty($f['value'])) ){
|
251 |
if( is_array($f['value']) ){
|
252 |
$html .= esc_html(implode( ', ', $f['value']));
|
253 |
}
|
254 |
else{
|
255 |
+
$f = $this->prepare_values( $f, WPF()->current_object['userid'] );
|
256 |
$html .= '<div class="wpf-field-wrap">';
|
257 |
$html .= $f['value'];
|
258 |
$html .= '</div>';
|
459 |
* @return string field HTML
|
460 |
*/
|
461 |
public function field_checkbox($f){
|
462 |
+
$i = 0; $field_html = '';
|
463 |
$f['value'] = $this->build_array_value( $f['value'] );
|
464 |
if( !is_array($f['values']) ) $f['values'] = $this->build_array_using_string_rows( $f['values'] );
|
465 |
if( !empty($f['values']) ){
|
466 |
$item_field_name = $f['fieldName'] . '[]';
|
467 |
$use_default_selected = (trim($f['isRequired']) && !$f['value']);
|
468 |
$f['isRequired'] = ( count($f['values']) == 1 ) ? $f['isRequired'] : '';
|
469 |
+
$field_html .= '<input type="hidden" name="' . esc_attr( $f['fieldName'] ) . '" value="">';
|
470 |
foreach( $f['values'] as $row ){
|
471 |
$item = $this->build_item_value_lable($row);
|
472 |
+
$id = $f['fieldId'] . '_' . ++$i;
|
473 |
$field_html .= '<div class="wpf-field-item">';
|
474 |
$item_html = '<input type="checkbox" ' . ($use_default_selected ? ($item['default_selected'] ? ' checked ' : '') : $this->check($item['value'], $f['value'])) . '
|
475 |
name="' . esc_attr( $item_field_name ) . '"
|
476 |
value="' . esc_attr( $item['value'] ) . '"
|
477 |
+
id="' . esc_attr( $id ) . '"
|
478 |
class="wpf-input-checkbox ' . esc_attr( $f['class'] ) . '"
|
479 |
' . $f['isDisabled'] . ' ' . $f['isRequired'] . ' ' . $f['attributes'] . '>';
|
480 |
+
$field_html .= $this->build_label($item['label'], $item_html, $f, $id);
|
481 |
$field_html .= '</div>';
|
|
|
482 |
}
|
|
|
483 |
}
|
484 |
return $field_html;
|
485 |
}
|
498 |
if( !empty($f['values']) ){
|
499 |
foreach( $f['values'] as $row ){
|
500 |
$item = $this->build_item_value_lable($row);
|
501 |
+
$id = $f['fieldId'] . '_' . ++$i;
|
502 |
$field_html .= '<div class="wpf-field-item">';
|
503 |
$item_html = '<input type="radio" ' . ($use_default_selected ? ($item['default_selected'] ? ' checked ' : '') : $this->check($item['value'], $f['value'])) . '
|
504 |
name="' . esc_attr( $f['fieldName'] ) . '"
|
505 |
value="' . esc_attr( $item['value'] ) . '"
|
506 |
+
id="' . esc_attr( $id ) . '"
|
507 |
class="wpf-input-radio ' . esc_attr( $f['class'] ) . '"
|
508 |
' . $f['isDisabled'] . ' ' . $f['isRequired'] . ' ' . $f['attributes'] . ' />';
|
509 |
+
$field_html .= $this->build_label($item['label'], $item_html, $f, $id);
|
510 |
$field_html .= '</div>';
|
|
|
511 |
}
|
512 |
}
|
513 |
return $field_html;
|
577 |
return $field_html;
|
578 |
}
|
579 |
|
580 |
+
public function field_secondary_groups($f){
|
581 |
+
$field_html = '';
|
582 |
+
if( $groups = WPF()->usergroup->get_secondary_usergroups() ){
|
583 |
+
$allowed_groupids = (array) wpfval($f, 'allowedGroupIds');
|
584 |
+
$i = 0;
|
585 |
+
$field_html .= '<input type="hidden" name="' . esc_attr( $f['fieldName'] ) . '" value="">';
|
586 |
+
foreach( $groups as $group ){
|
587 |
+
if( in_array($group['groupid'], array(1,2,4)) || ( $allowed_groupids && !in_array($group['groupid'], $allowed_groupids) ) ) continue;
|
588 |
+
$id = $f['fieldId'] . '_' . ++$i;
|
589 |
+
$field_html .= '<div class="wpf-field-item">';
|
590 |
+
$item_html = '<input type="checkbox" ' . $this->check($group['groupid'], $f['value']) . '
|
591 |
+
name="' . esc_attr( $f['fieldName'] . '[]' ) . '"
|
592 |
+
value="' . esc_attr( $group['groupid'] ) . '"
|
593 |
+
id="' . esc_attr( $id ) . '"
|
594 |
+
class="wpf-input-checkbox ' . esc_attr( $f['class'] ) . '"
|
595 |
+
' . $f['isDisabled'] . ' ' . $f['attributes'] . '>';
|
596 |
+
$field_html .= $this->build_label($group['name'], $item_html, $f, $id);
|
597 |
+
$field_html .= '</div>';
|
598 |
+
}
|
599 |
+
}
|
600 |
+
return $field_html;
|
601 |
+
}
|
602 |
+
|
603 |
/**
|
604 |
* Avatar - Field builder
|
605 |
*
|
639 |
* @return string field HTML
|
640 |
*/
|
641 |
public function field_html($f){
|
642 |
+
return stripslashes( do_shortcode( wpforo_apply_ucf_shortcode($f['html']) ) );
|
643 |
}
|
644 |
|
645 |
/**
|
692 |
* Prepares displayed values for Profile fields
|
693 |
*
|
694 |
* @param array $f field arguments
|
695 |
+
* @param int $userid
|
696 |
* @return array prepared values
|
697 |
*/
|
698 |
+
public function prepare_values($f, $userid = 0){
|
699 |
switch ( $f['type'] ){
|
700 |
case 'textarea':
|
701 |
$f['value'] = wpforo_kses(wpforo_decode($f['value']));
|
702 |
+
break;
|
703 |
case 'date':
|
704 |
$f['value'] = wpforo_date($f['value'], 'date', false);
|
705 |
+
break;
|
706 |
case 'datetime':
|
707 |
$f['value'] = wpforo_date($f['value'], 'datetime', false);
|
708 |
+
break;
|
709 |
case 'url':
|
710 |
$f['value'] = sprintf('<a href="%1$s" target="_blank" rel="nofollow">%2$s</a>', $f['value'], $f['value']);
|
711 |
+
break;
|
712 |
case 'email':
|
713 |
$f['value'] = sprintf('<a href="mailto:%1$s" rel="nofollow">%2$s</a>', $f['value'], $f['value']);
|
714 |
+
break;
|
715 |
case 'phone':
|
716 |
$f['value'] = sprintf('<a href="tel:%1$s" rel="nofollow">%2$s</a>', $f['value'], $f['value']);
|
717 |
+
break;
|
718 |
case 'file':
|
719 |
if( !empty($f['value']) ){
|
720 |
$wp_upload_dir = wp_upload_dir();
|
728 |
$f['value'] = sprintf('<a href="%s" target="_blank">%s</a>', $file_url, $file_name );
|
729 |
}
|
730 |
}
|
731 |
+
break;
|
732 |
+
case 'avatar':
|
733 |
+
$f['value'] = (WPF()->perm->usergroup_can('va') && wpforo_feature('avatars')) ? WPF()->member->get_avatar_html($f['value'], $userid) : '';
|
734 |
+
break;
|
735 |
+
case 'color':
|
736 |
+
if($f['value']){
|
737 |
+
$f['value'] = '<input type="color" value="'.$f['value'].'" disabled title="'.$f['value'].'" style="min-width: 100px; min-height: 25px;">';
|
738 |
+
}
|
739 |
+
break;
|
740 |
}
|
741 |
switch ( $f['name'] ){
|
742 |
case 'skype':
|
769 |
$f['field_class'] = sanitize_text_field( $f['name'] );
|
770 |
|
771 |
//varname
|
772 |
+
$vn = wpfval( WPF()->data, 'varname');
|
773 |
+
$f['varname'] = $f['isDefault'] && $vn ? $vn : 'data';
|
774 |
|
775 |
//template
|
776 |
$f['template'] = ( isset(WPF()->data['template']) ) ? WPF()->data['template'] : WPF()->current_object['template'];
|
781 |
$f['value'] = ( isset(WPF()->data['value'][$f['varname']][$f['name']]) ) ? WPF()->data['value'][$f['varname']][$f['name']] : $f['value'];
|
782 |
}
|
783 |
$f['value'] = wpforo_unslashe( $f['value'] );
|
784 |
+
$f['value'] = wpforo_decode( $f['value'] );
|
785 |
|
786 |
+
if( $f['name'] === 'user_nicename' ){
|
787 |
$f['value'] = urldecode($f['value']);
|
788 |
}
|
789 |
|
790 |
//allowedGroupIds
|
791 |
$groups = array();
|
792 |
+
if ( !empty($f['allowedGroupIds']) ) $groups = $this->build_array_value( $f['allowedGroupIds'] );
|
793 |
+
if( $f['type'] === 'usergroup' ){
|
794 |
+
if( !$is_owner && wpforo_current_user_is('admin') ){
|
795 |
+
$groups = WPF()->usergroup->get_usergroups('groupid');
|
796 |
+
}elseif( $is_owner && !in_array(WPF()->current_user_groupid, $f['allowedGroupIds']) ) {
|
797 |
+
$groups = array();
|
798 |
+
}
|
|
|
799 |
}
|
800 |
$f['allowedGroupIds'] = array_filter( $groups );
|
801 |
|
827 |
//isDisabled
|
828 |
$f['isDisabled'] = ( $f['isDisabled'] ) ? ' disabled="disabled" ' : '';
|
829 |
|
|
|
|
|
|
|
830 |
//fieldName | new key in args
|
831 |
$f['fieldName'] = ( !empty($f['varname'] ) ? $f['varname'] . '[' . $f['name'] . ']' : $f['name'] );
|
832 |
|
833 |
+
//isMultiChoice
|
834 |
+
if( $f['isMultiChoice'] ){
|
835 |
+
$f['fieldName'] .= '[]';
|
836 |
+
$f['isMultiChoice'] = ' multiple="multiple" ';
|
837 |
+
}else{
|
838 |
+
$f['isMultiChoice'] = '';
|
839 |
+
}
|
840 |
+
|
841 |
+
//fieldId | new key in args
|
842 |
$f['fieldId'] = ( !empty($f['varname'] ) ? $f['varname'] . '_' : '' ) . ( ($f['id']) ? $f['id'] : $f['name'] );
|
843 |
|
844 |
//minLength & maxLength
|
881 |
}
|
882 |
|
883 |
public function check($needle, $haystack){
|
884 |
+
if( is_scalar($haystack) ) $haystack = explode(',', $haystack);
|
885 |
return in_array($needle, (array) $haystack) ? 'checked' : '';
|
886 |
}
|
887 |
|
889 |
return in_array($needle, (array) $haystack) ? 'selected' : '';
|
890 |
}
|
891 |
|
892 |
+
public function build_label( $item_label, $item_html, $f, $for = '' ){
|
893 |
+
$label = '<span class="wpf-' . $f['type'] . '-label">' . stripslashes($item_label) . '</span>';
|
894 |
+
$field_html = $f['isLabelFirst'] ? $label . ' ' . $item_html : $item_html . ' ' . $label;
|
895 |
+
if( $f['isWrapItem'] ) $field_html = '<label for="' . $for . '">' . $field_html . '</label>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
896 |
return $field_html;
|
897 |
}
|
898 |
|
908 |
return $item;
|
909 |
}
|
910 |
|
911 |
+
public function build_array_value( $var, $sep = ',' ){
|
912 |
+
if( is_scalar($var) ){
|
913 |
+
$var = trim($var);
|
914 |
+
if( !strlen($var) ) return array();
|
915 |
+
}
|
916 |
+
if( is_serialized($var) ) {
|
917 |
+
$var = unserialize($var);
|
918 |
+
} elseif( is_scalar($var) && strpos($var, $sep) !== false ) {
|
919 |
+
$var = explode($sep, $var);
|
920 |
+
}
|
921 |
+
return array_map('trim', (array) $var);
|
922 |
+
}
|
923 |
|
924 |
public function build_array_using_string_rows( $string, $regexp = '' ){
|
925 |
if( !$regexp ) $regexp = '#' . preg_quote(PHP_EOL) . '#isu';
|
1007 |
$f['value'] = wpforo_trim($f['value']);
|
1008 |
if( wpfval($f, 'type') && $f['type'] === 'textarea' ) {
|
1009 |
$f['value'] = wpautop( wpforo_kses( stripslashes( $f['value'] ) ) );
|
1010 |
+
} elseif( $f['name'] === 'timezone' ){
|
1011 |
+
$f['value'] = str_replace('_', ' ', $f['value']);
|
1012 |
+
}elseif( $f['fieldKey'] === 'secondary_groups' ) {
|
1013 |
+
$f['value'] = WPF()->usergroup->get_secondary_usergroup_names( $f['value'] );
|
1014 |
+
$f['value'] = implode( ', ', $f['value'] );
|
1015 |
+
}elseif( $f['type'] === 'usergroup' && $f['fieldKey'] === 'groupid' && ($f['value'] = intval( $f['value'] )) ) {
|
1016 |
+
if( $group = WPF()->usergroup->get_usergroup( $f['value'] ) ) $f['value'] = wpfval($group, 'name');
|
1017 |
+
}elseif( is_array($f['value']) ){
|
1018 |
+
$f['value'] = array_filter($f['value']);
|
1019 |
+
$f['value'] = implode( ', ', $f['value'] );
|
1020 |
+
}else{
|
|
|
|
|
|
|
1021 |
$f['value'] = esc_html($f['value']);
|
1022 |
}
|
1023 |
}
|
1032 |
$error = array();
|
1033 |
$return = array();
|
1034 |
$is_owner = $this->owner();
|
|
|
1035 |
$template = ( isset(WPF()->data['template']) ) ? WPF()->data['template'] : WPF()->current_object['template'];
|
1036 |
if( empty($data) ) $error[] = 'No data submitted';
|
1037 |
if( empty($fields) ) $error[] = 'User profile fields not found';
|
1129 |
}
|
1130 |
}
|
1131 |
if( wpfval( $field, 'fileSize' ) ){
|
1132 |
+
if ( wpfval( $_FILES, 'data', 'size', $name ) && $_FILES[ 'data' ]['size'][ $name ] > ( $field['fileSize'] * 1024 * 1024 ) ) {
|
1133 |
$error[] = $label . ' ' . wpforo_phrase('file is too large', false, false);
|
1134 |
$error[] = sprintf( 'Maximum allowed file size is %s MB', $field['fileSize'] );
|
1135 |
}
|
1154 |
$error[] = 'You have no permission to edit Usergroup field';
|
1155 |
}
|
1156 |
} else {
|
1157 |
+
if( in_array($value, array(1,2,4)) ){
|
1158 |
$error[] = 'Admin and Moderator Usergroups are not permitted';
|
1159 |
} else {
|
1160 |
if( wpfval($field, 'allowedGroupIds') ){
|
1169 |
}
|
1170 |
}
|
1171 |
if( $name === 'secondary_groups' ){
|
1172 |
+
if( $template === 'register' || ($is_owner && $field['isEditable']) || ( !$is_owner && in_array(WPF()->current_user_groupid, (array) $field['canEdit']) ) || wpforo_current_user_is('admin') ){
|
1173 |
+
if( !empty($value) && is_array($value) ){
|
1174 |
+
$secondary_usergroups = WPF()->usergroup->get_secondary_usergroup_ids();
|
1175 |
+
foreach( $value as $secondary_usergroup_id ){
|
1176 |
+
if( in_array($secondary_usergroup_id, array(1,2,4)) ){
|
1177 |
+
$error[] = 'Admin and Moderator Usergroups are not permitted';
|
1178 |
+
}
|
1179 |
+
if( $secondary_usergroup_id && !in_array( $secondary_usergroup_id, $secondary_usergroups) ){
|
1180 |
+
$error[] = 'One of the selected Usergroups cannot be set as Secondary';
|
1181 |
+
}
|
1182 |
+
}
|
1183 |
+
}
|
1184 |
+
}else{
|
1185 |
+
$error[] = 'You have no permission to edit Usergroup field';
|
1186 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1187 |
}
|
1188 |
}
|
1189 |
}
|
1317 |
$usergroups_who_can_edit = !empty($f['canEdit']) ? (array) $f['canEdit'] : array(1);
|
1318 |
return in_array(WPF()->current_user_groupid, $usergroups_who_can_edit);
|
1319 |
}
|
1320 |
+
|
1321 |
+
public function can_show_value($f){
|
1322 |
+
$return = true;
|
1323 |
+
if( is_string($f) ) $f = WPF()->member->get_field($f);
|
1324 |
+
$f = wpforo_parse_args($f, $this->default);
|
1325 |
+
if( $f['type'] === 'password' ) $return = false;
|
1326 |
+
return apply_filters('wpforo_form_can_show_value', $return, $f);
|
1327 |
+
}
|
1328 |
}
|
wpf-includes/class-forums.php
CHANGED
@@ -45,6 +45,7 @@ class wpForoForum{
|
|
45 |
'et' => __('Can edit topic', 'wpforo'),
|
46 |
'dt' => __('Can delete topic', 'wpforo'),
|
47 |
'cr' => __('Can post reply', 'wpforo'),
|
|
|
48 |
'vr' => __('Can view replies', 'wpforo'),
|
49 |
'er' => __('Can edit replies', 'wpforo'),
|
50 |
'dr' => __('Can delete replies', 'wpforo'),
|
@@ -104,14 +105,14 @@ class wpForoForum{
|
|
104 |
$new_slug = wpforo_text($slug, 250, false);
|
105 |
$forumid = intval($forumid);
|
106 |
$i = 2;
|
107 |
-
while( WPF()->db->get_var("SELECT `forumid` FROM ".WPF()->tables->forums." WHERE `slug` = '" . esc_sql($new_slug) . "'" . ($forumid ? ' AND `forumid` != '. intval($forumid) : '')) ){
|
108 |
if( !isset($parent_slug) && $parentid = intval($parentid) ){
|
109 |
$parent_slug = WPF()->db->get_var("SELECT `slug` FROM ".WPF()->tables->forums." WHERE `forumid` = " . intval($parentid) );
|
110 |
$new_slug = $parent_slug . "-" . wpforo_text($slug, 250, false);
|
111 |
}else{
|
112 |
$new_slug = wpforo_text($slug, 250, false) . '-' . $i;
|
|
|
113 |
}
|
114 |
-
$i++;
|
115 |
}
|
116 |
return $new_slug;
|
117 |
}
|
45 |
'et' => __('Can edit topic', 'wpforo'),
|
46 |
'dt' => __('Can delete topic', 'wpforo'),
|
47 |
'cr' => __('Can post reply', 'wpforo'),
|
48 |
+
'ocr' => __('Can reply to own topic', 'wpforo'),
|
49 |
'vr' => __('Can view replies', 'wpforo'),
|
50 |
'er' => __('Can edit replies', 'wpforo'),
|
51 |
'dr' => __('Can delete replies', 'wpforo'),
|
105 |
$new_slug = wpforo_text($slug, 250, false);
|
106 |
$forumid = intval($forumid);
|
107 |
$i = 2;
|
108 |
+
while( !WPF()->can_use_this_slug($new_slug) || WPF()->db->get_var("SELECT `forumid` FROM ".WPF()->tables->forums." WHERE `slug` = '" . esc_sql($new_slug) . "'" . ($forumid ? ' AND `forumid` != '. intval($forumid) : '')) ){
|
109 |
if( !isset($parent_slug) && $parentid = intval($parentid) ){
|
110 |
$parent_slug = WPF()->db->get_var("SELECT `slug` FROM ".WPF()->tables->forums." WHERE `forumid` = " . intval($parentid) );
|
111 |
$new_slug = $parent_slug . "-" . wpforo_text($slug, 250, false);
|
112 |
}else{
|
113 |
$new_slug = wpforo_text($slug, 250, false) . '-' . $i;
|
114 |
+
$i++;
|
115 |
}
|
|
|
116 |
}
|
117 |
return $new_slug;
|
118 |
}
|
wpf-includes/class-logs.php
CHANGED
@@ -271,8 +271,8 @@ class wpForoLogs{
|
|
271 |
update_user_meta( WPF()->current_userid, 'wpf_read_topics', array() );
|
272 |
}
|
273 |
wpforo_setcookie( 'wpf_all_read', $last );
|
274 |
-
wpforo_setcookie( 'wpf_read_forums
|
275 |
-
wpforo_setcookie( 'wpf_read_topics
|
276 |
}
|
277 |
|
278 |
public function get_all_read( $item ){
|
271 |
update_user_meta( WPF()->current_userid, 'wpf_read_topics', array() );
|
272 |
}
|
273 |
wpforo_setcookie( 'wpf_all_read', $last );
|
274 |
+
wpforo_setcookie( 'wpf_read_forums' );
|
275 |
+
wpforo_setcookie( 'wpf_read_topics' );
|
276 |
}
|
277 |
|
278 |
public function get_all_read( $item ){
|
wpf-includes/class-members.php
CHANGED
@@ -92,7 +92,7 @@ class wpForoMember{
|
|
92 |
$sql = WPF()->db->prepare(
|
93 |
$sql,
|
94 |
$userid,
|
95 |
-
( isset($title) && $title ? $title :
|
96 |
sanitize_user($username),
|
97 |
intval((isset($groupid) && $groupid ? $groupid : WPF()->usergroup->default_groupid)),
|
98 |
(isset($site) ? sanitize_text_field($site) : '' ),
|
@@ -121,19 +121,18 @@ class wpForoMember{
|
|
121 |
//-- START -- copied from update code
|
122 |
//Define $user
|
123 |
$user = $user_fields;
|
124 |
-
$varname = WPF()->form->varname();
|
125 |
|
126 |
//Define $userid
|
127 |
$userid = intval( wpfval($user, 'userid') );
|
128 |
|
129 |
//Check custom fields and merge to $user array
|
130 |
-
if( wpfval($data,
|
131 |
-
$custom_fields = $data
|
132 |
$user = array_merge( $custom_fields, $user );
|
133 |
}
|
134 |
|
135 |
//Check file uploading custom fields and merge to $user array
|
136 |
-
$file_data = isset($_FILES
|
137 |
$file_fields = WPF()->form->prepare_file_args( $file_data, $userid );
|
138 |
if( wpfval( $file_fields, 'fields') ) {
|
139 |
$user = array_merge( $file_fields['fields'], $user );
|
@@ -281,7 +280,7 @@ class wpForoMember{
|
|
281 |
/**
|
282 |
* @deprecated since 1.5.0
|
283 |
* @deprecated No longer used by core and not recommended.
|
284 |
-
* @deprecated Use
|
285 |
*/
|
286 |
function edit( $args = array() ){
|
287 |
if( empty($args) && empty($_REQUEST['member']) ) return FALSE;
|
@@ -374,8 +373,8 @@ class wpForoMember{
|
|
374 |
/**
|
375 |
* @deprecated since 1.5.0
|
376 |
* @deprecated No longer used by core and not recommended.
|
377 |
-
* @deprecated Use
|
378 |
-
* @deprecated Or use
|
379 |
*/
|
380 |
function edit_profile($args){
|
381 |
if(empty($args)) return FALSE;
|
@@ -512,7 +511,7 @@ class wpForoMember{
|
|
512 |
*
|
513 |
* $data['member']['userid'] or $data['userid'] is required
|
514 |
*
|
515 |
-
* @param
|
516 |
* $type = 'full' user fields, profile fields, custom fields
|
517 |
* $type = 'user' only user fields (wp_users table)
|
518 |
* $type = 'profile' only profile fields (wp_wpforo_profiles table)
|
@@ -524,44 +523,33 @@ class wpForoMember{
|
|
524 |
* @return false|array wpForo User array
|
525 |
*/
|
526 |
public function update( $data, $type = 'full', $check_permissions = true ){
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
} else{
|
540 |
-
$form = 'member';
|
541 |
-
$form_fields = $this->get_account_fields();
|
542 |
-
$form = apply_filters( 'wpforo_user_update_form', $form );
|
543 |
-
$form_fields = apply_filters( 'wpforo_user_update_fields', $form_fields );
|
544 |
-
}
|
545 |
-
|
546 |
-
if( !$form ){ WPF()->notice->add( 'Form name not found', 'error'); return false; }
|
547 |
if( !$form_fields ){ WPF()->notice->add( 'Form template not found', 'error'); return false; }
|
548 |
|
549 |
if( !wpfkey($data, $form) ){
|
550 |
-
if( in_array('custom_fields', $type) && count($type)
|
551 |
-
if( !wpfval($data,
|
552 |
-
$data[
|
553 |
-
if( wpfkey($data,
|
554 |
}
|
555 |
} else {
|
556 |
$data[ $form ] = $data;
|
557 |
}
|
558 |
}
|
559 |
-
if( wpfval($data, 'userid') && !wpfval($data, $form, 'userid')
|
560 |
-
$data[ $form ]['userid'] = $data['userid'];
|
561 |
-
}
|
562 |
|
563 |
if( wpfval($data, $form, 'userid') ){
|
564 |
-
|
565 |
$result_user = true;
|
566 |
$result_fields = true;
|
567 |
$result_profile = true;
|
@@ -577,13 +565,13 @@ class wpForoMember{
|
|
577 |
if( $check_permissions ) WPF()->perm->can_edit_user( $userid );
|
578 |
|
579 |
//Check custom fields and merge to $user array
|
580 |
-
if(
|
581 |
-
$custom_fields = $data
|
582 |
$user = array_merge( $custom_fields, $user );
|
583 |
}
|
584 |
|
585 |
//Check file uploading custom fields and merge to $user array
|
586 |
-
$file_data = isset($_FILES
|
587 |
$file_fields = WPF()->form->prepare_file_args( $file_data, $userid );
|
588 |
if( wpfval( $file_fields, 'fields') ) {
|
589 |
$user = array_merge( $file_fields['fields'], $user );
|
@@ -634,12 +622,12 @@ class wpForoMember{
|
|
634 |
$result_password = false;
|
635 |
}
|
636 |
if( $result_password && wpfval($user, 'old_pass') && wpfval($user, 'user_pass1') ){
|
637 |
-
$result_password =
|
638 |
}
|
639 |
|
640 |
//Upload avatar
|
641 |
-
if( wpfval($user, 'avatar_type')
|
642 |
-
|
643 |
}
|
644 |
|
645 |
//Update Custom Fields
|
@@ -814,10 +802,10 @@ class wpForoMember{
|
|
814 |
$profile_fields['avatar'] = '';
|
815 |
$profile_fields_types[] = '%s';
|
816 |
}
|
817 |
-
if( wpfkey($data, 'secondary_groups')
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
}
|
822 |
if( wpfkey($data, 'rank') ){
|
823 |
$profile_fields['rank'] = $data['rank'];
|
@@ -978,10 +966,9 @@ class wpForoMember{
|
|
978 |
|
979 |
public function upload_files( $file_fields ){
|
980 |
if ( !empty( $file_fields ) ) {
|
981 |
-
$varname = WPF()->form->varname();
|
982 |
foreach( $file_fields as $field_name => $file_path ) {
|
983 |
-
if( wpfval( $_FILES,
|
984 |
-
!move_uploaded_file( $_FILES[
|
985 |
) {
|
986 |
WPF()->notice->add('Sorry, there was an error uploading attached file', 'error');
|
987 |
}
|
@@ -1050,7 +1037,7 @@ class wpForoMember{
|
|
1050 |
|
1051 |
public function synchronize_user($userid, $roles_usergroups = array()){
|
1052 |
$groupid = false;
|
1053 |
-
if(!$userid) return
|
1054 |
$user = get_userdata($userid);
|
1055 |
|
1056 |
//Don't synchronize User Roles with Usergroups if the option is disabled
|
@@ -1079,7 +1066,7 @@ class wpForoMember{
|
|
1079 |
$insert_groupid = ( isset($_POST['wpforo_usergroup']) && !wpforo_feature('role-synch') ) ? intval($_POST['wpforo_usergroup']) : $groupid;
|
1080 |
$insert_timezone = (isset($_POST['wpforo_usertimezone'])) ? sanitize_text_field($_POST['wpforo_usertimezone']) : '';
|
1081 |
$about = get_user_meta( $userid, 'description', true );
|
1082 |
-
return $this->add_profile(
|
1083 |
array( 'userid' => wpforo_bigintval($userid),
|
1084 |
'username' => sanitize_user($user->user_login),
|
1085 |
'groupid' => intval($insert_groupid),
|
@@ -1087,6 +1074,11 @@ class wpForoMember{
|
|
1087 |
'timezone' => sanitize_text_field($insert_timezone),
|
1088 |
'about' => stripslashes( wpforo_kses(trim($about), 'user_description') ),
|
1089 |
'last_login' => sanitize_text_field($user->user_registered) ) );
|
|
|
|
|
|
|
|
|
|
|
1090 |
}
|
1091 |
|
1092 |
public function synchronize_users($limit = NULL){
|
@@ -1173,9 +1165,9 @@ class wpForoMember{
|
|
1173 |
|
1174 |
if(!empty($member)) {
|
1175 |
$member['profile_url'] = $this->profile_url( $member );
|
1176 |
-
if( !wpfval($member, 'stat') )
|
1177 |
-
|
1178 |
-
|
1179 |
if( $do_db_cache ){
|
1180 |
if(!$user_meta_obj) update_user_meta( $userid, '_wpf_member_obj', $member );
|
1181 |
}
|
@@ -1360,7 +1352,7 @@ class wpForoMember{
|
|
1360 |
|
1361 |
if( !($reassign = intval($reassign)) ){
|
1362 |
if( $postids = WPF()->db->get_col( WPF()->db->prepare( "SELECT `postid` FROM `".WPF()->tables->posts."` WHERE userid = %d", $userid ) ) ){
|
1363 |
-
foreach( $postids as $postid ) WPF()->post->delete($postid);
|
1364 |
}
|
1365 |
|
1366 |
if( $topicids = WPF()->db->get_col( WPF()->db->prepare( "SELECT `topicid` FROM `".WPF()->tables->topics."` WHERE userid = %d", $userid ) ) ){
|
@@ -1461,20 +1453,13 @@ class wpForoMember{
|
|
1461 |
$cache = WPF()->cache->on('memory_cashe');
|
1462 |
|
1463 |
if($cache && isset(self::$cache['avatar'][$userid])){
|
1464 |
-
if(self::$cache['avatar'][$userid
|
1465 |
if(isset(self::$cache['avatar'][$userid]['img'])){
|
1466 |
return self::$cache['avatar'][$userid]['img'];
|
1467 |
}
|
1468 |
}
|
1469 |
}
|
1470 |
-
$
|
1471 |
-
if($src && wpforo_feature('custom-avatars')){
|
1472 |
-
$attr = ($attr ? $attr : 'height="96" width="96"');
|
1473 |
-
$img = '<img class="avatar" src="'.esc_url($src).'" '. $attr .' />';
|
1474 |
-
}else{
|
1475 |
-
$img = ($size) ? get_avatar($userid, $size) : get_avatar($userid);
|
1476 |
-
if($attr) $img = str_replace('<img', '<img ' . $attr, $img);
|
1477 |
-
}
|
1478 |
if($cache){
|
1479 |
self::$cache['avatar'][$userid]['attr'] = $attr;
|
1480 |
self::$cache['avatar'][$userid]['size'] = $size;
|
@@ -1500,6 +1485,17 @@ class wpForoMember{
|
|
1500 |
return $avatar_url;
|
1501 |
}
|
1502 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1503 |
public function get_topics_count( $userid ){
|
1504 |
$count = WPF()->db->get_var("SELECT count(topicid) FROM `".WPF()->tables->topics."` WHERE `userid` = ".intval($userid));
|
1505 |
return $count;
|
@@ -1549,20 +1545,20 @@ class wpForoMember{
|
|
1549 |
|
1550 |
public function get_profile_url( $arg, $template = 'profile' ){
|
1551 |
if(!$arg) return wpforo_home_url();
|
1552 |
-
$template_slug =
|
1553 |
$userid = intval( basename($arg) );
|
1554 |
$member_args = ( $userid ? $userid : array( 'user_nicename' => basename($arg) ) );
|
1555 |
$user = $this->get_member( $member_args );
|
1556 |
if(empty($user)) return wpforo_home_url();
|
1557 |
-
$user_slug = ( wpfo
|
1558 |
$profile_url = wpforo_home_url("$template_slug/$user_slug");
|
1559 |
return apply_filters('wpforo_member_profile_url', $profile_url, $user, $template);
|
1560 |
}
|
1561 |
|
1562 |
public function profile_url( $member = array(), $template = 'profile' ){
|
1563 |
-
$template_slug =
|
1564 |
if(isset($member['ID']) || isset($member['user_nicename'])){
|
1565 |
-
$user_slug = ( wpfo
|
1566 |
$profile_url = wpforo_home_url("$template_slug/$user_slug");
|
1567 |
$profile_url = apply_filters( 'wpforo_profile_url', $profile_url, $member, $template );
|
1568 |
}
|
@@ -1666,7 +1662,7 @@ class wpForoMember{
|
|
1666 |
}
|
1667 |
|
1668 |
public function is_online( $userid, $duration = NULL ){
|
1669 |
-
if(!$duration) $duration =
|
1670 |
|
1671 |
$cache = WPF()->cache->on('memory_cashe');
|
1672 |
|
@@ -1714,7 +1710,7 @@ class wpForoMember{
|
|
1714 |
}
|
1715 |
|
1716 |
public function online_members_count( $duration = NULL ){
|
1717 |
-
if(!$duration) $duration =
|
1718 |
$current_time = current_time( 'timestamp', 1 );
|
1719 |
$online_timeframe = $current_time - $duration;
|
1720 |
$online = WPF()->db->get_var( "SELECT COUNT(DISTINCT `userid`, `ip`) AS total FROM `".WPF()->tables->visits."` WHERE `time` > " . intval($online_timeframe) );
|
@@ -1723,7 +1719,7 @@ class wpForoMember{
|
|
1723 |
}
|
1724 |
|
1725 |
public function get_online_members( $count = 1, $groupids = array(), $duration = NULL ){
|
1726 |
-
if(!$duration) $duration =
|
1727 |
$current_time = current_time( 'timestamp', 1 );
|
1728 |
$online_timeframe = $current_time - $duration;
|
1729 |
$groupids = array_filter( wpforo_parse_args($groupids) );
|
@@ -1749,17 +1745,17 @@ class wpForoMember{
|
|
1749 |
$rating['title'] = array( 0 => 'New Member', 1 => 'Active Member', 2 => 'Eminent Member', 3 => 'Trusted Member', 4 => 'Estimable Member', 5 => 'Reputable Member', 6 => 'Honorable Member', 7 => 'Prominent Member', 8 => 'Noble Member', 9 => 'Famed Member', 10 => 'Illustrious Member' );
|
1750 |
$rating['icon'] = array( 0 => 'far fa-star-half', 1 => 'fas fa-star', 2 => 'fas fa-star', 3 => 'fas fa-star', 4 => 'fas fa-star', 5 => 'fas fa-star', 6 => 'fas fa-certificate', 7 => 'fas fa-certificate', 8 => 'fas fa-certificate', 9 => 'fas fa-shield-alt', 10 => 'fas fa-trophy' );
|
1751 |
|
1752 |
-
if(!empty
|
1753 |
|
1754 |
-
if($level === false) return
|
1755 |
-
if(!empty
|
1756 |
|
1757 |
-
if(!$var) return
|
1758 |
-
if(!empty
|
1759 |
|
1760 |
-
if( $var == 'icon' && strpos(
|
1761 |
|
1762 |
-
return
|
1763 |
}
|
1764 |
}
|
1765 |
}
|
@@ -1855,16 +1851,13 @@ class wpForoMember{
|
|
1855 |
$user = $this->get_member( $current_user->ID );
|
1856 |
}
|
1857 |
$user_meta = get_user_meta( $current_user->ID );
|
1858 |
-
$
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
$this->update_online_time();
|
1866 |
-
}
|
1867 |
-
WPF()->current_user_status = $status;
|
1868 |
}elseif ( $guest = $this->get_guest_cookies() ){
|
1869 |
WPF()->current_user = $this->get_guest($guest);
|
1870 |
WPF()->current_user_email = $guest['email'];
|
@@ -2042,617 +2035,502 @@ class wpForoMember{
|
|
2042 |
|
2043 |
}
|
2044 |
|
2045 |
-
public function init_fields
|
2046 |
-
|
2047 |
|
2048 |
-
|
2049 |
-
|
2050 |
|
2051 |
-
$this->fields = apply_filters
|
2052 |
|
2053 |
-
|
2054 |
-
|
2055 |
-
|
2056 |
-
|
2057 |
-
|
2058 |
-
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
-
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
2066 |
-
|
2067 |
-
|
2068 |
-
|
2069 |
-
|
2070 |
-
|
2071 |
-
|
2072 |
-
|
2073 |
-
|
2074 |
-
|
2075 |
-
|
2076 |
-
|
2077 |
-
|
2078 |
-
|
2079 |
-
|
2080 |
-
'
|
2081 |
-
|
2082 |
-
'profile',
|
2083 |
-
'search'
|
2084 |
-
),
|
2085 |
-
'canEdit' => array(),
|
2086 |
-
'canView' => WPF()->perm->usergroups_can('vmu'),
|
2087 |
-
'can' => 'vmu',
|
2088 |
-
'isSearchable' => 0
|
2089 |
-
);
|
2090 |
|
2091 |
-
|
2092 |
-
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
2096 |
-
|
2097 |
-
|
2098 |
-
|
2099 |
-
|
2100 |
-
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
2104 |
-
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
|
2109 |
-
|
2110 |
-
|
2111 |
-
'canView' => WPF()->perm->usergroups_can('vmm'),
|
2112 |
-
'can' => 'vmm',
|
2113 |
-
'isSearchable' => 1
|
2114 |
-
);
|
2115 |
|
2116 |
-
|
2117 |
-
|
2118 |
-
|
2119 |
-
|
2120 |
-
|
2121 |
-
|
2122 |
-
|
2123 |
-
|
2124 |
-
|
2125 |
-
|
2126 |
-
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
2130 |
-
|
2131 |
-
|
2132 |
-
|
2133 |
-
|
2134 |
-
|
2135 |
-
|
2136 |
-
|
2137 |
-
|
2138 |
-
|
2139 |
-
|
2140 |
|
2141 |
-
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
2146 |
-
|
2147 |
-
|
2148 |
-
|
2149 |
-
|
2150 |
-
|
2151 |
-
'faIcon'
|
2152 |
-
|
2153 |
-
|
2154 |
-
|
2155 |
-
|
2156 |
-
|
2157 |
-
'
|
2158 |
-
|
2159 |
-
'can' => '',
|
2160 |
-
'isSearchable' => 1
|
2161 |
-
);
|
2162 |
|
2163 |
-
|
2164 |
-
|
2165 |
-
|
2166 |
-
|
2167 |
-
|
2168 |
-
|
2169 |
-
|
2170 |
-
|
2171 |
-
|
2172 |
-
|
2173 |
-
|
2174 |
-
|
2175 |
-
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
2179 |
-
|
2180 |
-
|
2181 |
-
|
2182 |
-
|
2183 |
-
|
2184 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2185 |
-
'canView' => $usergroupids,
|
2186 |
-
'can' => '',
|
2187 |
-
'isSearchable' => 1
|
2188 |
-
);
|
2189 |
|
2190 |
-
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
|
2196 |
-
|
2197 |
-
|
2198 |
-
|
2199 |
-
|
2200 |
-
|
2201 |
-
|
2202 |
-
'faIcon'
|
2203 |
-
|
2204 |
-
|
2205 |
-
|
2206 |
-
|
2207 |
-
|
2208 |
-
|
2209 |
-
|
2210 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2211 |
-
'canView' => WPF()->perm->usergroups_can('vmt'),
|
2212 |
-
'can' => 'vmt',
|
2213 |
-
'isSearchable' => 1
|
2214 |
-
);
|
2215 |
|
2216 |
-
|
2217 |
-
|
2218 |
-
|
2219 |
-
|
2220 |
-
|
2221 |
-
|
2222 |
-
|
2223 |
-
|
2224 |
-
|
2225 |
-
|
2226 |
-
|
2227 |
-
|
2228 |
-
'allowedGroupIds' => array(3, 5),
|
2229 |
-
|
2230 |
-
|
2231 |
-
|
2232 |
-
|
2233 |
-
|
2234 |
-
|
2235 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2236 |
-
'canView' => $usergroupids,
|
2237 |
-
'can' => '',
|
2238 |
-
'isSearchable' => 1
|
2239 |
-
);
|
2240 |
|
2241 |
-
|
2242 |
-
|
2243 |
-
|
2244 |
-
|
2245 |
-
|
2246 |
-
|
2247 |
-
|
2248 |
-
|
2249 |
-
|
2250 |
-
|
2251 |
-
|
2252 |
-
|
2253 |
-
|
2254 |
-
|
2255 |
-
|
2256 |
-
|
2257 |
-
|
2258 |
-
|
2259 |
-
|
2260 |
-
|
2261 |
-
|
2262 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2263 |
-
'canView' => $usergroupids,
|
2264 |
-
'can' => '',
|
2265 |
-
'isSearchable' => 1
|
2266 |
-
);
|
2267 |
|
2268 |
-
|
2269 |
-
|
2270 |
-
|
2271 |
-
|
2272 |
-
|
2273 |
-
|
2274 |
-
|
2275 |
-
|
2276 |
-
|
2277 |
-
|
2278 |
-
|
2279 |
-
|
2280 |
-
|
2281 |
-
|
2282 |
-
|
2283 |
-
|
2284 |
-
|
2285 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2286 |
-
'canView' => WPF()->perm->usergroups_can('va'),
|
2287 |
-
'can' => 'va',
|
2288 |
-
'isSearchable' => 0
|
2289 |
-
);
|
2290 |
|
2291 |
-
|
2292 |
-
|
2293 |
-
|
2294 |
-
|
2295 |
-
|
2296 |
-
|
2297 |
-
|
2298 |
-
|
2299 |
-
|
2300 |
-
|
2301 |
-
|
2302 |
-
|
2303 |
-
|
2304 |
-
|
2305 |
-
|
2306 |
-
|
2307 |
-
|
2308 |
-
|
2309 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2310 |
-
'canView' => WPF()->perm->usergroups_can('vmw'),
|
2311 |
-
'can' => 'vmw',
|
2312 |
-
'isSearchable' => 1
|
2313 |
-
);
|
2314 |
|
2315 |
-
|
2316 |
-
|
2317 |
-
|
2318 |
-
|
2319 |
-
|
2320 |
-
|
2321 |
-
|
2322 |
-
|
2323 |
-
|
2324 |
-
|
2325 |
-
|
2326 |
-
|
2327 |
-
|
2328 |
-
|
2329 |
-
|
2330 |
-
|
2331 |
-
|
2332 |
-
|
2333 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2334 |
-
'canView' => $usergroupids_can_view_social_net,
|
2335 |
-
'can' => 'vmsn',
|
2336 |
-
'isSearchable' => 1
|
2337 |
-
);
|
2338 |
|
2339 |
-
|
2340 |
-
|
2341 |
-
|
2342 |
-
|
2343 |
-
|
2344 |
-
|
2345 |
-
|
2346 |
-
|
2347 |
-
|
2348 |
-
|
2349 |
-
|
2350 |
-
|
2351 |
-
|
2352 |
-
|
2353 |
-
|
2354 |
-
|
2355 |
-
|
2356 |
-
|
2357 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2358 |
-
'canView' => $usergroupids_can_view_social_net,
|
2359 |
-
'can' => 'vmsn',
|
2360 |
-
'isSearchable' => 1
|
2361 |
-
);
|
2362 |
|
2363 |
-
|
2364 |
-
|
2365 |
-
|
2366 |
-
|
2367 |
-
|
2368 |
-
|
2369 |
-
|
2370 |
-
|
2371 |
-
|
2372 |
-
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
|
2377 |
-
|
2378 |
-
|
2379 |
-
|
2380 |
-
|
2381 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2382 |
-
'canView' => $usergroupids_can_view_social_net,
|
2383 |
-
'can' => 'vmsn',
|
2384 |
-
'isSearchable' => 1
|
2385 |
-
);
|
2386 |
|
2387 |
-
|
2388 |
-
|
2389 |
-
|
2390 |
-
|
2391 |
-
|
2392 |
-
|
2393 |
-
|
2394 |
-
|
2395 |
-
|
2396 |
-
|
2397 |
-
|
2398 |
-
|
2399 |
-
|
2400 |
-
|
2401 |
-
|
2402 |
-
|
2403 |
-
|
2404 |
-
|
2405 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2406 |
-
'canView' => $usergroupids_can_view_social_net,
|
2407 |
-
'can' => 'vmsn',
|
2408 |
-
'isSearchable' => 1
|
2409 |
-
);
|
2410 |
|
2411 |
-
|
2412 |
-
|
2413 |
-
|
2414 |
-
|
2415 |
-
|
2416 |
-
|
2417 |
-
|
2418 |
-
|
2419 |
-
|
2420 |
-
|
2421 |
-
'faIcon'
|
2422 |
-
|
2423 |
-
|
2424 |
-
|
2425 |
-
|
2426 |
-
|
2427 |
-
|
2428 |
-
|
2429 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2430 |
-
'canView' => $usergroupids_can_view_social_net,
|
2431 |
-
'can' => 'vmsn',
|
2432 |
-
'isSearchable' => 1
|
2433 |
-
);
|
2434 |
|
2435 |
-
|
2436 |
-
|
2437 |
-
|
2438 |
-
|
2439 |
-
|
2440 |
-
|
2441 |
-
|
2442 |
-
|
2443 |
-
|
2444 |
-
|
2445 |
-
'faIcon'
|
2446 |
-
|
2447 |
-
|
2448 |
-
|
2449 |
-
|
2450 |
-
|
2451 |
-
|
2452 |
-
|
2453 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2454 |
-
'canView' => $usergroupids_can_view_social_net,
|
2455 |
-
'can' => 'vmsn',
|
2456 |
-
'isSearchable' => 1
|
2457 |
-
);
|
2458 |
|
2459 |
-
|
2460 |
-
|
2461 |
-
|
2462 |
-
|
2463 |
-
|
2464 |
-
|
2465 |
-
|
2466 |
-
|
2467 |
-
|
2468 |
-
|
2469 |
-
'faIcon'
|
2470 |
-
|
2471 |
-
|
2472 |
-
|
2473 |
-
|
2474 |
-
|
2475 |
-
|
2476 |
-
|
2477 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2478 |
-
'canView' => $usergroupids_can_view_social_net,
|
2479 |
-
'can' => 'vmsn',
|
2480 |
-
'isSearchable' => 1
|
2481 |
-
);
|
2482 |
|
2483 |
-
|
2484 |
-
|
2485 |
-
|
2486 |
-
|
2487 |
-
|
2488 |
-
|
2489 |
-
|
2490 |
-
|
2491 |
-
|
2492 |
-
|
2493 |
-
|
2494 |
-
|
2495 |
-
|
2496 |
-
|
2497 |
-
|
2498 |
-
|
2499 |
-
|
2500 |
-
|
2501 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2502 |
-
'canView' => $usergroupids_can_view_social_net,
|
2503 |
-
'can' => 'vmsn',
|
2504 |
-
'isSearchable' => 1
|
2505 |
-
);
|
2506 |
|
2507 |
-
|
2508 |
-
|
2509 |
-
|
2510 |
-
|
2511 |
-
|
2512 |
-
|
2513 |
-
|
2514 |
-
|
2515 |
-
|
2516 |
-
|
2517 |
-
|
2518 |
-
|
2519 |
-
|
2520 |
-
|
2521 |
-
|
2522 |
-
|
2523 |
-
|
2524 |
-
|
2525 |
-
|
2526 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2527 |
-
'canView' => WPF()->perm->usergroups_can('vml'),
|
2528 |
-
'can' => 'vml',
|
2529 |
-
'isSearchable' => 1
|
2530 |
-
);
|
2531 |
|
2532 |
-
|
2533 |
-
|
2534 |
-
|
2535 |
-
|
2536 |
-
|
2537 |
-
|
2538 |
-
|
2539 |
-
|
2540 |
-
|
2541 |
-
|
2542 |
-
|
2543 |
-
|
2544 |
-
|
2545 |
-
|
2546 |
-
|
2547 |
-
|
2548 |
-
|
2549 |
-
|
2550 |
-
|
2551 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2552 |
-
'canView' => $usergroupids,
|
2553 |
-
'can' => '',
|
2554 |
-
'isSearchable' => 1
|
2555 |
-
);
|
2556 |
|
2557 |
-
|
2558 |
-
|
2559 |
-
|
2560 |
-
|
2561 |
-
|
2562 |
-
|
2563 |
-
|
2564 |
-
|
2565 |
-
|
2566 |
-
|
2567 |
-
|
2568 |
-
|
2569 |
-
|
2570 |
-
|
2571 |
-
|
2572 |
-
|
2573 |
-
|
2574 |
-
|
2575 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2576 |
-
'canView' => WPF()->perm->usergroups_can('vmo'),
|
2577 |
-
'can' => 'vmo',
|
2578 |
-
'isSearchable' => 1
|
2579 |
-
);
|
2580 |
|
2581 |
-
|
2582 |
-
|
2583 |
-
|
2584 |
-
|
2585 |
-
|
2586 |
-
|
2587 |
-
|
2588 |
-
|
2589 |
-
|
2590 |
-
|
2591 |
-
|
2592 |
-
|
2593 |
-
|
2594 |
-
|
2595 |
-
|
2596 |
-
|
2597 |
-
|
2598 |
-
|
2599 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2600 |
-
'canView' => WPF()->perm->usergroups_can('vms'),
|
2601 |
-
'can' => 'vms',
|
2602 |
-
'isSearchable' => 1
|
2603 |
-
);
|
2604 |
|
2605 |
-
|
2606 |
-
|
2607 |
-
|
2608 |
-
|
2609 |
-
|
2610 |
-
|
2611 |
-
|
2612 |
-
|
2613 |
-
|
2614 |
-
|
2615 |
-
|
2616 |
-
|
2617 |
-
|
2618 |
-
|
2619 |
-
|
2620 |
-
|
2621 |
-
|
2622 |
-
|
2623 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2624 |
-
'canView' => WPF()->perm->usergroups_can('vmam'),
|
2625 |
-
'can' => 'vmam',
|
2626 |
-
'isSearchable' => 1
|
2627 |
-
);
|
2628 |
|
2629 |
-
|
2630 |
-
|
2631 |
-
|
2632 |
-
|
2633 |
-
|
2634 |
-
|
2635 |
-
|
2636 |
-
|
2637 |
-
|
2638 |
-
|
2639 |
-
|
2640 |
-
|
2641 |
-
|
2642 |
-
|
2643 |
-
|
2644 |
-
|
2645 |
-
|
2646 |
-
|
2647 |
-
|
2648 |
-
'canEdit' => $usergroupids_can_edit_fields,
|
2649 |
-
'canView' => $usergroupids_can_view_social_net,
|
2650 |
-
'can' => 'vmsn',
|
2651 |
-
'isSearchable' => 0
|
2652 |
-
);
|
2653 |
|
2654 |
-
|
2655 |
-
|
2656 |
|
2657 |
private function init_countries(){
|
2658 |
$this->countries = array( "Afghanistan","Ã…land Islands","Albania","Algeria","American Samoa","Andorra","Angola","Anguilla","Antarctica",
|
@@ -2728,166 +2606,198 @@ class wpForoMember{
|
|
2728 |
|
2729 |
public function get_fields($only_defaults = false){
|
2730 |
$this->init_fields();
|
2731 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2732 |
|
2733 |
-
|
2734 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2735 |
}
|
2736 |
|
2737 |
-
public function
|
2738 |
-
|
2739 |
-
$
|
2740 |
-
$regform =
|
2741 |
-
|
2742 |
-
|
2743 |
-
);
|
2744 |
-
if( !wpforo_feature('user-register-email-confirm') ) $regform[] = $this->fields['user_pass'];
|
2745 |
-
$fields = array(
|
2746 |
-
array(
|
2747 |
-
$regform
|
2748 |
-
)
|
2749 |
-
);
|
2750 |
-
if(!$only_defaults) {
|
2751 |
-
$fields = apply_filters('wpforo_get_register_fields', $fields);
|
2752 |
-
foreach( $fields as $kr => $row ){
|
2753 |
-
foreach( $row as $kc => $cols ){
|
2754 |
-
foreach( $cols as $kf => $field ){
|
2755 |
-
if( 'user_pass' == $field['name'] ){
|
2756 |
-
if( wpforo_feature('user-register-email-confirm') ){
|
2757 |
-
unset( $fields[$kr][$kc][$kf] );
|
2758 |
-
$password = false;
|
2759 |
-
} else {
|
2760 |
-
$password = true;
|
2761 |
-
}
|
2762 |
-
}
|
2763 |
-
}
|
2764 |
-
}
|
2765 |
-
}
|
2766 |
-
if( !wpforo_feature('user-register-email-confirm') && !$password ){
|
2767 |
-
$fields[$kr][$kc][] = $this->fields['user_pass'];
|
2768 |
-
}
|
2769 |
-
}
|
2770 |
return $fields;
|
2771 |
}
|
2772 |
|
2773 |
-
public function
|
2774 |
-
$this->
|
|
|
2775 |
|
|
|
2776 |
$fields = array(
|
2777 |
array(
|
2778 |
array(
|
2779 |
-
|
2780 |
-
|
2781 |
-
|
2782 |
-
|
2783 |
-
|
2784 |
-
|
2785 |
-
|
2786 |
-
|
2787 |
-
|
2788 |
-
|
2789 |
-
|
2790 |
-
|
2791 |
)
|
2792 |
),
|
2793 |
array(
|
2794 |
array(
|
2795 |
-
|
2796 |
),
|
2797 |
array(
|
2798 |
-
|
2799 |
-
|
2800 |
-
|
2801 |
-
|
2802 |
),
|
2803 |
array(
|
2804 |
-
|
2805 |
-
|
2806 |
-
|
2807 |
-
|
2808 |
)
|
2809 |
),
|
2810 |
array(
|
2811 |
array(
|
2812 |
-
|
2813 |
-
|
2814 |
-
|
2815 |
)
|
2816 |
)
|
2817 |
);
|
2818 |
-
|
2819 |
if(!$only_defaults) $fields = apply_filters('wpforo_get_account_fields', $fields);
|
2820 |
return $fields;
|
2821 |
}
|
2822 |
|
2823 |
-
|
2824 |
-
$this->
|
|
|
2825 |
|
|
|
2826 |
$fields = array(
|
2827 |
array(
|
2828 |
array(
|
2829 |
-
|
2830 |
-
|
2831 |
)
|
2832 |
),
|
2833 |
array(
|
2834 |
array(
|
2835 |
-
|
2836 |
-
|
2837 |
-
|
2838 |
-
|
2839 |
)
|
2840 |
),
|
2841 |
array(
|
2842 |
array(
|
2843 |
-
|
2844 |
),
|
2845 |
),
|
2846 |
array(
|
2847 |
array(
|
2848 |
-
|
2849 |
-
|
2850 |
-
|
2851 |
-
|
2852 |
),
|
2853 |
array(
|
2854 |
-
|
2855 |
-
|
2856 |
-
|
2857 |
-
|
2858 |
)
|
2859 |
),
|
2860 |
);
|
2861 |
-
|
2862 |
if(!$only_defaults) $fields = apply_filters('wpforo_get_profile_fields', $fields);
|
2863 |
-
|
2864 |
}
|
2865 |
|
2866 |
-
public function
|
2867 |
-
|
2868 |
-
|
2869 |
-
$fields = array(
|
2870 |
-
array(
|
2871 |
-
array(
|
2872 |
-
$this->fields['display_name'],
|
2873 |
-
$this->fields['user_nicename'],
|
2874 |
-
)
|
2875 |
-
)
|
2876 |
-
);
|
2877 |
|
|
|
|
|
2878 |
if(!$only_defaults) $fields = apply_filters('wpforo_get_search_fields', $fields);
|
|
|
|
|
2879 |
|
|
|
|
|
2880 |
foreach ($fields as $row_key => $row){
|
2881 |
foreach ($row as $col_key => $col){
|
2882 |
foreach ($col as $field_key => $field){
|
2883 |
-
$
|
2884 |
-
|
2885 |
-
|
2886 |
-
|
|
|
|
|
|
|
2887 |
}
|
2888 |
}
|
2889 |
}
|
2890 |
-
|
2891 |
return $fields;
|
2892 |
}
|
2893 |
|
@@ -2962,14 +2872,55 @@ class wpForoMember{
|
|
2962 |
}
|
2963 |
|
2964 |
public function set_usergroup($userid, $groupid){
|
|
|
|
|
2965 |
if($userid && $groupid){
|
2966 |
-
|
2967 |
-
|
|
|
|
|
|
|
2968 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2969 |
}
|
2970 |
|
2971 |
-
|
2972 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2973 |
}
|
2974 |
|
2975 |
public function after_register_new_user($userid){
|
92 |
$sql = WPF()->db->prepare(
|
93 |
$sql,
|
94 |
$userid,
|
95 |
+
( isset($title) && $title ? $title : $this->options['default_title'] ),
|
96 |
sanitize_user($username),
|
97 |
intval((isset($groupid) && $groupid ? $groupid : WPF()->usergroup->default_groupid)),
|
98 |
(isset($site) ? sanitize_text_field($site) : '' ),
|
121 |
//-- START -- copied from update code
|
122 |
//Define $user
|
123 |
$user = $user_fields;
|
|
|
124 |
|
125 |
//Define $userid
|
126 |
$userid = intval( wpfval($user, 'userid') );
|
127 |
|
128 |
//Check custom fields and merge to $user array
|
129 |
+
if( wpfval($data, 'data') && is_array($data['data']) && !empty($data['data']) ){
|
130 |
+
$custom_fields = $data['data'];
|
131 |
$user = array_merge( $custom_fields, $user );
|
132 |
}
|
133 |
|
134 |
//Check file uploading custom fields and merge to $user array
|
135 |
+
$file_data = isset($_FILES['data']['name']) && $_FILES['data']['name'] && is_array($_FILES['data']['name']) ? array_filter($_FILES['data']['name']) : array();
|
136 |
$file_fields = WPF()->form->prepare_file_args( $file_data, $userid );
|
137 |
if( wpfval( $file_fields, 'fields') ) {
|
138 |
$user = array_merge( $file_fields['fields'], $user );
|
280 |
/**
|
281 |
* @deprecated since 1.5.0
|
282 |
* @deprecated No longer used by core and not recommended.
|
283 |
+
* @deprecated Use $this->update()
|
284 |
*/
|
285 |
function edit( $args = array() ){
|
286 |
if( empty($args) && empty($_REQUEST['member']) ) return FALSE;
|
373 |
/**
|
374 |
* @deprecated since 1.5.0
|
375 |
* @deprecated No longer used by core and not recommended.
|
376 |
+
* @deprecated Use $this->update()
|
377 |
+
* @deprecated Or use $this->update_profile_field() for one field update
|
378 |
*/
|
379 |
function edit_profile($args){
|
380 |
if(empty($args)) return FALSE;
|
511 |
*
|
512 |
* $data['member']['userid'] or $data['userid'] is required
|
513 |
*
|
514 |
+
* @param string|array $type User data update types (comma separated)
|
515 |
* $type = 'full' user fields, profile fields, custom fields
|
516 |
* $type = 'user' only user fields (wp_users table)
|
517 |
* $type = 'profile' only profile fields (wp_wpforo_profiles table)
|
523 |
* @return false|array wpForo User array
|
524 |
*/
|
525 |
public function update( $data, $type = 'full', $check_permissions = true ){
|
526 |
+
$type = (array) $type;
|
527 |
+
|
528 |
+
switch (WPF()->current_object['template']){
|
529 |
+
case 'register':
|
530 |
+
$form = 'wpfreg';
|
531 |
+
$form_fields = $this->get_register_fields();
|
532 |
+
break;
|
533 |
+
default:
|
534 |
+
$form = 'member';
|
535 |
+
$form_fields = $this->get_account_fields();
|
536 |
+
break;
|
537 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
538 |
if( !$form_fields ){ WPF()->notice->add( 'Form template not found', 'error'); return false; }
|
539 |
|
540 |
if( !wpfkey($data, $form) ){
|
541 |
+
if( in_array('custom_fields', $type) && count($type) === 1 ){
|
542 |
+
if( !wpfval($data, 'data') ){
|
543 |
+
$data[ 'data' ] = $data;
|
544 |
+
if( wpfkey($data, 'data', 'userid') ) unset($data[ 'data' ]['userid']);
|
545 |
}
|
546 |
} else {
|
547 |
$data[ $form ] = $data;
|
548 |
}
|
549 |
}
|
550 |
+
if( wpfval($data, 'userid') && !wpfval($data, $form, 'userid') ) $data[ $form ]['userid'] = $data['userid'];
|
|
|
|
|
551 |
|
552 |
if( wpfval($data, $form, 'userid') ){
|
|
|
553 |
$result_user = true;
|
554 |
$result_fields = true;
|
555 |
$result_profile = true;
|
565 |
if( $check_permissions ) WPF()->perm->can_edit_user( $userid );
|
566 |
|
567 |
//Check custom fields and merge to $user array
|
568 |
+
if( wpfkey($data, 'data') && is_array($data['data']) && !empty($data['data']) ){
|
569 |
+
$custom_fields = $data['data'];
|
570 |
$user = array_merge( $custom_fields, $user );
|
571 |
}
|
572 |
|
573 |
//Check file uploading custom fields and merge to $user array
|
574 |
+
$file_data = isset($_FILES['data']['name']) && $_FILES['data']['name'] && is_array($_FILES['data']['name']) ? array_filter($_FILES['data']['name']) : array();
|
575 |
$file_fields = WPF()->form->prepare_file_args( $file_data, $userid );
|
576 |
if( wpfval( $file_fields, 'fields') ) {
|
577 |
$user = array_merge( $file_fields['fields'], $user );
|
622 |
$result_password = false;
|
623 |
}
|
624 |
if( $result_password && wpfval($user, 'old_pass') && wpfval($user, 'user_pass1') ){
|
625 |
+
$result_password = $this->change_password( $user['old_pass'], $user['user_pass1'], $userid );
|
626 |
}
|
627 |
|
628 |
//Upload avatar
|
629 |
+
if( wpfval($user, 'avatar_type') === 'custom' ){
|
630 |
+
$this->upload_avatar($userid);
|
631 |
}
|
632 |
|
633 |
//Update Custom Fields
|
802 |
$profile_fields['avatar'] = '';
|
803 |
$profile_fields_types[] = '%s';
|
804 |
}
|
805 |
+
if( wpfkey($data, 'secondary_groups') ){
|
806 |
+
$data['secondary_groups'] = array_filter( array_map('intval', (array) $data['secondary_groups']) );
|
807 |
+
$profile_fields['secondary_groups'] = implode( ',', $data['secondary_groups'] );
|
808 |
+
$profile_fields_types[] = '%s';
|
809 |
}
|
810 |
if( wpfkey($data, 'rank') ){
|
811 |
$profile_fields['rank'] = $data['rank'];
|
966 |
|
967 |
public function upload_files( $file_fields ){
|
968 |
if ( !empty( $file_fields ) ) {
|
|
|
969 |
foreach( $file_fields as $field_name => $file_path ) {
|
970 |
+
if( wpfval( $_FILES, 'data', 'tmp_name', $field_name ) &&
|
971 |
+
!move_uploaded_file( $_FILES[ 'data' ]['tmp_name'][$field_name], $file_path )
|
972 |
) {
|
973 |
WPF()->notice->add('Sorry, there was an error uploading attached file', 'error');
|
974 |
}
|
1037 |
|
1038 |
public function synchronize_user($userid, $roles_usergroups = array()){
|
1039 |
$groupid = false;
|
1040 |
+
if(!$userid) return false;
|
1041 |
$user = get_userdata($userid);
|
1042 |
|
1043 |
//Don't synchronize User Roles with Usergroups if the option is disabled
|
1066 |
$insert_groupid = ( isset($_POST['wpforo_usergroup']) && !wpforo_feature('role-synch') ) ? intval($_POST['wpforo_usergroup']) : $groupid;
|
1067 |
$insert_timezone = (isset($_POST['wpforo_usertimezone'])) ? sanitize_text_field($_POST['wpforo_usertimezone']) : '';
|
1068 |
$about = get_user_meta( $userid, 'description', true );
|
1069 |
+
$return = $this->add_profile(
|
1070 |
array( 'userid' => wpforo_bigintval($userid),
|
1071 |
'username' => sanitize_user($user->user_login),
|
1072 |
'groupid' => intval($insert_groupid),
|
1074 |
'timezone' => sanitize_text_field($insert_timezone),
|
1075 |
'about' => stripslashes( wpforo_kses(trim($about), 'user_description') ),
|
1076 |
'last_login' => sanitize_text_field($user->user_registered) ) );
|
1077 |
+
|
1078 |
+
if( $return !== false && ($secondary_groups = wpfval($_POST, 'wpforo_secondary_usergroup')) ){
|
1079 |
+
$this->set_usergroups_secondary($userid, $secondary_groups);
|
1080 |
+
}
|
1081 |
+
return $return;
|
1082 |
}
|
1083 |
|
1084 |
public function synchronize_users($limit = NULL){
|
1165 |
|
1166 |
if(!empty($member)) {
|
1167 |
$member['profile_url'] = $this->profile_url( $member );
|
1168 |
+
if( !wpfval($member, 'stat') ) $member['stat'] = $this->get_stat( $member, false, true );
|
1169 |
+
$fields = wpfval($member, 'fields');
|
1170 |
+
if( is_string($fields) && $fields ) $member = array_merge((array) json_decode($fields, true), $member);
|
1171 |
if( $do_db_cache ){
|
1172 |
if(!$user_meta_obj) update_user_meta( $userid, '_wpf_member_obj', $member );
|
1173 |
}
|
1352 |
|
1353 |
if( !($reassign = intval($reassign)) ){
|
1354 |
if( $postids = WPF()->db->get_col( WPF()->db->prepare( "SELECT `postid` FROM `".WPF()->tables->posts."` WHERE userid = %d", $userid ) ) ){
|
1355 |
+
foreach( $postids as $postid ) WPF()->post->delete($postid, true, true, $exclude, false);
|
1356 |
}
|
1357 |
|
1358 |
if( $topicids = WPF()->db->get_col( WPF()->db->prepare( "SELECT `topicid` FROM `".WPF()->tables->topics."` WHERE userid = %d", $userid ) ) ){
|
1453 |
$cache = WPF()->cache->on('memory_cashe');
|
1454 |
|
1455 |
if($cache && isset(self::$cache['avatar'][$userid])){
|
1456 |
+
if( wpfval(self::$cache['avatar'][$userid], 'attr') == $attr && wpfval(self::$cache['avatar'][$userid], 'size') == $size){
|
1457 |
if(isset(self::$cache['avatar'][$userid]['img'])){
|
1458 |
return self::$cache['avatar'][$userid]['img'];
|
1459 |
}
|
1460 |
}
|
1461 |
}
|
1462 |
+
$img = $this->get_avatar_html($this->get_avatar_url($userid), $userid, $attr, $size );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1463 |
if($cache){
|
1464 |
self::$cache['avatar'][$userid]['attr'] = $attr;
|
1465 |
self::$cache['avatar'][$userid]['size'] = $size;
|
1485 |
return $avatar_url;
|
1486 |
}
|
1487 |
|
1488 |
+
public function get_avatar_html($url, $userid = 0, $attr = '', $size = '' ) {
|
1489 |
+
if($url && wpforo_feature('custom-avatars')){
|
1490 |
+
$attr = ($attr ? $attr : 'height="96" width="96"');
|
1491 |
+
$img = '<img class="avatar" src="'.esc_url($url).'" '. $attr .' />';
|
1492 |
+
}else{
|
1493 |
+
$img = ($size) ? get_avatar($userid, $size) : get_avatar($userid);
|
1494 |
+
if($attr) $img = str_replace('<img', '<img ' . $attr, $img);
|
1495 |
+
}
|
1496 |
+
return $img;
|
1497 |
+
}
|
1498 |
+
|
1499 |
public function get_topics_count( $userid ){
|
1500 |
$count = WPF()->db->get_var("SELECT count(topicid) FROM `".WPF()->tables->topics."` WHERE `userid` = ".intval($userid));
|
1501 |
return $count;
|
1545 |
|
1546 |
public function get_profile_url( $arg, $template = 'profile' ){
|
1547 |
if(!$arg) return wpforo_home_url();
|
1548 |
+
$template_slug = wpforo_get_template_slug($template);
|
1549 |
$userid = intval( basename($arg) );
|
1550 |
$member_args = ( $userid ? $userid : array( 'user_nicename' => basename($arg) ) );
|
1551 |
$user = $this->get_member( $member_args );
|
1552 |
if(empty($user)) return wpforo_home_url();
|
1553 |
+
$user_slug = ( wpfo($this->options['url_structure'], false) === 'id' ? $user['ID'] : $user['user_nicename'] );
|
1554 |
$profile_url = wpforo_home_url("$template_slug/$user_slug");
|
1555 |
return apply_filters('wpforo_member_profile_url', $profile_url, $user, $template);
|
1556 |
}
|
1557 |
|
1558 |
public function profile_url( $member = array(), $template = 'profile' ){
|
1559 |
+
$template_slug = wpforo_get_template_slug($template);
|
1560 |
if(isset($member['ID']) || isset($member['user_nicename'])){
|
1561 |
+
$user_slug = ( wpfo($this->options['url_structure'], false) === 'id' ? $member['ID'] : $member['user_nicename'] );
|
1562 |
$profile_url = wpforo_home_url("$template_slug/$user_slug");
|
1563 |
$profile_url = apply_filters( 'wpforo_profile_url', $profile_url, $member, $template );
|
1564 |
}
|
1662 |
}
|
1663 |
|
1664 |
public function is_online( $userid, $duration = NULL ){
|
1665 |
+
if(!$duration) $duration = $this->options['online_status_timeout'];
|
1666 |
|
1667 |
$cache = WPF()->cache->on('memory_cashe');
|
1668 |
|
1710 |
}
|
1711 |
|
1712 |
public function online_members_count( $duration = NULL ){
|
1713 |
+
if(!$duration) $duration = $this->options['online_status_timeout'];
|
1714 |
$current_time = current_time( 'timestamp', 1 );
|
1715 |
$online_timeframe = $current_time - $duration;
|
1716 |
$online = WPF()->db->get_var( "SELECT COUNT(DISTINCT `userid`, `ip`) AS total FROM `".WPF()->tables->visits."` WHERE `time` > " . intval($online_timeframe) );
|
1719 |
}
|
1720 |
|
1721 |
public function get_online_members( $count = 1, $groupids = array(), $duration = NULL ){
|
1722 |
+
if(!$duration) $duration = $this->options['online_status_timeout'];
|
1723 |
$current_time = current_time( 'timestamp', 1 );
|
1724 |
|