wpForo Forum - Version 1.5.3

Version Description

Download this release

Release Info

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

Code changes from version 1.5.2 to 1.5.3

readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: gVectors Team
3
Tags: forum, forums, forum plugin, WordPress forum plugin, community, discussion
4
Requires at least: 4.1
5
Tested up to: 4.9
6
- Stable tag: 1.5.2
7
Requires PHP: 5.5 and higher
8
License: GPLv2 or later
9
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -159,6 +159,33 @@ Find wpForo forum plugin addons on [gVectors Team website...](https://gvectors.c
159
160
== Changelog ==
161
162
= wpForo Forum 1.5.2 | 05.09.2018 =
163
164
[wpForo v1.5.2 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-5-2-is-released/)
@@ -205,15 +232,6 @@ Find wpForo forum plugin addons on [gVectors Team website...](https://gvectors.c
205
* Fixed Bug: Error on user profile update in dashboard. Warning: array_filter() expects parameter 1 to be array in /class-members.php on line 770
206
207
208
- UPDATE NOTES:
209
-
210
- - This version is also security fixes, please update it to avoid security issues.
211
- - To load your customized colors please refresh forum front-end page twice.
212
- - If you have a Cache Plugin, please delete all caches after wpForo update.
213
- - If you use CDN and found some issue please purge it.
214
- - Forum template files are modified. If you have an old (1.5.1 or lower) customized copy of wpForo forum template files in your WP theme /wpforo/ folder please update them.
215
-
216
-
217
= wpForo Forum 1.5.0 / 1.5.1 | 11.07.2018 =
218
219
[wpForo v1.5.0 and 1.5.1 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-5-0-is-released/)
3
Tags: forum, forums, forum plugin, WordPress forum plugin, community, discussion
4
Requires at least: 4.1
5
Tested up to: 4.9
6
+ Stable tag: 1.5.3
7
Requires PHP: 5.5 and higher
8
License: GPLv2 or later
9
License URI: https://www.gnu.org/licenses/gpl-2.0.html
159
160
== Changelog ==
161
162
+ = wpForo Forum 1.5.3 | 13.09.2018 =
163
+
164
+ [wpForo v1.5.3 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-5-3-is-released/)
165
+
166
+ * Changed: Change all "Topic" phrases to "Question" in Q&A layout
167
+ * Changed: Display topic last post date in related topics area
168
+ * Changed: Allow guests to use default file attachment button
169
+ * Changed: Post auto-moderation optimization (smarter spam suspicion)
170
+ * Fixed Bug: Tag counts in Topic Footer
171
+ * Fixed Bug: Link detection in new users posts (Removed Link)
172
+ * Fixed Bug: Delete Topic Error in Dashboard > Moderation admin page
173
+ * Fixed Bug: http_headers ajax request referrer problem
174
+ * Fixed Bug: Too many redirects on plugin activation
175
+ * Fixed Bug: Profile fields not saved in Dashboard > Edit Users page
176
+ * Fixed Bug: Usergroup and Secondary Usergroups not saved
177
+ * Fixed Bug: Error - "Invalid User ID" on profile update
178
+
179
+
180
+ UPDATE NOTES:
181
+
182
+ - This version is also security fixes, please update it to avoid security issues.
183
+ - To load your customized colors please refresh forum front-end page twice.
184
+ - If you have a Cache Plugin, please delete all caches after wpForo update.
185
+ - If you use CDN and found some issue please purge it.
186
+ - Forum template files are modified. If you have an old (1.5.1 or lower) customized copy of wpForo forum template files in your WP theme /wpforo/ folder please update them.
187
+
188
+
189
= wpForo Forum 1.5.2 | 05.09.2018 =
190
191
[wpForo v1.5.2 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-5-2-is-released/)
232
* Fixed Bug: Error on user profile update in dashboard. Warning: array_filter() expects parameter 1 to be array in /class-members.php on line 770
233
234
235
= wpForo Forum 1.5.0 / 1.5.1 | 11.07.2018 =
236
237
[wpForo v1.5.0 and 1.5.1 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-5-0-is-released/)
wpf-admin/xml/english.xml CHANGED
@@ -551,4 +551,8 @@
551
<phrase name="Tags are disabled"><![CDATA[Tags are disabled]]></phrase>
552
<phrase name="Unread Posts"><![CDATA[Unread Posts]]></phrase>
553
<phrase name="No unread posts were found"><![CDATA[No unread posts were found]]></phrase>
554
</language>
551
<phrase name="Tags are disabled"><![CDATA[Tags are disabled]]></phrase>
552
<phrase name="Unread Posts"><![CDATA[Unread Posts]]></phrase>
553
<phrase name="No unread posts were found"><![CDATA[No unread posts were found]]></phrase>
554
+ <phrase name="Ask a question"><![CDATA[Ask a question]]></phrase>
555
+ <phrase name="Your question"><![CDATA[Your question]]></phrase>
556
+ <phrase name="Question Tags"><![CDATA[Question Tags]]></phrase>
557
+ <phrase name="This topic doesn't exist or you don't have permissions to see that."><![CDATA[This topic doesn't exist or you don't have permissions to see that.]]></phrase>
558
</language>
wpf-assets/js/ajax.js CHANGED
@@ -1,3 +1,10 @@
1
jQuery(document).ready(function ($) {
2
var wpforo_wrap = $('#wpforo-wrap');
3
// Like
@@ -799,7 +806,6 @@ function wpforo_topic_tools_tab_load() {
799
jQuery('#wpf_tool_tab_content_wrap').html('<i class="fas fa-spinner fa-spin wpf-icon-spinner"></i>');
800
jQuery.ajax({
801
type: 'POST',
802
- url: wpf_ajax_obj.url,
803
data: {
804
active_tab_id: active_tab_id,
805
action: 'wpforo_active_tab_content_ajax'
1
+ jQuery.ajaxSetup({
2
+ url: wpf_ajax_obj.url,
3
+ data:{
4
+ referer: window.location.origin + window.location.pathname
5
+ }
6
+ });
7
+
8
jQuery(document).ready(function ($) {
9
var wpforo_wrap = $('#wpforo-wrap');
10
// Like
806
jQuery('#wpf_tool_tab_content_wrap').html('<i class="fas fa-spinner fa-spin wpf-icon-spinner"></i>');
807
jQuery.ajax({
808
type: 'POST',
809
data: {
810
active_tab_id: active_tab_id,
811
action: 'wpforo_active_tab_content_ajax'
wpf-assets/js/frontend.js CHANGED
@@ -52,7 +52,7 @@ jQuery(document).ready(function($){
52
var stat = $( ".wpf-topic-create" ).is( ":hidden" );
53
$( ".wpf-topic-create" ).slideToggle( "slow" );
54
var add_wpftopic = '<i class="fas fa-times" aria-hidden="true"></i>';
55
- if( !stat ) add_wpftopic = wpforo_phrase('add topic');
56
$( "#add_wpftopic" ).html(add_wpftopic);
57
$('html, body').animate({ scrollTop: ($(".wpforo-main").offset().top - 25) }, 415);
58
});
@@ -142,7 +142,9 @@ jQuery(document).ready(function($){
142
143
//Answer
144
$( ".wpforo-answer" ).click(function(){
145
-
146
$("#wpf-msg-box").hide(); $('#wpforo-load').visible();
147
$("#wpf-reply-form-title").html( wpforo_phrase('Your answer') );
148
@@ -153,7 +155,7 @@ jQuery(document).ready(function($){
153
$( "#wpf_title" ).attr('name', 'post[title]');
154
$( "#wpf_formaction" ).val( 'add' );
155
$( "#wpf_formpostid" ).val( '' );
156
- $( "#wpf_formbutton" ).val( wpforo_phrase('Save') );
157
$( "#wpf_title").val( wpforo_phrase('Answer to') + ": " + $("#wpf_title").attr('placeholder').replace( wpforo_phrase('re') + ": ", "").replace( wpforo_phrase('Answer to') + ": ", ""));
158
$('html, body').animate({ scrollTop: $("#wpf-form-wrapper").offset().top }, 500);
159
@@ -167,6 +169,9 @@ jQuery(document).ready(function($){
167
168
//Comment
169
$( ".wpforo-childreply" ).click(function(){
170
$("#wpf-msg-box").hide(); $('#wpforo-load').visible();
171
$("#wpf-reply-form-title").html( wpforo_phrase('Leave a comment') );
172
@@ -184,7 +189,7 @@ jQuery(document).ready(function($){
184
$( "#wpf_title" ).attr('name', 'post[title]');
185
$( "#wpf_formaction" ).val( 'add' );
186
$( "#wpf_formpostid" ).val( '' );
187
- $( "#wpf_formbutton" ).val( wpforo_phrase('Save') );
188
$( "#wpf_title").val( wpforo_phrase('re') + ": " + $("#wpf_title").attr('placeholder').replace( wpforo_phrase('re') + ": ", "").replace( wpforo_phrase('Answer to') + ": ", "") );
189
$('html, body').animate({ scrollTop: $("#wpf-form-wrapper").offset().top }, 800);
190
52
var stat = $( ".wpf-topic-create" ).is( ":hidden" );
53
$( ".wpf-topic-create" ).slideToggle( "slow" );
54
var add_wpftopic = '<i class="fas fa-times" aria-hidden="true"></i>';
55
+ if( !stat ) add_wpftopic = $("#wpf_formbutton").val();
56
$( "#add_wpftopic" ).html(add_wpftopic);
57
$('html, body').animate({ scrollTop: ($(".wpforo-main").offset().top - 25) }, 415);
58
});
142
143
//Answer
144
$( ".wpforo-answer" ).click(function(){
145
+ var phrase = wpforo_phrase('Save') ;
146
+ if( $(this).data('phrase') !== undefined ) phrase = $(this).data('phrase');
147
+
148
$("#wpf-msg-box").hide(); $('#wpforo-load').visible();
149
$("#wpf-reply-form-title").html( wpforo_phrase('Your answer') );
150
155
$( "#wpf_title" ).attr('name', 'post[title]');
156
$( "#wpf_formaction" ).val( 'add' );
157
$( "#wpf_formpostid" ).val( '' );
158
+ $( "#wpf_formbutton" ).val( phrase );
159
$( "#wpf_title").val( wpforo_phrase('Answer to') + ": " + $("#wpf_title").attr('placeholder').replace( wpforo_phrase('re') + ": ", "").replace( wpforo_phrase('Answer to') + ": ", ""));
160
$('html, body').animate({ scrollTop: $("#wpf-form-wrapper").offset().top }, 500);
161
169
170
//Comment
171
$( ".wpforo-childreply" ).click(function(){
172
+ var phrase = wpforo_phrase('Save') ;
173
+ if( $(this).data('phrase') !== undefined ) phrase = $(this).data('phrase');
174
+
175
$("#wpf-msg-box").hide(); $('#wpforo-load').visible();
176
$("#wpf-reply-form-title").html( wpforo_phrase('Leave a comment') );
177
189
$( "#wpf_title" ).attr('name', 'post[title]');
190
$( "#wpf_formaction" ).val( 'add' );
191
$( "#wpf_formpostid" ).val( '' );
192
+ $( "#wpf_formbutton" ).val( phrase );
193
$( "#wpf_title").val( wpforo_phrase('re') + ": " + $("#wpf_title").attr('placeholder').replace( wpforo_phrase('re') + ": ", "").replace( wpforo_phrase('Answer to') + ": ", "") );
194
$('html, body').animate({ scrollTop: $("#wpf-form-wrapper").offset().top }, 800);
195
wpf-includes/class-feed.php CHANGED
@@ -63,11 +63,7 @@ class wpForoFeed{
63
<?php echo esc_html($forum['title']); ?> - <?php echo esc_html(WPF()->general_options['title']); ?>
64
<?php endif; ?>
65
</title>
66
- <?php if($forum['forumurl'] != '#'): ?>
67
- <link><?php echo esc_url($forum['forumurl']); ?></link>
68
- <?php else: ?>
69
- <link><?php echo esc_url_raw( wpforo_home_url() . '?' . $_SERVER['QUERY_STRING'] ); ?></link>
70
- <?php endif; ?>
71
<description><?php echo esc_html(WPF()->general_options['description']); ?></description>
72
<language><?php bloginfo_rss( 'language' ); ?></language>
73
<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', date('Y-m-d H:i:s'), false); ?></lastBuildDate>
@@ -80,7 +76,7 @@ class wpForoFeed{
80
<link><?php echo esc_url($topic['topicurl']); ?></link>
81
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', $topic['created'], false); ?></pubDate>
82
<description><![CDATA[<?php echo wpforo_removebb(esc_html($topic['description'])) ?>]]></description>
83
- <content:encoded><![CDATA[<?php echo wpforo_removebb(esc_html($topic['content'])) ?>]]></content:encoded>
84
<?php if($forum['forumurl'] != '#'): ?><category domain="<?php echo esc_url($forum['forumurl']); ?>"><?php echo esc_html($forum['title']); ?></category><?php endif; ?>
85
<dc:creator><?php echo esc_html($topic['author']); ?></dc:creator>
86
<guid isPermaLink="true"><?php echo esc_url($topic['topicurl']); ?></guid>
@@ -133,7 +129,7 @@ class wpForoFeed{
133
<link><?php echo esc_url($post['posturl']); ?></link>
134
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', $post['created'], false); ?></pubDate>
135
<description><![CDATA[<?php echo wpforo_removebb(esc_html($post['description'])) ?>]]></description>
136
- <content:encoded><![CDATA[<?php echo wpforo_removebb(esc_html($post['content'])) ?>]]></content:encoded>
137
<?php if($forum['forumurl'] != '#'): ?><category domain="<?php echo esc_url($forum['forumurl']); ?>"><?php echo esc_html($forum['title']); ?></category><?php endif; ?>
138
<dc:creator><?php echo esc_html($post['author']); ?></dc:creator>
139
<guid isPermaLink="true"><?php echo esc_url($post['posturl']); ?></guid>
63
<?php echo esc_html($forum['title']); ?> - <?php echo esc_html(WPF()->general_options['title']); ?>
64
<?php endif; ?>
65
</title>
66
+ <link><?php echo esc_url($forum['forumurl']); ?></link>
67
<description><?php echo esc_html(WPF()->general_options['description']); ?></description>
68
<language><?php bloginfo_rss( 'language' ); ?></language>
69
<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', date('Y-m-d H:i:s'), false); ?></lastBuildDate>
76
<link><?php echo esc_url($topic['topicurl']); ?></link>
77
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', $topic['created'], false); ?></pubDate>
78
<description><![CDATA[<?php echo wpforo_removebb(esc_html($topic['description'])) ?>]]></description>
79
+ <content:encoded><![CDATA[<?php echo wpforo_removebb($topic['content']) ?>]]></content:encoded>
80
<?php if($forum['forumurl'] != '#'): ?><category domain="<?php echo esc_url($forum['forumurl']); ?>"><?php echo esc_html($forum['title']); ?></category><?php endif; ?>
81
<dc:creator><?php echo esc_html($topic['author']); ?></dc:creator>
82
<guid isPermaLink="true"><?php echo esc_url($topic['topicurl']); ?></guid>
129
<link><?php echo esc_url($post['posturl']); ?></link>
130
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', $post['created'], false); ?></pubDate>
131
<description><![CDATA[<?php echo wpforo_removebb(esc_html($post['description'])) ?>]]></description>
132
+ <content:encoded><![CDATA[<?php echo wpforo_removebb($post['content']) ?>]]></content:encoded>
133
<?php if($forum['forumurl'] != '#'): ?><category domain="<?php echo esc_url($forum['forumurl']); ?>"><?php echo esc_html($forum['title']); ?></category><?php endif; ?>
134
<dc:creator><?php echo esc_html($post['author']); ?></dc:creator>
135
<guid isPermaLink="true"><?php echo esc_url($post['posturl']); ?></guid>
wpf-includes/class-forms.php CHANGED
@@ -998,7 +998,7 @@ class wpForoForm{
998
if( wpfval($field, 'label') ) $label = esc_html($field['label']);
999
if( wpfval($field, 'type') ) $type = $field['type'];
1000
if( wpfval($data, 'userid') ) $userid = $data['userid'];
1001
- if( isset($template) && $template != 'register' ){
1002
if( !$this->can_edit( $field ) ) {
1003
unset($cols[$key]);
1004
unset($data[$name]);
998
if( wpfval($field, 'label') ) $label = esc_html($field['label']);
999
if( wpfval($field, 'type') ) $type = $field['type'];
1000
if( wpfval($data, 'userid') ) $userid = $data['userid'];
1001
+ if( $template && $template != 'register' ){
1002
if( !$this->can_edit( $field ) ) {
1003
unset($cols[$key]);
1004
unset($data[$name]);
wpf-includes/class-forums.php CHANGED
@@ -876,7 +876,9 @@ class wpForoForum{
876
*
877
* @return int layout id
878
*/
879
- function get_layout($args){
880
if(is_array($args)){
881
$default = array(
882
'forumid' => NULL, // forum id
@@ -908,7 +910,8 @@ class wpForoForum{
908
return $this->get_layout(array( 'forumid' => $forumid ));
909
}
910
}
911
-
912
}
913
914
function get_forum_url($forum){
876
*
877
* @return int layout id
878
*/
879
+ function get_layout($args = NULL){
880
+ if(is_null($args)) $args = WPF()->current_object['forumid'];
881
+ if(!$args) return false;
882
if(is_array($args)){
883
$default = array(
884
'forumid' => NULL, // forum id
910
return $this->get_layout(array( 'forumid' => $forumid ));
911
}
912
}
913
+
914
+ return false;
915
}
916
917
function get_forum_url($forum){
wpf-includes/class-members.php CHANGED
@@ -620,6 +620,8 @@ class wpForoMember{
620
return $user;
621
}
622
}
623
}
624
625
public function update_user_fields( $userid, $data, $check_permissions = true ){
@@ -688,6 +690,9 @@ class wpForoMember{
688
WPF()->perm->can_edit_user( $userid );
689
}
690
691
//Profile Fields
692
if( wpfkey($data, 'last_login') ){
693
$profile_fields['last_login'] = $data['last_login'];
@@ -1022,13 +1027,17 @@ class wpForoMember{
1022
'last_login' => sanitize_text_field($user->user_registered) ) );
1023
}
1024
1025
- public function synchronize_users(){
1026
1027
if( is_multisite() ){
1028
- $sql = "SELECT `user_id` FROM `".WPF()->db->usermeta."` WHERE `meta_key` LIKE '".WPF()->blog_prefix."capabilities' AND `user_id` NOT IN( SELECT `userid` FROM `".WPF()->tables->profiles."` )";
1029
} else {
1030
- $sql = "SELECT `ID` as user_id FROM `".WPF()->db->users."` WHERE `ID` NOT IN( SELECT `userid` FROM `".WPF()->tables->profiles."` )";
1031
}
1032
$userids = WPF()->db->get_col($sql);
1033
if( !empty($userids) ){
1034
$roles_usergroups = WPF()->usergroup->get_role_usergroup_relation();
@@ -1755,6 +1764,12 @@ class wpForoMember{
1755
public function init_current_user(){
1756
WPF()->wp_current_user = $current_user = wp_get_current_user();
1757
if( $current_user->exists() ){
1758
$user = $this->get_member( $current_user->ID );
1759
$user_meta = get_user_meta( $current_user->ID );
1760
$status = ( isset($user['status']) ? $user['status'] : '' );
@@ -1764,10 +1779,6 @@ class wpForoMember{
1764
WPF()->current_usermeta = $user_meta;
1765
WPF()->current_user_groupid = WPF()->current_user['groupid'];
1766
WPF()->current_user_secondary_groupids = ( wpfkey(WPF()->current_user, 'secondary_groups') ) ? WPF()->current_user['secondary_groups'] : '';
1767
- WPF()->current_userid = $current_user->ID;
1768
- WPF()->current_username = $current_user->user_login;
1769
- WPF()->current_user_email = $current_user->user_email;
1770
- WPF()->current_user_display_name = $current_user->display_name;
1771
$this->update_online_time();
1772
}
1773
WPF()->current_user_status = $status;
@@ -2864,7 +2875,12 @@ class wpForoMember{
2864
2865
public function set_usergroup($userid, $groupid){
2866
if($userid && $groupid){
2867
- WPF()->db->query( "UPDATE `" . WPF()->tables->profiles . "` SET `groupid` = " . intval($groupid) . " WHERE `userid` = " . wpforo_bigintval($userid) );
2868
$this->reset($userid);
2869
}
2870
}
620
return $user;
621
}
622
}
623
+
624
+ return false;
625
}
626
627
public function update_user_fields( $userid, $data, $check_permissions = true ){
690
WPF()->perm->can_edit_user( $userid );
691
}
692
693
+ $profile_fields = array();
694
+ $profile_fields_types = array();
695
+
696
//Profile Fields
697
if( wpfkey($data, 'last_login') ){
698
$profile_fields['last_login'] = $data['last_login'];
1027
'last_login' => sanitize_text_field($user->user_registered) ) );
1028
}
1029
1030
+ public function synchronize_users($limit = NULL){
1031
1032
if( is_multisite() ){
1033
+ $sql = "SELECT `user_id` FROM `".WPF()->db->usermeta."` WHERE `meta_key` LIKE '".WPF()->blog_prefix."capabilities' AND `user_id` NOT IN( SELECT `userid` FROM `".WPF()->tables->profiles."` ) ORDER BY `user_id` ASC";
1034
} else {
1035
+ $sql = "SELECT `ID` as user_id FROM `".WPF()->db->users."` WHERE `ID` NOT IN( SELECT `userid` FROM `".WPF()->tables->profiles."` ) ORDER BY `ID` ASC";
1036
}
1037
+ if( !is_null($limit) ){
1038
+ $sql .= " LIMIT " . intval($limit);
1039
+ }
1040
+
1041
$userids = WPF()->db->get_col($sql);
1042
if( !empty($userids) ){
1043
$roles_usergroups = WPF()->usergroup->get_role_usergroup_relation();
1764
public function init_current_user(){
1765
WPF()->wp_current_user = $current_user = wp_get_current_user();
1766
if( $current_user->exists() ){
1767
+
1768
+ WPF()->current_userid = $current_user->ID;
1769
+ WPF()->current_username = $current_user->user_login;
1770
+ WPF()->current_user_email = $current_user->user_email;
1771
+ WPF()->current_user_display_name = $current_user->display_name;
1772
+
1773
$user = $this->get_member( $current_user->ID );
1774
$user_meta = get_user_meta( $current_user->ID );
1775
$status = ( isset($user['status']) ? $user['status'] : '' );
1779
WPF()->current_usermeta = $user_meta;
1780
WPF()->current_user_groupid = WPF()->current_user['groupid'];
1781
WPF()->current_user_secondary_groupids = ( wpfkey(WPF()->current_user, 'secondary_groups') ) ? WPF()->current_user['secondary_groups'] : '';
1782
$this->update_online_time();
1783
}
1784
WPF()->current_user_status = $status;
2875
2876
public function set_usergroup($userid, $groupid){
2877
if($userid && $groupid){
2878
+ if( !$current_groupid = WPF()->db->get_var("SELECT `groupid` FROM ". WPF()->tables->profiles ." WHERE `userid` = " . wpforo_bigintval($userid)) ){
2879
+ $this->synchronize_user($userid);
2880
+ }
2881
+ if( $current_groupid != $groupid ){
2882
+ WPF()->db->query( "UPDATE `" . WPF()->tables->profiles . "` SET `groupid` = " . intval($groupid) . " WHERE `userid` = " . wpforo_bigintval($userid) );
2883
+ }
2884
$this->reset($userid);
2885
}
2886
}
wpf-includes/class-moderation.php CHANGED
@@ -16,12 +16,6 @@ class wpForoModeration
16
add_filter('wpforo_add_post_data_filter', array(&$this, 'auto_moderate'));
17
}
18
else{
19
- if( !WPF()->perm->can_link() ){
20
- add_filter('wpforo_add_topic_data_filter', array(&$this, 'remove_links'), 7);
21
- add_filter('wpforo_edit_topic_data_filter', array(&$this, 'remove_links'), 7);
22
- add_filter('wpforo_add_post_data_filter', array(&$this, 'remove_links'), 7);
23
- add_filter('wpforo_edit_post_data_filter', array(&$this, 'remove_links'), 7);
24
- }
25
if( WPF()->member->current_user_is_new() ){
26
if (class_exists('Akismet')) {
27
add_filter('wpforo_add_topic_data_filter', array(&$this, 'akismet_topic'), 8);
@@ -42,7 +36,13 @@ class wpForoModeration
42
add_filter('wpforo_add_topic_data_filter', array(&$this, 'auto_moderate'), 10);
43
add_filter('wpforo_add_post_data_filter', array(&$this, 'auto_moderate'), 10);
44
}
45
- }
46
}
47
48
public function get_post_status_dname($status)
@@ -266,8 +266,7 @@ class wpForoModeration
266
else{
267
return $post;
268
}
269
-
270
- // $len = wpforo_strlen($item);
271
$item = strip_tags($item);
272
$is_similar = false;
273
$post_args = array( 'userid' => $post['userid'] );
@@ -364,21 +363,53 @@ class wpForoModeration
364
}
365
366
public function remove_links( $item ){
367
- if( isset($item['body']) && $item['body'] ){
368
- $item['body'] = preg_replace('/((http|https)\:\/\/)?[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z0-9\&\.\/\?\:@\-_=#])*/is', ' <span style="color:#aaa;">' . wpforo_phrase('removed link', false, false) . '</span> ', $item['body']);
369
- }
370
- if( isset($item['title']) && $item['title'] ){
371
- if(preg_match('/((http|https)\:\/\/)?[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z0-9\&\.\/\?\:@\-_=#])*/is', $item['title'] )){
372
- $item['title'] = preg_replace('/((http|https)\:\/\/)?[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z0-9\&\.\/\?\:@\-_=#])*/is', ' -' . wpforo_phrase('removed link', false, false) . '- ', $item['title']);
373
- }
374
}
375
return $item;
376
}
377
378
public function has_link( $content ){
379
- if( preg_match('/((http|https)\:\/\/)?[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z0-9\&\.\/\?\:@\-_=#])*/is', $content ) ){
380
- return true;
381
- }
382
return false;
383
}
384
16
add_filter('wpforo_add_post_data_filter', array(&$this, 'auto_moderate'));
17
}
18
else{
19
if( WPF()->member->current_user_is_new() ){
20
if (class_exists('Akismet')) {
21
add_filter('wpforo_add_topic_data_filter', array(&$this, 'akismet_topic'), 8);
36
add_filter('wpforo_add_topic_data_filter', array(&$this, 'auto_moderate'), 10);
37
add_filter('wpforo_add_post_data_filter', array(&$this, 'auto_moderate'), 10);
38
}
39
+ if( !WPF()->perm->can_link() ){
40
+ add_filter('wpforo_add_topic_data_filter', array(&$this, 'remove_links'), 20);
41
+ add_filter('wpforo_edit_topic_data_filter', array(&$this, 'remove_links'), 20);
42
+ add_filter('wpforo_add_post_data_filter', array(&$this, 'remove_links'), 20);
43
+ add_filter('wpforo_edit_post_data_filter', array(&$this, 'remove_links'), 20);
44
+ }
45
+ }
46
}
47
48
public function get_post_status_dname($status)
266
else{
267
return $post;
268
}
269
+
270
$item = strip_tags($item);
271
$is_similar = false;
272
$post_args = array( 'userid' => $post['userid'] );
363
}
364
365
public function remove_links( $item ){
366
+ if( wpfval($item, 'body') ){
367
+ $domain = wpforo_get_request_uri();
368
+ $urls = wp_extract_urls( $item['body'] );
369
+ if( !empty($urls) ){
370
+ foreach( $urls as $k => $url ){
371
+ $url = parse_url( $url );
372
+ if( wpfval($url, 'host') ){
373
+ if( strpos( $domain, $url['host'] ) !== FALSE ) unset($urls[$k]);
374
+ }
375
+ }
376
+ if( !empty($urls) ){
377
+ $item['body'] = str_replace($urls, ' <span style="color:#aaa;">' . wpforo_phrase('removed link', false, false) . '</span> ', $item['body']);
378
+ }
379
+ }
380
}
381
+ if( wpfval($item, 'title') ){
382
+ $domain = wpforo_get_request_uri();
383
+ $urls = wp_extract_urls( $item['title'] );
384
+ if( !empty($urls) ){
385
+ foreach( $urls as $k => $url ){
386
+ $url = parse_url( $url );
387
+ if( wpfval($url, 'host') ){
388
+ if( strpos( $domain, $url['host'] ) !== FALSE ) unset($urls[$k]);
389
+ }
390
+ }
391
+ if( !empty($urls) ){
392
+ $item['title'] = str_replace($urls, ' -' . wpforo_phrase('removed link', false, false) . '- ', $item['title']);
393
+ }
394
+ }
395
+ }
396
return $item;
397
}
398
399
public function has_link( $content ){
400
+ $domain = wpforo_get_request_uri();
401
+ $urls = wp_extract_urls( $content );
402
+ if( !empty($urls) ){
403
+ foreach( $urls as $k => $url ){
404
+ $url = parse_url( $url );
405
+ if( wpfval($url, 'host') ){
406
+ if( strpos( $domain, $url['host'] ) !== FALSE ) unset($urls[$k]);
407
+ }
408
+ }
409
+ }
410
+ if( !empty($urls) ){
411
+ return true;
412
+ }
413
return false;
414
}
415
wpf-includes/class-permissions.php CHANGED
@@ -347,7 +347,7 @@ class wpForoPermissions{
347
$posts = intval($posts);
348
if( isset(WPF()->tools_antispam['min_number_post_to_link']) ){
349
$min_posts = intval(WPF()->tools_antispam['min_number_post_to_link']);
350
- if( $min_posts != 0 ){
351
if ( $posts <= $min_posts ) {
352
return false;
353
}
@@ -358,7 +358,8 @@ class wpForoPermissions{
358
}
359
360
public function can_attach(){
361
- if( !WPF()->perm->usergroup_can( 'em' ) ){
362
$posts = WPF()->member->member_approved_posts( WPF()->current_userid );
363
$posts = intval($posts);
364
if( isset(WPF()->tools_antispam['min_number_post_to_attach']) ){
@@ -374,7 +375,7 @@ class wpForoPermissions{
374
}
375
376
public function can_attach_file_type( $ext = '' ){
377
- if( !WPF()->perm->usergroup_can( 'em' ) ){
378
if( isset(WPF()->tools_antispam['limited_file_ext']) && WPF()->member->current_user_is_new() ){
379
$expld = explode('|', WPF()->tools_antispam['limited_file_ext'] );
380
if( in_array($ext, $expld) ){
347
$posts = intval($posts);
348
if( isset(WPF()->tools_antispam['min_number_post_to_link']) ){
349
$min_posts = intval(WPF()->tools_antispam['min_number_post_to_link']);
350
+ if( $min_posts !== 0 ){
351
if ( $posts <= $min_posts ) {
352
return false;
353
}
358
}
359
360
public function can_attach(){
361
+ if( !$this->forum_can('a') ) return false;
362
+ if( !$this->usergroup_can( 'em' ) ){
363
$posts = WPF()->member->member_approved_posts( WPF()->current_userid );
364
$posts = intval($posts);
365
if( isset(WPF()->tools_antispam['min_number_post_to_attach']) ){
375
}
376
377
public function can_attach_file_type( $ext = '' ){
378
+ if( !$this->usergroup_can( 'em' ) ){
379
if( isset(WPF()->tools_antispam['limited_file_ext']) && WPF()->member->current_user_is_new() ){
380
$expld = explode('|', WPF()->tools_antispam['limited_file_ext'] );
381
if( in_array($ext, $expld) ){
wpf-includes/class-posts.php CHANGED
@@ -325,14 +325,7 @@ class wpForoPost{
325
$this->delete_attachments( $postid );
326
327
//Delete post
328
- if( WPF()->db->delete(WPF()->tables->posts, array( 'postid' => intval($postid) ), array( '%d' )) ){
329
- $last_post = $this->get_posts( array('topicid' => intval($post['topicid']), 'orderby' => '`created` DESC, `postid` DESC', 'row_count' => 1, 'status' => 0, 'private' => 0) );
330
- if(is_array($last_post) && !empty($last_post)){
331
- $last_post = $last_post[0];
332
- }else{
333
- $last_post = array( 'modified' => '0000-00-00 00:00:00', 'created' => '0000-00-00 00:00:00', 'userid' => 0, 'postid' => 0 );
334
- }
335
-
336
WPF()->db->delete(
337
WPF()->tables->likes, array( 'postid' => $postid ), array( '%d' )
338
);
@@ -342,8 +335,8 @@ class wpForoPost{
342
343
$answ_incr = '';
344
$comm_incr = '';
345
- $forum = WPF()->forum->get_forum($post['forumid']);
346
- if( isset($forum['cat_layout']) && $forum['cat_layout'] == 3 ){
347
if($post['parentid']){
348
$comm_incr = ', `comments` = IF( (`comments` - 1) < 0, 0, `comments` - 1 ) ';
349
}else{
@@ -351,15 +344,17 @@ class wpForoPost{
351
}
352
}
353
354
- if(WPF()->db->query( "UPDATE IGNORE ".WPF()->tables->topics." SET `modified` = '" . esc_sql($last_post['modified']) . "', `last_post` = " . intval($last_post['postid']) . ", `posts` = IF( (`posts` - 1) < 0, 0, `posts` - 1 ) $answ_incr WHERE `topicid` = " . intval( $post['topicid'] ))){
355
- if( WPF()->db->query( "UPDATE IGNORE `".WPF()->tables->forums."` SET `last_post_date` = '" . esc_sql($last_post['created']) . "', `last_userid` = " . intval($last_post['userid']) . ", `last_postid` = " . intval($last_post['postid']) . ", `posts` = IF( (`posts` - 1) < 0, 0, `posts` - 1 ) WHERE `forumid` = " . intval( $post['forumid'] ))){
356
- if( WPF()->db->query( "UPDATE IGNORE `".WPF()->tables->profiles."` SET `posts` = IF( (`posts` - 1) < 0, 0, `posts` - 1 ) $answ_incr $comm_incr WHERE `userid` = " . intval($post['userid']) ) ){
357
- WPF()->member->reset($post['userid']);
358
- WPF()->notice->add('This post successfully deleted', 'success');
359
- }
360
- }
361
}
362
-
363
do_action('wpforo_after_delete_post', $post);
364
365
if( $post['is_first_post'] ) return WPF()->topic->delete($post['topicid']);
325
$this->delete_attachments( $postid );
326
327
//Delete post
328
+ if( WPF()->db->delete(WPF()->tables->posts, array( 'postid' => $postid ), array( '%d' )) ){
329
WPF()->db->delete(
330
WPF()->tables->likes, array( 'postid' => $postid ), array( '%d' )
331
);
335
336
$answ_incr = '';
337
$comm_incr = '';
338
+ $layout = WPF()->forum->get_layout($post['forumid']);
339
+ if($layout == 3){
340
if($post['parentid']){
341
$comm_incr = ', `comments` = IF( (`comments` - 1) < 0, 0, `comments` - 1 ) ';
342
}else{
344
}
345
}
346
347
+ WPF()->topic->rebuild_first_last($post['topicid']);
348
+ WPF()->topic->rebuild_stats($post['topicid']);
349
+ WPF()->forum->rebuild_last_infos($post['forumid']);
350
+ WPF()->forum->rebuild_stats($post['forumid']);
351
+
352
+ if( false !== WPF()->db->query( "UPDATE IGNORE `".WPF()->tables->profiles."` SET `posts` = IF( (`posts` - 1) < 0, 0, `posts` - 1 ) $answ_incr $comm_incr WHERE `userid` = " . intval($post['userid']) ) ){
353
+ WPF()->member->reset($post['userid']);
354
}
355
+
356
+ WPF()->notice->add('This post successfully deleted', 'success');
357
+
358
do_action('wpforo_after_delete_post', $post);
359
360
if( $post['is_first_post'] ) return WPF()->topic->delete($post['topicid']);
wpf-includes/class-template.php CHANGED
@@ -29,6 +29,9 @@ class wpForoTemplate{
29
add_filter("tiny_mce_plugins", array($this, 'filter_tinymce_plugins'), 15);
30
add_filter("wp_mce_translation", array($this, 'add_tinymce_translations'));
31
32
add_action('wp_footer', array($this, 'add_footer_html'), 999999, 0);
33
34
//ajax actions hooks
@@ -98,6 +101,17 @@ class wpForoTemplate{
98
$mce_translation['Open link in a new tab'] = __( 'Open link in a new tab' );
99
return $mce_translation;
100
}
101
102
function topic_form($forumid){
103
if(!isset(WPF()->post->options['max_upload_size']) || !WPF()->post->options['max_upload_size']){ $server_mus = wpforo_human_size_to_bytes(ini_get('upload_max_filesize')); if( !$server_mus || $server_mus > 10485760 ) $server_mus = 10485760; WPF()->post->options['max_upload_size'] = $server_mus;}
@@ -123,7 +137,7 @@ class wpForoTemplate{
123
</div>
124
<?php endif; ?>
125
126
- <label style="padding-left:8px;"> <?php wpforo_phrase('Topic Title') ?> * </label>
127
<input id="wpf_title" class="wpf-subject" type="text" name="topic[title]" autocomplete="off" required autofocus placeholder="<?php esc_attr( wpforo_phrase('Enter title here') ) ?>">
128
<?php
129
$content = '';
@@ -167,29 +181,20 @@ class wpForoTemplate{
167
<?php endif; ?>
168
<?php do_action('wpforo_topic_form_buttons_hook'); ?>&nbsp;&nbsp;
169
</div>
170
- <?php if( WPF()->perm->can_attach() ): ?>
171
- <?php if(!defined('WPFOROATTACH_BASENAME') && WPF()->perm->forum_can('a', $forumid)): ?>
172
- <div class="wpf-default-attachment" style="padding-top:5px;">
173
- <label for="wpf_file"><?php wpforo_phrase('Attach file:') ?> </label> <input id="wpf_file" type="file" name="attachfile" />
174
- <p><?php wpforo_phrase('Maximum allowed file size is'); echo ' ' . wpforo_print_size(WPF()->post->options['max_upload_size']); ?></p>
175
- <div class="wpf-clear"></div>
176
- </div>
177
- <?php endif; ?>
178
- <?php endif; ?>
179
<?php do_action('wpforo_topic_form_extra_fields_after') ?>
180
</div>
181
<?php if( WPF()->post->options['tags'] && WPF()->perm->forum_can('tag', $forumid) ) : ?>
182
<div class="wpf-topic-tags">
183
- <p class="wpf-topic-tags-label"><i class="fas fa-tag"></i> <?php wpforo_phrase('Topic Tags') ?> <span>(<?php wpforo_phrase('Separate tags using a comma') ?>)</span></p>
184
<input id="wpf_tags" placeholder="<?php echo sprintf(wpforo_phrase('Start typing tags here (maximum %d tags are allowed)...', false), WPF()->post->options['max_tags']) ?>" name="topic[tags]" autocomplete="off" value="" type="text">
185
<style type="text/css">#wpforo-wrap .wpf-ac-loading {background-image: url('<?php echo WPFORO_URL ?>/wpf-assets/images/ajax_loading.gif');background-repeat: no-repeat;background-position: right center;visibility: visible;} </style>
186
</div>
187
<?php endif; ?>
188
<?php if( wpforo_feature('subscribe_checkbox_on_post_editor') && WPF()->perm->forum_can('sb', $forumid) ) : ?>
189
- <div class="wpf-topic-sbs"><input id="wpf-topic-sbs" type="checkbox" name="wpforo_topic_subs" value="1" <?php echo ( wpforo_feature('subscribe_checkbox_default_status') ) ? 'checked="true" ' : ''; ?>/>&nbsp;<label for="wpf-topic-sbs"><?php wpforo_phrase('Subscribe to this topic') ?></label></div>
190
<?php endif; ?>
191
<?php do_action('wpforo_editor_topic_submit_before', $forumid) ?>
192
- <input id="wpf_formbutton" type="submit" name="topic[save]" class="button button-primary forum_submit" value="<?php wpforo_phrase('Add Topic') ?>">
193
<?php do_action('wpforo_editor_topic_submit_after', $forumid) ?>
194
<div class="wpf-clear"></div>
195
</form>
@@ -294,16 +299,7 @@ class wpForoTemplate{
294
?>
295
<div class="wpf-extra-fields">
296
<?php do_action('wpforo_reply_form_extra_fields_before') ?>
297
- <?php do_action('wpforo_reply_form_buttons_hook'); ?>&nbsp;&nbsp;
298
- <?php if( WPF()->perm->can_attach() ): ?>
299
- <?php if(!defined('WPFOROATTACH_BASENAME') && WPF()->perm->forum_can('a', $forumid)): ?>
300
- <div class="wpf-default-attachment">
301
- <label for="wpf_file"><?php wpforo_phrase('Attach file:') ?> </label> <input id="wpf_file" type="file" name="attachfile" />
302
- <p><?php wpforo_phrase('Maximum allowed file size is'); echo ' ' . wpforo_print_size(WPF()->post->options['max_upload_size']); ?></p>
303
- <div class="wpf-clear"></div>
304
- </div>
305
- <?php endif; ?>
306
- <?php endif; ?>
307
<?php do_action('wpforo_reply_form_extra_fields_after') ?>
308
</div>
309
<?php if( WPF()->post->options['tags'] && WPF()->perm->forum_can('tag', $forumid) ) : ?>
@@ -317,11 +313,11 @@ class wpForoTemplate{
317
$args = array( "userid" => WPF()->current_userid , "itemid" => intval($topicid), "type" => "topic" );
318
$subscribe = WPF()->sbscrb->get_subscribe( $args );
319
if( !isset($subscribe['subid']) ) : ?>
320
- <div class="wpf-topic-sbs"><input id="wpf-topic-sbs" type="checkbox" name="wpforo_topic_subs" value="1" <?php echo ( wpforo_feature('subscribe_checkbox_default_status') ) ? 'checked="true" ' : ''; ?> />&nbsp;<label for="wpf-topic-sbs"><?php wpforo_phrase('Subscribe to this topic') ?></label></div>
321
<?php endif;
322
endif; ?>
323
<?php do_action('wpforo_editor_post_submit_before', $args) ?>
324
- <input id="wpf_formbutton" type="submit" name="post[save]" class="button button-primary forum_submit" value="<?php wpforo_phrase('Add Reply') ?>">
325
<?php do_action('wpforo_editor_post_submit_after', $args) ?>
326
<div class="wpf-clear"></div>
327
</form>
@@ -656,19 +652,19 @@ class wpForoTemplate{
656
case 'answer':
657
if( WPF()->perm->forum_can('cr', $forumid) ){
658
if( WPF()->topic->can_answer($topicid) ){
659
- $button_html[] = '<span class="wpforo-answer wpf-button"><i class="fas fa-pencil-alt"></i> ' . wpforo_phrase('Answer', false).'</span>';
660
}
661
} else {
662
- $button_html[] = '<span class="wpf-button not_reg_user"><i class="fas fa-pencil-alt"></i> ' . wpforo_phrase('Answer', false).'</span>';
663
}
664
break;
665
case 'comment':
666
if($is_closed) break;
667
$title = wpforo_phrase('Use comments to ask for more information or suggest improvements. Avoid answering questions in comments.', false);
668
if( WPF()->perm->forum_can('cr', $forumid) ) {
669
- $button_html[] = '<span id="parentpostid'.intval($postid).'" class="wpforo-childreply wpf-button" title="'.esc_attr($title).'"><i class="fas fa-comment"></i> ' . wpforo_phrase('Add a comment', false).'</span>';
670
}else{
671
- $button_html[] = '<span class="not_reg_user wpf-button" title="'.esc_attr($title).'"><i class="fas fa-comment"></i> ' . wpforo_phrase('Add a comment', false).'</span>';
672
}
673
break;
674
case 'quote':
29
add_filter("tiny_mce_plugins", array($this, 'filter_tinymce_plugins'), 15);
30
add_filter("wp_mce_translation", array($this, 'add_tinymce_translations'));
31
32
+ add_action('wpforo_topic_form_extra_fields_after', array($this, 'add_default_attach_input'));
33
+ add_action('wpforo_reply_form_extra_fields_after', array($this, 'add_default_attach_input'));
34
+
35
add_action('wp_footer', array($this, 'add_footer_html'), 999999, 0);
36
37
//ajax actions hooks
101
$mce_translation['Open link in a new tab'] = __( 'Open link in a new tab' );
102
return $mce_translation;
103
}
104
+
105
+ public function add_default_attach_input(){
106
+ if( WPF()->perm->can_attach() ){ ?>
107
+ <div class="wpf-default-attachment">
108
+ <label for="wpf_file"><?php wpforo_phrase('Attach file:') ?> </label> <input id="wpf_file" type="file" name="attachfile" />
109
+ <p><?php wpforo_phrase('Maximum allowed file size is'); echo ' ' . wpforo_print_size(WPF()->post->options['max_upload_size']); ?></p>
110
+ <div class="wpf-clear"></div>
111
+ </div>
112
+ <?php
113
+ }
114
+ }
115
116
function topic_form($forumid){
117
if(!isset(WPF()->post->options['max_upload_size']) || !WPF()->post->options['max_upload_size']){ $server_mus = wpforo_human_size_to_bytes(ini_get('upload_max_filesize')); if( !$server_mus || $server_mus > 10485760 ) $server_mus = 10485760; WPF()->post->options['max_upload_size'] = $server_mus;}
137
</div>
138
<?php endif; ?>
139
140
+ <label style="padding-left:8px;"> <?php wpforo_phrase(( WPF()->forum->get_layout() == 3 ? 'Your question' : 'Topic Title' )) ?> * </label>
141
<input id="wpf_title" class="wpf-subject" type="text" name="topic[title]" autocomplete="off" required autofocus placeholder="<?php esc_attr( wpforo_phrase('Enter title here') ) ?>">
142
<?php
143
$content = '';
181
<?php endif; ?>
182
<?php do_action('wpforo_topic_form_buttons_hook'); ?>&nbsp;&nbsp;
183
</div>
184
<?php do_action('wpforo_topic_form_extra_fields_after') ?>
185
</div>
186
<?php if( WPF()->post->options['tags'] && WPF()->perm->forum_can('tag', $forumid) ) : ?>
187
<div class="wpf-topic-tags">
188
+ <p class="wpf-topic-tags-label"><i class="fas fa-tag"></i> <?php wpforo_phrase(( WPF()->forum->get_layout() == 3 ? 'Question Tags' : 'Topic Tags' )) ?> <span>(<?php wpforo_phrase('Separate tags using a comma') ?>)</span></p>
189
<input id="wpf_tags" placeholder="<?php echo sprintf(wpforo_phrase('Start typing tags here (maximum %d tags are allowed)...', false), WPF()->post->options['max_tags']) ?>" name="topic[tags]" autocomplete="off" value="" type="text">
190
<style type="text/css">#wpforo-wrap .wpf-ac-loading {background-image: url('<?php echo WPFORO_URL ?>/wpf-assets/images/ajax_loading.gif');background-repeat: no-repeat;background-position: right center;visibility: visible;} </style>
191
</div>
192
<?php endif; ?>
193
<?php if( wpforo_feature('subscribe_checkbox_on_post_editor') && WPF()->perm->forum_can('sb', $forumid) ) : ?>
194
+ <div class="wpf-topic-sbs"><input id="wpf-topic-sbs" type="checkbox" name="wpforo_topic_subs" value="1" <?php echo ( wpforo_feature('subscribe_checkbox_default_status') ) ? 'checked="true" ' : ''; ?>/>&nbsp;<label for="wpf-topic-sbs"><?php wpforo_phrase(( WPF()->forum->get_layout() == 3 ? 'Subscribe to this question' : 'Subscribe to this topic' ) ) ?></label></div>
195
<?php endif; ?>
196
<?php do_action('wpforo_editor_topic_submit_before', $forumid) ?>
197
+ <input id="wpf_formbutton" type="submit" name="topic[save]" class="button button-primary forum_submit" value="<?php wpforo_phrase(( WPF()->forum->get_layout() == 3 ? 'Ask a question' : 'Add topic' )) ?>">
198
<?php do_action('wpforo_editor_topic_submit_after', $forumid) ?>
199
<div class="wpf-clear"></div>
200
</form>
299
?>
300
<div class="wpf-extra-fields">
301
<?php do_action('wpforo_reply_form_extra_fields_before') ?>
302
+ <?php do_action('wpforo_reply_form_buttons_hook'); ?>&nbsp;&nbsp;
303
<?php do_action('wpforo_reply_form_extra_fields_after') ?>
304
</div>
305
<?php if( WPF()->post->options['tags'] && WPF()->perm->forum_can('tag', $forumid) ) : ?>
313
$args = array( "userid" => WPF()->current_userid , "itemid" => intval($topicid), "type" => "topic" );
314
$subscribe = WPF()->sbscrb->get_subscribe( $args );
315
if( !isset($subscribe['subid']) ) : ?>
316
+ <div class="wpf-topic-sbs"><input id="wpf-topic-sbs" type="checkbox" name="wpforo_topic_subs" value="1" <?php echo ( wpforo_feature('subscribe_checkbox_default_status') ) ? 'checked="true" ' : ''; ?> />&nbsp;<label for="wpf-topic-sbs"><?php wpforo_phrase(( WPF()->forum->get_layout() == 3 ? 'Subscribe to this question' : 'Subscribe to this topic' ) ) ?></label></div>
317
<?php endif;
318
endif; ?>
319
<?php do_action('wpforo_editor_post_submit_before', $args) ?>
320
+ <input id="wpf_formbutton" type="submit" name="post[save]" class="button button-primary forum_submit" value="<?php wpforo_phrase(( WPF()->forum->get_layout() == 3 ? 'Answer' : 'Add Reply' ) ) ?>">
321
<?php do_action('wpforo_editor_post_submit_after', $args) ?>
322
<div class="wpf-clear"></div>
323
</form>
652
case 'answer':
653
if( WPF()->perm->forum_can('cr', $forumid) ){
654
if( WPF()->topic->can_answer($topicid) ){
655
+ $button_html[] = '<span class="wpforo-answer wpf-button" data-phrase="' . esc_attr( wpforo_phrase('Answer', false) ).'"><i class="fas fa-pencil-alt"></i> ' . wpforo_phrase('Answer', false).'</span>';
656
}
657
} else {
658
+ $button_html[] = '<span class="wpf-button not_reg_user" data-phrase="' . esc_attr( wpforo_phrase('Answer', false) ).'"><i class="fas fa-pencil-alt"></i> ' . wpforo_phrase('Answer', false).'</span>';
659
}
660
break;
661
case 'comment':
662
if($is_closed) break;
663
$title = wpforo_phrase('Use comments to ask for more information or suggest improvements. Avoid answering questions in comments.', false);
664
if( WPF()->perm->forum_can('cr', $forumid) ) {
665
+ $button_html[] = '<span id="parentpostid'.intval($postid).'" class="wpforo-childreply wpf-button" title="'.esc_attr($title).'" data-phrase="' . esc_attr( wpforo_phrase('Add a comment', false) ) . '"><i class="fas fa-comment"></i> ' . wpforo_phrase('Add a comment', false).'</span>';
666
}else{
667
+ $button_html[] = '<span class="not_reg_user wpf-button" title="'.esc_attr($title).'" data-phrase="' . esc_attr( wpforo_phrase('Add a comment', false) ).'"><i class="fas fa-comment"></i> ' . wpforo_phrase('Add a comment', false).'</span>';
668
}
669
break;
670
case 'quote':
wpf-includes/class-topics.php CHANGED
@@ -425,8 +425,8 @@ class wpForoTopic{
425
if( $forumid = $topic['forumid'] ){
426
427
$questions = '';
428
- $forum = WPF()->forum->get_forum($forumid);
429
- if( isset($forum['cat_layout']) && $forum['cat_layout'] == 3 ){
430
$questions = ' `questions` = `questions` - 1 ';
431
$this->users_stats_incr_minus($topicid);
432
}
@@ -448,51 +448,26 @@ class wpForoTopic{
448
}
449
// END delete topic posts include first post
450
451
- if( WPF()->db->delete(WPF()->tables->topics, array('topicid' => $topicid)) ){
452
WPF()->db->delete(WPF()->tables->views, array( 'topicid' => $topicid ), array( '%d' ));
453
- $last_topic = $this->get_topics( array('forumid' => intval($forumid), 'orderby' => 'modified', 'order' => 'DESC', 'row_count' => 1, 'status' => 0, 'private' => 0) );
454
- if(is_array($last_topic) && !empty($last_topic)){
455
- $last_topic = $last_topic[0];
456
- if( isset($last_topic['last_post']) ) {
457
- $last_post = WPF()->post->get_post($last_topic['last_post']);
458
- if( is_array($last_post) && !empty($last_post) ){
459
- $last_topic['last_post_userid'] = $last_post['userid'];
460
- }
461
- else{
462
- $last_topic['last_post_userid'] = $last_topic['userid'];
463
- }
464
- }
465
- }else{
466
- $last_topic = array( 'topicid' => 0, 'last_post' => 0, 'last_post_userid' => 0, 'modified' => '0000-00-00 00:00:00');
467
- }
468
-
469
- if(WPF()->db->query(
470
- "UPDATE IGNORE ".WPF()->tables->forums."
471
- SET
472
- `last_topicid` = " . intval($last_topic['topicid']) . ",
473
- `last_postid` = " . intval($last_topic['last_post']) . ",
474
- `last_userid` = " . intval($last_topic['last_post_userid']) . ",
475
- `last_post_date` = '" . esc_sql($last_topic['modified']) . "',
476
- `topics` = IF( (`topics` - 1) < 0, 0, `topics` - 1 )
477
- WHERE `forumid` = " . intval($forumid)
478
- )
479
- ){
480
- if($questions) WPF()->db->query(
481
- "UPDATE IGNORE `".WPF()->tables->profiles."`
482
SET $questions
483
- WHERE `userid` = " . intval($topic['userid'])
484
- );
485
486
- do_action( 'wpforo_after_delete_topic', $topic );
487
488
- if( wpfval($topic, 'tags') ) $this->remove_tags( $topic['tags'] );
489
- if( $delete_cache ) wpforo_clean_cache('topic', $topicid, $topic);
490
- WPF()->member->reset($topic['userid']);
491
- WPF()->forum->rebuild_last_infos($forumid);
492
493
- WPF()->notice->add('This topic successfully deleted', 'success');
494
- return TRUE;
495
- }
496
}
497
}
498
425
if( $forumid = $topic['forumid'] ){
426
427
$questions = '';
428
+ $layout = WPF()->forum->get_layout($forumid);
429
+ if($layout == 3){
430
$questions = ' `questions` = `questions` - 1 ';
431
$this->users_stats_incr_minus($topicid);
432
}
448
}
449
// END delete topic posts include first post
450
451
+ if( WPF()->db->delete(WPF()->tables->topics, array( 'topicid' => $topicid ), array( '%d' )) ){
452
WPF()->db->delete(WPF()->tables->views, array( 'topicid' => $topicid ), array( '%d' ));
453
+
454
+ if($questions) WPF()->db->query(
455
+ "UPDATE IGNORE `".WPF()->tables->profiles."`
456
SET $questions
457
+ WHERE `userid` = " . intval($topic['userid'])
458
+ );
459
460
+ do_action( 'wpforo_after_delete_topic', $topic );
461
462
+ if( wpfval($topic, 'tags') ) $this->remove_tags( $topic['tags'] );
463
+ if( $delete_cache ) wpforo_clean_cache('topic', $topicid, $topic);
464
+ WPF()->member->reset($topic['userid']);
465
466
+ WPF()->forum->rebuild_stats($forumid);
467
+ WPF()->forum->rebuild_last_infos($forumid);
468
+
469
+ WPF()->notice->add('This topic successfully deleted', 'success');
470
+ return TRUE;
471
}
472
}
473
wpf-includes/functions-installation.php CHANGED
@@ -45,8 +45,7 @@ function wpforo_activation(){
45
@WPF()->db->query( preg_replace('#)[\r\n\t\s]*ENGINE.*$#isu', ')', $sql) );
46
}
47
48
- $users = WPF()->db->get_var("SELECT COUNT(*) FROM `".WPF()->db->users."`");
49
- if( $users <= 100 ) WPF()->member->synchronize_users();
50
WPF()->member->init_current_user();
51
52
add_option( 'wpforo_count_per_page', 10 );
45
@WPF()->db->query( preg_replace('#)[\r\n\t\s]*ENGINE.*$#isu', ')', $sql) );
46
}
47
48
+ WPF()->member->synchronize_users(100);
49
WPF()->member->init_current_user();
50
51
add_option( 'wpforo_count_per_page', 10 );
wpf-includes/functions-template.php CHANGED
@@ -1869,7 +1869,8 @@ function wpforo_tags( $topic, $wrap = true, $type = 'medium', $count = false ){
1869
<div class="<?php if( $type != 'text' ) echo 'wpf-tags' ; ?> wpf-tags-<?php echo esc_attr($type) ?>">
1870
<?php if($type == 'text'): ?><i class="fas fa-tag"></i> <?php wpforo_phrase('Topic Tags'); ?>:&nbsp; <?php endif; ?>
1871
<?php foreach( $tags as $tag ): ?>
1872
- <tag><a href="<?php echo wpforo_home_url() . '?wpfin=tag&wpfs=' . $tag ?>"><?php echo esc_html($tag); ?><?php if($count && wpfval($tag, 'count') && !$topic['status']) echo ' (' . wpforo_tag($tag, 'count') . ')'; ?></a></tag><?php if($type == 'text') echo '<sep>,</sep> '; ?>
1873
<?php endforeach; ?>
1874
</div>
1875
<div class="wpf-clear"></div>
@@ -1879,7 +1880,8 @@ function wpforo_tags( $topic, $wrap = true, $type = 'medium', $count = false ){
1879
?>
1880
<div class="<?php if( $type != 'text' ) echo 'wpf-tags'; ?> wpf-tags-<?php echo esc_attr($type) ?>">
1881
<?php foreach( $tags as $tag ): ?>
1882
- <tag><a href="<?php echo wpforo_home_url() . '?wpfin=tag&wpfs=' . $tag ?>"><?php echo esc_html($tag); ?><?php if($count && wpfval($tag, 'count') && !$topic['status']) echo ' (' . wpforo_tag($tag, 'count') . ')'; ?></a></tag>
1883
<?php endforeach; ?>
1884
</div>
1885
<?php
@@ -1914,7 +1916,7 @@ function wpforo_topic_rel( $topic ){
1914
$data = wpforo_topic($item['topicid']);
1915
$html .= '<li>' . wpforo_topic_icon( $item, 'all', true, false ) . '
1916
<a href="' . esc_url( $data['url'] ) . '" title="'.esc_attr($item['title']).'">' . esc_html($item['title']) . '</a>
1917
- <div class="wpf-rel-date">' . wpforo_date( $item['created'], 'ago', false ) . '</div>
1918
<div class="wpf-clear"></div>
1919
</li>';
1920
}
1869
<div class="<?php if( $type != 'text' ) echo 'wpf-tags' ; ?> wpf-tags-<?php echo esc_attr($type) ?>">
1870
<?php if($type == 'text'): ?><i class="fas fa-tag"></i> <?php wpforo_phrase('Topic Tags'); ?>:&nbsp; <?php endif; ?>
1871
<?php foreach( $tags as $tag ): ?>
1872
+ <?php $item = wpforo_tag($tag) ?>
1873
+ <tag><a href="<?php echo wpforo_home_url() . '?wpfin=tag&wpfs=' . $tag ?>"><?php echo esc_html($tag); ?><?php if($count && wpfval($item, 'count') && !$topic['status']) echo ' (' . $item['count'] . ')'; ?></a></tag><?php if($type == 'text') echo '<sep>,</sep> '; ?>
1874
<?php endforeach; ?>
1875
</div>
1876
<div class="wpf-clear"></div>
1880
?>
1881
<div class="<?php if( $type != 'text' ) echo 'wpf-tags'; ?> wpf-tags-<?php echo esc_attr($type) ?>">
1882
<?php foreach( $tags as $tag ): ?>
1883
+ <?php $item = wpforo_tag($tag) ?>
1884
+ <tag><a href="<?php echo wpforo_home_url() . '?wpfin=tag&wpfs=' . $tag ?>"><?php echo esc_html($tag); ?><?php if($count && wpfval($item, 'count') && !$topic['status']) echo ' (' . $item['count'] . ')'; ?></a></tag>
1885
<?php endforeach; ?>
1886
</div>
1887
<?php
1916
$data = wpforo_topic($item['topicid']);
1917
$html .= '<li>' . wpforo_topic_icon( $item, 'all', true, false ) . '
1918
<a href="' . esc_url( $data['url'] ) . '" title="'.esc_attr($item['title']).'">' . esc_html($item['title']) . '</a>
1919
+ <div class="wpf-rel-date">' . wpforo_date( $item['modified'], 'ago', false ) . '</div>
1920
<div class="wpf-clear"></div>
1921
</li>';
1922
}
wpf-includes/functions.php CHANGED
@@ -242,7 +242,14 @@ if(!function_exists('is_serialized')){
242
243
function wpforo_get_request_uri($with_port = FALSE, $get_referer_when_ajax = TRUE){
244
if( $get_referer_when_ajax && wpforo_is_ajax() ){
245
- if( isset($_SERVER['HTTP_REFERER']) ){ return $_SERVER['HTTP_REFERER']; }
246
}
247
$s = is_ssl() ? 's' : '';
248
$sp = strtolower($_SERVER["SERVER_PROTOCOL"]);
242
243
function wpforo_get_request_uri($with_port = FALSE, $get_referer_when_ajax = TRUE){
244
if( $get_referer_when_ajax && wpforo_is_ajax() ){
245
+ if( $referer = wpfval($_REQUEST, 'referer') ) {
246
+ $referer = preg_replace('#\#[^\/\?\&]*$#isu', '', $referer);
247
+ return esc_url_raw($referer);
248
+ }
249
+ if( isset($_SERVER['HTTP_REFERER']) ){
250
+ $url = preg_replace('#\#[^\/\?\&]*$#isu', '', $_SERVER['HTTP_REFERER']);
251
+ return esc_url_raw($url);
252
+ }
253
}
254
$s = is_ssl() ? 's' : '';
255
$sp = strtolower($_SERVER["SERVER_PROTOCOL"]);
wpf-includes/integration/ultimate-member.php CHANGED
@@ -406,7 +406,8 @@ if( class_exists('UM') ){
406
407
//Get author information
408
$author_id = $post['userid'];
409
- $topic_author_id = $topic['userid'];
410
um_fetch_user( $author_id );
411
412
// Hierarchical replies
406
407
//Get author information
408
$author_id = $post['userid'];
409
+ $topic_author_id = $topic['userid'];
410
+ $reply_to_item_author_id = 0;
411
um_fetch_user( $author_id );
412
413
// Hierarchical replies
wpf-includes/wpf-actions.php CHANGED
@@ -5,6 +5,20 @@
5
function wpforo_actions(){
6
do_action( 'wpforo_actions' );
7
8
if( isset($_POST['wpfreg']) && !empty($_POST['wpfreg']) && $userid = WPF()->member->create( $_POST )){
9
wpforo_verify_form('ref');
10
WPF()->member->reset($userid);
@@ -944,7 +958,7 @@ function wpforo_actions(){
944
945
if( $_GET['forum'] == 'g' ){
946
$forum = array();
947
- $forum['forumurl'] = '#';
948
$forum['title'] = '';
949
}
950
else{
@@ -957,7 +971,7 @@ function wpforo_actions(){
957
if( $_GET['topic'] == 'g' ){
958
$posts = WPF()->post->get_posts( array( 'row_count' => $topic_rss_items, 'orderby' => '`created` DESC, `postid` DESC', 'check_private' => true ) );
959
$topic['title'] = '';
960
- $topic['topicurl'] = '#';
961
}
962
else{
963
$topicid = intval($_GET['topic']);
5
function wpforo_actions(){
6
do_action( 'wpforo_actions' );
7
8
+ add_action( 'delete_attachment', 'wpforo_delete_attachment', 10 );
9
+ if( has_action('wpforo_topic_form_extra_fields_after', array(WPF()->tpl, 'add_default_attach_input')) ){
10
+ add_filter( 'wpforo_add_topic_data_filter', 'wpforo_add_default_attachment' );
11
+ add_filter( 'wpforo_edit_topic_data_filter', 'wpforo_add_default_attachment' );
12
+ add_filter( 'wpforo_add_post_data_filter', 'wpforo_add_default_attachment' );
13
+ add_filter( 'wpforo_edit_post_data_filter', 'wpforo_add_default_attachment' );
14
+ add_filter( 'wpforo_body_text_filter', 'wpforo_default_attachments_filter');
15
+ }
16
+
17
+ if( !class_exists('wpForoSmiles') ){
18
+ add_filter('wpforo_body_text_filter', 'wp_encode_emoji', 9);
19
+ add_filter('wpforo_body_text_filter', 'convert_smilies');
20
+ }
21
+
22
if( isset($_POST['wpfreg']) && !empty($_POST['wpfreg']) && $userid = WPF()->member->create( $_POST )){
23
wpforo_verify_form('ref');
24
WPF()->member->reset($userid);
958
959
if( $_GET['forum'] == 'g' ){
960
$forum = array();
961
+ $forum['forumurl'] = wpforo_home_url();
962
$forum['title'] = '';
963
}
964
else{
971
if( $_GET['topic'] == 'g' ){
972
$posts = WPF()->post->get_posts( array( 'row_count' => $topic_rss_items, 'orderby' => '`created` DESC, `postid` DESC', 'check_private' => true ) );
973
$topic['title'] = '';
974
+ $topic['topicurl'] = wpforo_home_url();
975
}
976
else{
977
$topicid = intval($_GET['topic']);
wpf-includes/wpf-hooks.php CHANGED
@@ -1265,7 +1265,7 @@ function wpforo_userform_to_wpuser_html_form($wp_user){
1265
&nbsp; <span style="color: green"><?php _e('Role-Usergroup Synchronization is Turned ON!', 'wpforo'); ?></span><br />
1266
<p class="description" style="font-weight: normal; font-size: 13px; line-height: 18px;"><?php _e('This user Usergroup is automatically changed according to current Role. If you want to disable Role-Usergroup synchronization and manage Usergroups and User Roles independently, please navigate to <b>Forums > Settings > Features</b> admin page and disable "Role-Usergroup Synchronization" option.', 'wpforo'); ?></p>
1267
<?php else: ?>
1268
- <select id="wpforo_usergroup" name="wpforo_usergroup">
1269
<?php WPF()->usergroup->show_selectbox($groupid); ?>
1270
</select>
1271
<?php endif; ?>
@@ -1321,21 +1321,36 @@ function wpforo_do_hook_user_register($userid){
1321
add_action( 'user_register', 'wpforo_do_hook_user_register', 10, 1 );
1322
1323
function wpforo_do_hook_update_profile($userid){
1324
- if( isset($_POST['wpforo_usergroup']) && $_POST['wpforo_usergroup'] ){
1325
- if( wpfval($_POST, 'wpforo_secondary_usergroup') ){
1326
- if( !empty($_POST['wpforo_secondary_usergroup']) ){
1327
- $secondary_groups = array_map('intval', $_POST['wpforo_secondary_usergroup']);
1328
}
1329
}
1330
- $args = array( 'userid' => intval($userid),
1331
- 'groupid' => intval($_POST['wpforo_usergroup']),
1332
- 'site' => esc_url($_POST['url']),
1333
- 'about' => wpforo_kses($_POST['description'], 'user_description'),
1334
- 'timezone' => ( isset($_POST['wpforo_usertimezone']) ? sanitize_text_field($_POST['wpforo_usertimezone']) : '' ),
1335
- 'secondary_groups' => ( isset($secondary_groups) ? $secondary_groups : ' ' ) );
1336
- WPF()->member->update($args);
1337
- }
1338
- WPF()->member->reset($userid);
1339
}
1340
add_action('personal_options_update', 'wpforo_do_hook_update_profile');
1341
add_action('edit_user_profile_update', 'wpforo_do_hook_update_profile');
@@ -1849,20 +1864,6 @@ function wpforo_default_attachments_filter($text){
1849
return $text;
1850
}
1851
1852
- add_action( 'delete_attachment', 'wpforo_delete_attachment', 10 );
1853
- if( !defined('WPFOROATTACH_BASENAME') ){
1854
- add_filter( 'wpforo_add_topic_data_filter', 'wpforo_add_default_attachment' );
1855
- add_filter( 'wpforo_edit_topic_data_filter', 'wpforo_add_default_attachment' );
1856
- add_filter( 'wpforo_add_post_data_filter', 'wpforo_add_default_attachment' );
1857
- add_filter( 'wpforo_edit_post_data_filter', 'wpforo_add_default_attachment' );
1858
- add_filter('wpforo_body_text_filter', 'wpforo_default_attachments_filter');
1859
- }
1860
-
1861
- if( !class_exists('wpForoSmiles') ){
1862
- add_filter('wpforo_body_text_filter', 'wp_encode_emoji', 9);
1863
- add_filter('wpforo_body_text_filter', 'convert_smilies');
1864
- }
1865
-
1866
function wpforo_content_enable_do_shortcode(){
1867
if (wpforo_feature('content-do_shortcode')) {
1868
add_filter('wpforo_content_after', 'do_shortcode', 20);
1265
&nbsp; <span style="color: green"><?php _e('Role-Usergroup Synchronization is Turned ON!', 'wpforo'); ?></span><br />
1266
<p class="description" style="font-weight: normal; font-size: 13px; line-height: 18px;"><?php _e('This user Usergroup is automatically changed according to current Role. If you want to disable Role-Usergroup synchronization and manage Usergroups and User Roles independently, please navigate to <b>Forums > Settings > Features</b> admin page and disable "Role-Usergroup Synchronization" option.', 'wpforo'); ?></p>
1267
<?php else: ?>
1268
+ <select id="wpforo_usergroup" name="wpforo_usergroup"<?php if( wpforo_is_owner( $wp_user->ID ) || !current_user_can('administrator') ) echo ' disabled="disabled"'; ?>>
1269
<?php WPF()->usergroup->show_selectbox($groupid); ?>
1270
</select>
1271
<?php endif; ?>
1321
add_action( 'user_register', 'wpforo_do_hook_user_register', 10, 1 );
1322
1323
function wpforo_do_hook_update_profile($userid){
1324
+ if( $userid ){
1325
+ if( current_user_can( 'create_users' ) || current_user_can( 'edit_user' ) ){
1326
+ if( wpfval($_POST, 'wpforo_usergroup') || wpfkey($_POST, 'wpforo_usertimezone') ){
1327
+ $member = wpforo_member($userid);
1328
+ if( wpfval($member, 'userid') ){
1329
+ $groupid = $member['groupid'];
1330
+ $secondary_groups = $member['secondary_groups'];
1331
+ if( current_user_can('administrator') ){
1332
+ if( wpfval($_POST, 'wpforo_usergroup') ){
1333
+ if( $userid != 1 && !wpforo_is_owner( $userid ) && current_user_can('administrator') ){
1334
+ $groupid = intval($_POST['wpforo_usergroup']);
1335
+ }
1336
+ }
1337
+ if( wpfval($_POST, 'wpforo_secondary_usergroup') ){
1338
+ if( !empty($_POST['wpforo_secondary_usergroup']) ){
1339
+ $secondary_groups = array_map('intval', $_POST['wpforo_secondary_usergroup']);
1340
+ }
1341
+ }
1342
+ }
1343
+ $args = array( 'groupid' => intval($groupid),
1344
+ 'site' => esc_url_raw($_POST['url']),
1345
+ 'about' => wpforo_kses($_POST['description'], 'user_description'),
1346
+ 'timezone' => ( isset($_POST['wpforo_usertimezone']) ? sanitize_text_field($_POST['wpforo_usertimezone']) : '' ),
1347
+ 'secondary_groups' => $secondary_groups );
1348
+ WPF()->member->update_profile_fields($userid, $args, false);
1349
+ WPF()->member->reset($userid);
1350
+ }
1351
}
1352
}
1353
+ }
1354
}
1355
add_action('personal_options_update', 'wpforo_do_hook_update_profile');
1356
add_action('edit_user_profile_update', 'wpforo_do_hook_update_profile');
1864
return $text;
1865
}
1866
1867
function wpforo_content_enable_do_shortcode(){
1868
if (wpforo_feature('content-do_shortcode')) {
1869
add_filter('wpforo_content_after', 'do_shortcode', 20);
wpf-includes/wpf-phrases.php CHANGED
@@ -772,7 +772,6 @@ $wpforo_phrases = array(
772
'Nickname validation failed' => __('Nickname validation failed', 'wpforo'),
773
'Numerical nicknames are not allowed. Please insert another.' => __('Numerical nicknames are not allowed. Please insert another.', 'wpforo'),
774
'Maximum allowed file size is %s MB' => __('Maximum allowed file size is %s MB', 'wpforo'),
775
- 'You are not allowed to attach this file type' => __('You are not allowed to attach this file type', 'wpforo'),
776
'This email address is already registered. Please insert another' => __('This email address is already registered. Please insert another', 'wpforo'),
777
'Allowed file types: %s' => __('Allowed file types: %s', 'wpforo'),
778
'Form name not found' => __('Form name not found', 'wpforo'),
@@ -821,4 +820,9 @@ $wpforo_phrases = array(
821
'Unread Posts' => __('Unread Posts', 'wpforo'),
822
'No unread posts were found' => __('No unread posts were found', 'wpforo'),
823
824
);
772
'Nickname validation failed' => __('Nickname validation failed', 'wpforo'),
773
'Numerical nicknames are not allowed. Please insert another.' => __('Numerical nicknames are not allowed. Please insert another.', 'wpforo'),
774
'Maximum allowed file size is %s MB' => __('Maximum allowed file size is %s MB', 'wpforo'),
775
'This email address is already registered. Please insert another' => __('This email address is already registered. Please insert another', 'wpforo'),
776
'Allowed file types: %s' => __('Allowed file types: %s', 'wpforo'),
777
'Form name not found' => __('Form name not found', 'wpforo'),
820
'Unread Posts' => __('Unread Posts', 'wpforo'),
821
'No unread posts were found' => __('No unread posts were found', 'wpforo'),
822
823
+ //1.5.3
824
+ 'Ask a question' => __('Ask a question', 'wpforo'),
825
+ 'Your question' => __('Your question', 'wpforo'),
826
+ 'Question Tags' => __('Question Tags', 'wpforo'),
827
+ 'This topic doesn\'t exist or you don\'t have permissions to see that.' => __('This topic doesn\'t exist or you don\'t have permissions to see that.', 'wpforo'),
828
);
wpf-themes/classic/index.php CHANGED
@@ -146,7 +146,7 @@
146
</div>
147
</div>
148
<?php if( WPF()->perm->forum_can( 'ct', $cat['forumid']) ): ?>
149
- <div class="wpf-head-bar-right"><button class="wpf-button" id="add_wpftopic"><?php wpforo_phrase('Add topic') ?></button></div>
150
<?php elseif( WPF()->current_user_groupid == 4 ) : ?>
151
<div class="wpf-head-bar-right"><button class="wpf-button not_reg_user" id="add_wpftopic"><?php wpforo_phrase('Add topic') ?></button></div>
152
<?php endif; ?>
@@ -250,13 +250,13 @@
250
<?php do_action( 'wpforo_post_list_footer' ) ?>
251
252
<?php else : ?>
253
- <?php include( wpftpl('404.php') ) ?>
254
<?php endif; ?>
255
256
<?php endif; ?>
257
258
<?php else : ?>
259
- <?php include( wpftpl('404.php') ) ?>
260
<?php endif; ?>
261
262
<?php else : ?>
146
</div>
147
</div>
148
<?php if( WPF()->perm->forum_can( 'ct', $cat['forumid']) ): ?>
149
+ <div class="wpf-head-bar-right"><button class="wpf-button" id="add_wpftopic"><?php wpforo_phrase( ( WPF()->forum->get_layout() == 3 ? 'Ask a question' : 'Add topic' ) ) ?></button></div>
150
<?php elseif( WPF()->current_user_groupid == 4 ) : ?>
151
<div class="wpf-head-bar-right"><button class="wpf-button not_reg_user" id="add_wpftopic"><?php wpforo_phrase('Add topic') ?></button></div>
152
<?php endif; ?>
250
<?php do_action( 'wpforo_post_list_footer' ) ?>
251
252
<?php else : ?>
253
+ <p class="wpf-p-error"><?php wpforo_phrase('You don\'t have permissions to see this page, please register or login for further information') ?></p>
254
<?php endif; ?>
255
256
<?php endif; ?>
257
258
<?php else : ?>
259
+ <p class="wpf-p-error"><?php wpforo_phrase('This topic doesn\'t exist or you don\'t have permissions to see that.') ?></p>
260
<?php endif; ?>
261
262
<?php else : ?>
wpforo.php CHANGED
@@ -5,14 +5,14 @@
5
* Description: WordPress Forum plugin. wpForo is a full-fledged forum solution for your community. Comes with multiple modern forum layouts.
6
* Author: gVectors Team (A. Chakhoyan, R. Hovhannisyan)
7
* Author URI: https://gvectors.com/
8
- * Version: 1.5.2
9
* Text Domain: wpforo
10
* Domain Path: /wpf-languages
11
*/
12
13
//Exit if accessed directly
14
if( !defined( 'ABSPATH' ) ) exit;
15
- if( !defined( 'WPFORO_VERSION' ) ) define('WPFORO_VERSION', '1.5.2');
16
17
function wpforo_load_plugin_textdomain() { load_plugin_textdomain( 'wpforo', FALSE, basename( dirname( __FILE__ ) ) . '/wpf-languages/' ); }
18
add_action( 'plugins_loaded', 'wpforo_load_plugin_textdomain' );
@@ -195,10 +195,13 @@ if( !class_exists( 'wpForo' ) ) {
195
if( !$db_version || version_compare( $db_version, WPFORO_VERSION, '<') ){
196
add_action( 'admin_notices', 'wpforo_update_db_notice' );
197
}
198
if( !WPF()->forum->manage() && wpforo_current_user_is('admin') ){
199
WPF()->member->set_usergroup(WPF()->current_userid, 1);
200
- wp_redirect( wpforo_get_request_uri() );
201
- exit;
202
}
203
}
204
}
@@ -506,6 +509,7 @@ if( !class_exists( 'wpForo' ) ) {
506
public function init_current_object($url = ''){
507
$this->current_object = array('template' => '', 'paged' => 1, 'is_404' => false, 'user_is_same_current_user' => false);
508
if(!$url) $url = wpforo_get_request_uri();
509
510
if( !is_wpforo_page($url) ) return;
511
@@ -694,7 +698,7 @@ if( !class_exists( 'wpForo' ) ) {
694
wp_redirect( wpforo_login_url() );
695
exit();
696
}else{
697
- $current_object['is_404'] = true;
698
$current_object['topic'] = array();
699
$current_object['topicid'] = 0;
700
}
5
* Description: WordPress Forum plugin. wpForo is a full-fledged forum solution for your community. Comes with multiple modern forum layouts.
6
* Author: gVectors Team (A. Chakhoyan, R. Hovhannisyan)
7
* Author URI: https://gvectors.com/
8
+ * Version: 1.5.3
9
* Text Domain: wpforo
10
* Domain Path: /wpf-languages
11
*/
12
13
//Exit if accessed directly
14
if( !defined( 'ABSPATH' ) ) exit;
15
+ if( !defined( 'WPFORO_VERSION' ) ) define('WPFORO_VERSION', '1.5.3');
16
17
function wpforo_load_plugin_textdomain() { load_plugin_textdomain( 'wpforo', FALSE, basename( dirname( __FILE__ ) ) . '/wpf-languages/' ); }
18
add_action( 'plugins_loaded', 'wpforo_load_plugin_textdomain' );
195
if( !$db_version || version_compare( $db_version, WPFORO_VERSION, '<') ){
196
add_action( 'admin_notices', 'wpforo_update_db_notice' );
197
}
198
+
199
+ $sql = "SELECT `groupid` FROM ". WPF()->tables->profiles ." WHERE `userid` = " . wpforo_bigintval(WPF()->current_userid);
200
+ if( !$current_groupid = WPF()->db->get_var($sql) ){
201
+ WPF()->member->synchronize_user(WPF()->current_userid);
202
+ }
203
if( !WPF()->forum->manage() && wpforo_current_user_is('admin') ){
204
WPF()->member->set_usergroup(WPF()->current_userid, 1);
205
}
206
}
207
}
509
public function init_current_object($url = ''){
510
$this->current_object = array('template' => '', 'paged' => 1, 'is_404' => false, 'user_is_same_current_user' => false);
511
if(!$url) $url = wpforo_get_request_uri();
512
+ $url = preg_replace('#\#[^\/\?\&]*$#isu', '', $url);
513
514
if( !is_wpforo_page($url) ) return;
515
698
wp_redirect( wpforo_login_url() );
699
exit();
700
}else{
701
+ $current_object['is_404'] = false;
702
$current_object['topic'] = array();
703
$current_object['topicid'] = 0;
704
}