diff --git a/modules/event-participants/Controllers/class-createevent.php b/modules/event-participants/Controllers/class-createevent.php
index 7c8ae2c..0b310a0 100644
--- a/modules/event-participants/Controllers/class-createevent.php
+++ b/modules/event-participants/Controllers/class-createevent.php
@@ -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',
diff --git a/modules/event-participants/Controllers/class-updateevent.php b/modules/event-participants/Controllers/class-updateevent.php
index 30746ad..800a7f6 100644
--- a/modules/event-participants/Controllers/class-updateevent.php
+++ b/modules/event-participants/Controllers/class-updateevent.php
@@ -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',
diff --git a/modules/event-participants/Views/event-edit-form.php b/modules/event-participants/Views/event-edit-form.php
index 53cabef..f0f04ca 100644
--- a/modules/event-participants/Views/event-edit-form.php
+++ b/modules/event-participants/Views/event-edit-form.php
@@ -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' => '
' . __('Please one line per row', BDP_LV_PLUGIN_SLUG)] );
+ ['setting' => 'contributing_tribes', 'style' => 'width: 256px', 'lines' => 5, 'value' => $tribes, 'appendix' => '
' . __('Please one line per row', BDP_LV_PLUGIN_SLUG)] );
do_settings_sections($events_settings);
submit_button();