[buddypress-trac] [BuddyPress] #3858: When posting a new topic from forums directory, tags won't be added to topic

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Fri Dec 16 11:32:50 UTC 2011


#3858: When posting a new topic from forums directory, tags won't be added to
topic
--------------------------+------------------------------
 Reporter:  deschle       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Forums        |     Version:  1.5.1
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by deschle):

 As far is I can see, the user rights for adding tags is checked in bp-
 groups-filters.php:


 {{{
 function groups_filter_bbpress_caps( $value, $cap, $args ) {
         global $bp;

         if ( is_super_admin() )
                 return true;

         if ( 'add_tag_to' == $cap )
                 if ( $bp->groups->current_group->user_has_access ) return
 true;

         if ( 'manage_forums' == $cap && is_user_logged_in() )
                 return true;

         return $value;
 }

 }}}

 When creating a topic from a non group page, the
 $bp->groups->current_group->user_has_access is not initialized.

 As a workaround I added the following code to my theme function.php:

 {{{
 function current_user_can_add_tag( $value, $cap, $args ) {
         global $bp;

         if ( 'add_tag_to' == $cap ) {
                 $topic_id = $args[1];
                 $topic = get_topic( $topic_id );
                 if ( !$topic ) return false;
                 // is current user super admin or the topic poster?
                 // maybe check if group admin?
                 if ( is_super_admin() || $topic->topic_poster ==
 $bp->loggedin_user->id )
                         return true;
         }
         return $value;
 }
 add_filter( 'bb_current_user_can', 'current_user_can_add_tag', 10, 3 );

 }}}

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3858#comment:1>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list