wpForo Forum - Version 1.1.0

Version Description

| 04.12.2016 =

  • Added: Support WordPress Multisite (single and network activation)
  • Added: Registration confirmation through email (WordPress way)
  • Added: Topic and Post Subscription checkbox next to Submit button
  • Added: New CAN (forum access permission) "Can view attachments"
  • Added: User Ban/Unban function in Forums > Members admin page
  • Added: Forums > Members, filter by users status
  • Added: Enable HTML in forum description
  • Added: Japanese (JA_ja) Translation, many thanks to Seg Way
  • Added: German (de_DE) translation, many thanks to Markus Herrmann
  • Added: Sticky topics on top of recent topics
  • Added: Option to notify forum admins when a new topic is created
  • Added: Option to notify forum admins when a new post is created
  • Added: Option to make post editor subscription checkboxe checked by default
  • Added: wpForo Addons admin page
  • New Addon: wpForo - Embeds
  • New Addon: wpForo - Advanced Attachments
  • Added: Nicename field in Profile > Accounts page to allow users change and hide usernames in profile URL.
  • Added: Option to change message when non-permitted visitor/user tries to view attachments
  • Added: Option to make some posts/pages available when "Turn WordPress to wpForo" option is enabled.
  • Fixed Bug: Dashboard menu access for non-permitted users
  • Fixed Bug: Missing forum edit, delete, view buttons on Forums admin page
  • Fixed Bug: Forums > Members bulk actions
  • Fixed Bug: Forums > Members list ordering issue
  • Fixed Bug: Missing topics, posts and profiles tables after installation
  • Fixed Bug: Remove reply, quote, edit buttons when topic is closed
  • Fixed Bug: Post Move, Report JS Errors.
  • Fixed Bug: Warning: Missing argument 2 for wpforo_update_last_login_date()
  • Optimization: Forum, topic and post loading speed and memory optimization
  • Security: improving post and topic creation security, two more level of checking processes before inserting data in database.

IMPORTANT:

  • To load old customized colors please refresh forum page twice.
  • If you have a Cache Plugin, please delete all caches after wpForo update.
  • If you use CDN and found some issue please purge it.
Download this release

Release Info

Developer Tomdever
Plugin Icon 128x128 wpForo Forum
Version 1.1.0
Comparing to
See all releases

Code changes from version 1.0.2 to 1.1.0

Files changed (88) hide show
  1. readme.txt +65 -52
  2. wpf-admin/addons.php +79 -0
  3. wpf-admin/admin.php +14 -2
  4. wpf-admin/css/admin.css +21 -6
  5. wpf-admin/dashboard.php +32 -10
  6. wpf-admin/forum.php +10 -5
  7. wpf-admin/js/contenthover/jquery.contenthover.min.js +16 -0
  8. wpf-admin/member.php +15 -4
  9. wpf-admin/options-tabs/accesses.php +10 -3
  10. wpf-admin/options-tabs/{subscriptions.php → emails.php} +27 -3
  11. wpf-admin/options-tabs/features.php +3 -0
  12. wpf-admin/options-tabs/general.php +17 -3
  13. wpf-admin/options-tabs/posts.php +10 -0
  14. wpf-admin/options.php +4 -3
  15. wpf-admin/phrase.php +1 -1
  16. wpf-assets/addons/attachments/header-off.png +0 -0
  17. wpf-assets/addons/attachments/header.png +0 -0
  18. wpf-assets/addons/embeds/header-off.png +0 -0
  19. wpf-assets/addons/embeds/header.png +0 -0
  20. wpf-assets/images/icons/eye-dark.png +0 -0
  21. wpf-assets/images/icons/eye.png +0 -0
  22. wpf-assets/images/icons/pencil-dark.png +0 -0
  23. wpf-assets/images/icons/pencil.png +0 -0
  24. wpf-assets/images/icons/plus-dark.png +0 -0
  25. wpf-assets/images/icons/plus.png +0 -0
  26. wpf-assets/images/icons/trash-dark.png +0 -0
  27. wpf-assets/images/icons/trash.png +0 -0
  28. wpf-assets/images/wpforo-40.png +0 -0
  29. wpf-assets/js/ajax.js +19 -9
  30. wpf-assets/js/frontend.js +8 -2
  31. wpf-includes/class-forums.php +24 -14
  32. wpf-includes/class-members.php +273 -94
  33. wpf-includes/class-notices.php +2 -1
  34. wpf-includes/class-permissions.php +19 -16
  35. wpf-includes/class-posts.php +17 -13
  36. wpf-includes/class-subscribes.php +2 -3
  37. wpf-includes/class-template.php +86 -68
  38. wpf-includes/class-topics.php +42 -7
  39. wpf-includes/class-usergroups.php +2 -14
  40. wpf-includes/functions-installation.php +56 -17
  41. wpf-includes/functions-template.php +4 -3
  42. wpf-includes/functions.php +161 -78
  43. wpf-includes/wpf-actions.php +52 -16
  44. wpf-includes/wpf-hooks.php +196 -58
  45. wpf-includes/wpf-phrases.php +3 -0
  46. wpf-languages/wpforo-cs_CZ.mo +0 -0
  47. wpf-languages/wpforo-cs_CZ.po +3282 -2972
  48. wpf-languages/wpforo-de_DE.mo +0 -0
  49. wpf-languages/wpforo-de_DE.po +3324 -2754
  50. wpf-languages/wpforo-es_ES.mo +0 -0
  51. wpf-languages/wpforo-es_ES.po +3317 -0
  52. wpf-languages/wpforo-es_MX.mo +0 -0
  53. wpf-languages/wpforo-es_MX.po +3317 -3008
  54. wpf-languages/wpforo-fr_FR.mo +0 -0
  55. wpf-languages/wpforo-fr_FR.po +3360 -3050
  56. wpf-languages/wpforo-he_IL.mo +0 -0
  57. wpf-languages/wpforo-he_IL.po +3193 -2883
  58. wpf-languages/wpforo-ja.mo +0 -0
  59. wpf-languages/wpforo-ja.po +3307 -0
  60. wpf-languages/wpforo-ko_KR.mo +0 -0
  61. wpf-languages/wpforo-ko_KR.po +3357 -3047
  62. wpf-languages/wpforo-nl_NL.mo +0 -0
  63. wpf-languages/wpforo-nl_NL.po +949 -658
  64. wpf-languages/wpforo-ru_RU.mo +0 -0
  65. wpf-languages/wpforo-ru_RU.po +960 -650
  66. wpf-languages/wpforo.pot +946 -627
  67. wpf-themes/classic/.gitignore +1 -0
  68. wpf-themes/classic/colors.css +9 -11
  69. wpf-themes/classic/footer.php +2 -9
  70. wpf-themes/classic/index.php +174 -174
  71. wpf-themes/classic/layouts/1/forum.php +3 -3
  72. wpf-themes/classic/layouts/1/post.php +3 -3
  73. wpf-themes/classic/layouts/1/topic.php +3 -3
  74. wpf-themes/classic/layouts/2/forum.php +3 -3
  75. wpf-themes/classic/layouts/2/post.php +6 -6
  76. wpf-themes/classic/layouts/2/topic.php +2 -1
  77. wpf-themes/classic/layouts/3/forum.php +3 -3
  78. wpf-themes/classic/layouts/3/post.php +11 -11
  79. wpf-themes/classic/layouts/3/topic.php +2 -1
  80. wpf-themes/classic/members.php +57 -56
  81. wpf-themes/classic/profile-account.php +4 -0
  82. wpf-themes/classic/profile.php +10 -2
  83. wpf-themes/classic/register.php +20 -10
  84. wpf-themes/classic/search.php +2 -2
  85. wpf-themes/classic/style-rtl.css +8 -4
  86. wpf-themes/classic/style.css +7 -3
  87. wpf-themes/classic/styles/css.php +8 -5
  88. wpforo.php +8 -7
