Changeset 4012 for trunk/bp-forums/bp-forums-template.php
- Timestamp:
- 02/02/2011 08:52:58 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-forums/bp-forums-template.php
r4010 r4012 449 449 450 450 $defaults = array( 451 'type' => 'thumb',452 'width' => false,451 'type' => 'thumb', 452 'width' => false, 453 453 'height' => false, 454 'alt' => __( 'Profile picture of %s', 'buddypress' )454 'alt' => __( 'Profile picture of %s', 'buddypress' ) 455 455 ); 456 456 … … 565 565 $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' . bp_current_item() ); 566 566 else 567 $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' . $bp->current_action);567 $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() ); 568 568 569 569 return apply_filters( 'bp_get_the_topic_permalink', trailingslashit( $permalink . 'topic/' . $forum_template->topic->topic_slug ) ); … … 901 901 if ( empty( $topic_id ) && bp_is_current_component( 'groups') && bp_is_current_action( 'forum' ) && 'topic' == $bp->action_variables[0] ) 902 902 $topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[1] ); 903 elseif ( empty( $topic_id ) && bp_is_current_component( 'forums') && bp_is_current_action( 'topic' ) && !empty( $bp->action_variables[0] ) ) 904 $topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[0] ); 903 905 904 906 if ( is_numeric( $topic_id ) ) { … … 1107 1109 } 1108 1110 1109 function bp_forum_permalink() { 1110 echo bp_get_forum_permalink(); 1111 } 1112 function bp_get_forum_permalink() { 1113 global $bp; 1114 1115 if ( $bp->is_single_item ) 1116 $permalink = trailingslashit( bp_get_root_domain() . '/' . $bp->current_component . '/' . bp_current_item() ); 1111 function bp_forum_permalink( $forum_id = 0 ) { 1112 echo bp_get_forum_permalink( $forum_id ); 1113 } 1114 function bp_get_forum_permalink( $forum_id = 0 ) { 1115 global $bp; 1116 1117 if ( bp_is_groups_component() ) { 1118 $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_current_item() . 'forum' ); 1119 } else { 1120 if ( empty( $forum_id ) ) { 1121 global $topic_template; 1122 if ( isset( $topic_template->forum_id ) ) 1123 $forum_id = $topic_template->forum_id; 1124 } 1125 1126 if ( $forum = bp_forums_get_forum( $forum_id ) ) 1127 $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/forum/' . $forum->forum_slug ); 1128 else 1129 return false; 1130 } 1131 1132 return apply_filters( 'bp_get_forum_permalink', trailingslashit( $permalink ) ); 1133 } 1134 1135 function bp_forum_name( $forum_id = 0 ) { 1136 echo bp_get_forum_name( $forum_id ); 1137 } 1138 function bp_get_forum_name( $forum_id = 0 ) { 1139 global $bp; 1140 1141 if ( empty( $forum_id ) ) { 1142 global $topic_template; 1143 if ( isset( $topic_template->forum_id ) ) 1144 $forum_id = $topic_template->forum_id; 1145 } 1146 1147 if ( $forum = bp_forums_get_forum( $forum_id ) ) 1148 return apply_filters( 'bp_get_forum_name', $forum->forum_name, $forum->forum_id ); 1117 1149 else 1118 $permalink = trailingslashit( bp_get_root_domain() . $bp->current_component . '/' . $bp->current_action ); 1119 1120 return apply_filters( 'bp_get_forum_permalink', trailingslashit( $permalink . 'forum' ) ); 1150 return false; 1121 1151 } 1122 1152
Note: See TracChangeset
for help on using the changeset viewer.