Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/11/2011 05:47:40 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Update bp-core-options.php with existing BuddyPress options. See #3835.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-options.php

    r5304 r5508  
    2525        /** DB Version ********************************************************/
    2626
    27         '_bp_db_version'            => '155',
     27        '_bp_db_version'                => '155',
    2828
    2929        /** Settings **********************************************************/
    3030
    31         // Lock post editing after 5 minutes
    32         '_bp_edit_lock'             => '5',
    33 
    34         // Throttle post time to 10 seconds
    35         '_bp_throttle_time'         => '10',
    36 
    37         // Favorites
    38         '_bp_enable_favorites'      => true,
    39 
    40         // Subscriptions
    41         '_bp_enable_subscriptions'  => true,
     31        // Disable the WP to BP profile sync
     32        'bp-disable-profile-sync'       => false,
     33
     34        // Hide the admin bar for logged out users
     35        'hide-loggedout-adminbar'       => false,
     36
     37        // Avatar uploads
     38        'bp-disable-avatar-uploads'     => false,
     39
     40        // Allow users to delete their own accounts
     41        'bp-disable-account-deletion'   => true,
    4242
    4343        // Allow anonymous posting
    44         '_bp_allow_anonymous'       => false,
    45 
    46         // Users from all sites can post
    47         '_bp_allow_global_access'   => false,
    48 
    49         // Use the WordPress editor if available
    50         '_bp_use_wp_editor'         => true,
    51 
    52         /** Per Page **********************************************************/
    53 
    54         // Topics per page
    55         '_bp_topics_per_page'       => '15',
    56 
    57         // Replies per page
    58         '_bp_replies_per_page'      => '15',
    59 
    60         // Forums per page
    61         '_bp_forums_per_page'       => '50',
    62 
    63         // Topics per RSS page
    64         '_bp_topics_per_rss_page'   => '25',
    65 
    66         // Replies per RSS page
    67         '_bp_replies_per_rss_page'  => '25',
    68 
    69         /** Page For **********************************************************/
    70 
    71         // Page for forums
    72         '_bp_page_for_forums'       => '0',
    73 
    74         // Page for forums
    75         '_bp_page_for_topics'       => '0',
    76 
    77         // Page for login
    78         '_bp_page_for_login'        => '0',
    79 
    80         // Page for register
    81         '_bp_page_for_register'     => '0',
    82 
    83         // Page for lost-pass
    84         '_bp_page_for_lost_pass'    => '0',
    85 
    86         /** Archive Slugs *****************************************************/
    87 
    88         // Forum archive slug
    89         '_bp_root_slug'             => 'forums',
    90 
    91         // Topic archive slug
    92         '_bp_topic_archive_slug'    => 'topics',
    93 
    94         /** Single Slugs ******************************************************/
    95 
    96         // Include Forum archive before single slugs
    97         '_bp_include_root'          => true,
    98 
    99         // Forum slug
    100         '_bp_forum_slug'            => 'forum',
    101 
    102         // Topic slug
    103         '_bp_topic_slug'            => 'topic',
    104 
    105         // Reply slug
    106         '_bp_reply_slug'            => 'reply',
    107 
    108         // Topic tag slug
    109         '_bp_topic_tag_slug'        => 'topic-tag',
    110 
    111         /** Other Slugs *******************************************************/
    112 
    113         // User profile slug
    114         '_bp_user_slug'             => 'users',
    115 
    116         // View slug
    117         '_bp_view_slug'             => 'view',
    118 
    119         /** Topics ************************************************************/
    120 
    121         // Title Max Length
    122         '_bp_title_max_length'      => '80',
    123 
    124         /** BuddyPress ********************************************************/
    125 
    126         // Enable BuddyPress Group Extension
    127         '_bbp_enable_group_forums'  => true,
    128 
    129         // Group Forums parent forum id
    130         '_bbp_group_forums_root_id' => '0',
     44        'bp-disable-blogforum-comments' => true,
     45
     46        // Use the WordPress editor when possible
     47        '_bp_use_wp_editor'             => false,
     48
     49        /** Groups ************************************************************/
     50
     51        // @todo Move this into the groups component
     52
     53        // Restrict group creation to super admins
     54        'bp_restrict_group_creation'    => false,
     55
     56        // Root forum ID for groups
     57        '_bbp_group_forums_root_id'     => 0,
    13158
    13259        /** Akismet ***********************************************************/
     
    16390    do_action( 'bp_add_options' );
    16491}
     92
    16593/**
    16694 * Delete default options
     
    190118/**
    191119 * Add filters to each BuddyPress option and allow them to be overloaded from
    192  * inside the $bbp->options array.
     120 * inside the $bp->options array.
    193121 *
    194122 * @since BuddyPress (1.6)
     
    213141/**
    214142 * Filter default options and allow them to be overloaded from inside the
    215  * $bbp->options array.
    216  *
    217  * @since BuddyPress (1.6)
    218  *
    219  * @global BuddyPress $bbp
     143 * $bp->options array.
     144 *
     145 * @since BuddyPress (1.6)
     146 *
     147 * @global BuddyPress $bp
    220148 * @param bool $value Optional. Default value false
    221149 * @return mixed false if not overloaded, mixed if set
    222150 */
    223151function bp_pre_get_option( $value = false ) {
    224     global $bbp;
     152    global $bp;
    225153
    226154    // Get the name of the current filter so we can manipulate it
     
    231159
    232160    // Check the options global for preset value
    233     if ( !empty( $bbp->options[$option] ) )
    234         $value = $bbp->options[$option];
     161    if ( !empty( $bp->options[$option] ) )
     162        $value = $bp->options[$option];
    235163
    236164    // Always return a value, even if false
     
    241169
    242170/**
    243  * Checks if favorites feature is enabled.
     171 * Is profile sycing disabled?
    244172 *
    245173 * @since BuddyPress (1.6)
     
    247175 * @param $default bool Optional.Default value true
    248176 *
    249  * @uses get_option() To get the favorites option
    250  * @return bool Is favorites enabled or not
    251  */
    252 function bp_is_favorites_active( $default = true ) {
    253     return (bool) apply_filters( 'bp_is_favorites_active', (bool) get_option( '_bp_enable_favorites', $default ) );
    254 }
    255 
    256 /**
    257  * Checks if subscription feature is enabled.
     177 * @uses get_option() To get the profile sync option
     178 * @return bool Is profile sync enabled or not
     179 */
     180function bp_disable_profile_sync( $default = true ) {
     181    return (bool) apply_filters( 'bp_disable_profile_sync', (bool) get_option( 'bp-disable-profile-sync', $default ) );
     182}
     183
     184/**
     185 * Is the admin bar hidden for logged out users?
    258186 *
    259187 * @since BuddyPress (1.6)
     
    261189 * @param $default bool Optional.Default value true
    262190 *
    263  * @uses get_option() To get the subscriptions option
    264  * @return bool Is subscription enabled or not
    265  */
    266 function bp_is_subscriptions_active( $default = true ) {
    267     return (bool) apply_filters( 'bp_is_subscriptions_active', (bool) get_option( '_bp_enable_subscriptions', $default ) );
    268 }
    269 
    270 /**
    271  * Are topic and reply revisions allowed
     191 * @uses get_option() To get the logged out admin bar option
     192 * @return bool Is logged out admin bar enabled or not
     193 */
     194function bp_hide_loggedout_adminbar( $default = true ) {
     195    return (bool) apply_filters( 'bp_hide_loggedout_adminbar', (bool) get_option( 'hide-loggedout-adminbar', $default ) );
     196}
     197
     198/**
     199 * Are members able to upload their own avatars?
    272200 *
    273201 * @since BuddyPress (r3412)
     
    275203 * @param $default bool Optional. Default value true
    276204 *
    277  * @uses get_option() To get the allow revisions
    278  * @return bool Are revisions allowed?
    279  */
    280 function bp_allow_revisions( $default = true ) {
    281     return (bool) apply_filters( 'bp_allow_revisions', (bool) get_option( '_bp_allow_revisions', $default ) );
    282 }
    283 
    284 /**
    285  * Is the anonymous posting allowed?
     205 * @uses get_option() To get the avatar uploads option
     206 * @return bool Are avatar uploads allowed?
     207 */
     208function bp_disable_avatar_uploads( $default = true ) {
     209    return (bool) apply_filters( 'bp_disable_avatar_uploads', (bool) get_option( 'bp-disable-avatar-uploads', $default ) );
     210}
     211
     212/**
     213 * Are members able to delete their own accounts
    286214 *
    287215 * @since BuddyPress (1.6)
     
    289217 * @param $default bool Optional. Default value
    290218 *
    291  * @uses get_option() To get the allow anonymous option
    292  * @return bool Is anonymous posting allowed?
    293  */
    294 function bp_allow_anonymous( $default = false ) {
    295     return apply_filters( 'bp_allow_anonymous', (bool) get_option( '_bp_allow_anonymous', $default ) );
    296 }
    297 
    298 /**
    299  * Is this community available to all users on all sites in this installation?
     219 * @uses get_option() To get the account deletion option
     220 * @return bool Is account deletion allowed?
     221 */
     222function bp_disable_account_deletion( $default = false ) {
     223    return apply_filters( 'bp_disable_account_deletion', (bool) get_option( 'bp-disable-account-deletion', $default ) );
     224}
     225
     226/**
     227 * Are blog and forum activity stream comments disabled
    300228 *
    301229 * @since BuddyPress (1.6)
    302230 *
    303231 * @param $default bool Optional. Default value false
    304  *
    305  * @uses get_option() To get the global access option
    306  * @return bool Is global access allowed?
    307  */
    308 function bp_allow_global_access( $default = false ) {
    309     return (bool) apply_filters( 'bp_allow_global_access', (bool) get_option( '_bp_allow_global_access', $default ) );
    310 }
    311 
    312 /**
    313  * Use the WordPress editor if available
     232 * @todo split and move into blog and forum components
     233 * @uses get_option() To get the blog/forum comments option
     234 * @return bool Is blog/forum comments allowed?
     235 */
     236function bp_disable_blogforum_comments( $default = false ) {
     237    return (bool) apply_filters( 'bp_disable_blogforum_comments', (bool) get_option( 'bp-disable-blogforum-comments', $default ) );
     238}
     239
     240/**
     241 * Is group creation turned off?
    314242 *
    315243 * @since BuddyPress (r3386)
     
    317245 * @param $default bool Optional. Default value true
    318246 *
     247 * @todo Move into groups component
     248 * @uses get_option() To get the group creation
     249 * @return bool Allow group creation?
     250 */
     251function bp_restrict_group_creation( $default = true ) {
     252    return (bool) apply_filters( 'bp_restrict_group_creation', (bool) get_option( 'bp_restrict_group_creation', $default ) );
     253}
     254
     255/**
     256 * Have we migrated to using the WordPress admin bar?
     257 *
     258 * @since BuddyPress (r3386)
     259 *
     260 * @param $default bool Optional. Default value true
     261 *
     262 * @todo Move into groups component
    319263 * @uses get_option() To get the WP editor option
    320264 * @return bool Use WP editor?
    321265 */
     266function bp_force_buddybar( $default = true ) {
     267    return (bool) apply_filters( 'bp_force_buddybar', (bool) get_option( 'bp-force-buddybar', $default ) );
     268}
     269
     270/**
     271 * Use the WordPress editor if available
     272 *
     273 * @since BuddyPress (r3386)
     274 *
     275 * @param $default bool Optional. Default value true
     276 *
     277 * @uses get_option() To get the WP editor option
     278 * @return bool Use WP editor?
     279 */
    322280function bp_use_wp_editor( $default = true ) {
    323281    return (bool) apply_filters( 'bp_use_wp_editor', (bool) get_option( '_bp_use_wp_editor', $default ) );
     
    325283
    326284/**
    327  * Output the maximum length of a title
    328  *
    329  * @since BuddyPress (r3246)
    330  *
    331  * @param $default bool Optional. Default value 80
    332  */
    333 function bp_title_max_length( $default = '80' ) {
    334     echo bp_get_title_max_length( $default );
    335 }
    336     /**
    337      * Return the maximum length of a title
    338      *
    339      * @since BuddyPress (1.6)
    340      *
    341      * @param $default bool Optional. Default value 80
    342      *
    343      * @uses get_option() To get the maximum title length
    344      * @return int Is anonymous posting allowed?
    345      */
    346     function bp_get_title_max_length( $default = '80' ) {
    347         return (int) apply_filters( 'bp_get_title_max_length', (int) get_option( '_bp_title_max_length', $default ) );
    348     }
    349 
    350 /**
    351285 * Output the group forums root parent forum id
    352286 *
     
    359293}
    360294    /**
    361      * Return the grop forums root parent forum id
     295     * Return the group forums root parent forum id
    362296     *
    363297     * @since BuddyPress (1.6)
Note: See TracChangeset for help on using the changeset viewer.