Version Description
- 2019-06-08
- Add log entry for privacy policy accepted (gets added to notification mail).
- Add msg_txt key/value to log entries for plain text display.
- Small updates to install routine.
- Support new wp_initialize_site action for multisite.
Download this release
Release Info
Developer | mpol |
Plugin | Gwolle Guestbook |
Version | 3.1.5 |
Comparing to | |
See all releases |
Code changes from version 3.1.4 to 3.1.5
- admin/css/gwolle-gb-admin.css +5 -1
- admin/gb-upgrade.php +37 -43
- frontend/gb-form-posthandling.php +6 -0
- functions/gb-log.php +20 -7
- functions/gb-mail.php +3 -3
- gwolle-gb-hooks.php +16 -0
- gwolle-gb.php +3 -2
- readme.txt +10 -1
admin/css/gwolle-gb-admin.css
CHANGED
@@ -22,6 +22,11 @@
|
|
22 |
height: 42px;
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
/*
|
27 |
* Welcome page
|
@@ -130,7 +135,6 @@ body #dashboard-widgets .postbox#gwolle_gb_notification ul {
|
|
130 |
margin-left: 4px;
|
131 |
}
|
132 |
|
133 |
-
|
134 |
/* Table */
|
135 |
#gwolle_gb_entries th {
|
136 |
white-space: nowrap;
|
22 |
height: 42px;
|
23 |
}
|
24 |
|
25 |
+
#gwolle_gb_entries .subsubsub,
|
26 |
+
h2.gwolle-nav-tab-wrapper {
|
27 |
+
clear: left;
|
28 |
+
}
|
29 |
+
|
30 |
|
31 |
/*
|
32 |
* Welcome page
|
135 |
margin-left: 4px;
|
136 |
}
|
137 |
|
|
|
138 |
/* Table */
|
139 |
#gwolle_gb_entries th {
|
140 |
white-space: nowrap;
|
admin/gb-upgrade.php
CHANGED
@@ -26,49 +26,43 @@ function gwolle_gb_install() {
|
|
26 |
$wpdb->gwolle_gb_entries = $wpdb->prefix . 'gwolle_gb_entries';
|
27 |
$wpdb->gwolle_gb_log = $wpdb->prefix . 'gwolle_gb_log';
|
28 |
|
29 |
-
$
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
(
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
author_id int(5) NOT NULL,
|
67 |
-
datetime bigint(8) UNSIGNED NOT NULL,
|
68 |
-
PRIMARY KEY (id)
|
69 |
-
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci";
|
70 |
-
$result = $wpdb->query($sql);
|
71 |
-
}
|
72 |
|
73 |
/* Upgrade to new shiny db collation. Since WP 4.2 */
|
74 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
26 |
$wpdb->gwolle_gb_entries = $wpdb->prefix . 'gwolle_gb_entries';
|
27 |
$wpdb->gwolle_gb_log = $wpdb->prefix . 'gwolle_gb_log';
|
28 |
|
29 |
+
$sql = "
|
30 |
+
CREATE TABLE IF NOT EXISTS
|
31 |
+
" . $wpdb->gwolle_gb_entries . "
|
32 |
+
(
|
33 |
+
id int(10) NOT NULL auto_increment,
|
34 |
+
author_name text NOT NULL,
|
35 |
+
author_id int(5) NOT NULL default '0',
|
36 |
+
author_email text NOT NULL,
|
37 |
+
author_origin text NOT NULL,
|
38 |
+
author_website text NOT NULL,
|
39 |
+
author_ip text NOT NULL,
|
40 |
+
author_host text NOT NULL,
|
41 |
+
content longtext NOT NULL,
|
42 |
+
datetime bigint(8) UNSIGNED NOT NULL,
|
43 |
+
ischecked tinyint(1) NOT NULL,
|
44 |
+
checkedby int(5) NOT NULL,
|
45 |
+
istrash varchar(1) NOT NULL default '0',
|
46 |
+
isspam varchar(1) NOT NULL default '0',
|
47 |
+
admin_reply longtext NOT NULL,
|
48 |
+
admin_reply_uid int(5) NOT NULL default '0',
|
49 |
+
book_id int(5) NOT NULL default '1',
|
50 |
+
PRIMARY KEY (id)
|
51 |
+
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci";
|
52 |
+
$result = $wpdb->query($sql);
|
53 |
+
|
54 |
+
$sql = "
|
55 |
+
CREATE TABLE IF NOT EXISTS
|
56 |
+
" . $wpdb->gwolle_gb_log . "
|
57 |
+
(
|
58 |
+
id int(8) NOT NULL auto_increment,
|
59 |
+
subject text NOT NULL,
|
60 |
+
entry_id int(5) NOT NULL,
|
61 |
+
author_id int(5) NOT NULL,
|
62 |
+
datetime bigint(8) UNSIGNED NOT NULL,
|
63 |
+
PRIMARY KEY (id)
|
64 |
+
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci";
|
65 |
+
$result = $wpdb->query($sql);
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
/* Upgrade to new shiny db collation. Since WP 4.2 */
|
68 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
frontend/gb-form-posthandling.php
CHANGED
@@ -504,6 +504,12 @@ function gwolle_gb_frontend_posthandling() {
|
|
504 |
}
|
505 |
|
506 |
|
|
|
|
|
|
|
|
|
|
|
|
|
507 |
/*
|
508 |
* Hooks gwolle_gb_clear_cache(), gwolle_gb_mail_moderators() and gwolle_gb_mail_author().
|
509 |
*/
|
504 |
}
|
505 |
|
506 |
|
507 |
+
/* Privacy checkbox for GDPR compliance added to log. */
|
508 |
+
if (isset($_POST['gwolle_gb_privacy']) && $_POST['gwolle_gb_privacy'] == 'on') {
|
509 |
+
gwolle_gb_add_log_entry( $entry->get_id(), 'privacy-policy-accepted' );
|
510 |
+
}
|
511 |
+
|
512 |
+
|
513 |
/*
|
514 |
* Hooks gwolle_gb_clear_cache(), gwolle_gb_mail_moderators() and gwolle_gb_mail_author().
|
515 |
*/
|
functions/gb-log.php
CHANGED
@@ -43,7 +43,8 @@ function gwolle_gb_add_log_entry( $entry_id, $subject ) {
|
|
43 |
'admin-reply-added',
|
44 |
'admin-reply-updated',
|
45 |
'admin-reply-removed',
|
46 |
-
'entry-anonymized'
|
|
|
47 |
);
|
48 |
if ( ! in_array( $subject, $log_messages ) ) {
|
49 |
return false;
|
@@ -91,7 +92,8 @@ function gwolle_gb_add_log_entry( $entry_id, $subject ) {
|
|
91 |
* datetime => (int) log_date with timestamp
|
92 |
* msg => (string) subject of the log, what happened. In Human Readable form, translated
|
93 |
* author_login => (string) display_name or login_name of the user as standard WP_User
|
94 |
-
* msg_html => (string) string of html-text ready for
|
|
|
95 |
*
|
96 |
*/
|
97 |
function gwolle_gb_get_log_entries( $entry_id ) {
|
@@ -124,7 +126,8 @@ function gwolle_gb_get_log_entries( $entry_id ) {
|
|
124 |
'admin-reply-added' => /* translators: Log message */ esc_html__('Admin reply has been added.', 'gwolle-gb'),
|
125 |
'admin-reply-updated' => /* translators: Log message */ esc_html__('Admin reply has been updated.', 'gwolle-gb'),
|
126 |
'admin-reply-removed' => /* translators: Log message */ esc_html__('Admin reply has been removed.', 'gwolle-gb'),
|
127 |
-
'entry-anonymized' => /* translators: Log message */ esc_html__('Entry has been anonymized.', 'gwolle-gb')
|
|
|
128 |
);
|
129 |
|
130 |
$where = " 1 = %d";
|
@@ -184,7 +187,7 @@ function gwolle_gb_get_log_entries( $entry_id ) {
|
|
184 |
$log_entry['author_login'] = $userdata->user_login;
|
185 |
}
|
186 |
} else {
|
187 |
-
$log_entry['author_login'] =
|
188 |
}
|
189 |
|
190 |
// Construct the message in HTML
|
@@ -192,12 +195,22 @@ function gwolle_gb_get_log_entries( $entry_id ) {
|
|
192 |
$log_entry['msg_html'] .= date_i18n( get_option('time_format'), $log_entry['datetime']);
|
193 |
$log_entry['msg_html'] .= ': ' . $log_entry['msg'];
|
194 |
|
195 |
-
if ( $log_entry['author_id'] == get_current_user_id() ) {
|
196 |
-
$log_entry['msg_html'] .= ' (<strong>' . esc_html__('You', 'gwolle-gb') . '</strong>)';
|
197 |
} else {
|
198 |
-
$log_entry['msg_html'] .= ' (' . $log_entry['author_login'] . ')';
|
199 |
}
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
$log_entries[] = $log_entry;
|
202 |
}
|
203 |
|
43 |
'admin-reply-added',
|
44 |
'admin-reply-updated',
|
45 |
'admin-reply-removed',
|
46 |
+
'entry-anonymized',
|
47 |
+
'privacy-policy-accepted'
|
48 |
);
|
49 |
if ( ! in_array( $subject, $log_messages ) ) {
|
50 |
return false;
|
92 |
* datetime => (int) log_date with timestamp
|
93 |
* msg => (string) subject of the log, what happened. In Human Readable form, translated
|
94 |
* author_login => (string) display_name or login_name of the user as standard WP_User
|
95 |
+
* msg_html => (string) string of html-text ready for display
|
96 |
+
* msg_txt => (string) string of text ready for display
|
97 |
*
|
98 |
*/
|
99 |
function gwolle_gb_get_log_entries( $entry_id ) {
|
126 |
'admin-reply-added' => /* translators: Log message */ esc_html__('Admin reply has been added.', 'gwolle-gb'),
|
127 |
'admin-reply-updated' => /* translators: Log message */ esc_html__('Admin reply has been updated.', 'gwolle-gb'),
|
128 |
'admin-reply-removed' => /* translators: Log message */ esc_html__('Admin reply has been removed.', 'gwolle-gb'),
|
129 |
+
'entry-anonymized' => /* translators: Log message */ esc_html__('Entry has been anonymized.', 'gwolle-gb'),
|
130 |
+
'privacy-policy-accepted' => /* translators: Log message */ esc_html__('Privacy Policy was accepted.', 'gwolle-gb')
|
131 |
);
|
132 |
|
133 |
$where = " 1 = %d";
|
187 |
$log_entry['author_login'] = $userdata->user_login;
|
188 |
}
|
189 |
} else {
|
190 |
+
$log_entry['author_login'] = esc_html__('Unknown', 'gwolle-gb');
|
191 |
}
|
192 |
|
193 |
// Construct the message in HTML
|
195 |
$log_entry['msg_html'] .= date_i18n( get_option('time_format'), $log_entry['datetime']);
|
196 |
$log_entry['msg_html'] .= ': ' . $log_entry['msg'];
|
197 |
|
198 |
+
if ( $log_entry['author_id'] == get_current_user_id() && $log_entry['author_id'] != 0 ) {
|
199 |
+
$log_entry['msg_html'] .= ' <i>(<strong>' . esc_html__('You', 'gwolle-gb') . '</strong>)</i>';
|
200 |
} else {
|
201 |
+
$log_entry['msg_html'] .= ' <i>(' . $log_entry['author_login'] . ')</i>';
|
202 |
}
|
203 |
|
204 |
+
// Construct the message in plain text
|
205 |
+
$log_entry['msg_txt'] = date_i18n( get_option('date_format'), $log_entry['datetime']) . ", ";
|
206 |
+
$log_entry['msg_txt'] .= date_i18n( get_option('time_format'), $log_entry['datetime']);
|
207 |
+
$log_entry['msg_txt'] .= ': ' . $log_entry['msg'];
|
208 |
+
|
209 |
+
if ( $log_entry['author_id'] == get_current_user_id() && $log_entry['author_id'] != 0 ) {
|
210 |
+
$log_entry['msg_txt'] .= ' (' . esc_html__('You', 'gwolle-gb') . ')';
|
211 |
+
} else {
|
212 |
+
$log_entry['msg_txt'] .= ' (' . $log_entry['author_login'] . ')';
|
213 |
+
}
|
214 |
$log_entries[] = $log_entry;
|
215 |
}
|
216 |
|
functions/gb-mail.php
CHANGED
@@ -117,15 +117,15 @@ Entry content:
|
|
117 |
|
118 |
// Add logging to mail
|
119 |
$log_entries = gwolle_gb_get_log_entries( $entry->get_id() );
|
120 |
-
if ( is_array($log_entries) && !empty($log_entries) ) {
|
121 |
-
$mail_body .= "\r\n
|
122 |
if ($entry->get_datetime() > 0) {
|
123 |
$mail_body .= date_i18n( get_option('date_format'), $entry->get_datetime() ) . ', ';
|
124 |
$mail_body .= date_i18n( get_option('time_format'), $entry->get_datetime() );
|
125 |
$mail_body .= ': ' . esc_html__('Written', 'gwolle-gb') . "\r\n";
|
126 |
}
|
127 |
foreach ($log_entries as $log_entry) {
|
128 |
-
$mail_body .= $log_entry['
|
129 |
}
|
130 |
}
|
131 |
|
117 |
|
118 |
// Add logging to mail
|
119 |
$log_entries = gwolle_gb_get_log_entries( $entry->get_id() );
|
120 |
+
if ( is_array($log_entries) && ! empty($log_entries) ) {
|
121 |
+
$mail_body .= "\r\n" . esc_html__('Log messages:', 'gwolle-gb') . "\r\n";
|
122 |
if ($entry->get_datetime() > 0) {
|
123 |
$mail_body .= date_i18n( get_option('date_format'), $entry->get_datetime() ) . ', ';
|
124 |
$mail_body .= date_i18n( get_option('time_format'), $entry->get_datetime() );
|
125 |
$mail_body .= ': ' . esc_html__('Written', 'gwolle-gb') . "\r\n";
|
126 |
}
|
127 |
foreach ($log_entries as $log_entry) {
|
128 |
+
$mail_body .= $log_entry['msg_txt'] . "\r\n";
|
129 |
}
|
130 |
}
|
131 |
|
gwolle-gb-hooks.php
CHANGED
@@ -43,6 +43,7 @@ add_action('admin_init', 'gwolle_gb_init');
|
|
43 |
|
44 |
/*
|
45 |
* Install database tables for new blog on MultiSite.
|
|
|
46 |
*
|
47 |
* @since 1.5.2
|
48 |
*/
|
@@ -54,6 +55,21 @@ function gwolle_gb_activate_new_site($blog_id) {
|
|
54 |
add_action( 'wpmu_new_blog', 'gwolle_gb_activate_new_site' );
|
55 |
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
/*
|
58 |
* Register styles and scripts.
|
59 |
* Enqueue them in the frontend function only when we need them.
|
43 |
|
44 |
/*
|
45 |
* Install database tables for new blog on MultiSite.
|
46 |
+
* Deprecated action since WP 5.1.0.
|
47 |
*
|
48 |
* @since 1.5.2
|
49 |
*/
|
55 |
add_action( 'wpmu_new_blog', 'gwolle_gb_activate_new_site' );
|
56 |
|
57 |
|
58 |
+
/*
|
59 |
+
* Install database tables for new blog on MultiSite.
|
60 |
+
* Used since WP 5.1.0.
|
61 |
+
* Do not use wp_insert_site, since the options table doesn't exist yet...
|
62 |
+
*
|
63 |
+
* @since 3.1.5
|
64 |
+
*/
|
65 |
+
function gwolle_gb_wp_initialize_site( $blog ) {
|
66 |
+
switch_to_blog( $blog->id );
|
67 |
+
gwolle_gb_install();
|
68 |
+
restore_current_blog();
|
69 |
+
}
|
70 |
+
add_action( 'wp_initialize_site', 'gwolle_gb_wp_initialize_site' );
|
71 |
+
|
72 |
+
|
73 |
/*
|
74 |
* Register styles and scripts.
|
75 |
* Enqueue them in the frontend function only when we need them.
|
gwolle-gb.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Gwolle Guestbook
|
4 |
Plugin URI: http://zenoweb.nl
|
5 |
Description: Gwolle Guestbook is not just another guestbook for WordPress. The goal is to provide an easy and slim way to integrate a guestbook into your WordPress powered site. Don't use your 'comment' section the wrong way - install Gwolle Guestbook and have a real guestbook.
|
6 |
-
Version: 3.1.
|
7 |
Author: Marcel Pol
|
8 |
Author URI: http://zenoweb.nl
|
9 |
License: GPLv2 or later
|
@@ -32,7 +32,7 @@ Domain Path: /lang/
|
|
32 |
|
33 |
|
34 |
// Plugin Version
|
35 |
-
define('GWOLLE_GB_VER', '3.1.
|
36 |
|
37 |
|
38 |
/*
|
@@ -58,6 +58,7 @@ define('GWOLLE_GB_VER', '3.1.4');
|
|
58 |
* - Use foreign keys for add-on, set meta var (add function). Test with frontend and export and isam db-engine.
|
59 |
* - Use foreign keys through a hook with SQL, and add a setter for meta.
|
60 |
* - Or add function to prepopulate metas for export.
|
|
|
61 |
*
|
62 |
*/
|
63 |
|
3 |
Plugin Name: Gwolle Guestbook
|
4 |
Plugin URI: http://zenoweb.nl
|
5 |
Description: Gwolle Guestbook is not just another guestbook for WordPress. The goal is to provide an easy and slim way to integrate a guestbook into your WordPress powered site. Don't use your 'comment' section the wrong way - install Gwolle Guestbook and have a real guestbook.
|
6 |
+
Version: 3.1.5
|
7 |
Author: Marcel Pol
|
8 |
Author URI: http://zenoweb.nl
|
9 |
License: GPLv2 or later
|
32 |
|
33 |
|
34 |
// Plugin Version
|
35 |
+
define('GWOLLE_GB_VER', '3.1.5');
|
36 |
|
37 |
|
38 |
/*
|
58 |
* - Use foreign keys for add-on, set meta var (add function). Test with frontend and export and isam db-engine.
|
59 |
* - Use foreign keys through a hook with SQL, and add a setter for meta.
|
60 |
* - Or add function to prepopulate metas for export.
|
61 |
+
* - Add emoji for Zwarte Piet and Sinterklaas when locale=nl_nl.
|
62 |
*
|
63 |
*/
|
64 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: Gwolle, mpol
|
|
3 |
Tags: guestbook, guest book, livre d'or, Gästebuch, review
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 5.2
|
6 |
-
Stable tag: 3.1.
|
7 |
License: GPLv2 or later
|
8 |
Requires PHP: 5.3
|
9 |
|
@@ -370,6 +370,8 @@ So you would need to load it on every page to have it available for the guestboo
|
|
370 |
add_action('wp_enqueue_scripts', 'my_gwolle_gb_register', 20);
|
371 |
?>
|
372 |
|
|
|
|
|
373 |
= I use the Autoptimize plugin =
|
374 |
|
375 |
The frontend scripts will only be loaded on the Guestbook page, so they won't be added to autoptimize.
|
@@ -425,6 +427,13 @@ But if you don't use standard comments, you can just as easily use the comment s
|
|
425 |
|
426 |
== Changelog ==
|
427 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
= 3.1.4 =
|
429 |
* 2019-05-03
|
430 |
* Make it possible to set entry to moderated with the gwolle_gb_new_entry_frontend filter.
|
3 |
Tags: guestbook, guest book, livre d'or, Gästebuch, review
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 5.2
|
6 |
+
Stable tag: 3.1.5
|
7 |
License: GPLv2 or later
|
8 |
Requires PHP: 5.3
|
9 |
|
370 |
add_action('wp_enqueue_scripts', 'my_gwolle_gb_register', 20);
|
371 |
?>
|
372 |
|
373 |
+
I don't have any experience myself with AJAX themes. If it doesn't work, please contact the theme author.
|
374 |
+
|
375 |
= I use the Autoptimize plugin =
|
376 |
|
377 |
The frontend scripts will only be loaded on the Guestbook page, so they won't be added to autoptimize.
|
427 |
|
428 |
== Changelog ==
|
429 |
|
430 |
+
= 3.1.5 =
|
431 |
+
* 2019-06-08
|
432 |
+
* Add log entry for privacy policy accepted (gets added to notification mail).
|
433 |
+
* Add msg_txt key/value to log entries for plain text display.
|
434 |
+
* Small updates to install routine.
|
435 |
+
* Support new wp_initialize_site action for multisite.
|
436 |
+
|
437 |
= 3.1.4 =
|
438 |
* 2019-05-03
|
439 |
* Make it possible to set entry to moderated with the gwolle_gb_new_entry_frontend filter.
|