Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin/partials/menu/manage-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<!-- TABLE BODY -->
<tbody>
<?php
if ( count( $all_forms ) > 0 ) {
if ( $all_forms && count( $all_forms ) > 0 ) {
$i = 1;
foreach( $all_forms as $id => $form ) {
?>
Expand Down
15 changes: 12 additions & 3 deletions includes/class-yikes-inc-easy-mailchimp-extender-option-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ public function get_form( $form_id ) {
* Get the IDs of all registered forms.
*
* @author Jeremy Pry
* @return array All form IDs.
* @return array|bool All form IDs.
*/
public function get_form_ids() {
return array_keys( $this->get_all_forms() );
if ( is_array( $this->get_all_forms() ) ) {
return array_keys( $this->get_all_forms() );
}

return false;
}

/**
Expand Down Expand Up @@ -77,7 +81,12 @@ public function create_form( $form_data ) {

// Grab our existing IDs and determine what the next one should be.
$all_ids = $this->get_form_ids();
$last_id = end( $all_ids );
$last_id = 0;

if ( is_array( $all_ids ) ) {
$last_id = end( $all_ids );
}

$new_id = false === $last_id ? 1 : $last_id + 1;
$form_data['id'] = $new_id;

Expand Down