Skip to content

Commit

Permalink
Multiple successful CF7 submission designation, timezone hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisblakley committed Apr 12, 2024
1 parent 2085f02 commit 0b2d12a
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nebula-wp",
"title": "Nebula",
"description": "Advanced Starter WordPress Theme for Developers",
"version": "11.11.12.378",
"version": "11.11.12.404",
"homepage": "https://gearside.com/nebula/",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion Nebula-Child/resources/sw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//BEGIN automated edits. These will be automatically overwritten.
const THEME_NAME = 'nebula-child';
const NEBULA_VERSION = 'v11.11.12.378'; //Friday, April 12, 2024 9:03:46 AM
const NEBULA_VERSION = 'v11.11.12.404'; //Friday, April 12, 2024 9:42:14 AM
const OFFLINE_URL = 'https://nebula.gearside.com/offline/';
const OFFLINE_IMG = 'https://nebula.gearside.com/wp-content/themes/Nebula-main/assets/img/offline.svg';
const META_ICON = 'https://nebula.gearside.com/wp-content/themes/Nebula-main/assets/img/meta/android-chrome-512x512.png';
Expand Down
4 changes: 2 additions & 2 deletions Nebula-Child/style.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions assets/css/admin.css

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions assets/scss/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,11 @@ body.appearance_page_nebula_options {background-color: #f1f1f1;}
$spam_color: $danger_color;
$internal_color: #666;

.color-submission {color: $submission_color;}
.color-failed {color: $failed_color;}
.color-invalid {color: $invalid_color;}
.color-spam {color: $spam_color;}

table.wp-list-table {table-layout: auto;
tr.status-submission {
th {border-left: 4px solid rgba($submission_color, 0.5); }
Expand Down
2 changes: 1 addition & 1 deletion assets/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Theme URI: https://nebula.gearside.com
Description: Nebula is a springboard WordPress theme framework for developers. Like other WordPress startup themes, it has custom functionality built-in (like shortcodes, styles, and JS/PHP functions), but unlike other themes Nebula is not meant for the end-user.
Author: Nebula
Version: 11.11.12.378
Version: 11.11.12.404
License: GNU General Public License v2.0 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nebula
Expand Down
2 changes: 1 addition & 1 deletion inc/data/nebula_theme.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "11.11.12.378",
"version": "11.11.12.404",
"details_url": "https://github.com/chrisblakley/Nebula/commits/main",
"download_url": "https://github.com/chrisblakley/Nebula/archive/main.zip"
}
12 changes: 8 additions & 4 deletions libs/Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1977,7 +1977,7 @@ public function cf7_storage_output($post){
if ( $submission_history_query->have_posts() ){
$invalid_count = 0;
$success_count = 0;
$the_invalid_submissions = array();
$the_submissions = array();

while ( $submission_history_query->have_posts() ){ //We only want to output this once
$submission_history_query->the_post();
Expand All @@ -2003,11 +2003,15 @@ public function cf7_storage_output($post){
$submission_icon = ( get_post_status() == 'submission' && strpos(get_the_title(), '(Invalid)') === false )? '<i class="fa-solid fa-fw fa-circle-check"></i><i class="fa-solid fa-arrow-right"></i>' : '<i class="fa-solid fa-fw fa-circle-xmark"></i><i class="fa-solid fa-arrow-right"></i>';
}

$the_invalid_submissions[] = '<li data-date="' . get_the_date('Y-m-dTh:i:s') . '" class="' . get_post_status() . '-submission-item ' . $submission_class . '"><a href="' . get_edit_post_link(get_the_ID()) . '"><strong>' . $submission_icon . ' ' . $submission_label . '</strong></a> <small>(' . get_the_title($invalid_form_data->_wpcf7) . ' on ' . get_the_date('F j, Y \a\t g:i:sa') . ')</small></li>';
$the_submissions[] = '<li data-date="' . get_the_date('Y-m-dTh:i:s') . '" class="' . get_post_status() . '-submission-item ' . $submission_class . '"><a href="' . get_edit_post_link(get_the_ID()) . '"><strong>' . $submission_icon . ' ' . $submission_label . '</strong></a> <small>(' . get_the_title($invalid_form_data->_wpcf7) . ' on ' . get_the_date('F j, Y \a\t g:i:sa') . ')</small></li>';
}

if ( $invalid_count >= 1 ){
echo '<div class="nebula-cf7-notice notice-warning"><p><i class="fa-solid fa-fw fa-circle-xmark"></i> <strong>User had ' . $invalid_count . ' invalid attempt(s)!</strong> This user attempted to submit forms at least <strong>' . $invalid_count . ' time(s)</strong>.<ol>' . implode($the_invalid_submissions) . '</ol></p></div>';
if ( count($the_submissions) >= 2 ){ //If this user has submitted a form more than once (successfully or not)
if ( $invalid_count >= 1 ){ //If any of those submissions were invalid
echo '<div class="nebula-cf7-notice notice-warning"><p><i class="fa-solid fa-fw fa-circle-xmark color-invalid"></i> <strong>User had ' . $invalid_count . ' invalid attempt(s)!</strong> This user attempted to submit forms at least <strong>' . $invalid_count . ' time(s)</strong>.<ol>' . implode($the_submissions) . '</ol></p></div>';
} else { //Otherwise, all submissions were successful
echo '<div class="nebula-cf7-notice notice-success"><p><i class="fa-solid fa-fw fa-check-double color-submission"></i> <strong>User submitted multiple times.</strong> This user has submitted at least <strong>' . count($the_submissions) . ' forms</strong> successfully.<ol>' . implode($the_submissions) . '</ol></p></div>';
}
}

if ( $is_invalid ){
Expand Down
2 changes: 1 addition & 1 deletion libs/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function set_default_timezone(){
//If that returns an offset instead of a named timezone
if ( strpos($timezone_option, ':') !== false ){ //@todo "Nebula" 0: Update strpos() to str_contains() in PHP8
$date_timezone = wp_timezone();
if ( !empty($date_timezone['timezone']) ){
if ( !empty($date_timezone->timezone) ){
$timezone_option = $date_timezone['timezone'];
}
}
Expand Down
6 changes: 3 additions & 3 deletions style.css

Large diffs are not rendered by default.

0 comments on commit 0b2d12a

Please sign in to comment.