Skip to:
Content

BuddyPress.org

Changeset 11866


Ignore:
Timestamp:
02/27/2018 10:44:12 PM (3 years ago)
Author:
offereins
Message:

Docs: document hooks in BP_XProfile_ProfileData::save().

Adds missing hooks documentation for the 'before_save' filters applied to
the user_id, field_id, value, and last_updated details of profile field
data.

Probably missed in [9304].

See #5949.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-profiledata.php

    r11316 r11866  
    185185        $bp = buddypress();
    186186
    187         $this->user_id      = apply_filters( 'xprofile_data_user_id_before_save',      $this->user_id,         $this->id );
    188         $this->field_id     = apply_filters( 'xprofile_data_field_id_before_save',     $this->field_id,        $this->id );
    189         $this->value        = apply_filters( 'xprofile_data_value_before_save',        $this->value,           $this->id, true, $this );
     187        /**
     188         * Filters the data's user ID before saving to the database.
     189         *
     190         * @since 1.0.0
     191         *
     192         * @param int $user_id The user ID.
     193         * @param int $data_id The field data ID.
     194         */
     195        $this->user_id = apply_filters( 'xprofile_data_user_id_before_save', $this->user_id, $this->id );
     196
     197        /**
     198         * Filters the data's field ID before saving to the database.
     199         *
     200         * @since 1.0.0
     201         *
     202         * @param int $field_id The field ID.
     203         * @param int $data_id  The field data ID.
     204         */
     205        $this->field_id = apply_filters( 'xprofile_data_field_id_before_save', $this->field_id, $this->id );
     206
     207        /**
     208         * Filters the data's value before saving to the database.
     209         *
     210         * @since 1.0.0
     211         * @since 2.1.0 Added `$reserialize` and `$this` parameters.
     212         *
     213         * @param string                  $field_value The field value.
     214         * @param int                     $data_id     The field data ID.
     215         * @param bool                    $reserialize Whether to reserialize arrays before returning. Defaults to true.
     216         * @param BP_XProfile_ProfileData $this        Current instance of the profile data being saved.
     217         */
     218        $this->value = apply_filters( 'xprofile_data_value_before_save', $this->value, $this->id, true, $this );
     219
     220        /**
     221         * Filters the data's last updated timestamp before saving to the database.
     222         *
     223         * @since 1.0.0
     224         *
     225         * @param int $last_updated The last updated timestamp.
     226         * @param int $data_id      The field data ID.
     227         */
    190228        $this->last_updated = apply_filters( 'xprofile_data_last_updated_before_save', bp_core_current_time(), $this->id );
    191229
Note: See TracChangeset for help on using the changeset viewer.