Repository navigation
Run WordCamp Participation Notifier when post is published - #964
Conversation
…dge notifications
`is_post_notifiable()` was returning `false` because the passed `id` wan't a `WP_Post`
|
I pushed 02ae763 to fix a problem that was preventing my tests from working. I'm seeing another problem now, but it doesn't seem to be in the PR. The CLI command also doesn't remove it either, though: > wp bp group member remove --group-id=wordcamp-organizer --user-id=13904193
Error: Could not remove member from the group.( The SQL query in I'm a bit stuck there, so I'm gonna move on to other tests and try again next week. |
|
🤔 it seems like the reason why After setting After removing that code, though, I can still reproduce the error:
I'm gonna look and see if it's a bug in BuddyPress, or some conflict with our custom code/environment. |
|
It looks like it was a BuddyPress bug, so I filed a report. I'll see if there's a good workaround. If not we may be need to wait until it's fixed. |
Looks like this was released in https://buddypress.trac.wordpress.org/changeset/13592, so we can test this again. |
gedex
left a comment
There was a problem hiding this comment.
Thanks for this, @timiwahalahti, and sorry it sat so long! Tested locally with this PR merged onto the production branch: a username saved on a draft now gets its badge when the post is published, which the production branch still misses. Happy to take another look after the update.
… changes Moving badge handling to wp_after_insert_post dropped the only code that took the badge off the previous user when a published speaker or organizer's WordPress.org username changed. Keep that removal in username_meta_update(); the new user still gets theirs on save. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@timiwahalahti I pushed the badge-removal fix to your branch so this can land. Tested locally: drafts now get their badge on publish, and a username change removes the old account's badge again. |
WordCamp Participation Notifier sends profile activity log messages and hands out the badges for organisers and speakers, in the future possibly for volunteers and attendees as well.
The notifier relied on
add_post_metaandupdate_post_metahooks to detect when the notifications for profiles.wordpress.org should be sent. This has proven to cause problems, as many WordCamps do fill out the WordPress.org username for the post when they draft it. That has caused the filters to run, but bail because the post isn't public yet. In the end, people haven't received their badges or organisers have had to empty the username field, save and fill in the username again to send notifications.This PR tries to fix that by hooking into
wp_after_insert_postaction that is run after the post itself and related meta have been saved. If all conditions are met (not revision, published, notifiable post type) then notifications are sent.The
username_meta_updatefunction was left because it is used to notify about a mentor assigned to a WordCamp, which has a bit different logic.Someone with sandbox needs to test this and see that activity log and badges do in fact get assigned.
Fixes #809
Props @vertizio, @CdrMarks
How to test the changes in this Pull Request: