Making WordPress.org


Ignore:
Timestamp:
10/09/2025 05:44:02 AM (6 months ago)
Author:
dd32
Message:

Learn: Sync with git WordPress/learn@1fbde84

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/profiles.php

    r12130 r14548  
    1919}
    2020
    21 add_action( 'sensei_course_status_updated', __NAMESPACE__ . '\add_course_completed_activity', 9, 3 ); // Before `redirect_to_course_completed_page()`.
     21add_action( 'sensei_course_status_updated', __NAMESPACE__ . '\add_course_completed_activity', 9, 5 ); // Before `redirect_to_course_completed_page()`.
    2222add_action( 'transition_post_status', __NAMESPACE__ . '\maybe_notify_new_published_post', 10, 3 );
    2323
     
    3030 */
    3131function maybe_notify_new_published_post( $new_status, $old_status, $post ) {
    32     if ( 'publish' != $new_status ) {
     32    if ( 'publish' != $new_status || 'publish' === $old_status ) {
    3333        return;
    3434    }
     
    104104 * Add an activity to a user's profile when they complete a course.
    105105 */
    106 function add_course_completed_activity( string $status, int $user_id, int $course_id ) : void {
    107     if ( 'complete' !== $status ) {
     106function add_course_completed_activity( string $status, int $user_id, int $course_id, int $comment_id, ?string $previous_status ) : void {
     107    if ( 'complete' !== $status || 'complete' === $previous_status ) {
    108108        return;
    109109    }
Note: See TracChangeset for help on using the changeset viewer.