Saving tribes as array
This commit is contained in:
parent
492d5a0028
commit
c1d83d5536
@ -17,7 +17,7 @@ class CreateEvent {
|
||||
$post_data['amount_default'] = str_replace(',', '.', $_POST['amount_default']);
|
||||
$post_data['amount_social'] = str_replace(',', '.', $_POST['amount_social']);
|
||||
|
||||
$post_data['contributing_tribes'] = str_replace( PHP_EOL, ',', $post_data['contributing_tribes'] );
|
||||
$post_data['contributing_tribes'] = serialize( explode(PHP_EOL, $post_data['contributing_tribes'] ) );
|
||||
|
||||
$new_event_id = $dbHandler->insertRows(
|
||||
'kompass_veranstaltungen_index',
|
||||
|
@ -17,7 +17,7 @@ class UpdateEvent {
|
||||
$post_data['amount_default'] = str_replace(',', '.', $_POST['amount_default']);
|
||||
$post_data['amount_social'] = str_replace(',', '.', $_POST['amount_social']);
|
||||
|
||||
$post_data['contributing_tribes'] = str_replace( PHP_EOL, ',', $post_data['contributing_tribes'] );
|
||||
$post_data['contributing_tribes'] = serialize( explode(PHP_EOL, $post_data['contributing_tribes'] ) );
|
||||
|
||||
$dbHandler->updateRows(
|
||||
'kompass_veranstaltungen_index',
|
||||
|
@ -5,12 +5,14 @@ use Bdp\Modules\EventParticipants\Models\Event as Event;
|
||||
function kompass_print_event_edit_form(?int $event_id = null)
|
||||
{
|
||||
$event = null;
|
||||
$tribes = '';
|
||||
if (null === $event_id) {
|
||||
$page = 'kompass-events&action=create-event';
|
||||
|
||||
} else {
|
||||
$page = 'kompass-events&action=update-event&event-id=' . $event_id;
|
||||
$event = Event::loadById($event_id);
|
||||
$tribes = implode(PHP_EOL, unserialize($event->contributing_tribes));
|
||||
}
|
||||
|
||||
$events_settings = BDP_LV_PLUGIN_SLUG . '-events-settings';
|
||||
@ -101,7 +103,7 @@ function kompass_print_event_edit_form(?int $event_id = null)
|
||||
'kompass_print_textbox',
|
||||
$events_settings,
|
||||
'events_settings',
|
||||
['setting' => 'contributing_tribes', 'style' => 'width: 256px', 'lines' => 5, 'value' => str_replace(',', PHP_EOL, null !== $event ? $event->contributing_tribes : ''), 'appendix' => '<br />' . __('Please one line per row', BDP_LV_PLUGIN_SLUG)] );
|
||||
['setting' => 'contributing_tribes', 'style' => 'width: 256px', 'lines' => 5, 'value' => $tribes, 'appendix' => '<br />' . __('Please one line per row', BDP_LV_PLUGIN_SLUG)] );
|
||||
|
||||
do_settings_sections($events_settings);
|
||||
submit_button();
|
||||
|
Loading…
Reference in New Issue
Block a user