New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add organizer debrief survey #1038
Conversation
c4777f1
to
6d32335
Compare
public_html/wp-content/plugins/wordcamp-organizer-survey/includes/admin-page.php
Outdated
Show resolved
Hide resolved
function add_temp_attendee() { | ||
if ( ! get_wordcamp_attendees_id() ) { | ||
$attendees_id = wp_insert_post( array( | ||
'post_title' => 'Organizer debrief survey', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few suggestions but this looks good overall
public_html/wp-content/plugins/wordcamp-organizer-survey/wordcamp-organizer-survey.php
Outdated
Show resolved
Hide resolved
public_html/wp-content/plugins/wordcamp-organizer-survey/includes/admin-page.php
Outdated
Show resolved
Hide resolved
public_html/wp-content/plugins/wordcamp-organizer-survey/includes/debrief-survey/page.php
Outdated
Show resolved
Hide resolved
public_html/wp-content/plugins/wordcamp-organizer-survey/includes/debrief-survey/cron.php
Show resolved
Hide resolved
public_html/wp-content/plugins/wordcamp-organizer-survey/includes/debrief-survey/cron.php
Outdated
Show resolved
Hide resolved
|
||
<!-- wp:jetpack/contact-form {"subject":"New feedback received from your website","style":{"spacing":{"padding":{"top":"16px","right":"16px","bottom":"16px","left":"16px"}}}} --> | ||
<div class="wp-block-jetpack-contact-form" style="padding-top:16px;padding-right:16px;padding-bottom:16px;padding-left:16px"><!-- wp:group {"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"><!-- wp:jetpack/field-text {"label":"What event did you organize?","required":true,"requiredText":"(required)"} /--></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't need to ask this, since we already know it based on the current site, who the email is sent to, etc. We can remove the question, but have some code that automatically adds it to the response before it's saved in the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems there's no proper filter or approach to add the predefined data before inserting the response to Feedback for Jetpack contact form. What's the common way to do so?
Also tried grunion_pre_message_sent
and wp_insert_post_data
, but I feel they aren't the best solution here.
Maybe using JavaScript to set the default values? I feel like there's a more elegant way to do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Known data was added in ad40047
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I wish there were more filters there 😦
It seems like it might work to hook into template_redirect
at priority 5
, since process_form_submission()
runs at priority 10
. Then you might be able to modify $_POST
directly.
<!-- /wp:heading --> | ||
|
||
<!-- wp:group {"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"><!-- wp:jetpack/field-text {"label":"How many tickets were sold?","required":true,"requiredText":"(required)"} /--></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can also be pulled from existing data. There may be other questions that can also be removed for that reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this PR, I've pre-populated the value for the question "What event did you organize?". The data sources for the other questions are different and might need to look for proper functions to retrieve the existing data. I'll handle that in a separate PR.
public_html/wp-content/plugins/wordcamp-organizer-survey/includes/debrief-survey/cron.php
Show resolved
Hide resolved
e26379a
to
5424875
Compare
The Organizer Reminders only works on central. It would get too complicated and introduce a few glitches if trying to use it through event site. The extra work doesn't worth the effort at the moment.
ea44ddd
to
5ef71c2
Compare
The Jetpack contact form fails to submit when there's a query string present.The Jetpack contact form's source code has been traced and no usable hooks found. Although the query string can be removed via JavaScript, the form still can't be submitted successfully. Therefore, it's temporarily disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some questions/suggestions, but nothing that blocks merging 👍🏻
public_html/wp-content/mu-plugins/wcorg-network-plugin-control.php
Outdated
Show resolved
Hide resolved
public_html/wp-content/plugins/wordcamp-organizer-survey/wordcamp-organizer-survey.php
Outdated
Show resolved
Hide resolved
$labels = $dom->getElementsByTagName('label'); | ||
foreach ( $labels as $label ) { | ||
// phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase | ||
if ( 'What event did you organize?' === $label->nodeValue ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 I suspect there may an easier way to do this. Do we need to show the question to the user if we're just going to fill it in anyway?
Another problem is that, If it's in the page, it could be edited by an admin who wouldn't realize that doing that would break this.
If we don't need to show the question, we could insert the value in $_POST
some time before Grunion_Contact_Form_Plugin::process_form_submission()
runs.
If you do want to show it, it might be possible to add an id/class
value to the post content in the database, and then use that in this function. That'd still break if someone edited it, but they'd be less likely to.
if ( 'What event did you organize?' === $label->nodeValue ) { | ||
$input_id = $label->getAttribute('for'); | ||
$event_name_field = $dom->getElementById($input_id); | ||
$event_name_field->setAttribute('value', $wordcamp_post_data->post_title); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be best to save the ID rather than the title, since the title can change. It also won't have the year, unless passed through get_wordcamp_name()
. That function might not work well for NextGen camps though, since some of them are monthly, etc.
If we don't remove the question from the user-facing form (see above), then it would be good to show the user the title, but we could still save the ID. Maybe just by modifying $_POST
before the value gets saved. Or it could be in a separate field if that's easier.
Closes #930
This PR implements what has been concluded in the ticket. The logic refers to #997.
Flow
Manually published Organizer Survey (event debrief) in Central.
When the plugin is activated:
tix_email
in draft status.daily
cron job.When the cron job runs:
tix_email
.tix_email
to the queue (set topending
)tix_scheduled_every_ten_minutes
Screenshots
How to test
Organizer Name
andEmail Address
inside the Organizing Team.Organizer Survey (event debrief)
Organizer Survey (event debrief)
inDraft
mode.wp cron event list --url=https://events.wordpress.test/{city}/{year}/{type}
wc_organizer_debrief_survey_email
wp post update {post_id} --post_status=wcpt-closed --url=https://central.wordcamp.test/
wp cron event run wc_organizer_debrief_survey_email --url=https://events.wordpress.test/{city}/{year}/{type}
Organizer Survey (event debrief)
in Ticket -> E-Mail should bepending
.tix_first_name
andtix_email
the same as the one you input when creating the event.wp cron event run tix_scheduled_every_ten_minutes -url=https://events.wordpress.test/{city}/{year}/{type}
Organizer Survey (event debrief)
in Ticket -> E-Mail should be published.Organizer Survey (event debrief)
.