[buddypress-trac] [BuddyPress] #3647: bp_forum_permalink() is missing a ’/’ (malformed)

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Mon Oct 3 12:46:46 UTC 2011


#3647: bp_forum_permalink() is missing a ’/’ (malformed)
----------------------+------------------------------
 Reporter:  Grimbog   |       Owner:
     Type:  defect    |      Status:  new
 Priority:  normal    |   Milestone:  Awaiting Review
Component:  Core      |     Version:  1.5
 Severity:  critical  |  Resolution:
 Keywords:            |
----------------------+------------------------------

Comment (by Grimbog):

 Further to my post above - I have managed to create a quick fix, but this
 will need to be submitted to the repository.

 Essentially, the permalink wasnt forming properly as it was missing a
 forward slash before 'forum' on line 1326 of bp-forum-template.php. Also
 trailingslashit(); was being run twice, which causes two forward-slashes.

 Grimbog

 ---


 {{{
 function bp_forum_permalink( $forum_id = 0 ) {
         echo bp_get_forum_permalink( $forum_id );
 }
         function bp_get_forum_permalink( $forum_id = 0 ) {
                 global $bp;

                 if ( bp_is_groups_component() ) {
                         $permalink = trailingslashit( bp_get_root_domain()
 . '/' . bp_get_groups_root_slug() . '/' . bp_current_item() . '/' .
 'forum' );
                 } else {
                         if ( empty( $forum_id ) ) {
                                 global $topic_template;
                                 if ( isset( $topic_template->forum_id ) )
                                         $forum_id =
 $topic_template->forum_id;
                         }

                         if ( $forum = bp_forums_get_forum( $forum_id ) )
                                 $permalink = trailingslashit(
 bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/forum/' .
 $forum->forum_slug );
                         else
                                 return false;
                 }

                 return apply_filters( 'bp_get_forum_permalink', $permalink
 );
         }
 }}}

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


More information about the buddypress-trac mailing list