Skip to:
Content

BuddyPress.org

Ticket #6210: 6210-imath-suggestions.patch

File 6210-imath-suggestions.patch, 18.5 KB (added by imath, 6 years ago)
  • src/bp-core/admin/bp-core-admin-schema.php

    diff --git src/bp-core/admin/bp-core-admin-schema.php src/bp-core/admin/bp-core-admin-schema.php
    index 928948797..bda0edaf0 100644
    function bp_core_install_invitations() { 
    579579                ) {$charset_collate};";
    580580        dbDelta( $sql );
    581581
    582         // @TODO: Migrate invitations here
     582        /**
     583         * @TODO: Migrate invitations here
     584         */
    583585
    584586        /**
    585587         * Fires after BuddyPress adds the invitations table.
  • src/bp-core/bp-core-update.php

    diff --git src/bp-core/bp-core-update.php src/bp-core/bp-core-update.php
    index 27e3819bc..db6d0289e 100644
    function bp_update_to_5_0() { 
    585585
    586586        bp_core_install_invitations();
    587587
    588         bp_groups_migrate_invitations();
     588        if ( bp_is_active( 'groups' ) ) {
     589                bp_groups_migrate_invitations();
     590        }
    589591}
    590592
    591593/**
  • src/bp-core/classes/class-bp-invitation-manager.php

    diff --git src/bp-core/classes/class-bp-invitation-manager.php src/bp-core/classes/class-bp-invitation-manager.php
    index 397258511..30158447a 100644
    abstract class BP_Invitation_Manager { 
    6969         *         @type int    $item_id ID associated with the invitation and class.
    7070         *         @type int    $secondary_item_id secondary ID associated with the
    7171         *                              invitation and class.
    72          *         @type string $type @TODO.
     72         *         @type string $type @TODO. < missing description.
    7373         *         @type string $content Extra information provided by the requester
    7474         *                              or inviter.
    7575         *         @type string $date_modified Date the invitation was last modified.
    abstract class BP_Invitation_Manager { 
    8383
    8484                $r = bp_parse_args( $args, array(
    8585                        'user_id'           => 0,
    86                         'invitee_email'         => '',
    87                         'inviter_id'            => 0,
     86                        'invitee_email'     => '',
     87                        'inviter_id'        => 0,
    8888                        'item_id'           => 0,
    8989                        'secondary_item_id' => 0,
    90                         'type'                          => 'invite',
    91                         'content'                       => '',
     90                        'type'              => 'invite',
     91                        'content'           => '',
    9292                        'date_modified'     => bp_core_current_time(),
    9393                        'send_invite'       => 0,
    9494                        'accepted'          => 0
    abstract class BP_Invitation_Manager { 
    215215         *         @type int    $item_id ID associated with the invitation and class.
    216216         *         @type int    $secondary_item_id secondary ID associated with the
    217217         *                              invitation and class.
    218          *         @type string $type @TODO.
     218         *         @type string $type @TODO. < missing description.
    219219         *         @type string $content Extra information provided by the requester
    220220         *                              or inviter.
    221221         *         @type string $date_modified Date the invitation was last modified.
  • src/bp-core/classes/class-bp-invitation.php

    diff --git src/bp-core/classes/class-bp-invitation.php src/bp-core/classes/class-bp-invitation.php
    index 18ec7b27c..bc75bd634 100644
    class BP_Invitation { 
    269269         *
    270270         * @param array $data {
    271271         *     Array of invitation data, passed to {@link wpdb::insert()}.
    272          *         @type int $user_id ID of the invited user.
    273          *         @type int $inviter_id ID of the user who created the invitation.
    274          *         @type string $invitee_email Email address of the invited user.
    275          *         @type string $class Name of the related class.
    276          *         @type int item_id ID associated with the invitation and component.
    277          *         @type int secondary_item_id secondary ID associated with the
    278          *                       invitation and component.
    279          *         @type string content Extra information provided by the requester
    280          *                       or inviter.
    281          *         @type string date_modified Date the invitation was last modified.
    282          *         @type int invite_sent Has the invitation been sent, or is it a
    283          *                       draft invite?
     272         *         @type int    $user_id          ID of the invited user.
     273         *         @type int    $inviter_id        ID of the user who created the invitation.
     274         *         @type string $invitee_email     Email address of the invited user.
     275         *         @type string $class             Name of the related class.
     276         *         @type int    $item_id          ID associated with the invitation and component.
     277         *         @type int    $secondary_item_id Secondary ID associated with the invitation and
     278         *                                    component.
     279         *         @type string $content          Extra information provided by the requester
     280         *                                                 or inviter.
     281         *         @type string $date_modified    Date the invitation was last modified.
     282         *         @type int    $invite_sent       Has the invitation been sent, or is it a draft
     283         *                                    invite?
    284284         * }
    285285         * @param array $data_format See {@link wpdb::insert()}.
    286286         * @return int|false The number of rows inserted, or false on error.
    class BP_Invitation { 
    297297         *
    298298         * @see wpdb::update() for further description of paramater formats.
    299299         *
    300          * @param array $data Array of invitation data to update, passed to
    301          *        {@link wpdb::update()}. Accepts any property of a
    302          *        BP_Invitation object.
    303          * @param array $where The WHERE params as passed to wpdb::update().
    304          *        Typically consists of array( 'ID' => $id ) to specify the ID
    305          *        of the item being updated. See {@link wpdb::update()}.
    306          * @param array $data_format See {@link wpdb::insert()}.
     300         * @param array $data         Array of invitation data to update, passed to
     301         *                            {@link wpdb::update()}. Accepts any property of a
     302         *                            BP_Invitation object.
     303         * @param array $where        The WHERE params as passed to wpdb::update().
     304         *                            Typically consists of array( 'ID' => $id ) to specify the ID
     305         *                            of the item being updated. See {@link wpdb::update()}.
     306         * @param array $data_format  See {@link wpdb::insert()}.
    307307         * @param array $where_format See {@link wpdb::insert()}.
    308308         * @return int|false The number of rows updated, or false on error.
    309309         */
    class BP_Invitation { 
    319319         *
    320320         * @see wpdb::update() for further description of paramater formats.
    321321         *
    322          * @param array $where Array of WHERE clauses to filter by, passed to
    323          *        {@link wpdb::delete()}. Accepts any property of a
    324          *        BP_Invitation object.
     322         * @param array $where        Array of WHERE clauses to filter by, passed to
     323         *                            {@link wpdb::delete()}. Accepts any property of a
     324         *                            BP_Invitation object.
    325325         * @param array $where_format See {@link wpdb::insert()}.
    326326         * @return int|false The number of rows updated, or false on error.
    327327         */
    class BP_Invitation { 
    338338         *
    339339         * @since 5.0.0
    340340         *
    341          * @param array $args See {@link BP_Invitation::get()}
    342          *        for more details.
     341         * @param array $args See {@link BP_Invitation::get()} for more details.
    343342         * @return string WHERE clause.
    344343         */
    345344        protected static function get_where_sql( $args = array() ) {
    class BP_Invitation { 
    462461         *
    463462         * @since 5.0.0
    464463         *
    465          * @param array $args See {@link BP_Invitation::get()}
    466          *        for more details.
     464         * @param array $args See {@link BP_Invitation::get()} for more details.
    467465         * @return string ORDER BY clause.
    468466         */
    469467        protected static function get_order_by_sql( $args = array() ) {
    class BP_Invitation { 
    499497         *
    500498         * @since 5.0.0
    501499         *
    502          * @param array $args See {@link BP_Invitation::get()}
    503          *        for more details.
     500         * @param array $args See {@link BP_Invitation::get()} for more details.
    504501         * @return string LIMIT clause.
    505502         */
    506503        protected static function get_paged_sql( $args = array() ) {
    class BP_Invitation { 
    556553         *
    557554         * @since 5.0.0
    558555         *
    559          * @param $args Associative array of filter arguments.
    560          *        See {@BP_Invitation::get()} for a breakdown.
     556         * @param array $args Associative array of filter arguments.
     557         *                    See {@BP_Invitation::get()} for a breakdown.
    561558         * @return array Associative array of 'data' and 'format' args.
    562559         */
    563560        protected static function get_query_clauses( $args = array() ) {
    class BP_Invitation { 
    847844         *      accepted update/where arguments.
    848845         *
    849846         * @param array $update_args Associative array of fields to update,
    850          *        and the values to update them to. Of the format
    851          *            array( 'user_id' => 4, 'class' => 'BP_Groups_Invitation_Manager', )
    852          * @param array $where_args Associative array of columns/values, to
    853          *        determine which rows should be updated. Of the format
    854          *            array( 'item_id' => 7, 'class' => 'BP_Groups_Invitation_Manager', )
     847         *                           and the values to update them to. Of the format
     848         *                           array( 'user_id' => 4, 'class' => 'BP_Groups_Invitation_Manager', ).
     849         * @param array $where_args  Associative array of columns/values, to
     850         *                           determine which rows should be updated. Of the format
     851         *                           array( 'item_id' => 7, 'class' => 'BP_Groups_Invitation_Manager', ).
    855852         * @return int|bool Number of rows updated on success, false on failure.
    856853         */
    857854        public static function update( $update_args = array(), $where_args = array() ) {
    class BP_Invitation { 
    883880         *      accepted where arguments.
    884881         *
    885882         * @param array $args Associative array of columns/values, to determine
    886          *        which rows should be deleted.  Of the format
    887          *            array( 'item_id' => 7, 'class' => 'BP_Groups_Invitation_Manager', )
     883         *                    which rows should be deleted.  Of the format
     884         *                    array( 'item_id' => 7, 'class' => 'BP_Groups_Invitation_Manager', ).
    888885         * @return int|bool Number of rows deleted on success, false on failure.
    889886         */
    890887        public static function delete( $args = array() ) {
  • src/bp-groups/bp-groups-functions.php

    diff --git src/bp-groups/bp-groups-functions.php src/bp-groups/bp-groups-functions.php
    index b1865ddb6..7bcad1a0a 100644
    function groups_uninvite_user( $user_id, $group_id, $inviter_id = false ) { 
    14911491                'inviter_id' => $inviter_id,
    14921492        ) );
    14931493
    1494         if ( $success ) {
     1494        if ( $success ) {
    14951495                /**
    14961496                 * Fires after uninviting a user from a group.
    14971497                 *
    function groups_reject_invite( $user_id, $group_id, $inviter_id = false ) { 
    15601560         * @since 1.0.0
    15611561         * @since 5.0.0 The $inviter_id arg was added.
    15621562         *
    1563          * @param int $user_id  ID of the user rejecting the invite.
    1564          * @param int $group_id ID of the group being rejected.
     1563         * @param int $user_id    ID of the user rejecting the invite.
     1564         * @param int $group_id   ID of the group being rejected.
    15651565         * @param int $inviter_id ID of the inviter.
    15661566         */
    15671567        do_action( 'groups_reject_invite', $user_id, $group_id, $inviter_id );
    function groups_check_for_membership_request( $user_id, $group_id ) { 
    21882188  * @return array Array of group IDs.
    21892189  */
    21902190 function groups_get_membership_requested_user_ids( $group_id = 0 ) {
    2191         if ( ! $group_id ) {
    2192                 $group_id = bp_get_current_group_id();
    2193         }
     2191        if ( ! $group_id ) {
     2192                $group_id = bp_get_current_group_id();
     2193        }
    21942194
    2195         $requests      = groups_get_requests( array(
     2195        $requests = groups_get_requests( array(
    21962196                'item_id' => $group_id,
    21972197                'fields'  => 'user_ids'
    21982198        ) );
    21992199
    2200         //@TODO-6210: What about those who make a request by email only (not yet site members)?
     2200        /**
     2201         * @TODO-6210: What about those who make a request by email only (not yet site members)?
     2202         */
    22012203        return $requests;
    22022204}
    22032205
  • src/bp-groups/classes/class-bp-groups-group.php

    diff --git src/bp-groups/classes/class-bp-groups-group.php src/bp-groups/classes/class-bp-groups-group.php
    index 8469129a5..dca139318 100644
    class BP_Groups_Group { 
    970970                }
    971971                if ( $page ) {
    972972                        $args['page'] = $page;
    973                 }
     973                }
    974974
    975975                $requests = groups_get_requests( $args );
    976976                $total    = count( groups_get_membership_requested_user_ids( $group_id ) );
  • src/bp-groups/classes/class-bp-groups-invitation-manager.php

    diff --git src/bp-groups/classes/class-bp-groups-invitation-manager.php src/bp-groups/classes/class-bp-groups-invitation-manager.php
    index 9abf2b854..d22cd0977 100644
    class BP_Groups_Invitation_Manager extends BP_Invitation_Manager { 
    2222        /**
    2323         * Construct parameters.
    2424         *
    25          * @since 3.1.0
     25         * @since 5.0.0
    2626         *
    27          * @param array|string $args {
    28 
    29          * }
     27         * @param array|string $args.
    3028         */
    3129        public function __construct( $args = '' ) {
    3230                parent::__construct();
    class BP_Groups_Invitation_Manager extends BP_Invitation_Manager { 
    3634         * This is where custom actions are added to run when notifications of an
    3735         * invitation or request need to be generated & sent.
    3836         *
    39          * @since 2.7.0
     37         * @since 5.0.0
    4038         *
    4139         * @param int $id The ID of the invitation to mark as sent.
    4240         * @return bool True on success, false on failure.
    class BP_Groups_Invitation_Manager extends BP_Invitation_Manager { 
    6361         * This is where custom actions are added to run when an invitation
    6462         * or request is accepted.
    6563         *
    66          * @since 2.7.0
     64         * @since 5.0.0
    6765         *
    6866         * @param string $type Are we accepting an invitation or request?
    6967         * @param array  $r    Parameters that describe the invitation being accepted.
    class BP_Groups_Invitation_Manager extends BP_Invitation_Manager { 
    131129         * With group invitations, we don't need to keep the old record, so we delete rather than
    132130         * mark invitations as "accepted."
    133131         *
    134          * @since 2.7.0
     132         * @since 5.0.0
    135133         *
    136134         * @see BP_Invitation::mark_accepted_by_data()
    137135         *      for a description of arguments.
     136         *
     137         * @param array $args.
    138138         */
    139139        public function mark_accepted( $args ) {
    140140                // Delete all existing invitations/requests to this group for this user.
    class BP_Groups_Invitation_Manager extends BP_Invitation_Manager { 
    149149         * Should this invitation be created?
    150150         *
    151151         * @since 5.0.0
     152         *
     153         * @param array $args.
     154         * @return bool
    152155         */
    153156        public function allow_invitation( $args ) {
    154157                // Does the inviter have this capability?
    class BP_Groups_Invitation_Manager extends BP_Invitation_Manager { 
    173176         * Should this request be created?
    174177         *
    175178         * @since 5.0.0
     179         *
     180         * @param array $args.
     181         * @return bool.
    176182         */
    177183        public function allow_request( $args ) {
    178184                // Does the requester have this capability? (Also checks for duplicates.)
  • src/bp-groups/classes/class-bp-groups-member.php

    diff --git src/bp-groups/classes/class-bp-groups-member.php src/bp-groups/classes/class-bp-groups-member.php
    index dc54b9466..8a6fe86f5 100644
    class BP_Groups_Member { 
    833833                        'where'  => '',
    834834                        'limits' => '',
    835835                );
    836 //@TODO 6210.
     836        /**
     837                 * @TODO 6210. < What has to be done? :)
     838                 */
    837839                switch ( $r['type'] ) {
    838840                        case 'membership' :
    839841                        default :
    class BP_Groups_Member { 
    884886         *
    885887         * @global WPDB $wpdb
    886888         *
    887          * @param  int $user_id  ID of the user.
    888          * @param  int $group_id ID of the group.
     889         * @param  int $user_id    ID of the user.
     890         * @param  int $group_id   ID of the group.
    889891         * @param  int $inviter_id ID of the inviter. Specify if you want to delete
    890892         *                         a specific invite. Leave false if you want to
    891893         *                         delete all invites to this group.
  • src/class-buddypress.php

    diff --git src/class-buddypress.php src/class-buddypress.php
    index ea807f44b..0d195abc5 100644
    class BuddyPress { 
    467467                require( $this->plugin_dir . 'bp-core/bp-core-theme-compatibility.php' );
    468468
    469469                // Require all of the BuddyPress core libraries
    470                 require( $this->plugin_dir . 'bp-core/bp-core-dependency.php'       );
    471                 require( $this->plugin_dir . 'bp-core/bp-core-actions.php'          );
    472                 require( $this->plugin_dir . 'bp-core/bp-core-caps.php'             );
    473                 require( $this->plugin_dir . 'bp-core/bp-core-cache.php'            );
    474                 require( $this->plugin_dir . 'bp-core/bp-core-cssjs.php'            );
    475                 require( $this->plugin_dir . 'bp-core/bp-core-update.php'           );
    476                 require( $this->plugin_dir . 'bp-core/bp-core-options.php'          );
    477                 require( $this->plugin_dir . 'bp-core/bp-core-taxonomy.php'         );
    478                 require( $this->plugin_dir . 'bp-core/bp-core-filters.php'          );
    479                 require( $this->plugin_dir . 'bp-core/bp-core-attachments.php'      );
    480                 require( $this->plugin_dir . 'bp-core/bp-core-avatars.php'          );
    481                 require( $this->plugin_dir . 'bp-core/bp-core-widgets.php'          );
    482                 require( $this->plugin_dir . 'bp-core/bp-core-template.php'         );
    483                 require( $this->plugin_dir . 'bp-core/bp-core-adminbar.php'         );
    484                 require( $this->plugin_dir . 'bp-core/bp-core-buddybar.php'         );
    485                 require( $this->plugin_dir . 'bp-core/bp-core-catchuri.php'         );
    486                 require( $this->plugin_dir . 'bp-core/bp-core-functions.php'        );
    487                 require( $this->plugin_dir . 'bp-core/bp-core-moderation.php'       );
    488                 require( $this->plugin_dir . 'bp-core/bp-core-loader.php'           );
    489                 require( $this->plugin_dir . 'bp-core/bp-core-customizer-email.php' );
     470                require( $this->plugin_dir . 'bp-core/bp-core-dependency.php'        );
     471                require( $this->plugin_dir . 'bp-core/bp-core-actions.php'           );
     472                require( $this->plugin_dir . 'bp-core/bp-core-caps.php'              );
     473                require( $this->plugin_dir . 'bp-core/bp-core-cache.php'             );
     474                require( $this->plugin_dir . 'bp-core/bp-core-cssjs.php'             );
     475                require( $this->plugin_dir . 'bp-core/bp-core-update.php'            );
     476                require( $this->plugin_dir . 'bp-core/bp-core-options.php'           );
     477                require( $this->plugin_dir . 'bp-core/bp-core-taxonomy.php'          );
     478                require( $this->plugin_dir . 'bp-core/bp-core-filters.php'           );
     479                require( $this->plugin_dir . 'bp-core/bp-core-attachments.php'       );
     480                require( $this->plugin_dir . 'bp-core/bp-core-avatars.php'           );
     481                require( $this->plugin_dir . 'bp-core/bp-core-widgets.php'           );
     482                require( $this->plugin_dir . 'bp-core/bp-core-template.php'          );
     483                require( $this->plugin_dir . 'bp-core/bp-core-adminbar.php'          );
     484                require( $this->plugin_dir . 'bp-core/bp-core-buddybar.php'          );
     485                require( $this->plugin_dir . 'bp-core/bp-core-catchuri.php'          );
     486                require( $this->plugin_dir . 'bp-core/bp-core-functions.php'         );
     487                require( $this->plugin_dir . 'bp-core/bp-core-moderation.php'        );
     488                require( $this->plugin_dir . 'bp-core/bp-core-loader.php'            );
     489                require( $this->plugin_dir . 'bp-core/bp-core-customizer-email.php'  );
    490490                require( $this->plugin_dir . 'bp-core/bp-core-invitations-cache.php' );
    491491
    492492                // Maybe load deprecated functionality (this double negative is proof positive!)