readme.txt CHANGED
@@ -1,10 +1,9 @@
1
=== Forum - wpForo ===
2
Contributors: gVectors Team
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y4YBFBNBV3R2E
4
Tags: forum, community, discussion, bulletin board, question and answers, qa, support, foro, forums
5
Requires at least: 4.1
6
- Tested up to: 4.6
7
- Stable tag: 1.0.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -27,61 +26,38 @@ Light, modern and beautiful forum layout with topic and post author avatars on f
27
Complete Question & Answers discussion board for professional support and for communities similar to Stack Overflow. Perfect platform for users to ask and answer questions, and, through membership and active participation, to vote up or down.
28
29
30
- = DESIGNED FOR ALL =
31
- You can use wpForo for small and extremely large communities. We keep improving plugin performance.
32
33
- = FORUM LAYOUTS =
34
- The "Extended", "Simplified" and "Question & Answer" layouts fit almost all type of discussions needs.
35
36
- = MOBILE FRIENDLY =
37
- wpForo is super responsive on all kind of devices. Adapted on all screen sizes. You get perfectly scaled layouts on desktop, tabs and smartphones.
38
39
- = SEO FRIENDLY =
40
- Built-in SEO functions. SEO effective Permalinks, Titles, Meta Data, Open Graph tags, Smart heading, Crawling friendly content.
41
42
- = THEME API =
43
- You can create and install new themes, copy the customized forum theme and keep it in active WordPress theme folder.
44
-
45
- = EXTENDABLE =
46
- We also develop free (built-in) and paid addons. The first addons "Advanced File Attachments", "Polls", "Private Messages" and "Ad Manager" will be available very soon.
47
-
48
- = MEMBER PROFILE SYSTEM =
49
- Beautiful, modern and informative profile system, with member statistic, bio, settings, activity and subscriptions pages.
50
-
51
- = MEMBER RATING AND BADGES =
52
- User rating system based on number of posts. Nice Badges and Member Rating Titles per reputation level. Fully customizable.
53
-
54
- = SUBSCRIPTION AND RSS FEED =
55
- Built-in forum/topic subscription with double opt-in subscription confirmation function. Separate forum/topic RSS2 feeds.
56
-
57
- = EASY FORUM HIERARCHY =
58
- Drag and Drop forum management system. Easy to set Parent-Child relationship and forum list order.
59
-
60
- = EASY FORUM MODERATION =
61
- All necessary moderation tools on each topic and post to make easy forum moderation. Fast and AJAX powered action will make it pleasure.
62
-
63
- = STYLES AND CUSTOMIZATION =
64
- Styles with different colors, dozens of settings, options, switches to manage and integrate forum with your theme look and feel. Almost everything has its option to make it different.
65
-
66
- = USERGROUPS AND PERMISSIONS =
67
- Built-in, powerful Usergroup system. Allows to create a new, manage and delete. All Usergroups have according permissions, with separate managing options.
68
-
69
- = FORUM ACCESS ROLES =
70
- This is a set of access roles named e.g.: "Read Only", "Standard Access", "Moderation Access", "Full Access", etc.. to manage Usergroup accesses for each forum.
71
-
72
- = LANGUAGE API & TRANSLATION =
73
- wpForo has its own Phrase System, which allows you to translate all phrases through Dashboard. And it supports WordPress .MO/.PO translation files.
74
-
75
- = EASY TO MIGRATE =
76
- You can download [Go2wpForo](http://wpforo.com/community/migrate-to-wpforo-from-other-forum-plugins/migrate-to-wpforo-go2wpforo-tool/) free migration tool from our [support forum](http://wpforo.com/community/migrate-to-wpforo-from-other-forum-plugins/migrate-to-wpforo-go2wpforo-tool/). This tool allows you migrate from different WordPress forum plugins to wpForo.
77
78
79
= Currently we're working on =
80
- * Social Network Sharing Buttons...
81
* wpForo Anti-Spam...
82
- * Go2wpForo Migration Tool...
83
* wpForo Documentation...
84
- * WordPress Multisite support...
85
86
== Installation ==
87
@@ -95,7 +71,7 @@ You can download [Go2wpForo](http://wpforo.com/community/migrate-to-wpforo-from-
95
96
1. **Forum Page:** wpForo creates a page with `/community/` slug. If this slug is used you'll have `/community-2/` or `/community-3/` slug. You can find the correct one in Forums > Settings > General Tab. Make sure you use WordPress permalinks. wpForo doesn't work with default `?p=1` URL structure.
97
98
- 2. **Change Forum Page:** If you need to change forum page you should put `[wpforo-index]` shortcode in new page content and insert the new page URL in Dashboard > Forums > Settings > General Tab > "Forum Base URL" option field.
99
100
3. **Forum Menu:** In Dashboard > Appearance > Menu admin page wpForo creates new navigation menu called "wpForo Navigation (wpForo Menu)" and attaches this menu to wpForo Menu location, it's the main, top forum menu. You can customize forum menu items through Appearance > Menu settings.
101
@@ -137,12 +113,49 @@ wpForo Support Forum: <http://wpforo.com/community/>
137
138
== Changelog ==
139
140
= 1.0.2 | 10.09.2016 =
141
142
* 1.0.x is stable now. We fixed all bugs related to Beta-6 > 1.0.x upgrade. The main issue was missing forums and missing forum page. These issues had two reasons. First(incorrect pageid) was fixed in 1.0.1. Second (WP installation with different WordPress and Site Address) has been fixed in this 1.0.2 version. Lots of small bugs are fixed two.
143
144
- NOTE! Make sure you've deleted all caches after updating this plugin
145
-
146
147
= 1.0.1 | 07.09.2016 =
148
1
=== Forum - wpForo ===
2
Contributors: gVectors Team
3
Tags: forum, community, discussion, bulletin board, question and answers, qa, support, foro, forums
4
Requires at least: 4.1
5
+ Tested up to: 4.7
6
+ Stable tag: 1.1.0
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
26
Complete Question & Answers discussion board for professional support and for communities similar to Stack Overflow. Perfect platform for users to ask and answer questions, and, through membership and active participation, to vote up or down.
27
28
29
+ = WPFORO FEATURES =
30
31
+ * | **DESIGNED FOR ALL** | You can use wpForo for small and extremely large communities. We keep improving plugin performance.
32
+ * | **FORUM LAYOUTS** | The "Extended", "Simplified" and "Question & Answer" layouts fit almost all type of discussions needs.
33
+ * | **MOBILE FRIENDLY** | wpForo is super responsive on all kind of devices. Adapted on all screen sizes. You get perfectly scaled layouts on desktop, tabs and smartphones.
34
+ * | **SEO FRIENDLY** | Built-in SEO functions. SEO effective Permalinks, Titles, Meta Data, Open Graph tags, Smart heading, Crawling friendly content.
35
+ * | **THEME API** | You can create and install new themes, copy the customized forum theme and keep it in active WordPress theme folder.
36
+ * | **EXTENDABLE** | We also develop free (built-in) and paid addons. The first addons "Advanced File Attachments", "Polls", "Private Messages" and "Ad Manager" will be available very soon.
37
+ * | **MEMBER PROFILE SYSTEM** | Beautiful, modern and informative profile system, with member statistic, bio, settings, activity and subscriptions pages.
38
+ * | **MEMBER RATING AND BADGES** | User rating system based on number of posts. Nice Badges and Member Rating Titles per reputation level. Fully customizable.
39
+ * | **SUBSCRIPTION AND RSS FEED** | Built-in forum/topic subscription with double opt-in subscription confirmation function. Separate forum/topic RSS2 feeds.
40
+ * | **EASY FORUM HIERARCHY** | Drag and Drop forum management system. Easy to set Parent-Child relationship and forum list order.
41
+ * | **EASY FORUM MODERATION** | All necessary moderation tools on each topic and post to make easy forum moderation. Fast and AJAX powered action will make it pleasure.
42
+ * | **STYLES AND CUSTOMIZATION** | Styles with different colors, dozens of settings, options, switches to manage and integrate forum with your theme look and feel. Almost everything has its option to make it different.
43
+ * | **USERGROUPS AND PERMISSIONS** | Built-in, powerful Usergroup system. Allows to create a new, manage and delete. All Usergroups have according permissions, with separate managing options.
44
+ * | **FORUM ACCESS ROLES** | This is a set of access roles named e.g.: "Read Only", "Standard Access", "Moderation Access", "Full Access", etc.. to manage Usergroup accesses for each forum.
45
+ * | **LANGUAGE API & TRANSLATION** | wpForo has its own Phrase System, which allows you to translate all phrases through Dashboard. And it supports WordPress .MO/.PO translation files.
46
+ * | **EASY TO MIGRATE** | You can download [Go2wpForo](http://wpforo.com/community/migrate-to-wpforo-from-other-forum-plugins/migrate-to-wpforo-go2wpforo-tool/) free migration tool from our [support forum](http://wpforo.com/community/migrate-to-wpforo-from-other-forum-plugins/migrate-to-wpforo-go2wpforo-tool/). This tool allows you migrate from different WordPress forum plugins to wpForo.
47
48
49
+ = WPFORO ADDONS =
50
51
+ * | [wpForo - Embeds](http://gvectors.com/product/wpforo-embeds/)
52
+ * | [wpForo - Advanced Attachments](http://gvectors.com/product/wpforo-advanced-attachments/)
53
54
55
= Currently we're working on =
56
+
57
* wpForo Anti-Spam...
58
+ * Social Network Sharing Buttons...
59
+ * [Go2wpForo](http://wpforo.com/community/migrate-to-wpforo-from-other-forum-plugins/migrate-to-wpforo-go2wpforo-tool/) Migration Tool...
60
* wpForo Documentation...
61
62
== Installation ==
63
71
72
1. **Forum Page:** wpForo creates a page with `/community/` slug. If this slug is used you'll have `/community-2/` or `/community-3/` slug. You can find the correct one in Forums > Settings > General Tab. Make sure you use WordPress permalinks. wpForo doesn't work with default `?p=1` URL structure.
73
74
+ 2. **Change Forum Page:** If you need to change forum page you should put `[wpforo]` shortcode in new page content and insert the new page URL in Dashboard > Forums > Settings > General Tab > "Forum Base URL" option field.
75
76
3. **Forum Menu:** In Dashboard > Appearance > Menu admin page wpForo creates new navigation menu called "wpForo Navigation (wpForo Menu)" and attaches this menu to wpForo Menu location, it's the main, top forum menu. You can customize forum menu items through Appearance > Menu settings.
77
113
114
== Changelog ==
115
116
+ = 1.1.0 | 04.12.2016 =
117
+
118
+ * Added: Support WordPress Multisite (single and network activation)
119
+ * Added: Registration confirmation through email (WordPress way)
120
+ * Added: Topic and Post Subscription checkbox next to Submit button
121
+ * Added: New CAN (forum access permission) "Can view attachments"
122
+ * Added: User Ban/Unban function in Forums > Members admin page
123
+ * Added: Forums > Members, filter by users status
124
+ * Added: Enable HTML in forum description
125
+ * Added: Japanese (JA_ja) Translation, many thanks to Seg Way
126
+ * Added: German (de_DE) translation, many thanks to Markus Herrmann
127
+ * Added: Sticky topics on top of recent topics
128
+ * Added: Option to notify forum admins when a new topic is created
129
+ * Added: Option to notify forum admins when a new post is created
130
+ * Added: Option to make post editor subscription checkboxe checked by default
131
+ * Added: wpForo Addons admin page
132
+ * New Addon: [wpForo - Embeds](http://gvectors.com/product/wpforo-embeds/)
133
+ * New Addon: [wpForo - Advanced Attachments](http://gvectors.com/product/wpforo-advanced-attachments/)
134
+ * Added: Nicename field in Profile > Accounts page to allow users change and hide usernames in profile URL.
135
+ * Added: Option to change message when non-permitted visitor/user tries to view attachments
136
+ * Added: Option to make some posts/pages available when "Turn WordPress to wpForo" option is enabled.
137
+ * Fixed Bug: Dashboard menu access for non-permitted users
138
+ * Fixed Bug: Missing forum edit, delete, view buttons on Forums admin page
139
+ * Fixed Bug: Forums > Members bulk actions
140
+ * Fixed Bug: Forums > Members list ordering issue
141
+ * Fixed Bug: Missing topics, posts and profiles tables after installation
142
+ * Fixed Bug: Remove reply, quote, edit buttons when topic is closed
143
+ * Fixed Bug: Post Move, Report JS Errors.
144
+ * Fixed Bug: Warning: Missing argument 2 for wpforo_update_last_login_date()
145
+ * Optimization: Forum, topic and post loading speed and memory optimization
146
+ * Security: improving post and topic creation security, two more level of checking processes before inserting data in database.
147
+
148
+ IMPORTANT:
149
+
150
+ - To load old customized colors please refresh forum page twice.
151
+ - If you have a Cache Plugin, please delete all caches after wpForo update.
152
+ - If you use CDN and found some issue please purge it.
153
+
154
+
155
= 1.0.2 | 10.09.2016 =
156
157
* 1.0.x is stable now. We fixed all bugs related to Beta-6 > 1.0.x upgrade. The main issue was missing forums and missing forum page. These issues had two reasons. First(incorrect pageid) was fixed in 1.0.1. Second (WP installation with different WordPress and Site Address) has been fixed in this 1.0.2 version. Lots of small bugs are fixed two.
158
159
160
= 1.0.1 | 07.09.2016 =
161
wpf-admin/addons.php ADDED
@@ -0,0 +1,79 @@
1
+ <?php
2
+ // Exit if accessed directly
3
+ if( !defined( 'ABSPATH' ) ) exit;
4
+ if( !current_user_can('administrator') ) exit;
5
+
6
+ $addons = array(
7
+ 'attachments' => array('version' => '1.0.0', 'requires' => '1.1.0', 'class' => 'wpForoAttachments', 'title' => 'Advanced Attachments', 'thumb' => WPFORO_URL . '/wpf-assets/addons/' . 'attachments' . '/header.png', 'desc' => __('Adds an advanced file attachment system to forum topics and posts. AJAX powered media uploading and displaying system with user specific library.', 'wpforo'), 'url' => 'http://gvectors.com/product/wpforo-advanced-attachments/'),
8
+ 'embeds' => array('version' => '1.0.0', 'requires' => '1.1.0', 'class' => 'wpForoEmbeds', 'title' => 'Embeds', 'thumb' => WPFORO_URL . '/wpf-assets/addons/' . 'embeds' . '/header.png', 'desc' => __('Allows to embed hundreds of video, social network, audio and photo content providers in forum topics and posts.', 'wpforo'), 'url' => 'http://gvectors.com/product/wpforo-embeds/'),
9
+ );
10
+ ?>
11
+
12
+ <div id="wpf-admin-wrap" class="wrap wpforo-addons">
13
+ <div style="float:left; width:50px; height:55px; margin:10px 10px 20px 0px;">
14
+ <img src="<?php echo WPFORO_URL . '/wpf-assets/images/' ?>/wpforo-40.png" style="border:2px solid #fff;">
15
+ </div>
16
+ <h1 style="padding-bottom:20px; padding-top:15px;"><?php _e('wpForo Addons', 'wpforo'); ?></h1>
17
+ <br style="clear:both">
18
+ <table class="widefat" width="100%" cellspacing="1" border="0">
19
+ <tbody><tr>
20
+ <td style="padding:10px 10px 0px 10px;" valign="top">
21
+ <table width="100%" cellspacing="1" border="0">
22
+ <thead>
23
+ <tr>
24
+ <th style="font-size:16px; padding-bottom:15px;"><strong><?php _e('wpForo Addons', 'wpforo'); ?></strong></th>
25
+ <th style="font-size:16px; padding-bottom:15px; width:205px; text-align:center; border-bottom:1px solid #008EC2;"><a href="http://gvectors.com/forum/" style="color:#008EC2; overflow:hidden; outline:none;" target="_blank">Addons Support Forum</a></th>
26
+ </tr>
27
+ </thead>
28
+ <tbody><tr valign="top">
29
+ <td colspan="2" style="background:#FFF; text-align:left; font-size:13px;">
30
+ <?php _e('All wpForo addons are being developed by wpForo developers at gVectors Team. Addon prices also include a small donation to the hard work wpForo developers do for free. When you buy an addon, you also donate the free wpForo development and support. Addons are the only incoming source for wpForo developers. wpForo is a premium forum plugin which will always be available for free. There will never be paid and pro versions of this forum board. We have another dozens of awesome features in our to-do list which will also be added for free in future releases. So the free wpForo development always stays on the first priority and wpForo is being extended with new free functions and features even faster than before.', 'wpforo'); ?>
31
+ <br>
32
+ <p style="font-size:10px; color:#B1B1B1; font-style:italic; text-align:right; line-height:12px; padding-top:6px; margin:0px;">
33
+ Thank you!<br> Sincerely yours,<br> gVectors Team&nbsp; </p>
34
+ </td>
35
+ </tr>
36
+ </tbody></table>
37
+ </td>
38
+ </tr>
39
+ </tbody></table>
40
+ <br style="clear:both">
41
+ <div class="wpforo-addons-wrapper">
42
+ <?php
43
+ foreach ($addons as $key => $addon) {
44
+ $installed = (class_exists($addon['class'])) ? true : false;
45
+ ?>
46
+ <div class="wpforo-addon-block">
47
+ <div id="wpforo-addon-<?php echo $key ?>" class="addon-thumb" style="background:url(<?php echo ($installed) ? str_replace('.png', '-off.png', $addon['thumb']) : $addon['thumb']; ?>) top center no-repeat;">
48
+ &nbsp;
49
+ </div>
50
+ <div class="contenthover">
51
+ <div class="addon-isactive">
52
+ <?php if ($installed) { ?>
53
+ <div class="note-installed"><?php _e('Installed', 'default'); ?></div>
54
+ <?php } else { ?>
55
+ <h3 style="font-weight:normal; font-size:22px; line-height: 25px; margin-bottom:2px; text-shadow: 0 0 2px #999;"><?php echo $addon['title'] ?></h3>
56
+ <ul>
57
+ <li style="line-height:16px;"><?php _e('Version', 'default'); ?>: <?php echo $addon['version']; ?></li>
58
+ <li style="line-height:16px;">wpForo: <?php _e('at least', 'default'); ?> <?php echo $addon['requires']; ?></li>
59
+ </ul>
60
+ <a class="button button-primary addon-button" href="<?php echo $addon['url']; ?>" target="_blank" style="font-size:14px;"><?php echo __('Details | Buy', 'wpforo'); ?></a>
61
+ <?php } ?>
62
+ </div>
63
+ </div>
64
+ <div style="clear:both"></div>
65
+ <div class="addon-info" style="<?php if ($installed) echo 'background-color:#bbbbbb'; ?>">
66
+ <a href="<?php echo $addon['url']; ?>" target="_blank" title="<?php _e('More information about', 'default'); ?> <?php echo $addon['title'] ?> add-on &raquo;">
67
+ <p class="addon-title"><?php echo $addon['title']; ?></p>
68
+ </a>
69
+ <div class="addon-desc"><?php echo $addon['desc']; ?></div>
70
+ </div>
71
+ </div>
72
+ <script language="javascript">jQuery(document).ready(function ($) { $('#wpforo-addon-<?php echo $key ?>').contenthover({ overlay_width:290, overlay_height:<?php echo ($installed) ? '100' : '180'; ?>, effect:'slide', slide_direction:'right', overlay_x_position:'right', overlay_y_position:'center', overlay_background:'#e5e5e5', overlay_opacity:0.9}); });</script>
73
+ <?php } ?>
74
+ </div>
75
+ <div style="clear:both;"></div>
76
+ <h3>&nbsp;</h3>
77
+ <hr />
78
+
79
+ </div>
wpf-admin/admin.php CHANGED
@@ -6,14 +6,21 @@
6
function wpforo_add_menu(){
7
global $wpforo;
8
$position = ( isset($wpforo->general_options['menu_position']) && $wpforo->general_options['menu_position'] > 0 ) ? $wpforo->general_options['menu_position'] : 23;
9
- add_menu_page(__('Dashboard', 'wpforo'), __('Forums', 'wpforo'), 'read', 'wpforo-community', 'wpforo_toplevel_page', 'dashicons-format-chat', $position);
10
- add_submenu_page('wpforo-community', __('Dashboard', 'wpforo'), __('Dashboard', 'wpforo'), 'read', 'wpforo-community', 'wpforo_toplevel_page' );
11
if( $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'cf' ) && $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'ef' ) && $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'df' ) ) add_submenu_page('wpforo-community', __('Forums', 'wpforo'), __('Forums', 'wpforo'), 'read', 'wpforo-forums', 'wpforo_forum_menu');
12
if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Settings', 'wpforo'), __('Settings', 'wpforo'), 'read', 'wpforo-settings', 'wpforo_settings');
13
if( $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'vm' ) ) add_submenu_page('wpforo-community', __('Members', 'wpforo'), __('Members', 'wpforo'), 'read', 'wpforo-members', 'wpforo_member_menu');
14
if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Usergroups', 'wpforo'), __('Usergroups', 'wpforo'), 'read', 'wpforo-usergroups', 'wpforo_usergroups_menu');
15
if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Phrases', 'wpforo'), __('Phrases', 'wpforo'), 'read', 'wpforo-phrases', 'wpforo_phrases');
16
if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Themes', 'wpforo'), __('Themes', 'wpforo'), 'read', 'wpforo-themes', 'wpforo_themes');
17
//exit();
18
}
19
add_action('admin_menu', 'wpforo_add_menu', 39);
@@ -57,4 +64,9 @@
57
global $wpforo;
58
require( WPFORO_DIR . '/wpf-admin/integration.php' );
59
}
60
?>
6
function wpforo_add_menu(){
7
global $wpforo;
8
$position = ( isset($wpforo->general_options['menu_position']) && $wpforo->general_options['menu_position'] > 0 ) ? $wpforo->general_options['menu_position'] : 23;
9
+ if( $wpforo->current_user_groupid == 1 ||
10
+ $wpforo->current_user_groupid == 2 ||
11
+ $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'vm' ) ||
12
+ ( $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'cf' ) &&
13
+ $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'ef' ) &&
14
+ $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'df' ) )
15
+ ) add_menu_page(__('Dashboard', 'wpforo'), __('Forums', 'wpforo'), 'read', 'wpforo-community', 'wpforo_toplevel_page', 'dashicons-format-chat', $position);
16
+ if( $wpforo->current_user_groupid == 1 || $wpforo->current_user_groupid == 2 ) add_submenu_page('wpforo-community', __('Dashboard', 'wpforo'), __('Dashboard', 'wpforo'), 'read', 'wpforo-community', 'wpforo_toplevel_page' );
17
if( $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'cf' ) && $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'ef' ) && $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'df' ) ) add_submenu_page('wpforo-community', __('Forums', 'wpforo'), __('Forums', 'wpforo'), 'read', 'wpforo-forums', 'wpforo_forum_menu');
18
if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Settings', 'wpforo'), __('Settings', 'wpforo'), 'read', 'wpforo-settings', 'wpforo_settings');
19
if( $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'vm' ) ) add_submenu_page('wpforo-community', __('Members', 'wpforo'), __('Members', 'wpforo'), 'read', 'wpforo-members', 'wpforo_member_menu');
20
if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Usergroups', 'wpforo'), __('Usergroups', 'wpforo'), 'read', 'wpforo-usergroups', 'wpforo_usergroups_menu');
21
if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Phrases', 'wpforo'), __('Phrases', 'wpforo'), 'read', 'wpforo-phrases', 'wpforo_phrases');
22
if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Themes', 'wpforo'), __('Themes', 'wpforo'), 'read', 'wpforo-themes', 'wpforo_themes');
23
+ if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Addons', 'wpforo'), __('Addons', 'wpforo'), 'read', 'wpforo-addons', 'wpforo_addons');
24
//exit();
25
}
26
add_action('admin_menu', 'wpforo_add_menu', 39);
64
global $wpforo;
65
require( WPFORO_DIR . '/wpf-admin/integration.php' );
66
}
67
+
68
+ function wpforo_addons(){
69
+ global $wpforo;
70
+ require( WPFORO_DIR . '/wpf-admin/addons.php' );
71
+ }
72
?>
wpf-admin/css/admin.css CHANGED
@@ -5,6 +5,7 @@
5
#wpf-admin-wrap .forum_width{width: 65%;}
6
#wpf-admin-wrap .forumtitle{font-size:14px;font-weight:bold;width: 52%;}
7
#wpf-admin-wrap .item-controls{font-size:13px;}
8
#wpf-admin-wrap .root_forum{text-decoration: none!important;color:#231f1f; }
9
#wpf-admin-wrap .forum_submit {margin: 0px 5px 10px 5px; min-width: 80px !important;}
10
#wpf-admin-wrap .wpf-delete.button, #wpf-admin-wrap .preview.button{display: inline-block !important;margin-bottom: 10px !important;}
@@ -104,11 +105,9 @@
104
#wpf-admin-wrap .menu-item-bar > .forum_width .item-controls{ border-left: 1px dotted #666666; padding-left: 22px; font-size:16px;}
105
#wpf-admin-wrap .menu-item-depth-0 > .menu-item-bar > .forum_width{ background: #43A6DF; color: white}
106
#wpf-admin-wrap .menu-item-bar > .forum_width:hover{ border: 1px solid #666666}
107
- #wpf-admin-wrap .menu-item-depth-0 > .menu-item-bar > .forum_width a{ color: white; font-size:16px;}
108
#wpf-admin-wrap .menu-item-bar > .forum_width .wpforo-cat-layout { font-size:12px;}
109
- #wpf-admin-wrap .menu-item-bar > .forum_width .menu_edit a:hover{ color:#0D7A05; background-color: #F6F6F6;}
110
- #wpf-admin-wrap .menu-item-bar > .forum_width .menu_delete a:hover{ color: red; background-color: #F6F6F6;}
111
- #wpf-admin-wrap .menu-item-bar > .forum_width .menu_view a:hover{ color: green; background-color: #F6F6F6;}
112
#wpf-admin-wrap .inside .main .wpforo-dashboard-logo{ width:220px; height:auto;}
113
#wpf-admin-wrap .vert_tab{ display: block; margin: 1px 0px 0px 0px;}
114
#wpf-admin-wrap .nav-tab-wrapper.vert_tab{ display: inline-block; width: 17%; border: none; vertical-align: top; margin: 0 !important; padding: 0 !important; float: left; position:relative; z-index:9;}
@@ -138,7 +137,7 @@
138
139
.wpforo_settings_table{ width:100%; padding:0px; margin:2px; border-spacing: 0; border-collapse: collapse;}
140
.wpforo_settings_table th, .wpforo_settings_table td { padding:8px 10px; text-align:left; vertical-align:top; }
141
- .wpforo_settings_table th{ font-weight:bold; font-size:14px; width:40%; }
142
.wpforo_settings_table tr:nth-child(odd) { background: #f5f5f5; }
143
.wpforo_settings_table tr:nth-child(even) { background: #FFFFFF; }
144
.wpforo_settings_table input[type="text"],
@@ -152,7 +151,7 @@
152
153
.wpf-switch-field input { display: none;}
154
.wpf-switch-field label {float: left;}
155
- .wpf-switch-field label {display: inline-block; line-height: 20px; width:80px; background-color: #e4e4e4;color:#333;font-size: 13px;font-weight: normal;text-align: center;text-shadow: none;padding: 2px 6px;border: 1px solid rgba(0, 0, 0, 0.2);-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);-webkit-transition: all 0.1s ease-in-out;-moz-transition: all 0.1s ease-in-out;-ms-transition: all 0.1s ease-in-out;-o-transition: all 0.1s ease-in-out;transition: all 0.1s ease-in-out;}
156
.wpf-switch-field label:hover {cursor: pointer;}
157
.wpf-switch-field input:checked + label {background-color: #43A6DF; -webkit-box-shadow: none; box-shadow: none; color:#fff;} /* #66DD8D */
158
/* .wpf-switch-field input:last-of-type:checked + label {background-color:#F77059; -webkit-box-shadow: none; box-shadow: none;} */
@@ -207,3 +206,19 @@
207
.wpforo-themes .wpf-theme-actions{ display:block; clear:both; margin-top:10px; text-align:right; box-sizing:border-box; padding:2px 20px; }
208
.wpforo-themes .wpf-theme-actions .wpf-action{ }
209
5
#wpf-admin-wrap .forum_width{width: 65%;}
6
#wpf-admin-wrap .forumtitle{font-size:14px;font-weight:bold;width: 52%;}
7
#wpf-admin-wrap .item-controls{font-size:13px;}
8
+ #wpf-admin-wrap .item-controls span a img{ vertical-align:middle;}
9
#wpf-admin-wrap .root_forum{text-decoration: none!important;color:#231f1f; }
10
#wpf-admin-wrap .forum_submit {margin: 0px 5px 10px 5px; min-width: 80px !important;}
11
#wpf-admin-wrap .wpf-delete.button, #wpf-admin-wrap .preview.button{display: inline-block !important;margin-bottom: 10px !important;}
105
#wpf-admin-wrap .menu-item-bar > .forum_width .item-controls{ border-left: 1px dotted #666666; padding-left: 22px; font-size:16px;}
106
#wpf-admin-wrap .menu-item-depth-0 > .menu-item-bar > .forum_width{ background: #43A6DF; color: white}
107
#wpf-admin-wrap .menu-item-bar > .forum_width:hover{ border: 1px solid #666666}
108
+ #wpf-admin-wrap .menu-item-depth-0 > .menu-item-bar > .forum_width a{ color: white; font-size:16px; padding:0px 2px; border-radius:10%;}
109
#wpf-admin-wrap .menu-item-bar > .forum_width .wpforo-cat-layout { font-size:12px;}
110
+ /* #wpf-admin-wrap .menu-item-bar > .forum_width .menu_edit a:hover{ color:#FF8A18; background:#fff;} #wpf-admin-wrap .menu-item-bar > .forum_width .menu_delete a:hover{ color: red; background:#fff;} #wpf-admin-wrap .menu-item-bar > .forum_width .menu_view a:hover{ color:#4278F7; background:#fff;} #wpf-admin-wrap .menu-item-bar > .forum_width .menu_add a:hover{ color:#129E15; background:#fff;} */
111
#wpf-admin-wrap .inside .main .wpforo-dashboard-logo{ width:220px; height:auto;}
112
#wpf-admin-wrap .vert_tab{ display: block; margin: 1px 0px 0px 0px;}
113
#wpf-admin-wrap .nav-tab-wrapper.vert_tab{ display: inline-block; width: 17%; border: none; vertical-align: top; margin: 0 !important; padding: 0 !important; float: left; position:relative; z-index:9;}
137
138
.wpforo_settings_table{ width:100%; padding:0px; margin:2px; border-spacing: 0; border-collapse: collapse;}
139
.wpforo_settings_table th, .wpforo_settings_table td { padding:8px 10px; text-align:left; vertical-align:top; }
140
+ .wpforo_settings_table th{ font-weight:bold; font-size:14px; width:42%; }
141
.wpforo_settings_table tr:nth-child(odd) { background: #f5f5f5; }
142
.wpforo_settings_table tr:nth-child(even) { background: #FFFFFF; }
143
.wpforo_settings_table input[type="text"],
151
152
.wpf-switch-field input { display: none;}
153
.wpf-switch-field label {float: left;}
154
+ .wpf-switch-field label {display: inline-block; line-height: 20px; width:80px; background-color: #e4e4e4;color:#333;font-size: 13px;font-weight: normal;text-align: center;text-shadow: none;padding: 2px 6px;border: 1px solid rgba(0, 0, 0, 0.2);-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);-webkit-transition: all 0.1s ease-in-out;-moz-transition: all 0.1s ease-in-out; -ms-transition: all 0.1s ease-in-out; -o-transition: all 0.1s ease-in-out;transition: all 0.1s ease-in-out;}
155
.wpf-switch-field label:hover {cursor: pointer;}
156
.wpf-switch-field input:checked + label {background-color: #43A6DF; -webkit-box-shadow: none; box-shadow: none; color:#fff;} /* #66DD8D */
157
/* .wpf-switch-field input:last-of-type:checked + label {background-color:#F77059; -webkit-box-shadow: none; box-shadow: none;} */
206
.wpforo-themes .wpf-theme-actions{ display:block; clear:both; margin-top:10px; text-align:right; box-sizing:border-box; padding:2px 20px; }
207
.wpforo-themes .wpf-theme-actions .wpf-action{ }
208
209
+ /**************************/
210
+ /* ADDONS *****************/
211
+ /**************************/
212
+ #menu-comments ul > li:nth-child(3) a{ color:#25ACEA!important; text-shadow: 1px 1px 1px #000; }
213
+ .wpforo-addons .wpforo-addons-wrapper {box-sizing: border-box;}
214
+ .wpforo-addons .wpforo-addon-block {width: 330px; padding-top:10px; height:auto; float: left; margin-right: 1%; margin-bottom: 20px; background: #fff; border: 2px solid #e5e5e5; box-shadow: 0 3px 3px rgba(0, 0, 0, 0.04);}
215
+ .wpforo-addons .wpforo-addon-block .addon-thumb {float:none; width: 310px; padding:10px; margin-top:2px; height:180px;}
216
+ .wpforo-addons .wpforo-addon-block .addon-info {display:block; margin:0px; background:#43A6DF; padding:10px 15px; border:3px solid #fff; border-top:none; margin-top:10px;}
217
+ .wpforo-addons .wpforo-addon-block .addon-title { font-size:16px; font-weight:bold; color:#FFFFFF; margin:0px; line-height:18px; display:inline-block; text-decoration:none;}
218
+ .wpforo-addons .wpforo-addon-block .addon-title:hover { color:#E5F6FF;}
219
+ .wpforo-addons .wpforo-addon-block .addon-desc { font-size:13px; color:#FFFFFF; margin:0px; line-height:18px; margin:0px; padding:10px 0px 0px 0px; font-style:italic;}
220
+ .wpforo-addons .wpforo-addon-block .addon-isactive {margin: 0px; padding:10px; background:#e5e5e5; text-align:center;}
221
+ .wpforo-addons .wpforo-addon-block .addon-button{ margin-bottom:10px;}
222
+ .wpforo-addons .wpforo-addon-block .note-installed { padding:10px 20px; background:#fff; border: 1px solid #ddd; box-shadow: 0 3px 3px rgba(0, 0, 0, 0.04); color:#2396D3; font-size:14px; margin-top:20px; }
223
+
224
+
wpf-admin/dashboard.php CHANGED
@@ -1,7 +1,9 @@
1
<?php
2
// Exit if accessed directly
3
if( !defined( 'ABSPATH' ) ) exit;
4
- global $wpforo ?>
5
6
<div id="wpf-admin-wrap" class="wrap">
7
<h1 style="padding:30px 0px 10px 0px;"><?php _e('wpForo Dashboard', 'wpforo'); ?></h1>
@@ -82,9 +84,13 @@
82
<td class="wpf-dw-td-value"><?php echo $_SERVER['HTTP_USER_AGENT'] ?></td>
83
</tr>
84
<tr class="wpf-dw-tr">
85
- <td class="wpf-dw-td">Web Server / PHP</td>
86
<td class="wpf-dw-td-value"><?php echo $_SERVER['SERVER_SOFTWARE'] ?></td>
87
</tr>
88
<tr class="wpf-dw-tr">
89
<td class="wpf-dw-td">MySQL Version</td>
90
<td class="wpf-dw-td-value"><?php echo $wpforo->db->db_version(); ?></td>
@@ -146,20 +152,36 @@
146
<td class="wpf-dw-td"><?php _e('Members Online', 'wpforo'); ?></td>
147
<td class="wpf-dw-td-value"><?php echo intval($statistic['online_members_count']) ?></td>
148
</tr>
149
-
150
<?php if( isset($statistic['attachments']) && $statistic['attachment_sizes'] ) : ?>
151
-
152
<tr class="wpf-dw-tr">
153
- <td class="wpf-dw-td"><?php _e('Attachments', 'wpforo'); ?></td>
154
- <td class="wpf-dw-td-value"><?php echo esc_html($statistic['attachments']) ?></td>
155
</tr>
156
<tr class="wpf-dw-tr">
157
- <td class="wpf-dw-td"><?php _e('Attachments Size', 'wpforo'); ?></td>
158
- <td class="wpf-dw-td-value"><?php echo wpforo_human_filesize( $statistic['attachment_sizes'] ); ?></td>
159
</tr>
160
-
161
<?php endif ?>
162
-
163
<tr>
164
<td colspan="2">
165
<p class="hndle" style="padding:25px 0px 5px 0px; margin:0px; font-size:14px; font-weight:bold;">
1
<?php
2
// Exit if accessed directly
3
if( !defined( 'ABSPATH' ) ) exit;
4
+
5
+ global $wpforo;
6
+ ?>
7
8
<div id="wpf-admin-wrap" class="wrap">
9
<h1 style="padding:30px 0px 10px 0px;"><?php _e('wpForo Dashboard', 'wpforo'); ?></h1>
84
<td class="wpf-dw-td-value"><?php echo $_SERVER['HTTP_USER_AGENT'] ?></td>
85
</tr>
86
<tr class="wpf-dw-tr">
87
+ <td class="wpf-dw-td">Web Server</td>
88
<td class="wpf-dw-td-value"><?php echo $_SERVER['SERVER_SOFTWARE'] ?></td>
89
</tr>
90
+ <tr class="wpf-dw-tr">
91
+ <td class="wpf-dw-td">PHP Version</td>
92
+ <td class="wpf-dw-td-value"><?php echo phpversion(); ?></td>
93
+ </tr>
94
<tr class="wpf-dw-tr">
95
<td class="wpf-dw-td">MySQL Version</td>
96
<td class="wpf-dw-td-value"><?php echo $wpforo->db->db_version(); ?></td>
152
<td class="wpf-dw-td"><?php _e('Members Online', 'wpforo'); ?></td>
153
<td class="wpf-dw-td-value"><?php echo intval($statistic['online_members_count']) ?></td>
154
</tr>
155
+ <?php
156
+ $upload_dir = wp_upload_dir();
157
+ if( is_dir( $upload_dir['basedir'] . '/wpforo/avatars/') ) $size_avatar = wpforo_dir_size( $upload_dir['basedir'] . '/wpforo/avatars' );
158
+ if( is_dir( $upload_dir['basedir'] . '/wpforo/default_attachments/') ) $size_da = wpforo_dir_size( $upload_dir['basedir'] . '/wpforo/default_attachments' );
159
+ ?>
160
+ <tr class="wpf-dw-tr">
161
+ <td class="wpf-dw-td"><?php _e('Avatars Size', 'wpforo'); ?></td>
162
+ <td class="wpf-dw-td-value"><?php echo wpforo_human_filesize( $size_avatar ); ?></td>
163
+ </tr>
164
+ <tr class="wpf-dw-tr">
165
+ <td class="wpf-dw-td"><?php _e('Default Attachments Size', 'wpforo'); ?></td>
166
+ <td class="wpf-dw-td-value"><?php echo wpforo_human_filesize( $size_da ); ?></td>
167
+ </tr>
168
<?php if( isset($statistic['attachments']) && $statistic['attachment_sizes'] ) : ?>
169
+ <?php $size_aa = 0; $upload_dir = wp_upload_dir(); if( is_dir( $upload_dir['basedir'] . '/wpforo/attachments/') ) $size_aa = wpforo_dir_size( $upload_dir['basedir'] . '/wpforo/attachments' ); ?>
170
<tr class="wpf-dw-tr">
171
+ <td class="wpf-dw-td"><?php _e('Advanced Attachments', 'wpforo'); ?></td>
172
+ <td class="wpf-dw-td-value"><?php echo esc_html($statistic['attachments']) ?> <?php _e('file(s)', 'wpforo'); ?></td>
173
</tr>
174
<tr class="wpf-dw-tr">
175
+ <td class="wpf-dw-td"><?php _e('Advanced Attachments Size', 'wpforo'); ?></td>
176
+ <td class="wpf-dw-td-value"><?php echo wpforo_human_filesize( $size_aa ); ?></td>
177
</tr>
178
<?php endif ?>
179
+ <tr class="wpf-dw-tr">
180
+ <td class="wpf-dw-td"><?php _e('Total Size', 'wpforo'); ?></td>
181
+ <td class="wpf-dw-td-value">
182
+ <strong style="font-size:14px;"><?php $total = (int)$size_avatar + (int)$size_da + ((isset($size_aa))?(int)$size_aa:0); echo wpforo_human_filesize( $total ); ?></strong>
183
+ </td>
184
+ </tr>
185
<tr>
186
<td colspan="2">
187
<p class="hndle" style="padding:25px 0px 5px 0px; margin:0px; font-size:14px; font-weight:bold;">
wpf-admin/forum.php CHANGED
@@ -39,7 +39,7 @@
39
<div id="icon-edit" class="icon32 icon32-posts-post"></div>
40
<div id="wpf-admin-wrap" class="wrap">
41
42
- <h2 style="padding:30px 0px 10px 0px;line-height: 20px;">
43
<?php _e('Categories and Forums', 'wpforo'); ?> &nbsp;
44
<a href="<?php echo admin_url( 'admin.php?page=wpforo-forums&action=add' ) ?>" class="add-new-h2"><?php _e('Add New', 'wpforo'); ?></a>
45
</h2>
@@ -50,10 +50,15 @@
50
<?php if( !isset($_GET['action'])) : ?>
51
<?php if($wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'ef')): ?>
52
53
-
54
- <div class="wpf-info-bar" style="box-shadow:none; margin:20px 0px;">
55
- <p style="font-size:15px; padding:0px; margin:10px 0px;"><?php _e('Please drag and drop forum panels to set parent-child hierarchy.', 'wpforo'); ?></p>
56
</div>
57
58
<form id="forum-hierarchy" encType="multipart/form-data" method="post" action="">
59
<?php wp_nonce_field( 'wpforo-forums-hierarchy' ); ?>
@@ -77,7 +82,7 @@
77
<?php endif; ?><!--checking edit forum permission-->
78
<?php endif; ?>
79
<!-- end Forum Hierarchy -->
80
-
81
<!-- Forum Add || Edit -->
82
<?php if( ( isset($_GET['action']) && $_GET['action'] == 'add' ) || ( isset($_GET['action']) && $_GET['action'] == 'edit' ) ) : ?>
83
<?php if($wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'cf')): ?>
39
<div id="icon-edit" class="icon32 icon32-posts-post"></div>
40
<div id="wpf-admin-wrap" class="wrap">
41
42
+ <h2 style="padding:30px 0px 10px 0px; line-height: 20px;">
43
<?php _e('Categories and Forums', 'wpforo'); ?> &nbsp;
44
<a href="<?php echo admin_url( 'admin.php?page=wpforo-forums&action=add' ) ?>" class="add-new-h2"><?php _e('Add New', 'wpforo'); ?></a>
45
</h2>
50
<?php if( !isset($_GET['action'])) : ?>
51
<?php if($wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'ef')): ?>
52
53
+ <div class="wpf-info-bar" style="line-height: 1em; clear:both; padding: 5px 30px; font-size:15px; display:block; box-shadow:none; margin: 20px 0 10px 0; font-style: italic; background: #FFFFC6; width:90%;">
54
+ <ul style="list-style-type: disc; line-height:18px;">
55
+ <li style="list-style:none; margin-left:-17px; font-style:normal; font-weight:bold;"><i class="fa fa-info-circle" aria-hidden="true"></i>&nbsp; <?php _e('Important Tips', 'wpforo'); ?></li>
56
+ <li><?php _e('Please drag and drop forum panels to set parent-child hierarchy.', 'wpforo'); ?></li>
57
+ <li><?php _e('If a category (blue panels) does not have forums (grey panels) it will not be displayed on front-end. Each category should contain at least one forum.', 'wpforo'); ?></li>
58
+ <li><?php _e('Forums can be displayed with different layouts (Extended, Simplified, Q&A), just edit the top (blue panels) category and set the layout you want. Child forums\' layout depends on the top category (blue panels) layout. They cannot have a different layout.', 'wpforo'); ?></li>
59
+ </ul>
60
</div>
61
+ <br style="clear: both;" />
62
63
<form id="forum-hierarchy" encType="multipart/form-data" method="post" action="">
64
<?php wp_nonce_field( 'wpforo-forums-hierarchy' ); ?>
82
<?php endif; ?><!--checking edit forum permission-->
83
<?php endif; ?>
84
<!-- end Forum Hierarchy -->
85
+ <br style="clear: both;"/>
86
<!-- Forum Add || Edit -->
87
<?php if( ( isset($_GET['action']) && $_GET['action'] == 'add' ) || ( isset($_GET['action']) && $_GET['action'] == 'edit' ) ) : ?>
88
<?php if($wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'cf')): ?>
wpf-admin/js/contenthover/jquery.contenthover.min.js ADDED
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * ContentHover jQuery plugin v0.1
3
+ * http://www.backslash.gr/demos/contenthover-jquery-plugin/
4
+ *
5
+ * Copyright 2011 by Nikos Tsaganos
6
+ * http://www.backslash.gr/
7
+ */
8
+ (function($){var methods={init:function(options){var defaults={data_selector:'.contenthover',width:0,height:0,overlay_width:0,overlay_height:0,overlay_x_position:'center',overlay_y_position:'bottom',overlay_background:'',overlay_opacity:1,effect:'fade',fade_speed:400,slide_speed:400,slide_direction:'bottom',zindex:2,wrapper_class:'ch_wrapper',normal_class:'ch_normal',hover_class:'ch_hover',onshow:function(){},onhide:function(){}},settings=$.extend({},defaults,options);return this.each(function(){var $this=$(this),w=$this.width()?$this.width():settings.width,h=$this.height()?$this.height():settings.height,overlay_w=settings.overlay_width?settings.overlay_width:w,overlay_h=settings.overlay_height?settings.overlay_height:h,$data=$this.next(settings.data_selector);if($data.length){$data.hide();var $ch_wrapper=$('<div>').addClass('ch_element').addClass(settings.wrapper_class).css({'width':w,'height':h,'position':'relative','overflow':'hidden'}).insertAfter($this);var $ch_normal=$('<div>').addClass(settings.normal_class).css({'width':w,'height':h,'position':'absolute','z-index':settings.zindex}).appendTo($ch_wrapper);$this.clone().appendTo($ch_normal);$this.hide();var $ch_hover=$('<div>').addClass(settings.hover_class).css({'width':overlay_w,'height':overlay_h,'position':'absolute','z-index':settings.zindex-1}).appendTo($ch_wrapper);$data.clone().show().appendTo($ch_hover);var ch_hover_css={};if(settings.overlay_background){ch_hover_css.background=settings.overlay_background;}
9
+ if(settings.overlay_opacity<1){ch_hover_css.opacity=settings.overlay_opacity;}
10
+ if(settings.overlay_x_position=='left'){ch_hover_css.left=0;}else if(settings.overlay_x_position=='right'){ch_hover_css.left=(w-overlay_w)+'px';}else{ch_hover_css.left=(w/2-overlay_w/2)+'px';}
11
+ if(settings.overlay_y_position=='top'){ch_hover_css.top=0;}else if(settings.overlay_y_position=='bottom'){ch_hover_css.top=(h-overlay_h)+'px';}else{ch_hover_css.top=(h/2-overlay_h/2)+'px';}
12
+ $ch_hover.css(ch_hover_css);if(settings.effect=='slide'){var initial_css={};if(settings.slide_direction=='top'){initial_css={top:('-'+overlay_h+'px')};}
13
+ if(settings.slide_direction=='bottom'){initial_css={top:h+'px'};}
14
+ if(settings.slide_direction=='left'){initial_css={left:('-'+overlay_w+'px')};}
15
+ if(settings.slide_direction=='right'){initial_css={left:w+'px'};}
16
+ $ch_hover.css('z-index',settings.zindex+1).css(initial_css);$ch_wrapper.hover(function(){$ch_hover.stop(true,true).animate({'top':ch_hover_css.top,'left':ch_hover_css.left},settings.slide_speed,settings.onshow());},function(){$ch_hover.stop(true,true).animate(initial_css,settings.slide_speed,settings.onhide());});}else if(settings.effect=='fade'){$ch_hover.css('z-index',settings.zindex+1).hide();$ch_wrapper.hover(function(){$ch_hover.stop(true,true).fadeIn(settings.fade_speed,settings.onshow());},function(){$ch_hover.stop(true,true).fadeOut(settings.fade_speed,settings.onhide());});}else{$ch_hover.css('z-index',settings.zindex+1).hide();$ch_wrapper.hover(function(){$ch_hover.show(0,settings.onshow());},function(){$ch_hover.hide(0,settings.onhide());});}}});},stop:function(){return this.each(function(){var $this=$(this),$data=$this.next('.ch_element');$this.show();$data.remove();$this.unbind('.contenthover');});},destroy:function(){return this.each(function(){$(this).show();$('.ch_element').remove();$(window).unbind('.contenthover');});}};$.fn.contenthover=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1));}else if(typeof method==='object'||!method){return methods.init.apply(this,arguments);}else{$.error('Method '+method+' does not exist in contentHover plugin.');}};})(jQuery);
wpf-admin/member.php CHANGED
@@ -27,6 +27,10 @@
27
$fields[] = 'groupid';
28
$filter_fields[] = 'groupid';
29
}
30
if($wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'vmr')){
31
$fields[] = 'rank';
32
}
@@ -35,9 +39,16 @@
35
}
36
$actions = array('button');
37
if( $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'em') ) $actions = array('edit_user', 'edit_profile');
38
- if( $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'dm') ) $actions[] = 'delete';
39
- wpforo_create_form_table('member', 'userid', $fields, $search_fields, $filter_fields, $actions);
40
?>
41
<?php endif; ?>
42
- </div>
43
-
27
$fields[] = 'groupid';
28
$filter_fields[] = 'groupid';
29
}
30
+ if( $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'bm') ){
31
+ $fields[] = 'status';
32
+ $filter_fields[] = 'status';
33
+ }
34
if($wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'vmr')){
35
$fields[] = 'rank';
36
}
39
}
40
$actions = array('button');
41
if( $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'em') ) $actions = array('edit_user', 'edit_profile');
42
+ if( $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'bm') ){
43
+ $actions[] = 'ban';
44
+ $bulk_actions[] = 'ban';
45
+ $bulk_actions[] = 'unban';
46
+ }
47
+ if( $wpforo->perm->usergroup_can( $wpforo->current_user_groupid, 'dm') ){
48
+ $actions[] = 'user_delete';
49
+ $bulk_actions[] = 'del';
50
+ }
51
+ wpforo_create_form_table('member', 'userid', $fields, $search_fields, $filter_fields, $actions, $bulk_actions);
52
?>
53
<?php endif; ?>
54
+ </div>
wpf-admin/options-tabs/accesses.php CHANGED
@@ -19,14 +19,21 @@
19
<tr id="post-2" class="post-1 type-post status-publish format-standard hentry category-uncategorized alternate iedit author-self" valign="top">
20
<td class="post-title page-title column-title" style="border-bottom:1px dotted #CCCCCC; padding-left:20px; background:<?php echo esc_attr($bgcolor) ?>;">
21
<strong class="row-title">
22
- <a href="?page=wpforo-settings&tab=accesses&action=edit&access=<?php echo esc_attr($access['access']) ?>" title="<?php echo esc_attr($access['title']) ?>">
23
<?php _e( $access['title'], 'wpforo') ?>
24
</a>
25
</strong>
26
<div class="row-actions">
27
<span class="edit"><a href="?page=wpforo-settings&tab=accesses&action=edit&access=<?php echo esc_attr($access['access']) ?>"><?php _e('edit', 'wpforo'); ?></a> |</span>
28
- <span class="trash"><a class="submitdelete" href="<?php echo wp_nonce_url( '?page=wpforo-settings&tab=accesses&action=del&accessid=' . esc_attr($access['accessid']) , 'wpforo_access_delete' ) ?>" onclick = "if (! confirm('<?php _e('Are you sure you want to remove this access set? Usergroups which attached to this access will lost all forum permissions.'); ?>')) { return false; }" ><?php _e('delete', 'wpforo'); ?></a></span>
29
- </div>
30
</td>
31
</tr>
32
<?php endforeach ?>
19
<tr id="post-2" class="post-1 type-post status-publish format-standard hentry category-uncategorized alternate iedit author-self" valign="top">
20
<td class="post-title page-title column-title" style="border-bottom:1px dotted #CCCCCC; padding-left:20px; background:<?php echo esc_attr($bgcolor) ?>;">
21
<strong class="row-title">
22
+ <a href="?page=wpforo-settings&tab=accesses&action=edit&access=<?php echo esc_attr($access['access']) ?>" title="<?php echo esc_attr($access['title']) ?>">
23
<?php _e( $access['title'], 'wpforo') ?>
24
</a>
25
+ <p class="wpf-info">
26
+ <?php if($access['title'] == 'Read only access') { _e('This access is usually used for ', 'wpforo'); echo '<span style="color:#F45B00"><b>'; _e('Guests', 'wpforo'); echo '</b></span> '; _e('usergroup', 'wpforo'); } ?>
27
+ <?php if($access['title'] == 'Standard access') { _e('This access is usually used for ', 'wpforo'); echo '<span style="color:#F45B00"><b>'; _e('Registered', 'wpforo'); echo '</b></span> '; _e('usergroup', 'wpforo'); } ?>
28
+ <?php if($access['title'] == 'Full access') { _e('This access is usually used for ', 'wpforo'); echo '<span style="color:#F45B00"><b>'; _e('Admin', 'wpforo'); echo '</b></span> '; _e('usergroup', 'wpforo'); } ?>
29
+ </p>
30
</strong>
31
<div class="row-actions">
32
<span class="edit"><a href="?page=wpforo-settings&tab=accesses&action=edit&access=<?php echo esc_attr($access['access']) ?>"><?php _e('edit', 'wpforo'); ?></a> |</span>
33
+ <?php if( $access['accessid'] > 5 ): ?>
34
+ <span class="trash"><a class="submitdelete" href="<?php echo wp_nonce_url( '?page=wpforo-settings&tab=accesses&action=del&accessid=' . esc_attr($access['accessid']) , 'wpforo_access_delete' ) ?>" onclick = "if (! confirm('<?php _e('Are you sure you want to remove this access set? Usergroups which attached to this access will lost all forum permissions.'); ?>')) { return false; }" ><?php _e('delete', 'wpforo'); ?></a></span>
35
+ <?php endif; ?>
36
+ </div>
37
</td>
38
</tr>
39
<?php endforeach ?>
wpf-admin/options-tabs/{subscriptions.php → emails.php} RENAMED
@@ -10,20 +10,44 @@
10
<table class="wpforo_settings_table">
11
<tbody>
12
<tr>
13
- <th style="width:40%"><label><?php _e('From Name', 'wpforo'); ?>:</label></th>
14
<td><input name="wpforo_subscribe_options[from_name]" type="text" value="<?php wpfo($wpforo->subscribe_options['from_name']); ?>" required></td>
15
</tr>
16
<tr>
17
- <th><label><?php _e('From Email Address', 'wpforo'); ?>:</label></th>
18
<td><input name="wpforo_subscribe_options[from_email]" type="text" value="<?php wpfo($wpforo->subscribe_options['from_email']); ?>" required /></td>
19
</tr>
20
<tr>
21
<th>
22
- <label><?php _e('Forum Admin Email Addresses', 'wpforo'); ?>:</label>
23
<p class="wpf-info"><?php _e('Comma separated email addresses of forum administrators to get forum notifications. For example post report messages.', 'wpforo') ?></p>
24
</th>
25
<td><input name="wpforo_subscribe_options[admin_emails]" type="text" value="<?php wpfo($wpforo->subscribe_options['admin_emails']); ?>" required /></td>
26
</tr>
27
<tr>
28
<td colspan="2" style="border-bottom:2px solid #ddd;">
29
<h3 style="font-weight:400; padding:10px 0px 0px 0px; margin:0px;"><?php _e('Subscription Emails', 'wpforo'); ?></h3>
10
<table class="wpforo_settings_table">
11
<tbody>
12
<tr>
13
+ <th style="width:40%"><label><?php _e('FROM Name', 'wpforo'); ?>:</label></th>
14
<td><input name="wpforo_subscribe_options[from_name]" type="text" value="<?php wpfo($wpforo->subscribe_options['from_name']); ?>" required></td>
15
</tr>
16
<tr>
17
+ <th><label><?php _e('FROM Email Address', 'wpforo'); ?>:</label></th>
18
<td><input name="wpforo_subscribe_options[from_email]" type="text" value="<?php wpfo($wpforo->subscribe_options['from_email']); ?>" required /></td>
19
</tr>
20
<tr>
21
<th>
22
+ <label><?php _e('Forum Admins email addresses', 'wpforo'); ?>:</label>
23
<p class="wpf-info"><?php _e('Comma separated email addresses of forum administrators to get forum notifications. For example post report messages.', 'wpforo') ?></p>
24
</th>
25
<td><input name="wpforo_subscribe_options[admin_emails]" type="text" value="<?php wpfo($wpforo->subscribe_options['admin_emails']); ?>" required /></td>
26
</tr>
27
+ <tr>
28
+ <th>
29
+ <label><?php _e('Notify Admins via email on new Topic', 'wpforo'); ?>:</label>
30
+ <p class="wpf-info"><?php _e('Send Notification emails to all email addresses (comma separated ) of forum administrators when a new Topic is created.', 'wpforo') ?></p>
31
+ </th>
32
+ <td>
33
+ <div class="wpf-switch-field">
34
+ <input type="radio" value="1" name="wpforo_subscribe_options[new_topic_notify]" id="wpf_new_topic_notify_1" <?php wpfo_check($wpforo->subscribe_options['new_topic_notify'], 1); ?>><label for="wpf_new_topic_notify_1"><?php _e('Yes', 'wpforo'); ?></label> &nbsp;
35
+ <input type="radio" value="0" name="wpforo_subscribe_options[new_topic_notify]" id="wpf_new_topic_notify_0" <?php wpfo_check($wpforo->subscribe_options['new_topic_notify'], 0); ?>><label for="wpf_new_topic_notify_0"><?php _e('No', 'wpforo'); ?></label>
36
+ </div>
37
+ </td>
38
+ </tr>
39
+ <tr>
40
+ <th>
41
+ <label><?php _e('Notify Admins via email on new Post', 'wpforo'); ?>:</label>
42
+ <p class="wpf-info"><?php _e('Send Notification emails to all email addresses (comma separated ) of forum administrators when a new Reply is created.', 'wpforo') ?></p>
43
+ </th>
44
+ <td>
45
+ <div class="wpf-switch-field">
46
+ <input type="radio" value="1" name="wpforo_subscribe_options[new_reply_notify]" id="wpf_new_reply_notify_1" <?php wpfo_check($wpforo->subscribe_options['new_reply_notify'], 1); ?>><label for="wpf_new_reply_notify_1"><?php _e('Yes', 'wpforo'); ?></label> &nbsp;
47
+ <input type="radio" value="0" name="wpforo_subscribe_options[new_reply_notify]" id="wpf_new_reply_notify_0" <?php wpfo_check($wpforo->subscribe_options['new_reply_notify'], 0); ?>><label for="wpf_new_reply_notify_0"><?php _e('No', 'wpforo'); ?></label>
48
+ </div>
49
+ </td>
50
+ </tr>
51
<tr>
52
<td colspan="2" style="border-bottom:2px solid #ddd;">
53
<h3 style="font-weight:400; padding:10px 0px 0px 0px; margin:0px;"><?php _e('Subscription Emails', 'wpforo'); ?></h3>
wpf-admin/options-tabs/features.php CHANGED
@@ -15,6 +15,7 @@ $options = array(
15
'author-link' => array( 'label' => __('Replace Author Link to Forum Profile', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0 ),
16
'comment-author-link' => array( 'label' => __('Replace Comment Author Link to Forum Profile', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0 ),
17
'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') ),
18
'register-url' => array( 'label' => __('Replace Registration Page URL to Forum URL', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0 ),
19
'login-url' => array( 'label' => __('Replace Login Page URL to Forum URL', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0 ),
20
'replace-avatar' => array( 'label' => __('Replace Author Avatar with Forum Profile Avatar', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1),
@@ -30,6 +31,8 @@ $options = array(
30
'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')),
31
'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')),
32
'subscribe_conf' => array( 'label' => __('Enable Subscription Confirmation', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Forum and Topic subscription with double opt-in/confirmation system.', 'wpforo') ),
33
'attach-media-lib' => array( 'label' => __('Insert Forum Attachments to Media Library', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Enable this option to be able manage forum attachments in Dashboard > Media > Library admin page.', 'wpforo') ),
34
'debug-mode' => array( 'label' => __('Enable Debug Mode', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0, 'description' => __('If you got some issue with wpForo, please enable this option before asking for support, this outputs hidden important information to help us debug your issue.', 'wpforo')),
35
'copyright' => array( 'label' => __('Help wpForo to grow, show plugin info', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Please enable this option to help wpForo get more popularity as your thank to the hard work we do for you totally free. This option adds a very small icon in forum footer, which will allow your site visitors recognize the name of forum solution you use.', 'wpforo')),
15
'author-link' => array( 'label' => __('Replace Author Link to Forum Profile', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0 ),
16
'comment-author-link' => array( 'label' => __('Replace Comment Author Link to Forum Profile', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0 ),
17
'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') ),
18
+ 'user-register-email-confirm' => array( 'label' => __('Enable User Registration email confirmation', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0, 'description' => __('If you have enabled this option, after registering, user can not login without confirming the email.', 'wpforo') ),
19
'register-url' => array( 'label' => __('Replace Registration Page URL to Forum URL', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0 ),
20
'login-url' => array( 'label' => __('Replace Login Page URL to Forum URL', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0 ),
21
'replace-avatar' => array( 'label' => __('Replace Author Avatar with Forum Profile Avatar', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1),
31
'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')),
32
'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')),
33
'subscribe_conf' => array( 'label' => __('Enable Subscription Confirmation', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Forum and Topic subscription with double opt-in/confirmation system.', 'wpforo') ),
34
+ 'subscribe_checkbox_on_post_editor' => array( 'label' => __('Topic subscription option on post editor', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('This option adds topic subscription checkbox next to new topic and post submit button.', 'wpforo') ),
35
+ 'subscribe_checkbox_default_status' => array( 'label' => __('Topic subscription option on post editor - checked/enabled', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Enable this option if you want the topic subscription checkbox to be checked by default.', 'wpforo') ),
36
'attach-media-lib' => array( 'label' => __('Insert Forum Attachments to Media Library', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Enable this option to be able manage forum attachments in Dashboard > Media > Library admin page.', 'wpforo') ),
37
'debug-mode' => array( 'label' => __('Enable Debug Mode', 'wpforo'), 'type' => '', 'required' => '', 'value' => 0, 'description' => __('If you got some issue with wpForo, please enable this option before asking for support, this outputs hidden important information to help us debug your issue.', 'wpforo')),
38
'copyright' => array( 'label' => __('Help wpForo to grow, show plugin info', 'wpforo'), 'type' => '', 'required' => '', 'value' => 1, 'description' => __('Please enable this option to help wpForo get more popularity as your thank to the hard work we do for you totally free. This option adds a very small icon in forum footer, which will allow your site visitors recognize the name of forum solution you use.', 'wpforo')),
wpf-admin/options-tabs/general.php CHANGED
@@ -17,13 +17,24 @@
17
<td align="left">
18
<?php if(!$wpforo->use_home_url): ?>
19
<span style="font-size:14px;"><?php echo esc_url( home_url('/') ) ?></span>
20
- <input required id="wpforourl" type="text" name="wpforo_url" value="<?php echo urldecode( $wpforo->permastruct ) ?>" style="width:47%;"/>/<br>
21
<?php endif; ?>
22
<label for="wpforo_use_home_url">
23
<input id="wpforo_use_home_url" type="checkbox" name="wpforo_use_home_url" value="1" <?php echo ($wpforo->use_home_url ? 'checked' : '') ?>/>
24
<?php _e('Turn WordPress to wpForo', 'wpforo') ?>
25
- <p class="wpf-info"><?php _e('This option will disable WordPress on front-end. Only forum pages will be available. wpForo will look like as a stand-alone forum.', 'wpforo') ?></p>
26
</label>
27
<a href="<?php echo WPFORO_BASE_URL ?>" target="_blank"><?php _e('Visit Forum', 'wpforo') ?></a> |
28
<?php $page_id = $wpforo->db->get_var("SELECT `ID` FROM `{$wpforo->db->prefix}posts` WHERE `ID` = ".intval($wpforo->pageid)." AND `post_content` LIKE '%[wpforo%' AND `post_status` LIKE 'publish' AND `post_type` IN('post', 'page')"); ?>
29
<?php if( !$wpforo->pageid || !$page_id ): ?>
@@ -53,7 +64,10 @@
53
</td>
54
</tr>
55
<tr>
56
- <th><label for="langid"><?php _e('Forum Language', 'wpforo'); ?></label></th>
57
<td>
58
<select id="langid" name="wpforo_general_options[lang]" style="float:left;">
59
<?php $wpforo->phrase->show_lang_list() ?>
17
<td align="left">
18
<?php if(!$wpforo->use_home_url): ?>
19
<span style="font-size:14px;"><?php echo esc_url( home_url('/') ) ?></span>
20
+ <input required id="wpforourl" type="text" name="wpforo_url" value="<?php echo esc_attr( urldecode( $wpforo->permastruct ) ) ?>" style="width:47%;"/>/<br>
21
<?php endif; ?>
22
<label for="wpforo_use_home_url">
23
<input id="wpforo_use_home_url" type="checkbox" name="wpforo_use_home_url" value="1" <?php echo ($wpforo->use_home_url ? 'checked' : '') ?>/>
24
<?php _e('Turn WordPress to wpForo', 'wpforo') ?>
25
+ <p class="wpf-info"><?php _e('This option will disable WordPress on front-end. Only forum pages and excluded post/pages will be available. wpForo will look like as a stand-alone forum.', 'wpforo') ?></p>
26
</label>
27
+ <?php if($wpforo->use_home_url): ?>
28
+ <label for="wpforo_excld_urls"><b style="font-weight: bold;">* <?php _e('Exclude page URLs', 'wpforo') ?></b> <span class="wpf-info">(<?php _e('one URL per line', 'wpforo') ?>)</span></label><br/>
29
+ <textarea id="wpforo_excld_urls"
30
+ style="font-size: 11px;"
31
+ rows="4"
32
+ cols="30"
33
+ name="wpforo_excld_urls"
34
+ placeholder="<?php echo esc_url( home_url('/') ) ?>sample-page/&#10;<?php echo esc_url( home_url('/') ) ?>hello-world/&#10; ..."
35
+ ><?php echo esc_textarea( $wpforo->excld_urls ) ?></textarea>
36
+ <br/>
37
+ <?php endif; ?>
38
<a href="<?php echo WPFORO_BASE_URL ?>" target="_blank"><?php _e('Visit Forum', 'wpforo') ?></a> |
39
<?php $page_id = $wpforo->db->get_var("SELECT `ID` FROM `{$wpforo->db->prefix}posts` WHERE `ID` = ".intval($wpforo->pageid)." AND `post_content` LIKE '%[wpforo%' AND `post_status` LIKE 'publish' AND `post_type` IN('post', 'page')"); ?>
40
<?php if( !$wpforo->pageid || !$page_id ): ?>
64
</td>
65
</tr>
66
<tr>
67
+ <th>
68
+ <label for="langid"><?php _e('Forum Language', 'wpforo'); ?></label>
69
+ <p class="wpf-info"><?php _e('This option is only related to XML language files. You should upload a translation XML file to have a new language option in this drop-down. If you are using PO/MO translation files you should change WordPress Language in Dashboard > Settings admin page to load according translation for wpForo.', 'wpforo'); ?></p>
70
+ </th>
71
<td>
72
<select id="langid" name="wpforo_general_options[lang]" style="float:left;">
73
<?php $wpforo->phrase->show_lang_list() ?>
wpf-admin/options-tabs/posts.php CHANGED
@@ -48,6 +48,16 @@
48
_e('Server "post_max_size" is '); echo ini_get('post_max_size');
49
?>
50
</p>
51
</td>
52
</tr>
53
<?php do_action( 'wpforo_settings_post_bottom', $wpforo ); ?>
48
_e('Server "post_max_size" is '); echo ini_get('post_max_size');
49
?>
50
</p>
51
+ </td>
52
+ </tr>
53
+
54
+ <tr>
55
+ <th>
56
+ <label><?php _e('Attachment click - message for non-permitted users', 'wpforo'); ?></label>
57
+ <p class="wpf-info"><?php _e('This message will be displayed when a non-permitted forum member clicks on attached file link in topic and posts.', 'wpforo'); ?></p>
58
+ </th>
59
+ <td>
60
+ <textarea name="wpforo_post_options[attach_cant_view_msg]"><?php echo esc_textarea( ( !empty( $wpforo->post_options['attach_cant_view_msg'] ) ? $wpforo->post_options['attach_cant_view_msg'] : '' ) ) ?></textarea>
61
</td>
62
</tr>
63
<?php do_action( 'wpforo_settings_post_bottom', $wpforo ); ?>
wpf-admin/options.php CHANGED
@@ -7,6 +7,7 @@
7
<?php $plugins = true; ?>
8
<div id="icon-tools" class="icon32"><br></div><div class="wrap"><h2 style="padding:20px 0px 30px 0px;line-height: 20px;"><?php _e('Forum Settings') ?></h2></div>
9
<?php $wpforo->notice->show(FALSE) ?>
10
<div id="wpf-admin-wrap" class="wrap"><div id="icon-users" class="icon32"><br /></div>
11
<?php
12
$tabs = array(
@@ -15,7 +16,7 @@
15
'accesses' => __('Forum Accesses', 'wpforo'),
16
'posts' => __('Topics &amp; Posts', 'wpforo'),
17
'members' => __('Members', 'wpforo'),
18
- 'subscriptions' => __('Emails', 'wpforo'),
19
'features' => __('Features', 'wpforo')
20
);
21
if( !empty( $wpforo->theme_options['styles'] ) ) $tabs['styles'] = __('Styles', 'wpforo');
@@ -44,8 +45,8 @@
44
case 'styles':
45
include( 'options-tabs/styles.php' );
46
break;
47
- case 'subscriptions':
48
- include( 'options-tabs/subscriptions.php' );
49
break;
50
case 'plugins':
51
include( 'options-tabs/plugins.php' );
7
<?php $plugins = true; ?>
8
<div id="icon-tools" class="icon32"><br></div><div class="wrap"><h2 style="padding:20px 0px 30px 0px;line-height: 20px;"><?php _e('Forum Settings') ?></h2></div>
9
<?php $wpforo->notice->show(FALSE) ?>
10
+ <?php do_action('wpforo_settings_page_top') ?>
11
<div id="wpf-admin-wrap" class="wrap"><div id="icon-users" class="icon32"><br /></div>
12
<?php
13
$tabs = array(
16
'accesses' => __('Forum Accesses', 'wpforo'),
17
'posts' => __('Topics &amp; Posts', 'wpforo'),
18
'members' => __('Members', 'wpforo'),
19
+ 'emails' => __('Emails', 'wpforo'),
20
'features' => __('Features', 'wpforo')
21
);
22
if( !empty( $wpforo->theme_options['styles'] ) ) $tabs['styles'] = __('Styles', 'wpforo');
45
case 'styles':
46
include( 'options-tabs/styles.php' );
47
break;
48
+ case 'emails':
49
+ include( 'options-tabs/emails.php' );
50
break;
51
case 'plugins':
52
include( 'options-tabs/plugins.php' );
wpf-admin/phrase.php CHANGED
@@ -14,7 +14,7 @@
14
$fields = array( 'phrase_key', 'phrase_value' );
15
$search_fields = array( 'phrase_key', 'phrase_value' );
16
$filter_fields = array( 'langid' );
17
- wpforo_create_form_table( 'phrase', 'phraseid', $fields, $search_fields, $filter_fields, array('edit'));
18
}
19
?>
20
<?php if( (isset($_GET['action']) && $_GET['action'] == 'edit') || (isset($_GET['action2']) && $_GET['action2'] == 'edit') ) : ?>
14
$fields = array( 'phrase_key', 'phrase_value' );
15
$search_fields = array( 'phrase_key', 'phrase_value' );
16
$filter_fields = array( 'langid' );
17
+ wpforo_create_form_table( 'phrase', 'phraseid', $fields, $search_fields, $filter_fields, array('edit'), array('edit'));
18
}
19
?>
20
<?php if( (isset($_GET['action']) && $_GET['action'] == 'edit') || (isset($_GET['action2']) && $_GET['action2'] == 'edit') ) : ?>
wpf-assets/addons/attachments/header-off.png ADDED
Binary file
wpf-assets/addons/attachments/header.png ADDED
Binary file
wpf-assets/addons/embeds/header-off.png ADDED
Binary file
wpf-assets/addons/embeds/header.png ADDED
Binary file
wpf-assets/images/icons/eye-dark.png ADDED
Binary file
wpf-assets/images/icons/eye.png ADDED
Binary file
wpf-assets/images/icons/pencil-dark.png ADDED
Binary file
wpf-assets/images/icons/pencil.png ADDED
Binary file
wpf-assets/images/icons/plus-dark.png ADDED
Binary file
wpf-assets/images/icons/plus.png ADDED
Binary file
wpf-assets/images/icons/trash-dark.png ADDED
Binary file
wpf-assets/images/icons/trash.png ADDED
Binary file
wpf-assets/images/wpforo-40.png ADDED
Binary file
wpf-assets/js/ajax.js CHANGED
@@ -192,6 +192,9 @@ jQuery(document).ready(function($){
192
}
193
}).done(function(response){
194
tinyMCE.activeEditor.setContent(response);
195
$( "#formaction" ).attr('name', 'post[action]');
196
$( "#formbutton" ).attr('name', 'post[save]');
197
$( "#formtopicid" ).attr('name', 'post[topicid]');
@@ -210,8 +213,9 @@ jQuery(document).ready(function($){
210
211
212
// Report
213
- jQuery( ".wpforo-report" ).click(function(){
214
- $("#wpf-msg-box").hide(); $('#wpforo-load').visible();
215
var postid_value = $(this).attr('id');
216
var postid = postid_value.replace("wpfreport", "");
217
$('#reportpostid').attr('value', postid);
@@ -224,12 +228,12 @@ jQuery(document).ready(function($){
224
H = ( dialogHeight < h ) ? dialogHeight : (h-40);
225
W = ( dialogWidth < w ) ? dialogWidth : (w-20);
226
227
- dialog = $( "#reportdialog" ).dialog({
228
create: function(event, ui) {
229
- $(event.target).parent().css('position', 'fixed');
230
},
231
close: function( event, ui ) {
232
- $("#wpf_attach_dialog").html('<div style="margin-top: 20%; margin-left: auto; margin-right: auto; display: table;"><i class="fa fa-spinner fa-spin fa-5x"></i></div>');
233
},
234
autoOpen: false,
235
height: H,
@@ -242,7 +246,7 @@ jQuery(document).ready(function($){
242
$('#wpforo-load').invisible();
243
});
244
245
- jQuery( "#sendreport" ).click(function(){
246
$("#wpf-msg-box").hide(); $('#wpforo-load').visible();
247
var postid = $('#reportpostid').attr('value');
248
var messagecontent = $('#reportmessagecontent').attr('value');
@@ -261,7 +265,7 @@ jQuery(document).ready(function($){
261
} catch (e) {
262
console.log(e);
263
}
264
- $( "#reportdialog" ).dialog('close');
265
$('#wpforo-load').invisible();
266
wpforo_notice_show(response);
267
});
@@ -383,6 +387,9 @@ jQuery(document).ready(function($){
383
$("#closeicon" + postid).removeClass('fa-lock').addClass('fa-unlock');
384
$("#closetext" + postid).text(' ' + wpf_ajax_obj.phrases.open);
385
$("#wpf-form-wrapper").remove();
386
}
387
$('#wpforo-load').invisible();
388
});
@@ -403,9 +410,9 @@ jQuery(document).ready(function($){
403
}
404
}).done(function(response){
405
if(response != 0){
406
- $("#" + postid_value).removeClass('wpforo-open').addClass('wpforo-close');
407
$("#closeicon" + postid).removeClass('fa-unlock').addClass('fa-lock');
408
- $("#closetext" + postid).text(' ' + wpf_ajax_obj.phrases.close);
409
window.location.assign(response);
410
}
411
$('#wpforo-load').invisible();
@@ -441,6 +448,9 @@ jQuery(document).ready(function($){
441
console.log(e);
442
}
443
tinyMCE.activeEditor.setContent( response.body );
444
$( "#formaction" ).val( 'edit' );
445
$( "#formpostid" ).val( postid );
446
$( "#formbutton" ).val( wpf_ajax_obj.phrases.update );
192
}
193
}).done(function(response){
194
tinyMCE.activeEditor.setContent(response);
195
+ $( ".wpf-topic-sbs" ).show();
196
+ $( "#wpf-topic-sbs" ).prop("disabled", false);
197
+
198
$( "#formaction" ).attr('name', 'post[action]');
199
$( "#formbutton" ).attr('name', 'post[save]');
200
$( "#formtopicid" ).attr('name', 'post[topicid]');
213
214
215
// Report
216
+ $( ".wpforo-report" ).click(function(){
217
+ $("#wpf-msg-box").hide();
218
+ $('#wpforo-load').visible();
219
var postid_value = $(this).attr('id');
220
var postid = postid_value.replace("wpfreport", "");
221
$('#reportpostid').attr('value', postid);
228
H = ( dialogHeight < h ) ? dialogHeight : (h-40);
229
W = ( dialogWidth < w ) ? dialogWidth : (w-20);
230
231
+ dialog = jQuery( "#reportdialog" ).dialog({
232
create: function(event, ui) {
233
+ jQuery(event.target).parent().css('position', 'fixed');
234
},
235
close: function( event, ui ) {
236
+ jQuery("#wpf_attach_dialog").html('<div style="margin-top: 20%; margin-left: auto; margin-right: auto; display: table;"><i class="fa fa-spinner fa-spin fa-5x"></i></div>');
237
},
238
autoOpen: false,
239
height: H,
246
$('#wpforo-load').invisible();
247
});
248
249
+ $( "#sendreport" ).click(function(){
250
$("#wpf-msg-box").hide(); $('#wpforo-load').visible();
251
var postid = $('#reportpostid').attr('value');
252
var messagecontent = $('#reportmessagecontent').attr('value');
265
} catch (e) {
266
console.log(e);
267
}
268
+ jQuery( "#reportdialog" ).dialog('close');
269
$('#wpforo-load').invisible();
270
wpforo_notice_show(response);
271
});
387
$("#closeicon" + postid).removeClass('fa-lock').addClass('fa-unlock');
388
$("#closetext" + postid).text(' ' + wpf_ajax_obj.phrases.open);
389
$("#wpf-form-wrapper").remove();
390
+ $(".wpforo-reply").remove();
391
+ $(".wpforo-quote").remove();
392
+ $(".wpforo-edit").remove();
393
}
394
$('#wpforo-load').invisible();
395
});
410
}
411
}).done(function(response){
412
if(response != 0){
413
+ /*$("#" + postid_value).removeClass('wpforo-open').addClass('wpforo-close');
414
$("#closeicon" + postid).removeClass('fa-unlock').addClass('fa-lock');
415
+ $("#closetext" + postid).text(' ' + wpf_ajax_obj.phrases.close);*/
416
window.location.assign(response);
417
}
418
$('#wpforo-load').invisible();
448
console.log(e);
449
}
450
tinyMCE.activeEditor.setContent( response.body );
451
+ $( ".wpf-topic-sbs" ).hide();
452
+ $( "#wpf-topic-sbs" ).prop("disabled", true);
453
+
454
$( "#formaction" ).val( 'edit' );
455
$( "#formpostid" ).val( postid );
456
$( "#formbutton" ).val( wpf_ajax_obj.phrases.update );
wpf-assets/js/frontend.js CHANGED
@@ -79,6 +79,9 @@ jQuery(document).ready(function($){
79
$("#wpf-reply-form-title").html(wpf_ajax_obj.phrases['leave a reply']);
80
81
tinyMCE.activeEditor.setContent('');
82
$( "#formaction" ).attr('name', 'post[action]');
83
$( "#formbutton" ).attr('name', 'post[save]');
84
$( "#formtopicid" ).attr('name', 'post[topicid]');
@@ -133,6 +136,9 @@ jQuery(document).ready(function($){
133
$("#postparentid").val( postid );
134
135
tinyMCE.activeEditor.setContent('');
136
$( "#formaction" ).attr('name', 'post[action]');
137
$( "#formbutton" ).attr('name', 'post[save]');
138
$( "#formtopicid" ).attr('name', 'post[topicid]');
@@ -151,8 +157,8 @@ jQuery(document).ready(function($){
151
});
152
153
// Move
154
- $( ".wpforo-move" ).click(function(){
155
- $( "#movedialog" ).dialog({dialogClass:'wpforo-dialog wpforo-dialog-move'});
156
});
157
158
//mobile menu responsive toggle
79
$("#wpf-reply-form-title").html(wpf_ajax_obj.phrases['leave a reply']);
80
81
tinyMCE.activeEditor.setContent('');
82
+ $( ".wpf-topic-sbs" ).show();
83
+ $( "#wpf-topic-sbs" ).prop("disabled", false);
84
+
85
$( "#formaction" ).attr('name', 'post[action]');
86
$( "#formbutton" ).attr('name', 'post[save]');
87
$( "#formtopicid" ).attr('name', 'post[topicid]');
136
$("#postparentid").val( postid );
137
138
tinyMCE.activeEditor.setContent('');
139
+ $( ".wpf-topic-sbs" ).show();
140
+ $( "#wpf-topic-sbs" ).prop("disabled", false);
141
+
142
$( "#formaction" ).attr('name', 'post[action]');
143
$( "#formbutton" ).attr('name', 'post[save]');
144
$( "#formtopicid" ).attr('name', 'post[topicid]');
157
});
158
159
// Move
160
+ jQuery( ".wpforo-move" ).click(function(){
161
+ jQuery( "#movedialog" ).dialog({dialogClass:'wpforo-dialog wpforo-dialog-move'});
162
});
163
164
//mobile menu responsive toggle
wpf-includes/class-forums.php CHANGED
@@ -46,7 +46,7 @@ class wpForoForum{
46
47
$title = sanitize_text_field($title);
48
$title = wpforo_text($title, 250, false);
49
- $description = (isset($description) ? wpforo_kses($description) : '');
50
$permission = (isset($permission) && is_array($permission)) ? serialize(array_map('sanitize_text_field', $permission)) : 'a:5:{i:1;s:4:"full";i:2;s:9:"moderator";i:3;s:8:"standard";i:4;s:9:"read_only";i:5;s:8:"standard";}';
51
$meta_key = (isset($meta_key)) ? sanitize_text_field($meta_key) : '';
52
$meta_desc = (isset($meta_desc)) ? sanitize_text_field($meta_desc) : '';
@@ -121,7 +121,7 @@ class wpForoForum{
121
$forumid = intval($forumid);
122
$title = sanitize_text_field($title);
123
$title = wpforo_text($title, 250, false);
124
- $description = wpforo_kses($description);
125
$permission = (isset($permission) && is_array($permission)) ? serialize(array_map('sanitize_text_field', $permission)) : 'a:5:{i:1;s:4:"full";i:2;s:9:"moderator";i:3;s:8:"standard";i:4;s:9:"read_only";i:5;s:8:"standard";}';
126
$meta_key = (isset($meta_key)) ? sanitize_text_field($meta_key) : '';
127
$meta_desc = (isset($meta_desc)) ? sanitize_text_field($meta_desc) : '';
@@ -287,19 +287,26 @@ class wpForoForum{
287
);
288
}else{
289
$default = array(
290
- 'forumid' => $args, // forumid
291
- 'slug' => '', // slug
292
'cat_layout' => 1, // forum layout
293
'status' => NULL, // status forum 1 OR 0
294
'type' => 'all' // category, forum
295
);
296
}
297
$args = wpforo_parse_args( $args, $default );
298
- if(isset($args['forumid'])){
299
- if( isset(self::$cache['forum'][$args['forumid']]) ){
300
return self::$cache['forum'][$args['forumid']];
301
}
302
}
303
if(!empty($args)){
304
extract($args, EXTR_OVERWRITE);
305
@@ -322,7 +329,8 @@ class wpForoForum{
322
$forum['url'] = $this->get_forum_url( $forum );
323
}
324
if($cache && isset($forumid)){
325
- return self::$cache['forum'][$forumid] = $forum;
326
}
327
else{
328
return $forum;
@@ -523,7 +531,7 @@ class wpForoForum{
523
$ad = $wpforo->ad->get_ad($_GET['id']);
524
$ad_forumids = explode(',', $ad['forumids']);
525
}
526
- ?><option value="<?php echo intval($forumid) ?>"<?php echo( !$cats && $depth == 0 ? 'disabled': ''); echo ( $forumid == $this->parentid($topicid) || (isset( $_GET['forumid'] ) && $forumid == $_GET['forumid']) || ( !empty($_GET['wpff']) && in_array($forumid, $_GET['wpff']) ) || ( !empty($ad_forumids) && in_array($forumid, $ad_forumids) ) ? 'selected' : '' ) ?> > <?php echo esc_html(str_repeat( '— ', $depth ) . trim($name)) ?></option><?php
527
}elseif($type == 'drag_menu'){
528
$cur_forum = $this->wpforo->db->get_row("SELECT `cat_layout`, `topics`, `posts` FROM `".$this->wpforo->db->prefix."wpforo_forums` WHERE `forumid` = ".intval($forumid), ARRAY_A);
529
$cat_layout_name = ( $cur_forum['cat_layout'] == 2 ? 'Simplified Layout' : ( $cur_forum['cat_layout'] == 3 ? 'QA Layout' : 'Extended Layout' ) ); ?>
@@ -537,12 +545,14 @@ class wpForoForum{
537
<span class="item-title forumtitle"><span style="font-weight:400; cursor:help;" title="Forum ID"><?php echo $forumid; ?> &nbsp;|&nbsp;</span> <?php echo esc_html($name) ?></span>
538
<span class="item-controls">
539
<span class="wpforo-cat-layout"><?php echo ( $depth != 0 ? __('Topics', 'wpforo') . '&nbsp;(' . intval($cur_forum['topics']) . ')&nbsp;,&nbsp;' . __('Posts', 'wpforo') . '&nbsp;(' . intval($cur_forum['posts']) . ')&nbsp; | &nbsp;' : '' ) ?><?php echo ( $depth == 0 ? '(&nbsp;<i>' . esc_html($cat_layout_name) . '</i>&nbsp;)&nbsp; | &nbsp;' : '' ); ?></span>
540
- <span class="menu_edit"><a href="<?php echo admin_url( 'admin.php?page=wpforo-forums&id=' . intval($forumid) . '&action=edit' ) ?>"><i class="fa fa-pencil" aria-hidden="true" title="<?php _e('edit', 'wpforo') ?>"></i></a></span>&nbsp;|&nbsp;
541
- <?php if( $this->wpforo->perm->usergroup_can( $this->wpforo->current_user_groupid, 'df') ): ?>
542
- <span class="menu_delete"><a href="<?php echo admin_url( 'admin.php?page=wpforo-forums&id=' . intval($forumid) . '&action=del' ) ?>"><i class="fa fa-trash" aria-hidden="true" title="<?php _e('delete', 'wpforo') ?>"></i></a></span>&nbsp;|&nbsp;
543
- <?php endif; ?>
544
- <span class="menu_view"><a href="<?php echo esc_url($this->get_forum_url($forumid)) ?>" > <i class="fa fa-eye" aria-hidden="true" title="<?php _e('View', 'wpforo') ?>"></i> </a> </span>
545
- </span>
546
</dt>
547
</dl>
548
<ul class="menu-item-transport"></ul>
46
47
$title = sanitize_text_field($title);
48
$title = wpforo_text($title, 250, false);
49
+ $description = (isset($description) ? wpforo_kses($description, 'post') : '');
50
$permission = (isset($permission) && is_array($permission)) ? serialize(array_map('sanitize_text_field', $permission)) : 'a:5:{i:1;s:4:"full";i:2;s:9:"moderator";i:3;s:8:"standard";i:4;s:9:"read_only";i:5;s:8:"standard";}';
51
$meta_key = (isset($meta_key)) ? sanitize_text_field($meta_key) : '';
52
$meta_desc = (isset($meta_desc)) ? sanitize_text_field($meta_desc) : '';
121
$forumid = intval($forumid);
122
$title = sanitize_text_field($title);
123
$title = wpforo_text($title, 250, false);
124
+ $description = wpforo_kses($description, 'post');
125
$permission = (isset($permission) && is_array($permission)) ? serialize(array_map('sanitize_text_field', $permission)) : 'a:5:{i:1;s:4:"full";i:2;s:9:"moderator";i:3;s:8:"standard";i:4;s:9:"read_only";i:5;s:8:"standard";}';
126
$meta_key = (isset($meta_key)) ? sanitize_text_field($meta_key) : '';
127
$meta_desc = (isset($meta_desc)) ? sanitize_text_field($meta_desc) : '';
287
);
288
}else{
289
$default = array(
290
+ 'forumid' => ( is_numeric($args) ? intval($args) : NULL ), // forumid
291
+ 'slug' => ( !is_numeric($args) ? $args : '' ), // slug
292
'cat_layout' => 1, // forum layout
293
'status' => NULL, // status forum 1 OR 0
294
'type' => 'all' // category, forum
295
);
296
}
297
$args = wpforo_parse_args( $args, $default );
298
+
299
+ if(!empty($args['forumid'])){
300
+ if( !empty(self::$cache['forum'][$args['forumid']]) ){
301
return self::$cache['forum'][$args['forumid']];
302
}
303
}
304
+
305
+ if(!empty($args['slug'])){
306
+ if( !empty(self::$cache['forum'][addslashes($args['slug'])]) ){
307
+ return self::$cache['forum'][addslashes($args['slug'])];
308
+ }
309
+ }
310
if(!empty($args)){
311
extract($args, EXTR_OVERWRITE);
312
329
$forum['url'] = $this->get_forum_url( $forum );
330
}
331
if($cache && isset($forumid)){
332
+ self::$cache['forum'][addslashes($forum['slug'])] = $forum;
333
+ return self::$cache['forum'][$forum['forumid']] = $forum;
334
}
335
else{
336
return $forum;
531
$ad = $wpforo->ad->get_ad($_GET['id']);
532
$ad_forumids = explode(',', $ad['forumids']);
533
}
534
+ ?><option value="<?php echo intval($forumid) ?>"<?php echo( !$cats && $depth == 0 ? 'disabled': ''); echo ( $forumid == $this->parentid($topicid) || (isset( $_GET['forumid'] ) && $forumid == $_GET['forumid']) || ( !empty($_GET['wpff']) && in_array($forumid, $_GET['wpff']) ) || ( !empty($ad_forumids) && in_array($forumid, $ad_forumids) ) || ( isset($_GET['parentid']) && $_GET['parentid'] == $forumid ) ? 'selected' : '' ) ?> > <?php echo esc_html(str_repeat( '— ', $depth ) . trim($name)) ?></option><?php
535
}elseif($type == 'drag_menu'){
536
$cur_forum = $this->wpforo->db->get_row("SELECT `cat_layout`, `topics`, `posts` FROM `".$this->wpforo->db->prefix."wpforo_forums` WHERE `forumid` = ".intval($forumid), ARRAY_A);
537
$cat_layout_name = ( $cur_forum['cat_layout'] == 2 ? 'Simplified Layout' : ( $cur_forum['cat_layout'] == 3 ? 'QA Layout' : 'Extended Layout' ) ); ?>
545
<span class="item-title forumtitle"><span style="font-weight:400; cursor:help;" title="Forum ID"><?php echo $forumid; ?> &nbsp;|&nbsp;</span> <?php echo esc_html($name) ?></span>
546
<span class="item-controls">
547
<span class="wpforo-cat-layout"><?php echo ( $depth != 0 ? __('Topics', 'wpforo') . '&nbsp;(' . intval($cur_forum['topics']) . ')&nbsp;,&nbsp;' . __('Posts', 'wpforo') . '&nbsp;(' . intval($cur_forum['posts']) . ')&nbsp; | &nbsp;' : '' ) ?><?php echo ( $depth == 0 ? '(&nbsp;<i>' . esc_html($cat_layout_name) . '</i>&nbsp;)&nbsp; | &nbsp;' : '' ); ?></span>
548
+ <span class="menu_add"><a href="<?php echo admin_url( 'admin.php?page=wpforo-forums&action=add&parentid=' . intval($forumid) ) ?>" > <img src="<?php echo WPFORO_URL ?>/wpf-assets/images/icons/plus<?php echo ((!$depth) ? '-dark' : ''); ?>.png" title="<?php if( $depth ) : _e('Add a new SubForum', 'wpforo'); else: _e('Add a new Forum in this Category', 'wpforo'); endif; ?>"/></a></span> &nbsp;|&nbsp;
549
+ <span class="menu_edit"><a href="<?php echo admin_url( 'admin.php?page=wpforo-forums&id=' . intval($forumid) . '&action=edit' ) ?>"><img src="<?php echo WPFORO_URL ?>/wpf-assets/images/icons/pencil<?php echo ((!$depth) ? '-dark' : ''); ?>.png" title="<?php _e('edit', 'wpforo') ?>"/></a></span>&nbsp;|&nbsp;
550
+ <?php if( $this->wpforo->perm->usergroup_can( $this->wpforo->current_user_groupid, 'df') ): ?>
551
+ <span class="menu_delete"><a href="<?php echo admin_url( 'admin.php?page=wpforo-forums&id=' . intval($forumid) . '&action=del' ) ?>"><img src="<?php echo WPFORO_URL ?>/wpf-assets/images/icons/trash<?php echo ((!$depth) ? '-dark' : ''); ?>.png" title="<?php _e('delete', 'wpforo') ?>"/></a></span>&nbsp;|&nbsp;
552
+ <?php endif; ?>
553
+ <span class="menu_view"><a href="<?php echo esc_url($this->get_forum_url($forumid)) ?>" > <img src="<?php echo WPFORO_URL ?>/wpf-assets/images/icons/eye<?php echo ((!$depth) ? '-dark' : ''); ?>.png" title="<?php _e('View', 'wpforo') ?>"/> </a> </span>
554
+
555
+ </span>
556
</dt>
557
</dl>
558
<ul class="menu-item-transport"></ul>
wpf-includes/class-members.php CHANGED
@@ -10,6 +10,7 @@ class wpForoMember{
10
11
function __construct( $wpForo ){
12
if(!isset($this->wpforo)) $this->wpforo = $wpForo;
13
}
14
15
private function add_profile($args){
@@ -135,33 +136,47 @@ class wpForoMember{
135
$this->wpforo->notice->add('User registration is disabled.', 'error');
136
return FALSE;
137
}
138
- if(!empty($args) && is_array($args)){
139
extract($args, EXTR_OVERWRITE);
140
- $user_login = sanitize_user( $user_login );
141
- $user_email = apply_filters( 'user_registration_email', sanitize_email($user_email) );
142
$user_pass1 = trim(substr($user_pass1, 0, 100));
143
$user_pass2 = trim(substr($user_pass2, 0, 100));
144
- if ( $user_login == '' ) {
145
$this->wpforo->notice->add('Username is missed.', 'error');
146
return FALSE;
147
}elseif ( ! validate_username( $user_login ) ) {
148
$this->wpforo->notice->add('Illegal character in username.', 'error');
149
$user_login = '';
150
return FALSE;
151
}elseif( strlen($user_login) < 3 || strlen($user_login) > 15 ){
152
$this->wpforo->notice->add('Username length must be between 3 characters and 15 characters.', 'error');
153
return FALSE;
154
- }elseif ( username_exists( $user_login ) ) {
155
$this->wpforo->notice->add('Username exists. Please insert another.', 'error');
156
return FALSE;
157
}elseif ( $user_email == '' ) {
158
$this->wpforo->notice->add('Insert your Email address.', 'error');
159
return FALSE;
160
}elseif ( ! is_email( $user_email ) ) {
161
$this->wpforo->notice->add('Invalid Email address', 'error');
162
$user_email = '';
163
return FALSE;
164
}elseif ( email_exists( $user_email ) ) {
165
$this->wpforo->notice->add('Email address exists. Please insert another.', 'error');
166
return FALSE;
167
}elseif( strlen($user_pass1) < 6 || strlen($user_pass1) > 20 ){
@@ -171,14 +186,29 @@ class wpForoMember{
171
$this->wpforo->notice->add('Password mismatch.', 'error');
172
return FALSE;
173
}else{
174
- $user_id = wp_create_user( $user_login, $user_pass1, $user_email );
175
if ( !is_wp_error( $user_id ) && $user_id ) {
176
- $creds = array('user_login' => $user_login, 'user_password' => $user_pass1 );
177
wp_signon($creds);
178
$this->wpforo->notice->add('Success! Thank you Dear Friend', 'success');
179
return $user_id;
180
}
181
}
182
}
183
if(!empty($user_id->errors)){
184
$args = array();
@@ -191,14 +221,12 @@ class wpForoMember{
191
}
192
193
function edit( $args = array() ){
194
-
195
if( empty($args) && empty($_REQUEST['member']) ) return FALSE;
196
if( empty($args) && !empty($_REQUEST['member']) ) $args = $_REQUEST['member'];
197
extract($args, EXTR_OVERWRITE);
198
199
- if( isset($userid) && isset($display_name) && isset($user_email) ){
200
$userid = intval($userid);
201
- $display_name = sanitize_text_field($display_name);
202
$user_email = sanitize_email($user_email);
203
if ( ! is_email( $user_email ) ) {
204
$this->wpforo->notice->add('Invalid Email address', 'error');
@@ -209,32 +237,41 @@ class wpForoMember{
209
return FALSE;
210
}
211
212
- if ( is_user_logged_in() ) {
213
- $current_user_id = get_current_user_id();
214
- if(!$this->wpforo->perm->user_can_manage_user( $current_user_id, $userid )){
215
- $this->wpforo->notice->add('Permission denied', 'error');
216
- return FALSE;
217
- }
218
}
219
- else{
220
$this->wpforo->notice->add('Permission denied', 'error');
221
return FALSE;
222
}
223
224
- if( $display_name && $user_email ){
225
$this->wpforo->db->update(
226
- $this->wpforo->db->prefix.'users',
227
array(
228
'display_name' => sanitize_text_field($display_name),
229
'user_email' => sanitize_email($user_email)
230
),
231
array('ID' => $userid),
232
- array(
233
- '%s',
234
- '%s'
235
- ),
236
array('%d')
237
);
238
$this->reset($userid);
239
}
240
@@ -251,7 +288,7 @@ class wpForoMember{
251
function upload_avatar(){
252
if( !isset($_POST['member']['userid']) || !$userid = intval($_POST['member']['userid']) ) return;
253
if( !$user = $this->get_member($userid) ) return;
254
- $username = $user['user_nicename'];
255
if(isset($_FILES['avatar']) && !empty($_FILES['avatar']) && isset($_FILES['avatar']['name']) && $_FILES['avatar']['name']){
256
257
$name = sanitize_file_name($_FILES['avatar']['name']); //myimg.png
@@ -259,7 +296,7 @@ class wpForoMember{
259
$tmp_name = sanitize_text_field($_FILES['avatar']['tmp_name']); //D:\wamp\tmp\php986B.tmp
260
$error = sanitize_text_field($_FILES['avatar']['error']); //0
261
$size = intval($_FILES['avatar']['size']); //6112
262
-
263
if( $error ){
264
$error = wpforo_file_upload_error($error);
265
$this->wpforo->notice->clear();
@@ -270,20 +307,23 @@ class wpForoMember{
270
$upload_dir = wp_upload_dir();
271
$uplds_dir = $upload_dir['basedir']."/wpforo";
272
$avatar_dir = $upload_dir['basedir']."/wpforo/avatars";
273
- if(!is_dir($uplds_dir)){
274
- wp_mkdir_p($uplds_dir);
275
- }
276
- if(!is_dir($avatar_dir)){
277
- wp_mkdir_p($avatar_dir);
278
- }
279
280
$ext = pathinfo($name, PATHINFO_EXTENSION);
281
if( !wpforo_is_image($ext) ){
282
$this->wpforo->notice->clear();
283
$this->wpforo->notice->add('Incorrect file format. Allowed formats: jpeg, jpg, png, gif.', 'error');
284
- return false;
285
}
286
- $avatar_fname = $username."_".$userid.".".$ext;
287
$avatar_path = $avatar_dir."/".$avatar_fname;
288
289
if(is_dir($avatar_dir)){
@@ -304,7 +344,7 @@ class wpForoMember{
304
function synchronize_user($userid){
305
if(!$userid) return FALSE;
306
if( $user = get_userdata($userid) ){
307
- if( in_array('administrator', $user->roles) ){
308
$groupid = 1;
309
}elseif( in_array('editor', $user->roles) ){
310
$groupid = 2;
@@ -329,7 +369,7 @@ class wpForoMember{
329
}
330
331
function synchronize_users(){
332
- $sql = "SELECT `ID` FROM `".$this->wpforo->db->prefix."users` WHERE `ID` NOT IN( SELECT `userid` FROM `".$this->wpforo->db->prefix."wpforo_profiles` )";
333
$userids = $this->wpforo->db->get_col($sql);
334
if( !empty($userids) ){
335
foreach($userids as $userid){
@@ -376,30 +416,27 @@ class wpForoMember{
376
$username = sanitize_user($username);
377
378
if( $do_db_cache ){
379
- if( $username != '' ){
380
$user_obj = get_user_by( 'user_nicename', $username );
381
if(!empty($user_obj)) $userid = $user_obj->ID;
382
$member = get_user_meta( $userid, '_wpf_member_obj', true );
383
- }
384
- elseif( $userid != NULL ){
385
$member = get_user_meta( $userid, '_wpf_member_obj', true );
386
- }
387
- else{
388
$user_meta_obj = true;
389
}
390
- }
391
- else{
392
$member = array();
393
}
394
395
if(empty($member)){
396
$user_meta_obj = false;
397
- $sql = "SELECT *, ug.name AS groupname FROM `".$this->wpforo->db->prefix."users` u
398
LEFT JOIN `".$this->wpforo->db->prefix."wpforo_profiles` p ON p.`userid` = u.`ID`
399
LEFT JOIN `".$this->wpforo->db->prefix."wpforo_usergroups` ug ON ug.`groupid` = p.`groupid`";
400
$wheres = array();
401
- if($userid != NULL) $wheres[] = "`ID` = " . intval($userid);
402
- if($username != '') $wheres[] = "`user_nicename` = '" . esc_sql($username) . "'";
403
if( !empty($wheres) ) $sql .= " WHERE " . implode($wheres, " AND ");
404
$member = $this->wpforo->db->get_row($sql, ARRAY_A);
405
}
@@ -411,8 +448,7 @@ class wpForoMember{
411
$member['stat'] = $this->get_stat( $member, false, true );
412
update_user_meta( $userid, '_wpf_member_obj', $member );
413
}
414
- }
415
- else{
416
$member['profile_url'] = $this->profile_url( $member );
417
$member['stat'] = $this->get_stat( $member, false, true );
418
}
@@ -420,8 +456,7 @@ class wpForoMember{
420
421
if($cache && isset($userid)){
422
return self::$cache['user'][$userid] = $member;
423
- }
424
- else{
425
return $member;
426
}
427
}
@@ -432,7 +467,7 @@ class wpForoMember{
432
$default = array(
433
'include' => array(), // array( 2, 10, 25 )
434
'exclude' => array(), // array( 2, 10, 25 )
435
- 'status' => 'active', // 'active', 'blocked', 'trashed', 'spamer'
436
'groupid' => NULL, // groupid
437
'orderby' => 'userid', //
438
'order' => 'ASC', // ASC DESC
@@ -447,13 +482,13 @@ class wpForoMember{
447
$include = wpforo_parse_args( $include );
448
$exclude = wpforo_parse_args( $exclude );
449
450
- $sql = "SELECT *, ug.name AS groupname FROM `".$this->wpforo->db->prefix."users` u
451
LEFT JOIN `".$this->wpforo->db->prefix."wpforo_profiles` p ON p.`userid` = u.`ID`
452
LEFT JOIN `".$this->wpforo->db->prefix."wpforo_usergroups` ug ON ug.`groupid` = p.`groupid`";
453
$wheres = array();
454
if(!empty($include)) $wheres[] = "u.`ID` IN(" . implode(', ', array_map('intval', $include)) . ")";
455
if(!empty($exclude)) $wheres[] = "u.`ID` NOT IN(" . implode(', ', array_map('intval', $exclude)) . ")";
456
- if(isset($status)) $wheres[] = " p.`status` = '" . esc_sql(sanitize_text_field($status)) . "' ";
457
if($groupid != NULL) $wheres[] = "p.`groupid` = " . intval($groupid);
458
459
if(!empty($wheres)) $sql .= " WHERE " . implode($wheres, " AND ");
@@ -461,6 +496,7 @@ class wpForoMember{
461
$item_count_sql = preg_replace('#SELECT.+?FROM#isu', 'SELECT count(*) FROM', $sql);
462
if( $item_count_sql ) $items_count = $this->wpforo->db->get_var($item_count_sql);
463
464
$sql .= esc_sql(" ORDER BY $orderby " . $order);
465
if($row_count) $sql .= esc_sql(" LIMIT $offset,$row_count");
466
@@ -481,7 +517,7 @@ class wpForoMember{
481
);
482
}
483
484
- $sql = "SELECT `ID` FROM `".$this->wpforo->db->prefix."users` u LEFT JOIN `".$this->wpforo->db->prefix."wpforo_profiles` p ON p.`userid` = u.`ID`";
485
$wheres = array();
486
487
foreach($fields as $field){
@@ -506,44 +542,134 @@ class wpForoMember{
506
507
}
508
509
/**
510
- * make user trashed
511
- * NOTE there is no way to delete user
512
- *
513
- * @since 1.0.0
514
- *
515
- * @return true or false
516
- */
517
-
518
-
519
- function delete( $userid, $permanently = FALSE ){
520
- if( $permanently ){
521
- if( FALSE !== $this->wpforo->db->delete(
522
- $this->wpforo->db->prefix.'wpforo_profiles', array( 'userid' => intval( $userid ) ), array( '%d' )
523
- )
524
- ){
525
- $this->wpforo->notice->add('User successfully deleted from wpforo', 'success');
526
- return TRUE;
527
}
528
}else{
529
- if( FALSE !== $this->wpforo->db->update(
530
- $this->wpforo->db->prefix.'wpforo_profiles',
531
- array('status' => 'trashed'),
532
- array('userid' => intval( $userid )),
533
- array('%s'),
534
- array('%d')
535
)
536
){
537
- $this->wpforo->notice->add('User successfully deleted from wpforo', 'success');
538
- return TRUE;
539
}
540
}
541
542
$this->wpforo->notice->add('User delete error', 'error');
543
return FALSE;
544
}
545
546
- function avatar($member, $attr = '', $size = '', $cache = false){
547
548
if(!isset($member['userid'])) return;
549
@@ -745,7 +871,8 @@ class wpForoMember{
745
}
746
747
function get_count(){
748
- return $this->wpforo->db->get_var( "SELECT COUNT(`userid`) FROM `".$this->wpforo->db->prefix."wpforo_profiles`" );
749
}
750
751
@@ -796,7 +923,7 @@ class wpForoMember{
796
if($duration == 240) $duration = $this->wpforo->member_options['online_status_timeout'];
797
$current_time = current_time( 'timestamp', 1 );
798
$online_timeframe = $current_time - $duration;
799
- return $this->wpforo->db->get_var( "SELECT COUNT(`user_id`) FROM `".$this->wpforo->db->prefix."usermeta` WHERE meta_key = 'wpforo_online_time' AND meta_value > " . wpforo_bigintval($online_timeframe) );
800
801
}
802
@@ -804,7 +931,7 @@ class wpForoMember{
804
if($duration == 240) $duration = $this->wpforo->member_options['online_status_timeout'];
805
$current_time = current_time( 'timestamp', 1 );
806
$online_timeframe = $current_time - $duration;
807
- $onlinemembers_ids = $this->wpforo->db->get_col( "SELECT `user_id` FROM `".$this->wpforo->db->prefix."usermeta` WHERE meta_key = 'wpforo_online_time' AND meta_value > " . wpforo_bigintval($online_timeframe) );
808
if(!empty($onlinemembers_ids)){
809
$args = array(
810
'include' => $onlinemembers_ids, // array( 2, 10, 25 )
@@ -902,25 +1029,37 @@ class wpForoMember{
902
}
903
}
904
905
- public function reset( $userid ){
906
if( !$userid ) return;
907
- $this->wpforo->db->query( "DELETE FROM `" . $this->wpforo->db->prefix ."usermeta` WHERE `meta_key` = '_wpf_member_obj' AND `user_id` = " . intval($userid) );
908
}
909
910
public function clear_db_cache(){
911
- $this->wpforo->db->query( "DELETE FROM `" . $this->wpforo->db->prefix ."usermeta` WHERE `meta_key` = '_wpf_member_obj'" );
912
}
913
914
public function init_current_user(){
915
- if(is_user_logged_in()){
916
- $current_user = wp_get_current_user();
917
- update_user_meta( $current_user->ID, 'wpforo_online_time', current_time( 'timestamp', 1 ) );
918
- $this->wpforo->current_user = $this->get_member( $current_user->ID );
919
- $this->wpforo->current_user_groupid = $this->wpforo->current_user['groupid'];
920
- $this->wpforo->current_userid = $current_user->ID;
921
- $this->wpforo->current_username = $current_user->user_login;
922
- $this->wpforo->current_user_email = $current_user->user_email;
923
- $this->wpforo->current_user_display_name = $current_user->display_name;
924
}else{
925
$this->wpforo->current_user = array();
926
$this->wpforo->current_user_groupid = 4;
@@ -928,6 +1067,7 @@ class wpForoMember{
928
$this->wpforo->current_username = '';
929
$this->wpforo->current_user_email = '';
930
$this->wpforo->current_user_display_name = '';
931
}
932
}
933
@@ -941,6 +1081,45 @@ class wpForoMember{
941
return (int) $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->comments. " WHERE `user_id` = " . intval($userid) . " OR `comment_author_email` = '" . esc_sql($user_email) . "'");
942
}
943
944
}
945
946
?>
10
11
function __construct( $wpForo ){
12
if(!isset($this->wpforo)) $this->wpforo = $wpForo;
13
+ add_action('delete_user_form', array(&$this, 'show_delete_form'), 10, 2);
14
}
15
16
private function add_profile($args){
136
$this->wpforo->notice->add('User registration is disabled.', 'error');
137
return FALSE;
138
}
139
+ if( !empty($args) && is_array($args) && !empty($args['user_pass1']) ){
140
+ $errors = new WP_Error();
141
+
142
extract($args, EXTR_OVERWRITE);
143
+ $sanitized_user_login = sanitize_user( $user_login );
144
+ $user_email = apply_filters( 'user_registration_email', $user_email );
145
$user_pass1 = trim(substr($user_pass1, 0, 100));
146
$user_pass2 = trim(substr($user_pass2, 0, 100));
147
+ $illegal_user_logins = array_map( 'strtolower', (array) apply_filters( 'illegal_user_logins', array() ) );
148
+ if ( $sanitized_user_login == '' ) {
149
+ $errors->add( 'empty_username', __( '<strong>ERROR</strong>: Please enter a username.' ) );
150
$this->wpforo->notice->add('Username is missed.', 'error');
151
return FALSE;
152
}elseif ( ! validate_username( $user_login ) ) {
153
+ $errors->add( 'invalid_username', __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
154
+ $sanitized_user_login = '';
155
$this->wpforo->notice->add('Illegal character in username.', 'error');
156
$user_login = '';
157
return FALSE;
158
}elseif( strlen($user_login) < 3 || strlen($user_login) > 15 ){
159
$this->wpforo->notice->add('Username length must be between 3 characters and 15 characters.', 'error');
160
return FALSE;
161
+ }elseif ( username_exists( $sanitized_user_login ) ) {
162
+ $errors->add( 'username_exists', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' ) );
163
$this->wpforo->notice->add('Username exists. Please insert another.', 'error');
164
return FALSE;
165
+ }elseif ( in_array( strtolower( $sanitized_user_login ), $illegal_user_logins ) ) {
166
+ $errors->add( 'invalid_username', __( '<strong>ERROR</strong>: Sorry, that username is not allowed.' ) );
167
+ $this->wpforo->notice->add('ERROR: invalid_username. Sorry, that username is not allowed. Please insert another.', 'error');
168
+ return FALSE;
169
}elseif ( $user_email == '' ) {
170
+ $errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please type your email address.' ) );
171
$this->wpforo->notice->add('Insert your Email address.', 'error');
172
return FALSE;
173
}elseif ( ! is_email( $user_email ) ) {
174
+ $errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The email address isn&#8217;t correct.' ) );
175
$this->wpforo->notice->add('Invalid Email address', 'error');
176
$user_email = '';
177
return FALSE;
178
}elseif ( email_exists( $user_email ) ) {
179
+ $errors->add( 'email_exists', __( '<strong>ERROR</strong>: This email is already registered, please choose another one.' ) );
180
$this->wpforo->notice->add('Email address exists. Please insert another.', 'error');
181
return FALSE;
182
}elseif( strlen($user_pass1) < 6 || strlen($user_pass1) > 20 ){
186
$this->wpforo->notice->add('Password mismatch.', 'error');
187
return FALSE;
188
}else{
189
+ do_action( 'register_post', $sanitized_user_login, $user_email, $errors );
190
+ $errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email );
191
+ if ( $errors->get_error_code() ){
192
+ $args = array();
193
+ foreach($errors->errors as $u_err) $args[] = $u_err[0];
194
+ $this->wpforo->notice->add($args, 'error');
195
+ return FALSE;
196
+ }
197
+ $user_id = wp_create_user( $sanitized_user_login, $user_pass1, $user_email );
198
if ( !is_wp_error( $user_id ) && $user_id ) {
199
+ $creds = array('user_login' => $sanitized_user_login, 'user_password' => $user_pass1 );
200
wp_signon($creds);
201
$this->wpforo->notice->add('Success! Thank you Dear Friend', 'success');
202
+ do_action( 'register_new_user', $user_id );
203
return $user_id;
204
}
205
}
206
+ }elseif( !empty($args['user_login']) && !empty($args['user_email']) ){
207
+ $user_id = register_new_user( $args['user_login'], $args['user_email'] );
208
+ if ( !is_wp_error( $user_id ) && $user_id ) {
209
+ $this->wpforo->notice->add('Success! Please check your mail for confirmation.', 'success');
210
+ return $user_id;
211
+ }
212
}
213
if(!empty($user_id->errors)){
214
$args = array();
221
}
222
223
function edit( $args = array() ){
224
if( empty($args) && empty($_REQUEST['member']) ) return FALSE;
225
if( empty($args) && !empty($_REQUEST['member']) ) $args = $_REQUEST['member'];
226
extract($args, EXTR_OVERWRITE);
227
228
+ if( isset($userid) && isset($display_name) && isset($user_email) && isset($user_nickname) ){
229
$userid = intval($userid);
230
$user_email = sanitize_email($user_email);
231
if ( ! is_email( $user_email ) ) {
232
$this->wpforo->notice->add('Invalid Email address', 'error');
237
return FALSE;
238
}
239
240
+ $user_nickname = sanitize_title($user_nickname);
241
+ if( is_numeric($user_nickname) ){
242
+ $this->wpforo->notice->add('Numerical nicknames are not allowed. Please insert another.', 'error');
243
+ return FALSE;
244
}
245
+ $sql = "SELECT `ID` FROM `".$this->wpforo->db->base_prefix."users` WHERE `ID` != ". intval($userid) ." AND ( `user_nicename` LIKE '".esc_sql($user_nickname)."' OR `ID` LIKE '".esc_sql($user_nickname)."' )";
246
+ if( $this->wpforo->db->get_var($sql)){
247
+ $this->wpforo->notice->add('This nickname is already registered. Please insert another.', 'error');
248
+ return FALSE;
249
+ }
250
+
251
+ if ( !is_user_logged_in() || !$this->wpforo->perm->user_can_manage_user( $this->wpforo->current_userid, $userid ) ) {
252
$this->wpforo->notice->add('Permission denied', 'error');
253
return FALSE;
254
}
255
256
+ if( $display_name && $user_email && $user_nickname ){
257
$this->wpforo->db->update(
258
+ $this->wpforo->db->base_prefix."users",
259
array(
260
'display_name' => sanitize_text_field($display_name),
261
+ 'user_nicename' => sanitize_title($user_nickname),
262
'user_email' => sanitize_email($user_email)
263
),
264
array('ID' => $userid),
265
+ array('%s','%s','%s'),
266
array('%d')
267
);
268
+ $this->wpforo->db->update(
269
+ $this->wpforo->db->base_prefix."usermeta",
270
+ array('meta_value' => sanitize_title($user_nickname)),
271
+ array('user_id' => $userid, 'meta_key' => 'nickname'),
272
+ array('%s'),
273
+ array('%d', '%s')
274
+ );
275
$this->reset($userid);
276
}
277
288
function upload_avatar(){
289
if( !isset($_POST['member']['userid']) || !$userid = intval($_POST['member']['userid']) ) return;
290
if( !$user = $this->get_member($userid) ) return;
291
+ $username = urldecode($user['user_nicename']);
292
if(isset($_FILES['avatar']) && !empty($_FILES['avatar']) && isset($_FILES['avatar']['name']) && $_FILES['avatar']['name']){
293
294
$name = sanitize_file_name($_FILES['avatar']['name']); //myimg.png
296
$tmp_name = sanitize_text_field($_FILES['avatar']['tmp_name']); //D:\wamp\tmp\php986B.tmp
297
$error = sanitize_text_field($_FILES['avatar']['error']); //0
298
$size = intval($_FILES['avatar']['size']); //6112
299
+
300
if( $error ){
301
$error = wpforo_file_upload_error($error);
302
$this->wpforo->notice->clear();
307
$upload_dir = wp_upload_dir();
308
$uplds_dir = $upload_dir['basedir']."/wpforo";
309
$avatar_dir = $upload_dir['basedir']."/wpforo/avatars";
310
+ if(!is_dir($uplds_dir)) wp_mkdir_p($uplds_dir);
311
+ if(!is_dir($avatar_dir)) wp_mkdir_p($avatar_dir);
312
313
$ext = pathinfo($name, PATHINFO_EXTENSION);
314
if( !wpforo_is_image($ext) ){
315
$this->wpforo->notice->clear();
316
$this->wpforo->notice->add('Incorrect file format. Allowed formats: jpeg, jpg, png, gif.', 'error');
317
+ return FALSE;
318
}
319
+
320
+ $fnm = pathinfo($username, PATHINFO_FILENAME);
321
+ $fnm = str_replace(' ', '-', $fnm);
322
+ while(strpos($fnm, '--') !== FALSE) $fnm = str_replace('--', '-', $fnm);
323
+ $fnm = preg_replace("/[^-a-zA-Z0-9]/", "", $fnm);
324
+ $fnm = trim($fnm, "-");
325
+
326
+ $avatar_fname = $fnm.( $fnm ? '_' : '' ).$userid.".".$ext;
327
$avatar_path = $avatar_dir."/".$avatar_fname;
328
329
if(is_dir($avatar_dir)){
344
function synchronize_user($userid){
345
if(!$userid) return FALSE;
346
if( $user = get_userdata($userid) ){
347
+ if( is_super_admin( $userid ) || in_array('administrator', $user->roles) ){
348
$groupid = 1;
349
}elseif( in_array('editor', $user->roles) ){
350
$groupid = 2;
369
}
370
371
function synchronize_users(){
372
+ $sql = "SELECT `ID` FROM `".$this->wpforo->db->base_prefix."users` WHERE `ID` NOT IN( SELECT `userid` FROM `".$this->wpforo->db->prefix."wpforo_profiles` )";
373
$userids = $this->wpforo->db->get_col($sql);
374
if( !empty($userids) ){
375
foreach($userids as $userid){
416
$username = sanitize_user($username);
417
418
if( $do_db_cache ){
419
+ if( $username ){
420
$user_obj = get_user_by( 'user_nicename', $username );
421
if(!empty($user_obj)) $userid = $user_obj->ID;
422
$member = get_user_meta( $userid, '_wpf_member_obj', true );
423
+ }elseif( $userid ){
424
$member = get_user_meta( $userid, '_wpf_member_obj', true );
425
+ }else{
426
$user_meta_obj = true;
427
}
428
+ }else{
429
$member = array();
430
}
431
432
if(empty($member)){
433
$user_meta_obj = false;
434
+ $sql = "SELECT *, ug.name AS groupname FROM `".$this->wpforo->db->base_prefix."users` u
435
LEFT JOIN `".$this->wpforo->db->prefix."wpforo_profiles` p ON p.`userid` = u.`ID`
436
LEFT JOIN `".$this->wpforo->db->prefix."wpforo_usergroups` ug ON ug.`groupid` = p.`groupid`";
437
$wheres = array();
438
+ if($userid) $wheres[] = "`ID` = " . intval($userid);
439
+ if($username) $wheres[] = "`user_nicename` = '" . esc_sql($username) . "'";
440
if( !empty($wheres) ) $sql .= " WHERE " . implode($wheres, " AND ");
441
$member = $this->wpforo->db->get_row($sql, ARRAY_A);
442
}
448
$member['stat'] = $this->get_stat( $member, false, true );
449
update_user_meta( $userid, '_wpf_member_obj', $member );
450
}
451
+ }else{
452
$member['profile_url'] = $this->profile_url( $member );
453
$member['stat'] = $this->get_stat( $member, false, true );
454
}
456
457
if($cache && isset($userid)){
458
return self::$cache['user'][$userid] = $member;
459
+ }else{
460
return $member;
461
}
462
}
467
$default = array(
468
'include' => array(), // array( 2, 10, 25 )
469
'exclude' => array(), // array( 2, 10, 25 )
470
+ 'status' => array('active', 'banned'), // 'active', 'blocked', 'trashed', 'spamer'
471
'groupid' => NULL, // groupid
472
'orderby' => 'userid', //
473
'order' => 'ASC', // ASC DESC
482
$include = wpforo_parse_args( $include );
483
$exclude = wpforo_parse_args( $exclude );
484
485
+ $sql = "SELECT *, ug.name AS groupname FROM `".$this->wpforo->db->base_prefix."users` u
486
LEFT JOIN `".$this->wpforo->db->prefix."wpforo_profiles` p ON p.`userid` = u.`ID`
487
LEFT JOIN `".$this->wpforo->db->prefix."wpforo_usergroups` ug ON ug.`groupid` = p.`groupid`";
488
$wheres = array();
489
if(!empty($include)) $wheres[] = "u.`ID` IN(" . implode(', ', array_map('intval', $include)) . ")";
490
if(!empty($exclude)) $wheres[] = "u.`ID` NOT IN(" . implode(', ', array_map('intval', $exclude)) . ")";
491
+ if(!empty($status)) $wheres[] = " p.`status` IN('" . implode("','", array_map('esc_sql', array_map('sanitize_text_field', $status)) ) . "')";
492
if($groupid != NULL) $wheres[] = "p.`groupid` = " . intval($groupid);
493
494
if(!empty($wheres)) $sql .= " WHERE " . implode($wheres, " AND ");
496
$item_count_sql = preg_replace('#SELECT.+?FROM#isu', 'SELECT count(*) FROM', $sql);
497
if( $item_count_sql ) $items_count = $this->wpforo->db->get_var($item_count_sql);
498
499
+ if( $orderby == 'groupid' ) $orderby = 'p.`groupid`';
500
$sql .= esc_sql(" ORDER BY $orderby " . $order);
501
if($row_count) $sql .= esc_sql(" LIMIT $offset,$row_count");
502
517
);
518
}
519
520
+ $sql = "SELECT `ID` FROM `".$this->wpforo->db->base_prefix."users` u LEFT JOIN `".$this->wpforo->db->prefix."wpforo_profiles` p ON p.`userid` = u.`ID`";
521
$wheres = array();
522
523
foreach($fields as $field){
542
543
}
544
545
+ function ban($userid){
546
+ if( !$this->wpforo->perm->usergroup_can( $this->wpforo->current_user_groupid , 'bm' ) || !$this->wpforo->perm->user_can_manage_user( $this->wpforo->current_userid, intval( $userid ) )){
547
+ $this->wpforo->notice->add('Permission denied for this action', 'error');
548
+ return FALSE;
549
+ }
550
+ if( FALSE !== $this->wpforo->db->update(
551
+ $this->wpforo->db->prefix.'wpforo_profiles',
552
+ array('status' => 'banned'),
553
+ array('userid' => intval( $userid )),
554
+ array('%s'),
555
+ array('%d')
556
+ )
557
+ ){
558
+ $this->reset($userid);
559
+ $this->wpforo->notice->add('User successfully banned from wpforo', 'success');
560
+ return TRUE;
561
+ }
562
+
563
+ $this->wpforo->notice->add('User ban action error', 'error');
564
+ return FALSE;
565
+ }
566
+
567
+ function unban($userid){
568
+ if( !$this->wpforo->perm->usergroup_can( $this->wpforo->current_user_groupid , 'bm' ) || !$this->wpforo->perm->user_can_manage_user( $this->wpforo->current_userid, intval( $userid ) )){
569
+ $this->wpforo->notice->add('Permission denied for this action', 'error');
570
+ return FALSE;
571
+ }
572
+ if( FALSE !== $this->wpforo->db->update(
573
+ $this->wpforo->db->prefix.'wpforo_profiles',
574
+ array('status' => 'active'),
575
+ array('userid' => intval( $userid )),
576
+ array('%s'),
577
+ array('%d')
578
+ )
579
+ ){
580
+ $this->reset($userid);
581
+ $this->wpforo->notice->add('User successfully unbanned from wpforo', 'success');
582
+ return TRUE;
583
+ }
584
+
585
+ $this->wpforo->notice->add('User unban action error', 'error');
586
+ return FALSE;
587
+ }
588
+
589
/**
590
+ *
591
+ * @param int $userid
592
+ * @param int $reassign
593
+ *
594
+ * @return bool true | false if user successfully deleted
595
+ */
596
+ public function delete( $userid, $reassign = NULL ){
597
+ if( !($userid = intval($userid)) ) return FALSE;
598
+ if( !$this->wpforo->perm->usergroup_can( $this->wpforo->current_user_groupid , 'dm' ) || !$this->wpforo->perm->user_can_manage_user( $this->wpforo->current_userid, intval( $userid ) )){
599
+ $this->wpforo->notice->add('Permission denied for this action', 'error');
600
+ return FALSE;
601
+ }
602
+
603
+ if( !($reassign = intval($reassign)) ){
604
+ if( $postids = $this->wpforo->db->get_col( $this->wpforo->db->prepare( "SELECT postid FROM {$this->wpforo->db->prefix}wpforo_posts WHERE userid = %d", $userid ) ) ){
605
+ foreach( $postids as $postid ) $this->wpforo->post->delete($postid);
606
+ }
607
+
608
+ if( $topicids = $this->wpforo->db->get_col( $this->wpforo->db->prepare( "SELECT topicid FROM {$this->wpforo->db->prefix}wpforo_topics WHERE userid = %d", $userid ) ) ){
609
+ foreach( $topicids as $topicid ) $this->wpforo->topic->delete($topicid);
610
}
611
}else{
612
+ $this->wpforo->db->update( $this->wpforo->db->prefix."wpforo_topics", array('userid' => $reassign), array('userid' => $userid) );
613
+ $this->wpforo->db->update( $this->wpforo->db->prefix."wpforo_posts", array('userid' => $reassign), array('userid' => $userid) );
614
+ $this->wpforo->db->update( $this->wpforo->db->prefix."wpforo_likes", array('post_userid' => $reassign), array('post_userid' => $userid) );
615
+ $this->wpforo->db->update( $this->wpforo->db->prefix."wpforo_votes", array('post_userid' => $reassign), array('post_userid' => $userid) );
616
+ if( $user_stats = $this->wpforo->db->get_row(
617
+ $this->wpforo->db->prepare( "SELECT
618
+ SUM(`posts`) AS posts,
619
+ SUM(`questions`) AS questions,
620
+ SUM(`answers`) AS answers,
621
+ SUM(`comments`) AS comments
622
+ FROM {$this->wpforo->db->prefix}wpforo_profiles
623
+ WHERE userid IN( %d , %d )", $userid, $reassign
624
+ ),
625
+ ARRAY_A
626
)
627
){
628
+ $this->wpforo->db->update(
629
+ $this->wpforo->db->prefix.'wpforo_profiles',
630
+ array(
631
+ 'posts' => $user_stats['posts'],
632
+ 'questions' => $user_stats['questions'],
633
+ 'answers' => $user_stats['answers'],
634
+ 'comments' => $user_stats['comments']
635
+ ),
636
+ array('userid' => $reassign),
637
+ array('%d','%d','%d','%d'),
638
+ array('%d')
639
+ );
640
}
641
}
642
643
+ $this->wpforo->db->delete(
644
+ $this->wpforo->db->prefix.'wpforo_subscribes', array( 'userid' => $userid ), array( '%d' )
645
+ );
646
+
647
+ $this->wpforo->db->delete(
648
+ $this->wpforo->db->prefix.'wpforo_views', array( 'userid' => $userid ), array( '%d' )
649
+ );
650
+
651
+ $this->wpforo->db->delete(
652
+ $this->wpforo->db->prefix.'wpforo_likes', array( 'userid' => $userid ), array( '%d' )
653
+ );
654
+
655
+ $this->wpforo->db->delete(
656
+ $this->wpforo->db->prefix.'wpforo_votes', array( 'userid' => $userid ), array( '%d' )
657
+ );
658
+
659
+ if( FALSE !== $this->wpforo->db->delete(
660
+ $this->wpforo->db->prefix.'wpforo_profiles', array( 'userid' => $userid ), array( '%d' )
661
+ )
662
+ ){
663
+ $this->clear_db_cache();
664
+ $this->wpforo->notice->add('User successfully deleted from wpforo', 'success');
665
+ return TRUE;
666
+ }
667
+
668
$this->wpforo->notice->add('User delete error', 'error');
669
return FALSE;
670
}
671
672
+ public function avatar($member, $attr = '', $size = '', $cache = false){
673
674
if(!isset($member['userid'])) return;
675
871
}
872
873
function get_count(){
874
+ return $this->wpforo->db->get_var( "SELECT COUNT(p.`userid`) FROM `".$this->wpforo->db->prefix."wpforo_profiles` p
875
+ INNER JOIN `".$this->wpforo->db->base_prefix."users` u ON u.`ID` = p.`userid` WHERE p.`status` NOT LIKE 'trashed'" );
876
}
877
878
923
if($duration == 240) $duration = $this->wpforo->member_options['online_status_timeout'];
924
$current_time = current_time( 'timestamp', 1 );
925
$online_timeframe = $current_time - $duration;
926
+ return $this->wpforo->db->get_var( "SELECT COUNT(`user_id`) FROM `".$this->wpforo->db->base_prefix."usermeta` WHERE meta_key = 'wpforo_online_time' AND meta_value > " . wpforo_bigintval($online_timeframe) );
927
928
}
929
931
if($duration == 240) $duration = $this->wpforo->member_options['online_status_timeout'];
932
$current_time = current_time( 'timestamp', 1 );
933
$online_timeframe = $current_time - $duration;
934
+ $onlinemembers_ids = $this->wpforo->db->get_col( "SELECT `user_id` FROM `".$this->wpforo->db->base_prefix."usermeta` WHERE meta_key = 'wpforo_online_time' AND meta_value > " . wpforo_bigintval($online_timeframe) );
935
if(!empty($onlinemembers_ids)){
936
$args = array(
937
'include' => $onlinemembers_ids, // array( 2, 10, 25 )
1029
}
1030
}
1031
1032
+ public function reset($userid){
1033
if( !$userid ) return;
1034
+ $this->wpforo->db->query( "DELETE FROM `" . $this->wpforo->db->base_prefix ."usermeta` WHERE `meta_key` = '_wpf_member_obj' AND `user_id` = " . intval($userid) );
1035
}
1036
1037
public function clear_db_cache(){
1038
+ $this->wpforo->db->query( "DELETE FROM `" . $this->wpforo->db->base_prefix ."usermeta` WHERE `meta_key` = '_wpf_member_obj'" );
1039
}
1040
1041
public function init_current_user(){
1042
+ $current_user = wp_get_current_user();
1043
+ if( $current_user->exists() ){
1044
+ $user = $this->get_member( $current_user->ID );
1045
+ $status = ( isset($user['status']) ? $user['status'] : '' );
1046
+ if( $status == 'active' ){
1047
+ update_user_meta( $current_user->ID, 'wpforo_online_time', current_time( 'timestamp', 1 ) );
1048
+ $this->wpforo->current_user = $user;
1049
+ $this->wpforo->current_user_groupid = $this->wpforo->current_user['groupid'];
1050
+ $this->wpforo->current_userid = $current_user->ID;
1051
+ $this->wpforo->current_username = $current_user->user_login;
1052
+ $this->wpforo->current_user_email = $current_user->user_email;
1053
+ $this->wpforo->current_user_display_name = $current_user->display_name;
1054
+ }else{
1055
+ $this->wpforo->current_user = array();
1056
+ $this->wpforo->current_user_groupid = 4;
1057
+ $this->wpforo->current_userid = 0;
1058
+ $this->wpforo->current_username = '';
1059
+ $this->wpforo->current_user_email = '';
1060
+ $this->wpforo->current_user_display_name = '';
1061
+ }
1062
+ $this->wpforo->current_user_status = $status;
1063
}else{
1064
$this->wpforo->current_user = array();
1065
$this->wpforo->current_user_groupid = 4;
1067
$this->wpforo->current_username = '';
1068
$this->wpforo->current_user_email = '';
1069
$this->wpforo->current_user_display_name = '';
1070
+ $this->wpforo->current_user_status = '';
1071
}
1072
}
1073
1081
return (int) $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->comments. " WHERE `user_id` = " . intval($userid) . " OR `comment_author_email` = '" . esc_sql($user_email) . "'");
1082
}
1083
1084
+ public function show_delete_form($current_user, $userids){
1085
+ if( empty($current_user) || empty($userids) ) return;
1086
+
1087
+ $userids = array_diff( $userids, array( $current_user->ID ) );
1088
+ $users_have_content = false;
1089
+ if ( $this->wpforo->db->get_var( "SELECT postid FROM {$this->wpforo->db->prefix}wpforo_posts WHERE userid IN( " . implode( ',', array_map('intval', $userids) ) . " ) LIMIT 1" ) ) {
1090
+ $users_have_content = true;
1091
+ }
1092
+ ?>
1093
+ <hr /><strong>#wpForo</strong>
1094
+ <?php if ( ! $users_have_content ) : ?>
1095
+ <input type="hidden" name="wpforo_user_delete_option" value="delete" />
1096
+ <?php else: ?>
1097
+ <?php if ( 1 == count($userids) ) : ?>
1098
+ <fieldset><p><legend><?php _e( 'What should be done with wpForo content owned by this user?', 'wpforo' ); ?></legend></p>
1099
+ <?php else : ?>
1100
+ <fieldset><p><legend><?php _e( 'What should be done with wpForo content owned by these users?', 'wpforo' ); ?></legend></p>
1101
+ <?php endif; ?>
1102
+ <ul style="list-style:none;">
1103
+ <li><label><input type="radio" id="wpforo_delete_option0" name="wpforo_user_delete_option" value="delete" />
1104
+ <?php _e('Delete all wpForo content.', 'wpforo'); ?></label></li>
1105
+ <li><input type="radio" id="wpforo_delete_option1" name="wpforo_user_delete_option" value="reassign" />
1106
+ <?php echo '<label for="wpforo_delete_option1">' . __( 'Attribute all content to:' ) . '</label> ';
1107
+ wp_dropdown_users( array(
1108
+ 'name' => 'wpforo_reassign_user',
1109
+ 'exclude' => $userids,
1110
+ 'show' => 'display_name_with_login',
1111
+ ) ); ?></li>
1112
+ </ul></fieldset>
1113
+ <script type="text/javascript">
1114
+ jQuery(document).ready( function($) {
1115
+ $('#wpforo_reassign_user').focus( function() {
1116
+ $('#wpforo_delete_option1').prop('checked', true).trigger('change');
1117
+ });
1118
+ });
1119
+ </script>
1120
+ <?php endif;
1121
+ }
1122
+
1123
}
1124
1125
?>
wpf-includes/class-notices.php CHANGED
@@ -109,7 +109,8 @@ class wpForoNotices{
109
$class = '';
110
}
111
$inner = '';
112
- foreach($_SESSION['wpforo_notices'] as $notice) if( !is_array($notice) ) $inner .= wpforo_phrase($notice, FALSE) . '<br/>';
113
?>
114
<?php if($frontend) : ?>
115
<script type="text/javascript">
109
$class = '';
110
}
111
$inner = '';
112
+ foreach($_SESSION['wpforo_notices'] as $notice) if( !is_array($notice) ) $inner .= wpforo_phrase($notice, FALSE) . '<br/><br/>';
113
+ $inner = preg_replace('#(<br\s*/?\s*>)*$#is', '', $inner);
114
?>
115
<?php if($frontend) : ?>
116
<script type="text/javascript">
wpf-includes/class-permissions.php CHANGED
@@ -42,15 +42,15 @@ class wpForoPermissions{
42
43
if( $groupid == FALSE ){
44
foreach($cans as $can => $name){
45
- $can_data[$can]['value'] = 0;
46
- $can_data[$can]['name'] = $name;
47
}
48
}else{
49
$usegroup = $this->wpforo->usergroup->get_usergroup( $groupid );
50
$ug_cans = unserialize($usegroup['cans']);
51
foreach($cans as $can => $name){
52
- $can_data[$can]['value'] = $ug_cans[$can];
53
- $can_data[$can]['name'] = $name;
54
}
55
}
56
@@ -64,15 +64,15 @@ class wpForoPermissions{
64
65
if( !$access ){
66
foreach($cans as $can => $name){
67
- $can_data[$can]['value'] = 0;
68
- $can_data[$can]['name'] = $name;
69
}
70
}else{
71
$access = $this->get_access( $access );
72
$access_cans = unserialize($access['cans']);
73
foreach($cans as $can => $name){
74
- $can_data[$can]['value'] = $access_cans[$can];
75
- $can_data[$can]['name'] = $name;
76
}
77
}
78
@@ -164,17 +164,20 @@ class wpForoPermissions{
164
return FALSE;
165
}
166
167
- function forum_can( $forumid, $do ){
168
$can = 0;
169
$forumid = intval($forumid);
170
if( !$this->wpforo->current_user_groupid ) return 0;
171
- $forum = $this->wpforo->forum->get_forum($forumid, true);
172
- $permissions = unserialize($forum['permissions']);
173
- if( isset($permissions[$this->wpforo->current_user_groupid]) ){
174
- $access = $permissions[$this->wpforo->current_user_groupid];
175
- $access_arr = $this->get_access($access);
176
- $cans = unserialize($access_arr['cans']);
177
- $can = ( isset($cans[$do]) ? $cans[$do] : 0 );
178
}
179
return $can;
180
}
42
43
if( $groupid == FALSE ){
44
foreach($cans as $can => $name){
45
+ @$can_data[$can]['value'] = 0;
46
+ @$can_data[$can]['name'] = $name;
47
}
48
}else{
49
$usegroup = $this->wpforo->usergroup->get_usergroup( $groupid );
50
$ug_cans = unserialize($usegroup['cans']);
51
foreach($cans as $can => $name){
52
+ @$can_data[$can]['value'] = $ug_cans[$can];
53
+ @$can_data[$can]['name'] = $name;
54
}
55
}
56
64
65
if( !$access ){
66
foreach($cans as $can => $name){
67
+ @$can_data[$can]['value'] = 0;
68
+ @$can_data[$can]['name'] = $name;
69
}
70
}else{
71
$access = $this->get_access( $access );
72
$access_cans = unserialize($access['cans']);
73
foreach($cans as $can => $name){
74
+ @$can_data[$can]['value'] = $access_cans[$can];
75
+ @$can_data[$can]['name'] = $name;
76
}
77
}
78
164
return FALSE;
165
}
166
167
+ function forum_can( $do, $forumid = NULL ){
168
$can = 0;
169
+ if( is_null($forumid) && isset($this->wpforo->current_object['forumid']) )
170
+ $forumid = intval($this->wpforo->current_object['forumid']);
171
$forumid = intval($forumid);
172
if( !$this->wpforo->current_user_groupid ) return 0;
173
+ if( $forum = $this->wpforo->forum->get_forum($forumid, true) ){
174
+ $permissions = unserialize($forum['permissions']);
175
+ if( isset($permissions[$this->wpforo->current_user_groupid]) ){
176
+ $access = $permissions[$this->wpforo->current_user_groupid];
177
+ $access_arr = $this->get_access($access);
178
+ $cans = unserialize($access_arr['cans']);
179
+ $can = ( isset($cans[$do]) ? $cans[$do] : 0 );
180
+ }
181
}
182
return $can;
183
}
wpf-includes/class-posts.php CHANGED
@@ -25,7 +25,7 @@ class wpForoPost{
25
return FALSE;
26
}
27
28
- if( !$this->wpforo->perm->forum_can(intval($topic['forumid']), 'cr') ){
29
$this->wpforo->notice->add('You haven\'t permission to create post into this forum', 'error');
30
return FALSE;
31
}
@@ -117,7 +117,7 @@ class wpForoPost{
117
if( !$post = $this->get_post($postid) ){ $this->wpforo->notice->add('No Posts found for update', 'error'); return FALSE; }
118
119
$diff = current_time( 'timestamp', 1 ) - strtotime($post['created']);
120
- if( !($this->wpforo->perm->forum_can($post['forumid'], 'er') || ($this->wpforo->current_userid == $post['userid'] && $this->wpforo->perm->forum_can($post['forumid'], 'eor') && $diff < $this->wpforo->post_options['eor_durr'])) ){
121
$this->wpforo->notice->add('You haven\'t permission to edit post from this forum', 'error');
122
return FALSE;
123
}
@@ -171,7 +171,7 @@ class wpForoPost{
171
172
$post = $this->get_post($postid);
173
$diff = current_time( 'timestamp', 1 ) - strtotime($post['created']);
174
- if( !($this->wpforo->perm->forum_can($post['forumid'], 'dr') || ($this->wpforo->current_userid == $post['userid'] && $this->wpforo->perm->forum_can($post['forumid'], 'dor') && $diff < $this->wpforo->post_options['dor_durr'])) ){
175
$this->wpforo->notice->add('You haven\'t permission to delete post from this forum', 'error');
176
return FALSE;