if ( $id > 0 ) {
$this->updateEntry( $id );
}
- //echo '<pre>$id: ' . print_r($id, true) . '</pre>';
- //echo '<pre>$_REQUEST: ' . print_r($_REQUEST, true) . '</pre>';
// Delete the current entries for the grouped amenities
$this->wpdb->delete(
GLM_MEMBERS_PLUGIN_DB_PREFIX . 'grouped_amenities',
case 'deleteGroup':
if ( $id > 0 ) {
- $groupData->deleteEntry( $id );
+ $groupData->deleteEntry( $id, true );
+
+ // Delete the current entries for the grouped amenities
+ $this->wpdb->delete(
+ GLM_MEMBERS_PLUGIN_DB_PREFIX . 'grouped_amenities',
+ array( 'group_id' => $id ),
+ array( '%d' )
+ );
}
break;
<td>Groups</td>
</tr>
</thead>
- {foreach $groups as $group}
- <tr>
- <td>
- <label>
- <input type="hidden" name="grouped[group][{$group.id}]" value="0">
- <input type="checkbox" name="grouped[group][{$group.id}]" value="1">
- {$group.name}
- </label>
- </td>
- <td>
- <label>
- <input type="hidden" name="grouped[searchable][{$group.id}]" value="0">
- <input type="checkbox" name="grouped[searchable][{$group.id}]" value="1">
- Searchable
- </label>
- </td>
- </tr>
- {/foreach}
+ {if $haveGroups}
+ {foreach $groups as $group}
+ <tr>
+ <td>
+ <label>
+ <input type="hidden" name="grouped[group][{$group.id}]" value="0">
+ <input type="checkbox" name="grouped[group][{$group.id}]" value="1">
+ {$group.name}
+ </label>
+ </td>
+ <td>
+ <label>
+ <input type="hidden" name="grouped[searchable][{$group.id}]" value="0">
+ <input type="checkbox" name="grouped[searchable][{$group.id}]" value="1">
+ Searchable
+ </label>
+ </td>
+ </tr>
+ {/foreach}
+ {/if}
</table>
</td>
</tr>
<td>Groups</td>
</tr>
</thead>
- {foreach $groups as $group}
- <tr>
- <td>
- <label>
- <input type="hidden" name="grouped[group][{$group.id}]" value="0">
- <input id="editAmenityGroup_{$group.id}" class="amenityGroup" type="checkbox" name="grouped[group][{$group.id}]" value="1">
- {$group.name}
- </label>
- </td>
- <td>
- <label>
- <input type="hidden" name="grouped[searchable][{$group.id}]" value="0">
- <input id="editAmenityGroupSearchable_{$group.id}" class="amenitySearch" type="checkbox" name="grouped[searchable][{$group.id}]" value="1">
- Searchable
- </label>
- </td>
- </tr>
- {/foreach}
+ {if $haveGroups}
+ {foreach $groups as $group}
+ <tr>
+ <td>
+ <label>
+ <input type="hidden" name="grouped[group][{$group.id}]" value="0">
+ <input id="editAmenityGroup_{$group.id}" class="amenityGroup" type="checkbox" name="grouped[group][{$group.id}]" value="1">
+ {$group.name}
+ </label>
+ </td>
+ <td>
+ <label>
+ <input type="hidden" name="grouped[searchable][{$group.id}]" value="0">
+ <input id="editAmenityGroupSearchable_{$group.id}" class="amenitySearch" type="checkbox" name="grouped[searchable][{$group.id}]" value="1">
+ Searchable
+ </label>
+ </td>
+ </tr>
+ {/foreach}
+ {/if}
</table>
</td>
</tr>
$("#newGroupDialog").dialog("close");
});
- var id = false;
+ var group_id = false;
$('.deleteGroupButton').click( function() {
- id = $(this).attr('data-groupID');
+ group_id = $(this).attr('data-groupID');
$("#deleteGroupDialog").dialog("open");
});
$('#deleteGroupConfirm').click( function() {
$("#deleteGroupDialog").dialog("close");
- window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=amenities&option=deleteGroup&id=" + id + "&option2=group";
+ window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=amenities&option=deleteGroup&id=" + group_id + "&option2=group";
});
$('#deleteGroupCancel').click( function() {
$("#deleteGroupDialog").dialog("close");