BP_Activity_Feed::__construct( array $args = array() )

Constructor.

Description

Parameters

$args

(Optional)

Default value: array()

Source

File: bp-activity/classes/class-bp-activity-feed.php

91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
public function __construct( $args = array() ) {
 
    /**
     * Filters if BuddyPress should consider feeds enabled. If disabled, it will return early.
     *
     * @since BuddyPress 1.8.0
     *
     * @param bool true Default true aka feeds are enabled.
     */
    if ( false === (bool) apply_filters( 'bp_activity_enable_feeds', true ) ) {
        global $wp_query;
 
        // Set feed flag to false.
        $wp_query->is_feed = false;
 
        return false;
    }
 
    // Setup data.
    $this->data = wp_parse_args( $args, array(
        // Internal identifier for the RSS feed - should be alphanumeric only.
        'id'               => '',
 
        // RSS title - should be plain-text.
        'title'            => '',
 
        // Relevant link for the RSS feed.
        'link'             => '',
 
        // RSS description - should be plain-text.
        'description'      => '',
 
        // Time-to-live - number of minutes to cache the data before an aggregator
        // requests it again.  This is only acknowledged if the RSS client supports it
        //
        'ttl'              => '30',
 
        // Syndication module - similar to ttl, but not really supported by RSS
        // clients
        //
        'update_period'    => 'hourly',
        'update_frequency' => 2,
 
        // Number of items to display.
        'max'              => 50,
 
        // Activity arguments passed to bp_has_activities().
        'activity_args'    => array()
    ) );
 
    /**
     * Fires before the feed is setup so plugins can modify.
     *
     * @since BuddyPress 1.8.0
     *
     * @param BP_Activity_Feed $this Current instance of activity feed. Passed by reference.
     */
    do_action_ref_array( 'bp_activity_feed_prefetch', array( &$this ) );
 
    // Setup class properties.
    $this->setup_properties();
 
    // Check if id is valid.
    if ( empty( $this->id ) ) {
        _doing_it_wrong( 'BP_Activity_Feed', __( "RSS feed 'id' must be defined", 'buddyboss' ), 'BP 1.8' );
        return false;
    }
 
    /**
     * Fires after the feed is setup so plugins can modify.
     *
     * @since BuddyPress 1.8.0
     *
     * @param BP_Activity_Feed $this Current instance of activity feed. Passed by reference.
     */
    do_action_ref_array( 'bp_activity_feed_postfetch', array( &$this ) );
 
    // Setup feed hooks.
    $this->setup_hooks();
 
    // Output the feed.
    $this->output();
 
    // Kill the rest of the output.
    die();
}

Changelog

Changelog
Version Description
BuddyPress 1.8.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.