AnsPress_Hooks::new_subscriber( $subscribe_id, integer $user_id, string $event, integer $ref_id )

Description #

Update qameta subscribers count on adding new subscriber.

Parameters #

  • $subscriber_id
    integer (Required) id of new subscriber added.
  • $user_id
    integer (Required) id of user.
  • $event
    string (Required) Subscribe event.
  • $ref_id
    integer (Required) Reference id.

Changelog #

VersionDescription
unknownunknown
4.1.5Introduced.

Source #

File: includes/hooks.php

953
954
955
956
957
958
959
960
961
962
963
964
965
966
public static function new_subscriber( $subscribe_id, $user_id, $event, $ref_id ) {
    // Remove ids from event.
    $esc_event = ap_esc_subscriber_event( $event );
 
    if ( in_array( $esc_event, [ 'question', 'answer', 'comment' ], true ) ) {
        ap_update_subscribers_count( $ref_id );
    }
 
    // Update answer subscribers count.
    if ( 'answer' === $esc_event ) {
        $event_id = ap_esc_subscriber_event_id( $event );
        ap_update_subscribers_count( $event_id );
    }
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment