Skip to:
Content

BuddyPress.org

Changeset 9490


Ignore:
Timestamp:
02/17/2015 06:23:02 AM (5 years ago)
Author:
tw2113
Message:

Adds hooks documentation for bp-groups-functions.php.

See #5943.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-functions.php

    r9471 r9490  
    5757    $group = new BP_Groups_Group( $r['group_id'], $group_args );
    5858
     59    /**
     60     * Filters a single group object.
     61     *
     62     * @since BuddyPress (1.2.0)
     63     *
     64     * @param BP_Groups_Group $group Single group object.
     65     */
    5966    return apply_filters( 'groups_get_group', $group );
    6067}
     
    161168        groups_update_groupmeta( $group->id, 'last_activity', bp_core_current_time() );
    162169
     170        /**
     171         * Fires after the creation of a new group and a group creator needs to be made.
     172         *
     173         * @since BuddyPress (1.5.0)
     174         *
     175         * @param int              $id     ID of the newly created group.
     176         * @param BP_Groups_Member $member Instance of the member who is assigned
     177         *                                 as group creator.
     178         * @param BP_Groups_Group  $group  Instance of the group being created.
     179         */
    163180        do_action( 'groups_create_group', $group->id, $member, $group );
    164181
    165182    } else {
     183
     184        /**
     185         * Fires after the update of a group.
     186         *
     187         * @since BuddyPress (1.5.0)
     188         *
     189         * @param int             $id    ID of the updated group.
     190         * @param BP_Groups_Group $group Instance of the group being updated.
     191         */
    166192        do_action( 'groups_update_group', $group->id, $group );
    167193    }
    168194
     195    /**
     196     * Fires after the creation of a group.
     197     *
     198     * @since BuddyPress (1.0.0)
     199     *
     200     * @param int             $id    ID of the newly created group.
     201     * @param BP_Groups_Group $group Instance of the group being updated.
     202     */
    169203    do_action( 'groups_created_group', $group->id, $group );
    170204
     
    260294
    261295    groups_update_groupmeta( $group->id, 'last_activity', bp_core_current_time() );
     296
     297    /**
     298     * Fires after the update of a groups settings.
     299     *
     300     * @since BuddyPress (1.0.0)
     301     *
     302     * @param int $id ID of the group that was updated.
     303     */
    262304    do_action( 'groups_settings_updated', $group->id );
    263305
     
    275317function groups_delete_group( $group_id ) {
    276318
     319    /**
     320     * Fires before the deletion of a group.
     321     *
     322     * @since BuddyPress (1.5.0)
     323     *
     324     * @param int $group_id ID of the group to be deleted.
     325     */
    277326    do_action( 'groups_before_delete_group', $group_id );
    278327
     
    288337    groups_delete_all_group_invites( $group_id );
    289338
     339    /**
     340     * Fires after the deletion of a group.
     341     *
     342     * @since BuddyPress (1.0.0)
     343     *
     344     * @param int $group_id ID of the group that was deleted.
     345     */
    290346    do_action( 'groups_delete_group', $group_id );
    291347
     
    383439    bp_core_add_message( __( 'You successfully left the group.', 'buddypress' ) );
    384440
     441    /**
     442     * Fires after a user leaves a group.
     443     *
     444     * @since BuddyPress (1.0.0)
     445     *
     446     * @param int $group_id ID of the group.
     447     * @param int $user_id  ID of the user leaving the group.
     448     */
    385449    do_action( 'groups_leave_group', $group_id, $user_id );
    386450
     
    442506    groups_update_groupmeta( $group_id, 'last_activity', bp_core_current_time() );
    443507
     508    /**
     509     * Fires after a user joins a group.
     510     *
     511     * @since BuddyPress (1.0.0)
     512     *
     513     * @param int $group_id ID of the group.
     514     * @param int $user_id  ID of the user joining the group.
     515     */
    444516    do_action( 'groups_join_group', $group_id, $user_id );
    445517
     
    635707    ) );
    636708
     709    /**
     710     * Filters the collection of groups based on parsed parameters.
     711     *
     712     * @since BuddyPress (1.2.0)
     713     *
     714     *
     715     * @param BP_Groups_Group $groups Object of found groups based on parameters.
     716     *                                Passed by reference.
     717     * @param array           $r      Array of parsed arguments used for group query.
     718     *                                Passed by reference.
     719     */
    637720    return apply_filters_ref_array( 'groups_get_groups', array( &$groups, &$r ) );
    638721}
     
    710793        : false;
    711794
     795    /**
     796     * Filters the BP_Groups_Group object corresponding to the current group.
     797     *
     798     * @since BuddyPress (1.5.0)
     799     *
     800     * @param BP_Groups_Group $current_group Current BP_Groups_Group object.
     801     */
    712802    return apply_filters( 'groups_get_current_group', $current_group );
    713803}
     
    738828    $newsubdir = '/group-avatars/' . $group_id;
    739829
     830    /**
     831     * Filters the avatar upload directory path for a given group.
     832     *
     833     * @since BuddyPress (1.1.0)
     834     *
     835     * @param array $value Array of parts related to the groups avatar upload directory.
     836     */
    740837    return apply_filters( 'groups_avatar_upload_dir', array( 'path' => $path, 'url' => $newurl, 'subdir' => $newsubdir, 'basedir' => $newbdir, 'baseurl' => $newburl, 'error' => false ) );
    741838}
     
    838935    $activity_content = $content;
    839936
     937    /**
     938     * Filters the action for the new group activity update.
     939     *
     940     * @since BuddyPress (1.2.0)
     941     *
     942     * @param string $activity_action The new group activity update.
     943     */
     944    $action = apply_filters( 'groups_activity_new_update_action',  $activity_action  );
     945
     946    /**
     947     * Filters the content for the new group activity update.
     948     *
     949     * @since BuddyPress (1.2.0)
     950     *
     951     * @param string $activity_content The content of the update.
     952     */
     953    $content_filtered = apply_filters( 'groups_activity_new_update_content', $activity_content );
     954
    840955    $activity_id = groups_record_activity( array(
    841956        'user_id' => $user_id,
    842         'action'  => apply_filters( 'groups_activity_new_update_action',  $activity_action  ),
    843         'content' => apply_filters( 'groups_activity_new_update_content', $activity_content ),
     957        'action'  => $action,
     958        'content' => $content_filtered,
    844959        'type'    => 'activity_update',
    845960        'item_id' => $group_id
     
    847962
    848963    groups_update_groupmeta( $group_id, 'last_activity', bp_core_current_time() );
     964
     965    /**
     966     * Fires after posting of an Activity status update affiliated with a group.
     967     *
     968     * @since BuddyPress (1.2.0)
     969     *
     970     * @param string $content     The content of the update.
     971     * @param int    $user_id     ID of the user posting the update.
     972     * @param int    $group_id    ID of the group being posted to.
     973     * @param bool   $activity_id Whether or not the activity recording succeeded.
     974     */
    849975    do_action( 'bp_groups_posted_update', $content, $user_id, $group_id, $activity_id );
    850976
     
    9341060            return false;
    9351061
     1062        /**
     1063         * Fires after the creation of a new group invite.
     1064         *
     1065         * @since BuddyPress (1.0.0)
     1066         *
     1067         * @param array $args Array of parsed arguments for the group invite.
     1068         */
    9361069        do_action( 'groups_invite_user', $args );
    9371070    }
     
    9541087        return false;
    9551088
     1089    /**
     1090     * Fires after uninviting a user from a group.
     1091     *
     1092     * @since BuddyPress (1.0.0)
     1093     *
     1094     * @param int $group_id ID of the group being uninvited from.
     1095     * @param int $user_id  ID of the user being uninvited.
     1096     */
    9561097    do_action( 'groups_uninvite_user', $group_id, $user_id );
    9571098
     
    9991140    groups_update_groupmeta( $group_id, 'last_activity', bp_core_current_time() );
    10001141
     1142    /**
     1143     * Fires after a user has accepted a group invite.
     1144     *
     1145     * @since BuddyPress (1.0.0)
     1146     *
     1147     * @param int $user_id  ID of the user who accepted the group invite.
     1148     * @param int $group_id ID of the group being accepted to.
     1149     */
    10011150    do_action( 'groups_accept_invite', $user_id, $group_id );
    10021151
     
    10151164        return false;
    10161165
     1166    /**
     1167     * Fires after a user rejects a group invitation.
     1168     *
     1169     * @since BuddyPress (1.0.0)
     1170     *
     1171     * @param int $user_id  ID of the user rejecting the invite.
     1172     * @param int $group_id ID of the group being rejected.
     1173     */
    10171174    do_action( 'groups_reject_invite', $user_id, $group_id );
    10181175
     
    10311188        return false;
    10321189
     1190    /**
     1191     * Fires after the deletion of a group invitation.
     1192     *
     1193     * @since BuddyPress (1.9.0)
     1194     *
     1195     * @param int $user_id  ID of the user whose invitation is being deleted.
     1196     * @param int $group_id ID of the group whose invitation is being deleted.
     1197     */
    10331198    do_action( 'groups_delete_invite', $user_id, $group_id );
    10341199
     
    10611226    }
    10621227
     1228    /**
     1229     * Fires after the sending of invites for a group.
     1230     *
     1231     * @since BuddyPress (1.0.0)
     1232     *
     1233     * @param int   $group_id      ID of the group who's being invited to.
     1234     * @param array $invited_users Array of users being invited to the group.
     1235     */
    10631236    do_action( 'groups_send_invites', $group_id, $invited_users );
    10641237}
     
    11231296    do_action( 'groups_premote_member', $group_id, $user_id, $status );
    11241297
    1125     // Use this action instead.
     1298    /**
     1299     * Fires before the promotion of a user to a new status.
     1300     *
     1301     * @since BuddyPress (1.6.0)
     1302     *
     1303     * @param int    $group_id ID of the group being promoted in.
     1304     * @param int    $user_id  ID of the user being promoted.
     1305     * @param string $status   New status being promoted to.
     1306     */
    11261307    do_action( 'groups_promote_member', $group_id, $user_id, $status );
    11271308
     
    11431324    $member = new BP_Groups_Member( $user_id, $group_id );
    11441325
     1326    /**
     1327     * Fires before the demotion of a user to 'member'.
     1328     *
     1329     * @since BuddyPress (1.0.0)
     1330     *
     1331     * @param int $group_id ID of the group being demoted in.
     1332     * @param int $user_id  ID of the user being demoted.
     1333     */
    11451334    do_action( 'groups_demote_member', $group_id, $user_id );
    11461335
     
    11621351    $member = new BP_Groups_Member( $user_id, $group_id );
    11631352
     1353    /**
     1354     * Fires before the banning of a member from a group.
     1355     *
     1356     * @since BuddyPress (1.0.0)
     1357     *
     1358     * @param int $group_id ID of the group being banned from.
     1359     * @param int $user_id  ID of the user being banned.
     1360     */
    11641361    do_action( 'groups_ban_member', $group_id, $user_id );
    11651362
     
    11811378    $member = new BP_Groups_Member( $user_id, $group_id );
    11821379
     1380    /**
     1381     * Fires before the unbanning of a member from a group.
     1382     *
     1383     * @since BuddyPress (1.0.0)
     1384     *
     1385     * @param int $group_id ID of the group being unbanned from.
     1386     * @param int $user_id  ID of the user being unbanned.
     1387     */
    11831388    do_action( 'groups_unban_member', $group_id, $user_id );
    11841389
     
    12021407    $member = new BP_Groups_Member( $user_id, $group_id );
    12031408
     1409    /**
     1410     * Fires before the removal of a member from a group.
     1411     *
     1412     * @since BuddyPress (1.2.6)
     1413     *
     1414     * @param int $group_id ID of the group being removed from.
     1415     * @param int $user_id  ID of the user being removed.
     1416     */
    12041417    do_action( 'groups_remove_member', $group_id, $user_id );
    12051418
     
    12491462            groups_notification_new_membership_request( $requesting_user_id, $admins[$i]->user_id, $group_id, $requesting_user->id );
    12501463
     1464        /**
     1465         * Fires after the creation of a new membership request.
     1466         *
     1467         * @since BuddyPress (1.0.0)
     1468         *
     1469         * @param int   $requesting_user_id  ID of the user requesting membership.
     1470         * @param array $admins              Array of group admins.
     1471         * @param int   $group_id            ID of the group being requested to.
     1472         * @param int   $requesting_user->id ID of the user requesting membership.
     1473         */
    12511474        do_action( 'groups_membership_requested', $requesting_user_id, $admins, $group_id, $requesting_user->id );
    12521475
     
    12871510    }
    12881511
     1512    /**
     1513     * Fires after a group membership request has been accepted.
     1514     *
     1515     * @since BuddyPress (1.0.0)
     1516     *
     1517     * @param int  $user_id  ID of the user who accepted membership.
     1518     * @param int  $group_id ID of the group that was accepted membership to.
     1519     * @param bool $value    If membership was accepted.
     1520     */
    12891521    do_action( 'groups_membership_accepted', $membership->user_id, $membership->group_id, true );
    12901522
     
    13081540    }
    13091541
     1542    /**
     1543     * Fires after a group membership request has been rejected.
     1544     *
     1545     * @since BuddyPress (1.0.0)
     1546     *
     1547     * @param int  $user_id  ID of the user who rejected membership.
     1548     * @param int  $group_id ID of the group that was rejected membership to.
     1549     * @param bool $value    If membership was accepted.
     1550     */
    13101551    do_action( 'groups_membership_rejected', $membership->user_id, $membership->group_id, false );
    13111552
     
    13621603        groups_accept_membership_request( false, $user_id, $group_id );
    13631604
     1605    /**
     1606     * Fires after the acceptance of all pending membership requests to a group.
     1607     *
     1608     * @since BuddyPress (1.0.2)
     1609     *
     1610     * @param int $group_id ID of the group whose pending memberships were accepted.
     1611     */
    13641612    do_action( 'groups_accept_all_pending_membership_requests', $group_id );
    13651613
     
    14801728    BP_Groups_Member::delete_all_for_user( $user_id );
    14811729
     1730    /**
     1731     * Fires after the deletion of all data for a user.
     1732     *
     1733     * @since BuddyPress (1.1.0)
     1734     *
     1735     * @param int $user_id ID of the user whose data is being deleted.
     1736     */
    14821737    do_action( 'groups_remove_data_for_user', $user_id );
    14831738}
Note: See TracChangeset for help on using the changeset viewer.