Skip to:
Content

BuddyPress.org

Changeset 9112


Ignore:
Timestamp:
10/30/2014 11:58:29 PM (10 years ago)
Author:
boonebgorges
Message:

Hook documentation for bp-activity-loader.php and bp-activity-screens.php.

Props tw2113.
See #5938.

Location:
trunk/src/bp-activity
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-loader.php

    r8754 r9112  
    6161        // Load Akismet support if Akismet is configured
    6262        $akismet_key = bp_get_option( 'wordpress_api_key' );
     63
     64        /** This filter is documented in bp-activity/bp-activity-actions.php */
    6365        if ( defined( 'AKISMET_VERSION' ) && ( !empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) && apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {
    6466            $includes[] = 'akismet';
  • trunk/src/bp-activity/bp-activity-screens.php

    r9062 r9112  
    1818 * Load the Activity directory.
    1919 *
    20  * @since BuddyPress (1.5)
     20 * @since BuddyPress (1.5.0)
    2121 *
    2222 * @uses bp_displayed_user_id()
     
    3232        bp_update_is_directory( true, 'activity' );
    3333
     34        /**
     35         * Fires right before the loading of the Activity directory screen template file.
     36         *
     37         * @since BuddyPress (1.5.0)
     38         */
    3439        do_action( 'bp_activity_screen_index' );
    3540
     41        /**
     42         * Filters the template to load for the Activity directory screen.
     43         *
     44         * @since BuddyPress (1.5.0)
     45         *
     46         * @param string $template Path to the activity template to load.
     47         */
    3648        bp_core_load_template( apply_filters( 'bp_activity_screen_index', 'activity/index' ) );
    3749    }
     
    4254 * Load the 'My Activity' page.
    4355 *
    44  * @since BuddyPress (1.0)
     56 * @since BuddyPress (1.0.0)
    4557 *
    4658 * @uses do_action() To call the 'bp_activity_screen_my_activity' hook.
     
    4961 */
    5062function bp_activity_screen_my_activity() {
     63
     64    /**
     65     * Fires right before the loading of the "My Activity" screen template file.
     66     *
     67     * @since BuddyPress (1.0.0)
     68     */
    5169    do_action( 'bp_activity_screen_my_activity' );
     70
     71    /**
     72     * Filters the template to load for the "My Activity" screen.
     73     *
     74     * @since BuddyPress (1.0.0)
     75     *
     76     * @param string $template Path to the activity template to load.
     77     */
    5278    bp_core_load_template( apply_filters( 'bp_activity_template_my_activity', 'members/single/home' ) );
    5379}
     
    5682 * Load the 'My Friends' activity page.
    5783 *
    58  * @since BuddyPress (1.0)
     84 * @since BuddyPress (1.0.0)
    5985 *
    6086 * @uses bp_is_active()
     
    7096
    7197    bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
     98
     99    /**
     100     * Fires right before the loading of the "My Friends" screen template file.
     101     *
     102     * @since BuddyPress (1.2.0)
     103     */
    72104    do_action( 'bp_activity_screen_friends' );
     105
     106    /**
     107     * Filters the template to load for the "My Friends" screen.
     108     *
     109     * @since BuddyPress (1.0.0)
     110     *
     111     * @param string $template Path to the activity template to load.
     112     */
    73113    bp_core_load_template( apply_filters( 'bp_activity_template_friends_activity', 'members/single/home' ) );
    74114}
     
    77117 * Load the 'My Groups' activity page.
    78118 *
    79  * @since BuddyPress (1.2)
     119 * @since BuddyPress (1.2.0)
    80120 *
    81121 * @uses bp_is_active()
     
    91131
    92132    bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
     133
     134    /**
     135     * Fires right before the loading of the "My Groups" screen template file.
     136     *
     137     * @since BuddyPress (1.2.0)
     138     */
    93139    do_action( 'bp_activity_screen_groups' );
     140
     141    /**
     142     * Filters the template to load for the "My Groups" screen.
     143     *
     144     * @since BuddyPress (1.2.0)
     145     *
     146     * @param string $template Path to the activity template to load.
     147     */
    94148    bp_core_load_template( apply_filters( 'bp_activity_template_groups_activity', 'members/single/home' ) );
    95149}
     
    98152 * Load the 'Favorites' activity page.
    99153 *
    100  * @since BuddyPress (1.2)
     154 * @since BuddyPress (1.2.0)
    101155 *
    102156 * @uses bp_update_is_item_admin()
     
    108162function bp_activity_screen_favorites() {
    109163    bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
     164
     165    /**
     166     * Fires right before the loading of the "Favorites" screen template file.
     167     *
     168     * @since BuddyPress (1.2.0)
     169     */
    110170    do_action( 'bp_activity_screen_favorites' );
     171
     172    /**
     173     * Filters the template to load for the "Favorites" screen.
     174     *
     175     * @since BuddyPress (1.2.0)
     176     *
     177     * @param string $template Path to the activity template to load.
     178     */
    111179    bp_core_load_template( apply_filters( 'bp_activity_template_favorite_activity', 'members/single/home' ) );
    112180}
     
    115183 * Load the 'Mentions' activity page.
    116184 *
    117  * @since BuddyPress (1.2)
     185 * @since BuddyPress (1.2.0)
    118186 *
    119187 * @uses bp_update_is_item_admin()
     
    125193function bp_activity_screen_mentions() {
    126194    bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
     195
     196    /**
     197     * Fires right before the loading of the "Mentions" screen template file.
     198     *
     199     * @since BuddyPress (1.2.0)
     200     */
    127201    do_action( 'bp_activity_screen_mentions' );
     202
     203    /**
     204     * Filters the template to load for the "Mentions" screen.
     205     *
     206     * @since BuddyPress (1.2.0)
     207     *
     208     * @param string $template Path to the activity template to load.
     209     */
    128210    bp_core_load_template( apply_filters( 'bp_activity_template_mention_activity', 'members/single/home' ) );
    129211}
     
    132214 * Reset the logged-in user's new mentions data when he visits his mentions screen.
    133215 *
    134  * @since BuddyPress (1.5)
     216 * @since BuddyPress (1.5.0)
    135217 *
    136218 * @uses bp_is_my_profile()
     
    147229 * Load the page for a single activity item.
    148230 *
    149  * @since BuddyPress (1.2)
     231 * @since BuddyPress (1.2.0)
    150232 *
    151233 * @global object $bp BuddyPress global settings
     
    219301    }
    220302
    221     // Allow access to be filtered
     303    /**
     304     * Filters the access permission for a single activity view.
     305     *
     306     * @since BuddyPress (1.2.0)
     307     *
     308     * @param array $access Array holding the current $has_access value and current activity item instance.
     309     */
    222310    $has_access = apply_filters_ref_array( 'bp_activity_permalink_access', array( $has_access, &$activity ) );
    223311
    224     // Allow additional code execution
     312    /**
     313     * Fires before the loading of a single activity template file.
     314     *
     315     * @since BuddyPress (1.2.0)
     316     *
     317     * @param BP_Activity_Activity $activity Object representing the current activity item being displayed.
     318     * @param bool $has_access Whether or not the current user has access to view activity.
     319     */
    225320    do_action( 'bp_activity_screen_single_activity_permalink', $activity, $has_access );
    226321
     
    245340    }
    246341
     342    /**
     343     * Filters the template to load for a single activity screen.
     344     *
     345     * @since BuddyPress (1.0.0)
     346     *
     347     * @param string $template Path to the activity template to load.
     348     */
    247349    bp_core_load_template( apply_filters( 'bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink' ) );
    248350}
     
    252354 * Add activity notifications settings to the notifications settings page.
    253355 *
    254  * @since BuddyPress (1.2)
     356 * @since BuddyPress (1.2.0)
    255357 *
    256358 * @uses bp_get_user_meta()
     
    299401            </tr>
    300402
    301             <?php do_action( 'bp_activity_screen_notification_settings' ) ?>
     403            <?php
     404
     405            /**
     406             * Fires inside the closing </tbody> tag for activity screen notification settings.
     407             *
     408             * @since BuddyPress (1.2.0)
     409             */
     410            do_action( 'bp_activity_screen_notification_settings' ) ?>
    302411        </tbody>
    303412    </table>
     
    315424 * activity template parts to the_title and the_content areas of a theme.
    316425 *
    317  * @since BuddyPress (1.7)
     426 * @since BuddyPress (1.7.0)
    318427 */
    319428class BP_Activity_Theme_Compat {
     
    322431     * Set up the activity component theme compatibility.
    323432     *
    324      * @since BuddyPress (1.7)
     433     * @since BuddyPress (1.7.0)
    325434     */
    326435    public function __construct() {
     
    331440     * Set up the theme compatibility hooks, if we're looking at an activity page.
    332441     *
    333      * @since BuddyPress (1.7)
     442     * @since BuddyPress (1.7.0)
    334443     */
    335444    public function is_activity() {
     
    343452            bp_update_is_directory( true, 'activity' );
    344453
     454            /** This action is documented in bp-activity/bp-activity-screens.php */
    345455            do_action( 'bp_activity_screen_index' );
    346456
     
    364474     * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
    365475     *
    366      * @since BuddyPress (1.8)
     476     * @since BuddyPress (1.8.0)
    367477     *
    368478     * @param string $templates The templates from bp_get_theme_compat_templates().
     
    370480     */
    371481    public function directory_template_hierarchy( $templates ) {
    372         // Setup our templates based on priority
     482
     483        /**
     484         * Filters the template hierarchy for the activity directory page.
     485         *
     486         * @since BuddyPress (1.8.0)
     487         *
     488         * @param array $index-directory Array holding template names to be merged into template list.
     489         */
    373490        $new_templates = apply_filters( 'bp_template_hierarchy_activity_directory', array(
    374491            'activity/index-directory.php'
     
    385502     * Update the global $post with directory data.
    386503     *
    387      * @since BuddyPress (1.7)
     504     * @since BuddyPress (1.7.0)
    388505     */
    389506    public function directory_dummy_post() {
     
    404521     * Filter the_content with the groups index template part.
    405522     *
    406      * @since BuddyPress (1.7)
     523     * @since BuddyPress (1.7.0)
    407524     */
    408525    public function directory_content() {
     
    417534     * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
    418535     *
    419      * @since BuddyPress (1.8)
     536     * @since BuddyPress (1.8.0)
    420537     *
    421538     * @param string $templates The templates from bp_get_theme_compat_templates().
     
    423540     */
    424541    public function single_template_hierarchy( $templates ) {
    425         // Setup our templates based on priority
     542
     543        /**
     544         * Filters the template hierarchy for the activity permalink pages.
     545         *
     546         * @since BuddyPress (1.8.0)
     547         *
     548         * @param array $index Array holding template names to be merged into template list.
     549         */
    426550        $new_templates = apply_filters( 'bp_template_hierarchy_activity_single_item', array(
    427551            'activity/single/index.php'
     
    438562     * Update the global $post with the displayed user's data.
    439563     *
    440      * @since BuddyPress (1.7)
     564     * @since BuddyPress (1.7.0)
    441565     */
    442566    public function single_dummy_post() {
     
    457581     * Filter the_content with the members' activity permalink template part.
    458582     *
    459      * @since BuddyPress (1.7)
     583     * @since BuddyPress (1.7.0)
    460584     */
    461585    public function single_dummy_content() {
Note: See TracChangeset for help on using the changeset viewer.