Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/28/2021 11:49:43 PM (6 months ago)
Author:
dcavins
Message:

BP_Invitation_Manager: Improve method return values.

In send_invitation_by_id() and
send_request_notification_by_id(), rather than
returning the number of database rows that were
updated, return the result of the the method
run_send_action().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-invitation-manager.php

    r12873 r12914  
    158158     * @param array $args          See BP_Invitation::mark_sent().
    159159     *
    160      * @return int|bool The number of rows updated, or false on error.
     160     * @return bool The result of `run_send_action()`.
    161161     */
    162162    public function send_invitation_by_id( $invitation_id = 0, $args = array() ) {
     
    196196
    197197        // Perform the send action.
    198         $this->run_send_action( $invitation );
    199 
    200         $updated = BP_Invitation::mark_sent( $invitation->id, $args );
    201 
    202         return $updated;
     198        $success = $this->run_send_action( $invitation );
     199
     200        if ( $success ) {
     201            BP_Invitation::mark_sent( $invitation->id, $args );
     202        }
     203
     204        return $success;
    203205    }
    204206
     
    310312     * @param array $args       See BP_Invitation::mark_sent().
    311313     *
    312      * @return int|bool The number of rows updated, or false on error.
     314     * @return bool The result of `run_send_action()`.
    313315     */
    314316    public function send_request_notification_by_id( $request_id = 0, $args = array() ) {
     
    343345
    344346        // Perform the send action.
    345         $this->run_send_action( $request );
    346 
    347         $updated = BP_Invitation::mark_sent( $request->id, $args );
    348 
    349         return $updated;
     347        $success = $this->run_send_action( $request );
     348
     349        if ( $success ) {
     350            BP_Invitation::mark_sent( $request->id, $args );
     351        }
     352
     353        return $success;
    350354    }
    351355
Note: See TracChangeset for help on using the changeset viewer.