Skip to:
Content

BuddyPress.org

Changeset 9511


Ignore:
Timestamp:
02/18/2015 03:44:20 AM (5 years ago)
Author:
tw2113
Message:

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

See #5943.

File:
1 edited

Legend:

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

    r9471 r9511  
    2222        bp_update_is_directory( true, 'groups' );
    2323
     24        /**
     25         * Fires before the loading of the Groups directory index.
     26         *
     27         * @since BuddyPress (1.1.0)
     28         */
    2429        do_action( 'groups_directory_groups_setup' );
    2530
     31        /**
     32         * Filters the template to load for the Groups directory index.
     33         *
     34         * @since BuddyPress (1.0.0)
     35         *
     36         * @param string $value Path to the groups directory index template to load.
     37         */
    2638        bp_core_load_template( apply_filters( 'groups_template_directory_groups', 'groups/index' ) );
    2739    }
     
    3446function groups_screen_my_groups() {
    3547
     48    /**
     49     * Fires before the loading of the My Groups page.
     50     *
     51     * @since BuddyPress (1.1.0)
     52     */
    3653    do_action( 'groups_screen_my_groups' );
    3754
     55    /**
     56     * Filters the template to load for the My Groups page.
     57     *
     58     * @since BuddyPress (1.0.0)
     59     *
     60     * @param string $value Path to the My Groups page template to load.
     61     */
    3862    bp_core_load_template( apply_filters( 'groups_template_my_groups', 'members/single/home' ) );
    3963}
     
    92116    }
    93117
     118    /**
     119     * Fires before the loading of a users Groups > Invites template.
     120     *
     121     * @since BuddyPress (1.0.0)
     122     *
     123     * @param int $group_id ID of the group being displayed
     124     */
    94125    do_action( 'groups_screen_group_invites', $group_id );
    95126
     127    /**
     128     * Filters the template to load for a users Groups > Invites page.
     129     *
     130     * @since BuddyPress (1.0.0)
     131     *
     132     * @param string $value Path to a users Groups > Invites page template.
     133     */
    96134    bp_core_load_template( apply_filters( 'groups_template_group_invites', 'members/single/home' ) );
    97135}
     
    106144    }
    107145
     146    /**
     147     * Fires before the loading of a single group's page.
     148     *
     149     * @since BuddyPress (1.0.0)
     150     */
    108151    do_action( 'groups_screen_group_home' );
    109152
     153    /**
     154     * Filters the template to load for a single group's page.
     155     *
     156     * @since BuddyPress (1.0.0)
     157     *
     158     * @param string $value Path to a single group's template to load.
     159     */
    110160    bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/single/home' ) );
    111161}
     
    190240            }
    191241
     242            /**
     243             * Fires after a group forum topic has been stickied.
     244             *
     245             * @since BuddyPress (1.1.0)
     246             *
     247             * @param int $topic_id ID of the topic being stickied.
     248             */
    192249            do_action( 'groups_stick_forum_topic', $topic_id );
    193250            bp_core_redirect( wp_get_referer() );
     
    205262            }
    206263
     264            /**
     265             * Fires after a group forum topic has been un-stickied.
     266             *
     267             * @since BuddyPress (1.1.0)
     268             *
     269             * @param int $topic_id ID of the topic being un-stickied.
     270             */
    207271            do_action( 'groups_unstick_forum_topic', $topic_id );
    208272            bp_core_redirect( wp_get_referer() );
     
    220284            }
    221285
     286            /**
     287             * Fires after a group forum topic has been closed.
     288             *
     289             * @since BuddyPress (1.1.0)
     290             *
     291             * @param int $topic_id ID of the topic being closed.
     292             */
    222293            do_action( 'groups_close_forum_topic', $topic_id );
    223294            bp_core_redirect( wp_get_referer() );
     
    235306            }
    236307
     308            /**
     309             * Fires after a group forum topic has been opened.
     310             *
     311             * @since BuddyPress (1.1.0)
     312             *
     313             * @param int $topic_id ID of the topic being opened.
     314             */
    237315            do_action( 'groups_open_forum_topic', $topic_id );
    238316            bp_core_redirect( wp_get_referer() );
     
    252330            check_admin_referer( 'bp_forums_delete_topic' );
    253331
     332            /**
     333             * Fires before a group forum topic is deleted.
     334             *
     335             * @since BuddyPress (1.5.0)
     336             *
     337             * @param int $topic_id ID of the topic being deleted.
     338             */
    254339            do_action( 'groups_before_delete_forum_topic', $topic_id );
    255340
     
    260345            }
    261346
     347            /**
     348             * Fires after a group forum topic has been deleted.
     349             *
     350             * @since BuddyPress (1.5.0)
     351             *
     352             * @param int $topic_id ID of the topic being deleted.
     353             */
    262354            do_action( 'groups_delete_forum_topic', $topic_id );
    263355            bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'forum/' );
     
    286378                }
    287379
     380                /**
     381                 * Fires after a group forum topic has been edited.
     382                 *
     383                 * @since BuddyPress (1.1.0)
     384                 *
     385                 * @param int $topic_id ID of the topic being edited.
     386                 */
    288387                do_action( 'groups_edit_forum_topic', $topic_id );
    289388                bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic_slug . '/' );
    290389            }
    291390
     391            /**
     392             * Filters the template to load for a topic edit page.
     393             *
     394             * @since BuddyPress (1.1.0)
     395             *
     396             * @param string $value Path to a topic edit template.
     397             */
    292398            bp_core_load_template( apply_filters( 'groups_template_group_forum_topic_edit', 'groups/single/home' ) );
    293399
     
    305411            check_admin_referer( 'bp_forums_delete_post' );
    306412
     413            /**
     414             * Fires before the deletion of a group forum post.
     415             *
     416             * @since BuddyPress (1.5.0)
     417             *
     418             * @param int $post_id ID of the forum post being deleted.
     419             */
    307420            do_action( 'groups_before_delete_forum_post', $post_id );
    308421
     
    313426            }
    314427
     428            /**
     429             * Fires after the deletion of a group forum post.
     430             *
     431             * @since BuddyPress (1.1.0)
     432             *
     433             * @param int $post_id ID of the forum post being deleted.
     434             */
    315435            do_action( 'groups_delete_forum_post', $post_id );
    316436            bp_core_redirect( wp_get_referer() );
     
    343463                }
    344464
     465                /**
     466                 * Fires after the editing of a group forum post.
     467                 *
     468                 * @since BuddyPress (1.1.0)
     469                 *
     470                 * @param int $post_id ID of the forum post being edited.
     471                 */
    345472                do_action( 'groups_edit_forum_post', $post_id );
    346473                bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic_slug . '/' . $query_vars . '#post-' . $post_id );
    347474            }
    348475
     476            /** This filter is documented in bp-groups/bp-groups-screens.php */
    349477            bp_core_load_template( apply_filters( 'groups_template_group_forum_topic_edit', 'groups/single/home' ) );
    350478
     
    355483            }
    356484
     485            /**
     486             * Filters the template to load for a topic page.
     487             *
     488             * @since BuddyPress (1.1.0)
     489             *
     490             * @param string $value Path to a topic template.
     491             */
    357492            bp_core_load_template( apply_filters( 'groups_template_group_forum_topic', 'groups/single/home' ) );
    358493        }
     
    404539        }
    405540
     541        /**
     542         * Fires at the end of the group forum screen loading process.
     543         *
     544         * @since BuddyPress (1.0.0)
     545         *
     546         * @param int $topic_id ID of the topic being displayed.
     547         * @param int $forum_id ID of the forum being displayed.
     548         */
    406549        do_action( 'groups_screen_group_forum', $topic_id, $forum_id );
    407550
     551        /**
     552         * Filters the template to load for a group forum page.
     553         *
     554         * @since BuddyPress (1.0.0)
     555         *
     556         * @param string $value Path to a group forum template.
     557         */
    408558        bp_core_load_template( apply_filters( 'groups_template_group_forum', 'groups/single/home' ) );
    409559    }
     
    423573    groups_update_groupmeta( $bp->groups->current_group->id, 'total_member_count', groups_get_total_member_count( $bp->groups->current_group->id ) );
    424574
     575    /**
     576     * Fires before the loading of a group's Members page.
     577     *
     578     * @since BuddyPress (1.0.0)
     579     *
     580     * @param int $id ID of the group whose members are being displayed.
     581     */
    425582    do_action( 'groups_screen_group_members', $bp->groups->current_group->id );
     583
     584    /**
     585     * Filters the template to load for a group's Members page.
     586     *
     587     * @since BuddyPress (1.0.0)
     588     *
     589     * @param string $value Path to a group's Members template.
     590     */
    426591    bp_core_load_template( apply_filters( 'groups_template_group_members', 'groups/single/home' ) );
    427592}
     
    451616        groups_send_invites( bp_loggedin_user_id(), $bp->groups->current_group->id );
    452617        bp_core_add_message( __('Group invites sent.', 'buddypress') );
     618
     619        /**
     620         * Fires after the sending of a group invite inside the group's Send Invites page.
     621         *
     622         * @since BuddyPress (1.0.0)
     623         *
     624         * @param int $id ID of the group whose members are being displayed.
     625         */
    453626        do_action( 'groups_screen_group_invite', $bp->groups->current_group->id );
    454627        bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
    455628
    456629    } elseif ( !bp_action_variable( 0 ) ) {
    457         // Show send invite page
     630
     631        /**
     632         * Filters the template to load for a group's Send Invites page.
     633         *
     634         * @since BuddyPress (1.0.0)
     635         *
     636         * @param string $value Path to a group's Send Invites template.
     637         */
    458638        bp_core_load_template( apply_filters( 'groups_template_group_invite', 'groups/single/home' ) );
    459639
     
    543723    }
    544724
     725    /**
     726     * Fires before the loading of a group's Request Memebership page.
     727     *
     728     * @since BuddyPress (1.0.0)
     729     *
     730     * @param int $id ID of the group currently being displayed.
     731     */
    545732    do_action( 'groups_screen_group_request_membership', $bp->groups->current_group->id );
    546733
     734    /**
     735     * Filters the template to load for a group's Request Membership page.
     736     *
     737     * @since BuddyPress (1.0.0)
     738     *
     739     * @param string $value Path to a group's Request Membership template.
     740     */
    547741    bp_core_load_template( apply_filters( 'groups_template_group_request_membership', 'groups/single/home' ) );
    548742}
     
    558752    buddypress()->is_single_item = true;
    559753
     754    /** This filter is documented in bp-groups/bp-groups-screens.php */
    560755    bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/single/home' ) );
    561756}
     
    601796            }
    602797
     798            /**
     799             * Fires before the redirect if a group details has been edited and saved.
     800             *
     801             * @since BuddyPress (1.0.0)
     802             *
     803             * @param int $id ID of the group that was edited.
     804             */
    603805            do_action( 'groups_group_details_edited', $bp->groups->current_group->id );
    604806
     
    606808        }
    607809
     810        /**
     811         * Fires before the loading of the group admin/edit-details page template.
     812         *
     813         * @since BuddyPress (1.0.0)
     814         *
     815         * @param int $id ID of the group that is being displayed.
     816         */
    608817        do_action( 'groups_screen_group_admin_edit_details', $bp->groups->current_group->id );
    609818
     819        /**
     820         * Filters the template to load for a group's admin/edit-details page.
     821         *
     822         * @since BuddyPress (1.0.0)
     823         *
     824         * @param string $value Path to a group's admin/edit-details template.
     825         */
    610826        bp_core_load_template( apply_filters( 'groups_template_group_admin', 'groups/single/home' ) );
    611827    }
     
    631847
    632848        // Checked against a whitelist for security
     849        /** This filter is documented in bp-groups/bp-groups-admin.php */
    633850        $allowed_status = apply_filters( 'groups_allowed_status', array( 'public', 'private', 'hidden' ) );
    634851        $status         = ( in_array( $_POST['group-status'], (array) $allowed_status ) ) ? $_POST['group-status'] : 'public';
    635852
    636853        // Checked against a whitelist for security
     854        /** This filter is documented in bp-groups/bp-groups-admin.php */
    637855        $allowed_invite_status = apply_filters( 'groups_allowed_invite_status', array( 'members', 'mods', 'admins' ) );
    638856        $invite_status         = isset( $_POST['group-invite-status'] ) && in_array( $_POST['group-invite-status'], (array) $allowed_invite_status ) ? $_POST['group-invite-status'] : 'members';
     
    648866        }
    649867
     868        /**
     869         * Fires before the redirect if a group settings has been edited and saved.
     870         *
     871         * @since BuddyPress (1.0.0)
     872         *
     873         * @param int $id ID of the group that was edited.
     874         */
    650875        do_action( 'groups_group_settings_edited', $bp->groups->current_group->id );
    651876
     
    653878    }
    654879
     880    /**
     881     * Fires before the loading of the group admin/group-settings page template.
     882     *
     883     * @since BuddyPress (1.0.0)
     884     *
     885     * @param int $id ID of the group that is being displayed.
     886     */
    655887    do_action( 'groups_screen_group_admin_settings', $bp->groups->current_group->id );
    656888
     889    /**
     890     * Filters the template to load for a group's admin/group-settings page.
     891     *
     892     * @since BuddyPress (1.0.0)
     893     *
     894     * @param string $value Path to a group's admin/group-settings template.
     895     */
    657896    bp_core_load_template( apply_filters( 'groups_template_group_admin_settings', 'groups/single/home' ) );
    658897}
     
    731970    }
    732971
     972    /**
     973     * Fires before the loading of the group Change Avatar page template.
     974     *
     975     * @since BuddyPress (1.0.0)
     976     *
     977     * @param int $id ID of the group that is being displayed.
     978     */
    733979    do_action( 'groups_screen_group_admin_avatar', $bp->groups->current_group->id );
    734980
     981    /**
     982     * Filters the template to load for a group's Change Avatar page.
     983     *
     984     * @since BuddyPress (1.0.0)
     985     *
     986     * @param string $value Path to a group's Change Avatar template.
     987     */
    735988    bp_core_load_template( apply_filters( 'groups_template_group_admin_avatar', 'groups/single/home' ) );
    736989}
     
    7651018                bp_core_add_message( __( 'User promoted successfully', 'buddypress' ) );
    7661019
     1020            /**
     1021             * Fires before the redirect after a group member has been promoted.
     1022             *
     1023             * @since BuddyPress (1.0.0)
     1024             *
     1025             * @param int $user_id ID of the user being promoted.
     1026             * @param int $id      ID of the group user is promoted within.
     1027             */
    7671028            do_action( 'groups_promoted_member', $user_id, $bp->groups->current_group->id );
    7681029
     
    7901051                bp_core_add_message( __( 'User demoted successfully', 'buddypress' ) );
    7911052
     1053            /**
     1054             * Fires before the redirect after a group member has been demoted.
     1055             *
     1056             * @since BuddyPress (1.0.0)
     1057             *
     1058             * @param int $user_id ID of the user being demoted.
     1059             * @param int $id      ID of the group user is demoted within.
     1060             */
    7921061            do_action( 'groups_demoted_member', $user_id, $bp->groups->current_group->id );
    7931062
     
    8081077                bp_core_add_message( __( 'User banned successfully', 'buddypress' ) );
    8091078
     1079            /**
     1080             * Fires before the redirect after a group member has been banned.
     1081             *
     1082             * @since BuddyPress (1.0.0)
     1083             *
     1084             * @param int $user_id ID of the user being banned.
     1085             * @param int $id      ID of the group user is banned from.
     1086             */
    8101087            do_action( 'groups_banned_member', $user_id, $bp->groups->current_group->id );
    8111088
     
    8261103                bp_core_add_message( __( 'User ban removed successfully', 'buddypress' ) );
    8271104
     1105            /**
     1106             * Fires before the redirect after a group member has been unbanned.
     1107             *
     1108             * @since BuddyPress (1.0.0)
     1109             *
     1110             * @param int $user_id ID of the user being unbanned.
     1111             * @param int $id      ID of the group user is unbanned from.
     1112             */
    8281113            do_action( 'groups_unbanned_member', $user_id, $bp->groups->current_group->id );
    8291114
     
    8441129                bp_core_add_message( __( 'User removed successfully', 'buddypress' ) );
    8451130
     1131            /**
     1132             * Fires before the redirect after a group member has been removed.
     1133             *
     1134             * @since BuddyPress (1.2.6)
     1135             *
     1136             * @param int $user_id ID of the user being removed.
     1137             * @param int $id      ID of the group the user is removed from.
     1138             */
    8461139            do_action( 'groups_removed_member', $user_id, $bp->groups->current_group->id );
    8471140
     
    8501143    }
    8511144
     1145    /**
     1146     * Fires before the loading of a group's manage members template.
     1147     *
     1148     * @since BuddyPress (1.0.0)
     1149     *
     1150     * @param int $id ID of the group whose manage members page is being displayed.
     1151     */
    8521152    do_action( 'groups_screen_group_admin_manage_members', $bp->groups->current_group->id );
    8531153
     1154    /**
     1155     * Filters the template to load for a group's manage members page.
     1156     *
     1157     * @since BuddyPress (1.0.0)
     1158     *
     1159     * @param string $value Path to a group's manage members template.
     1160     */
    8541161    bp_core_load_template( apply_filters( 'groups_template_group_admin_manage_members', 'groups/single/home' ) );
    8551162}
     
    8981205        }
    8991206
     1207        /**
     1208         * Fires before the redirect if a group membership request has been handled.
     1209         *
     1210         * @since BuddyPress (1.0.0)
     1211         *
     1212         * @param int    $id             ID of the group that was edited.
     1213         * @param string $request_action Membership request action being performed.
     1214         * @param int    $membership_id  The key of the action_variables array that you want.
     1215         */
    9001216        do_action( 'groups_group_request_managed', $bp->groups->current_group->id, $request_action, $membership_id );
    9011217        bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'admin/membership-requests/' );
    9021218    }
    9031219
     1220    /**
     1221     * Fires before the loading of the group membership request page template.
     1222     *
     1223     * @since BuddyPress (1.0.0)
     1224     *
     1225     * @param int $id ID of the group that is being displayed.
     1226     */
    9041227    do_action( 'groups_screen_group_admin_requests', $bp->groups->current_group->id );
     1228
     1229    /**
     1230     * Filters the template to load for a group's membership request page.
     1231     *
     1232     * @since BuddyPress (1.0.0)
     1233     *
     1234     * @param string $value Path to a group's membership request template.
     1235     */
    9051236    bp_core_load_template( apply_filters( 'groups_template_group_admin_requests', 'groups/single/home' ) );
    9061237}
     
    9271258        }
    9281259
     1260        /**
     1261         * Fires before the deletion of a group from the Delete Group page.
     1262         *
     1263         * @since BuddyPress (1.5.0)
     1264         *
     1265         * @param int $id ID of the group being deleted.
     1266         */
    9291267        do_action( 'groups_before_group_deleted', $bp->groups->current_group->id );
    9301268
     
    9351273            bp_core_add_message( __( 'The group was deleted successfully', 'buddypress' ) );
    9361274
     1275            /**
     1276             * Fires after the deletion of a group from the Delete Group page.
     1277             *
     1278             * @since BuddyPress (1.0.0)
     1279             *
     1280             * @param int $id ID of the group being deleted.
     1281             */
    9371282            do_action( 'groups_group_deleted', $bp->groups->current_group->id );
    9381283
     
    9431288    }
    9441289
     1290    /**
     1291     * Fires before the loading of the Delete Group page template.
     1292     *
     1293     * @since BuddyPress (1.0.0)
     1294     *
     1295     * @param int $id ID of the group that is being displayed.
     1296     */
    9451297    do_action( 'groups_screen_group_admin_delete_group', $bp->groups->current_group->id );
    9461298
     1299    /**
     1300     * Filters the template to load for the Delete Group page.
     1301     *
     1302     * @since BuddyPress (1.0.0)
     1303     *
     1304     * @param string $value Path to the Delete Group template.
     1305     */
    9471306    bp_core_load_template( apply_filters( 'groups_template_group_admin_delete_group', 'groups/single/home' ) );
    9481307}
     
    10021361            </tr>
    10031362
    1004             <?php do_action( 'groups_screen_notification_settings' ); ?>
     1363            <?php
     1364
     1365            /**
     1366             * Fires at the end of the available group settings fields on Notification Settings page.
     1367             *
     1368             * @since BuddyPress (1.0.0)
     1369             */
     1370            do_action( 'groups_screen_notification_settings' ); ?>
    10051371
    10061372        </tbody>
     
    10471413            bp_update_is_directory( true, 'groups' );
    10481414
     1415            /**
     1416             * Fires at the start of the group theme compatibility setup.
     1417             *
     1418             * @since BuddyPress (1.1.0)
     1419             */
    10491420            do_action( 'groups_directory_groups_setup' );
    10501421
     
    10821453     */
    10831454    public function directory_template_hierarchy( $templates ) {
    1084         // Setup our templates based on priority
     1455
     1456        /**
     1457         * Filters the Groups directory page template hierarchy based on priority.
     1458         *
     1459         * @since BuddyPress (1.8.0)
     1460         *
     1461         * @param array $value Array of default template files to use.
     1462         */
    10851463        $new_templates = apply_filters( 'bp_template_hierarchy_groups_directory', array(
    10861464            'groups/index-directory.php'
     
    11361514     */
    11371515    public function create_template_hierarchy( $templates ) {
    1138         // Setup our templates based on priority
     1516
     1517        /**
     1518         * Filters the Groups create page template hierarchy based on priority.
     1519         *
     1520         * @since BuddyPress (1.8.0)
     1521         *
     1522         * @param array $value Array of default template files to use.
     1523         */
    11391524        $new_templates = apply_filters( 'bp_template_hierarchy_groups_create', array(
    11401525            'groups/index-create.php'
     
    11961581        $group = groups_get_current_group();
    11971582
    1198         // Setup our templates based on priority
     1583        /**
     1584         * Filters the Groups single pages template hierarchy based on priority.
     1585         *
     1586         * @since BuddyPress (1.8.0)
     1587         *
     1588         * @param array $value Array of default template files to use.
     1589         */
    11991590        $new_templates = apply_filters( 'bp_template_hierarchy_groups_single_item', array(
    12001591            'groups/single/index-id-'     . sanitize_file_name( bp_get_current_group_id() )   . '.php',
Note: See TracChangeset for help on using the changeset viewer.