/** * Add a song from a guest to the playlist. * * Add a new entry from a guest to the event playlist. * * @since 1.3 * @param arr $data Form data from the $_POST super global. * @return void */ function mdjm_add_guest_playlist_entry_action($data) { if (!wp_verify_nonce($data['mdjm_nonce'], 'add_guest_playlist_entry')) { $message = 'nonce_fail'; } elseif (!isset($data['entry_guest_firstname'], $data['entry_guest_lastname'], $data['entry_guest_song'], $data['entry_guest_artist'])) { $message = 'playlist_guest_data_missing'; } else { // Setup the playlist entry details $posted = array(); foreach ($data as $key => $value) { if ($key != 'mdjm_nonce' && $key != 'mdjm_action' && $key != 'mdjm_redirect' && $key != 'entry_guest_addnew') { if (is_string($value) || is_int($value)) { $posted[$key] = strip_tags(addslashes($value)); } elseif (is_array($value)) { $posted[$key] = array_map('absint', $value); } } } $entry = mdjm_store_guest_playlist_entry($posted); if ($entry) { $message = 'playlist_guest_added'; } else { $message = 'playlist_guest_error'; } } wp_redirect(add_query_arg('mdjm_message', $message, mdjm_guest_playlist_url($data['entry_event']))); die; }
/** * Content tag: guest_playlist_url. * The URL to the guest playlist page. * * @param int The event ID. * @return str The playlist page URL for guests. */ function mdjm_content_tag_guest_playlist_url($event_id = '') { if (empty($event_id)) { return; } $url = mdjm_guest_playlist_url($event_id); if (empty($url)) { $return = __('Guest playlist is disabled.', 'mobile-dj-manager'); } else { $return = $url; } return $return; }