[buddypress-trac] [BuddyPress] #4914: BP_Groups_Component->setup_globals should use $bp->site_options

buddypress-trac noreply at wordpress.org
Wed Apr 3 13:55:43 UTC 2013


#4914: BP_Groups_Component->setup_globals should use $bp->site_options
-------------------------+-----------------------------
 Reporter:  wpdennis     |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Groups       |    Version:
 Severity:  normal       |   Keywords:  dev-feedback
-------------------------+-----------------------------
 In ''BP_Core->setup_globals()'' the site options are loaded into
 ''$bp->site_options''.

 ''BP_Groups_Component->setup_globals()'' uses ''bp_get_option'' to decide
 whether avatar uploads are enabled or not:

 {{{
 // If avatar uploads are not disabled, add avatar option
 if ( !(int)bp_get_option( 'bp-disable-avatar-uploads' ) ) {
         $this->group_creation_steps['group-avatar'] = array(
                 'name'     => __( 'Avatar',   'buddypress' ),
                 'position' => 20
         );
 }
 }}}

 I'm not 100% sure on this, but shouldn't it be possible to use
 ''$bp->site_options'' instead of ''bp_get_option()'' like:

 {{{
 // If avatar uploads are not disabled, add avatar option
 if ( !(int)$bp->site_options['bp-disable-avatar-uploads'] ) {
 }}}

 Or, maybe, ''bp_get_option()'' should check if the needed value is already
 loaded. Something like:

 {{{
 function bp_get_option( $option_name, $default = '' ) {
         $bp = buddypress();

         $value = array_key_exists($option_name, $bp->site_options)
                 ? $bp->site_options[$option_name]
                 : get_blog_option( bp_get_root_blog_id(), $option_name,
 $default );

         return apply_filters( 'bp_get_option', $value );
 }
 }}}

 What do you think?

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4914>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list