Changeset 2970
- Timestamp:
- 04/01/2011 01:33:09 AM (14 years ago)
- Location:
- branches/plugin
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-general-functions.php
r2957 r2970 116 116 /** 117 117 * The plugin version of bbPress comes with two topic display options: 118 * ~ Traditional -Topics are included in the reply loop (default)119 * ~ New Style -Topics appear as "lead" posts, ahead of replies118 * - Traditional: Topics are included in the reply loop (default) 119 * - New Style: Topics appear as "lead" posts, ahead of replies 120 120 * 121 121 * @since bbPress (r2954) 122 122 * 123 * @global obj $bbp124 123 * @param $show_lead Optional. Default false 125 * @return bool 124 * @return bool Yes if the topic appears as a lead, otherwise false 126 125 */ 127 126 function bbp_show_lead_topic( $show_lead = false ) { … … 158 157 * Append 'view=all' to query string if it's already there from referer 159 158 * 160 * @param string $original_link 161 * @return <type> 159 * @param string $original_link Original Link to be modified 160 * @uses current_user_can() To check if the current user can moderate 161 * @uses add_query_arg() To add args to the url 162 * @uses apply_filters() Calls 'bbp_add_view_all' with the link and original link 163 * @return string The link with 'view=all' appended if necessary 162 164 */ 163 165 function bbp_add_view_all( $original_link ) { … … 202 204 * @param array $data Post data 203 205 * @param array $postarr Original post array (includes post id) 206 * @uses bbp_get_topic_post_type() To get the topic post type 207 * @uses bbp_get_reply_post_type() To get the reply post type 204 208 * @uses bbp_is_topic_anonymous() To check if the topic is by an anonymous user 205 209 * @uses bbp_is_reply_anonymous() To check if the reply is by an anonymous user … … 259 263 * - count_empty_tags: Count empty tags? 260 264 * @uses bbp_count_users() To count the number of registered users 265 * @uses bbp_get_forum_post_type() To get the forum post type 266 * @uses bbp_get_topic_post_type() To get the topic post type 267 * @uses bbp_get_reply_post_type() To get the reply post type 261 268 * @uses wp_count_posts() To count the number of forums, topics and replies 262 269 * @uses wp_count_terms() To count the number of topic tags … … 537 544 // Assign variables 538 545 $defaults = array ( 539 'bbp_anonymous_name' => $_POST['bbp_anonymous_name'],540 'bbp_anonymous_email' => $_POST['bbp_anonymous_email'],541 'bbp_anonymous_website' => $_POST['bbp_anonymous_website'],542 'bbp_anonymous_ip' => $_SERVER['REMOTE_ADDR']546 'bbp_anonymous_name' => !empty( $_POST['bbp_anonymous_name'] ) ? $_POST['bbp_anonymous_name'] : false, 547 'bbp_anonymous_email' => !empty( $_POST['bbp_anonymous_email'] ) ? $_POST['bbp_anonymous_email'] : false, 548 'bbp_anonymous_website' => !empty( $_POST['bbp_anonymous_website'] ) ? $_POST['bbp_anonymous_website'] : false, 549 'bbp_anonymous_ip' => !empty( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : false 543 550 ); 544 551 … … 680 687 * 681 688 * @uses bbp_is_user_profile_page() To check if it's a profile page 689 * @uses apply_filters() Calls 'bbp_profile_templates' with the profile 690 * templates array 682 691 * @uses bbp_is_user_profile_edit() To check if it's a profile edit page 692 * @uses apply_filters() Calls 'bbp_profile_edit_templates' with the profile 693 * edit templates array 694 * @uses bbp_is_view() To check if it's a view page 695 * @uses bbp_get_view_id() To get the view id 696 * @uses apply_filters() Calls 'bbp_view_templates' with the view templates array 683 697 * @uses bbp_is_topic_edit() To check if it's a topic edit page 698 * @uses bbp_get_topic_post_type() To get the topic post type 699 * @uses apply_filters() Calls 'bbp_topic_edit_templates' with the topic edit 700 * templates array 684 701 * @uses bbp_is_reply_edit() To check if it's a reply edit page 702 * @uses bbp_get_reply_post_type() To get the reply post type 703 * @uses apply_filters() Calls 'bbp_reply_edit_templates' with the reply edit 704 * templates array 685 705 * @uses apply_filters() Calls 'bbp_custom_template' with the template array 686 706 * @uses bbp_load_template() To load the template … … 707 727 'bbpress/user-edit.php', 708 728 'user-edit.php', 729 'forums/user.php', 709 730 'bbpress/user.php', 710 731 'user.php', … … 717 738 $template = apply_filters( 'bbp_view_templates', array( 718 739 'forums/view-' . bbp_get_view_id(), 740 'bbpress/view-' . bbp_get_view_id(), 719 741 'forums/view.php', 720 'bbpress/view-' . bbp_get_view_id(),721 742 'bbpress/view.php', 722 743 'view-' . bbp_get_view_id(), … … 729 750 $template = array( 730 751 'forums/action-edit.php', 752 'bbpress/action-edit.php', 731 753 'forums/single-' . bbp_get_topic_post_type(), 732 'bbpress/action-edit.php',733 754 'bbpress/single-' . bbp_get_topic_post_type(), 734 755 'action-bbp-edit.php', … … 740 761 // Add split/merge to front of array if present in _GET 741 762 if ( !empty( $_GET['action'] ) && in_array( $_GET['action'], array( 'merge', 'split' ) ) ) { 742 array_unshift( $template, array(763 array_unshift( $template, 743 764 'forums/action-split-merge.php', 744 765 'bbpress/action-split-merge.php', 745 'action- bbp-split-merge.php'746 ) );766 'action-split-merge.php' 767 ); 747 768 } 748 769 … … 753 774 $template = apply_filters( 'bbp_reply_edit_templates', array( 754 775 'forums/action-edit.php', 776 'bbpress/action-edit.php', 755 777 'forums/single-' . bbp_get_reply_post_type(), 756 'bbpress/action-edit.php',757 778 'bbpress/single-' . bbp_get_reply_post_type(), 758 779 'action-bbp-edit.php', … … 778 799 */ 779 800 function bbp_load_template( $files ) { 801 802 // Bail if nothing passed 780 803 if ( empty( $files ) ) 781 804 return; … … 788 811 if ( locate_template( $files, true ) ) 789 812 exit(); 790 791 return;792 813 } 793 814 … … 811 832 * 812 833 * @uses get_query_var() To get {@link WP_Query} query var 834 * @uses is_email() To check if the string is an email 835 * @uses get_user_by() To try to get the user by email and nicename 813 836 * @uses WP_User to get the user data 814 837 * @uses WP_Query::set_404() To set a 404 status 815 * @uses is_multisite() To check if it's a multisite816 838 * @uses current_user_can() To check if the current user can edit the user 817 839 * @uses apply_filters() Calls 'enable_edit_any_user_configuration' with true 818 840 * @uses wp_die() To die 841 * @uses bbp_get_query_name() To get the query name and check if it's 'bbp_widget' 842 * @uses bbp_get_view_query_args() To get the view query args 843 * @uses bbp_get_topic_post_type() To get the topic post type 844 * @uses bbp_get_reply_post_type() To get the reply post type 845 * @uses is_multisite() To check if it's a multisite 846 * @uses remove_action() To remove the auto save post revision action 819 847 */ 820 848 function bbp_pre_get_posts( $wp_query ) { 821 849 global $bbp, $wp_version; 822 850 851 // Bail if $wp_query is empty or of incorrect class 852 if ( empty( $wp_query ) || ( 'WP_Query' != get_class( $wp_query ) ) ) 853 return $wp_query; 854 855 // Get query variables 823 856 $bbp_user = get_query_var( 'bbp_user' ); 824 857 $bbp_view = get_query_var( 'bbp_view' ); … … 930 963 * @uses bbp_is_user_profile_page() To check if it's a user profile page 931 964 * @uses bbp_is_user_profile_edit() To check if it's a user profile edit page 965 * @uses bbp_is_user_home() To check if the profile page is of the current user 932 966 * @uses get_query_var() To get the user id 933 967 * @uses get_userdata() To get the user data 968 * @uses bbp_is_forum() To check if it's a forum 969 * @uses bbp_get_forum_title() To get the forum title 970 * @uses bbp_is_topic() To check if it's a topic 971 * @uses bbp_get_topic_title() To get the topic title 972 * @uses bbp_is_reply() To check if it's a reply 973 * @uses bbp_get_reply_title() To get the reply title 974 * @uses is_tax() To check if it's the tag page 975 * @uses get_queried_object() To get the queried object 976 * @uses bbp_is_view() To check if it's a view 977 * @uses bbp_get_view_title() To get the view title 934 978 * @uses apply_filters() Calls 'bbp_raw_title' with the title 935 979 * @uses apply_filters() Calls 'bbp_profile_page_wp_title' with the title, … … 1015 1059 } 1016 1060 1017 $title = apply_filters( 'bbp_title', $title, $sep, $seplocation ); 1018 1019 return $title; 1061 // Filter and return 1062 return apply_filters( 'bbp_title', $title, $sep, $seplocation ); 1020 1063 } 1021 1064 … … 1070 1113 return false; 1071 1114 1072 $reply_id = $reply->ID; 1073 $topic_id = $topic->ID; 1074 1075 do_action( 'bbp_pre_notify_subscribers', $reply_id, $topic_id ); 1115 do_action( 'bbp_pre_notify_subscribers', $reply->ID, $topic->ID ); 1076 1116 1077 1117 // Get the users who have favorited the topic and have subscriptions on 1078 if ( !$user_ids = bbp_get_topic_subscribers( $topic_id, true ) ) 1079 return false; 1080 1118 if ( !$user_ids = bbp_get_topic_subscribers( $topic->ID, true ) ) 1119 return false; 1120 1121 // Loop through users 1081 1122 foreach ( (array) $user_ids as $user_id ) { 1082 1123 … … 1086 1127 1087 1128 // For plugins 1088 if ( !$message = apply_filters( 'bbp_subscription_mail_message', __( "%1\$s wrote:\n\n%2\$s\n\nPost Link: %3\$s\n\nYou're getting this mail because you subscribed to the topic, visit the topic and login to unsubscribe." ), $reply _id, $topic_id, $user_id ) )1129 if ( !$message = apply_filters( 'bbp_subscription_mail_message', __( "%1\$s wrote:\n\n%2\$s\n\nPost Link: %3\$s\n\nYou're getting this mail because you subscribed to the topic, visit the topic and login to unsubscribe." ), $reply->ID, $topic->ID, $user_id ) ) 1089 1130 continue; 1090 1131 1132 // Get user data of this user 1091 1133 $user = get_userdata( $user_id ); 1092 1134 1135 // Send notification email 1093 1136 wp_mail( 1094 1137 $user->user_email, 1095 apply_filters( 'bbp_subscription_mail_title', '[' . get_option( 'blogname' ) . '] ' . $topic->post_title, $reply _id, $topic_id),1096 sprintf( $message, $poster_name, strip_tags( $reply->post_content ), bbp_get_reply_permalink( $reply _id) )1138 apply_filters( 'bbp_subscription_mail_title', '[' . get_option( 'blogname' ) . '] ' . $topic->post_title, $reply->ID, $topic->ID ), 1139 sprintf( $message, $poster_name, strip_tags( $reply->post_content ), bbp_get_reply_permalink( $reply->ID ) ) 1097 1140 ); 1098 1141 } 1099 1142 1100 do_action( 'bbp_post_notify_subscribers', $reply _id, $topic_id);1143 do_action( 'bbp_post_notify_subscribers', $reply->ID, $topic->ID ); 1101 1144 1102 1145 return true; … … 1133 1176 */ 1134 1177 function bbp_logout_url( $url = '', $redirect_to = '' ) { 1135 if ( !isset( $_SERVER['REDIRECT_URL'] ) || !$redirect_to = home_url( $_SERVER['REDIRECT_URL'] ) ) 1178 1179 // Rejig the $redirect_to 1180 if ( !isset( $_SERVER['REDIRECT_URL'] ) || ( !$redirect_to = home_url( $_SERVER['REDIRECT_URL'] ) ) ) 1136 1181 $redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : ''; 1137 1182 1183 // Make sure we are directing somewhere 1138 1184 if ( empty( $redirect_to ) ) 1139 1185 $redirect_to = home_url( isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '' ); 1140 1186 1141 $url = add_query_arg( array( 'redirect_to' => esc_url( $redirect_to ) ), $url ); 1142 1187 // Sanitize $redirect_to and add it to full $url 1188 $redirect_to = esc_url( add_query_arg( array( 'loggedout' => 'true' ), $redirect_to ) ); 1189 $url = add_query_arg( array( 'redirect_to' => $redirect_to ), $url ); 1190 1191 // Filter and return 1143 1192 return apply_filters( 'bbp_logout_url', $url, $redirect_to ); 1144 1193 } … … 1149 1198 * Query the DB and get the last public post_id that has parent_id as post_parent 1150 1199 * 1151 * @global db $wpdb 1152 * @param int $parent_id 1153 * @param string $post_type 1200 * @param int $parent_id Parent id 1201 * @param string $post_type Post type. Defaults to 'post' 1202 * @uses bbp_get_topic_post_type() To get the topic post type 1203 * @uses wp_cache_get() To check if there is a cache of the last child id 1204 * @uses wpdb::prepare() To prepare the query 1205 * @uses wpdb::get_var() To get the result of the query in a variable 1206 * @uses wp_cache_set() To set the cache for future use 1207 * @uses apply_filters() Calls 'bbp_get_public_child_last_id' with the child 1208 * id, parent id and post type 1154 1209 * @return int The last active post_id 1155 1210 */ … … 1157 1212 global $wpdb; 1158 1213 1214 // Bail if nothing passed 1159 1215 if ( empty( $parent_id ) ) 1160 1216 return false; 1161 1217 1162 1218 // The ID of the cached query 1163 $cache_id = 'bbp_parent_' . $parent_id . '_type_' . $post_type . '_child_last_id'; 1164 1219 $cache_id = 'bbp_parent_' . $parent_id . '_type_' . $post_type . '_child_last_id'; 1220 $post_status = array( 'publish' ); 1221 1222 // Add closed status if topic post type 1223 if ( $post_type == bbp_get_topic_post_type() ) 1224 $post_status[] = $bbp->closed_status_id; 1225 1226 // Join post statuses together 1227 $post_status = "'" . join( "', '", $post_status ) . "'"; 1228 1229 // Check for cache and set if needed 1165 1230 if ( !$child_id = wp_cache_get( $cache_id, 'bbpress' ) ) { 1166 $child_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status = 'publish'AND post_type = '%s' ORDER BY ID DESC LIMIT 1;", $parent_id, $post_type ) );1231 $child_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s' ORDER BY ID DESC LIMIT 1;", $parent_id, $post_type ) ); 1167 1232 wp_cache_set( $cache_id, $child_id, 'bbpress' ); 1168 1233 } 1169 1234 1235 // Filter and return 1170 1236 return apply_filters( 'bbp_get_public_child_last_id', (int) $child_id, (int) $parent_id, $post_type ); 1171 1237 } … … 1174 1240 * Query the DB and get a count of public children 1175 1241 * 1176 * @global db $wpdb 1177 * @param int $parent_id 1178 * @param string $post_type 1242 * @param int $parent_id Parent id 1243 * @param string $post_type Post type. Defaults to 'post' 1244 * @uses bbp_get_topic_post_type() To get the topic post type 1245 * @uses wp_cache_get() To check if there is a cache of the children count 1246 * @uses wpdb::prepare() To prepare the query 1247 * @uses wpdb::get_var() To get the result of the query in a variable 1248 * @uses wp_cache_set() To set the cache for future use 1249 * @uses apply_filters() Calls 'bbp_get_public_child_count' with the child 1250 * count, parent id and post type 1179 1251 * @return int The number of children 1180 1252 */ … … 1182 1254 global $wpdb, $bbp; 1183 1255 1256 // Bail if nothing passed 1184 1257 if ( empty( $parent_id ) ) 1185 1258 return false; 1186 1259 1187 1260 // The ID of the cached query 1188 $cache_id = 'bbp_parent_' . $parent_id . '_type_' . $post_type . '_child_count'; 1189 1261 $cache_id = 'bbp_parent_' . $parent_id . '_type_' . $post_type . '_child_count'; 1262 $post_status = array( 'publish' ); 1263 1264 // Add closed status if topic post type 1265 if ( $post_type == bbp_get_topic_post_type() ) 1266 $post_status[] = $bbp->closed_status_id; 1267 1268 // Join post statuses together 1269 $post_status = "'" . join( "', '", $post_status ) . "'"; 1270 1271 // Check for cache and set if needed 1190 1272 if ( !$child_count = wp_cache_get( $cache_id, 'bbpress' ) ) { 1191 $child_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( '" . join( "', '", array( 'publish', $bbp->closed_status_id ) ) . "') AND post_type = '%s';", $parent_id, $post_type ) );1273 $child_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s';", $parent_id, $post_type ) ); 1192 1274 wp_cache_set( $cache_id, $child_count, 'bbpress' ); 1193 1275 } 1194 1276 1277 // Filter and return 1195 1278 return apply_filters( 'bbp_get_public_child_count', (int) $child_count, (int) $parent_id, $post_type ); 1196 1279 } 1197 1280 1198 1281 /** 1199 * Query the DB and get a the child ID's of public children 1200 * 1201 * @global db $wpdb 1202 * @param int $parent_id 1203 * @param string $post_type 1204 * @return int The number of children 1282 * Query the DB and get a the child id's of public children 1283 * 1284 * @param int $parent_id Parent id 1285 * @param string $post_type Post type. Defaults to 'post' 1286 * @uses bbp_get_topic_post_type() To get the topic post type 1287 * @uses wp_cache_get() To check if there is a cache of the children 1288 * @uses wpdb::prepare() To prepare the query 1289 * @uses wpdb::get_col() To get the result of the query in an array 1290 * @uses wp_cache_set() To set the cache for future use 1291 * @uses apply_filters() Calls 'bbp_get_public_child_ids' with the child ids, 1292 * parent id and post type 1293 * @return array The array of children 1205 1294 */ 1206 1295 function bbp_get_public_child_ids( $parent_id = 0, $post_type = 'post' ) { 1207 1296 global $wpdb, $bbp; 1208 1297 1298 // Bail if nothing passed 1209 1299 if ( empty( $parent_id ) ) 1210 1300 return false; 1211 1301 1212 1302 // The ID of the cached query 1213 $cache_id = 'bbp_parent_' . $parent_id . '_type_' . $post_type . '_child_ids'; 1214 1303 $cache_id = 'bbp_parent_' . $parent_id . '_type_' . $post_type . '_child_ids'; 1304 $post_status = array( 'publish' ); 1305 1306 // Add closed status if topic post type 1307 if ( $post_type == bbp_get_topic_post_type() ) 1308 $post_status[] = $bbp->closed_status_id; 1309 1310 // Join post statuses together 1311 $post_status = "'" . join( "', '", $post_status ) . "'"; 1312 1313 // Check for cache and set if needed 1215 1314 if ( !$child_ids = wp_cache_get( $cache_id, 'bbpress' ) ) { 1216 $child_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( '" . join( "', '", array( 'publish', $bbp->closed_status_id ) ) . "') AND post_type = '%s' ORDER BY ID DESC;", $parent_id, $post_type ) );1315 $child_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s' ORDER BY ID DESC;", $parent_id, $post_type ) ); 1217 1316 wp_cache_set( $cache_id, $child_ids, 'bbpress' ); 1218 1317 } 1219 1318 1319 // Filter and return 1220 1320 return apply_filters( 'bbp_get_public_child_ids', $child_ids, (int) $parent_id, $post_type ); 1221 1321 } -
branches/plugin/bbp-includes/bbp-general-template.php
r2927 r2970 39 39 * @since bbPress (r2549) 40 40 * 41 * @uses WP_Query42 *43 41 * @param int $post_id Possible post_id to check 44 * @return bool 42 * @uses bbp_get_forum_post_type() To get the forum post type 43 * @uses is_singular() To check if it's the single post page 44 * @uses get_post_field() To get the post type of the post id 45 * @uses WP_Query To make some checks 46 * @return bool True if it's a forum page, false if not 45 47 */ 46 48 function bbp_is_forum( $post_id = 0 ) { … … 69 71 * @since bbPress (r2549) 70 72 * 71 * @uses WP_Query72 * @uses bbp_is_topic_edit() To check if it's a topic edit page73 *74 73 * @param int $post_id Possible post_id to check 75 * @return bool 74 * 75 * @uses bbp_is_topic_edit() To return false if it's a topic edit page 76 * @uses bbp_get_topic_post_type() To get the topic post type 77 * @uses is_singular() To check if it's the single post page 78 * @uses get_post_field() To get the post type of the post id 79 * @uses WP_Query To make some checks 80 * @return bool True if it's a topic page, false if not 76 81 */ 77 82 function bbp_is_topic( $post_id = 0 ) { … … 105 110 * 106 111 * @uses WP_Query Checks if WP_Query::bbp_is_topic_edit is true 107 * @return bool 112 * @return bool True if it's the topic edit page, false if not 108 113 */ 109 114 function bbp_is_topic_edit() { … … 122 127 * 123 128 * @uses bbp_is_topic_edit() To check if it's a topic edit page 124 * @return bool 129 * @return bool True if it's the topic merge page, false if not 125 130 */ 126 131 function bbp_is_topic_merge() { … … 138 143 * 139 144 * @uses bbp_is_topic_edit() To check if it's a topic edit page 140 * @return bool 145 * @return bool True if it's the topic split page, false if not 141 146 */ 142 147 function bbp_is_topic_split() { … … 153 158 * @since bbPress (r2549) 154 159 * 155 * @uses WP_Query156 * @uses bbp_is_reply_edit() To check if it's a reply edit page157 *158 160 * @param int $post_id Possible post_id to check 159 * @return bool 161 * @uses bbp_is_reply_edit() To return false if it's a reply edit page 162 * @uses bbp_get_reply_post_type() To get the reply post type 163 * @uses is_singular() To check if it's the single post page 164 * @uses get_post_field() To get the post type of the post id 165 * @uses WP_Query To make some checks 166 * @return bool True if it's a reply page, false if not 160 167 */ 161 168 function bbp_is_reply( $post_id = 0 ) { … … 189 196 * 190 197 * @uses WP_Query Checks if WP_Query::bbp_is_reply_edit is true 191 * @return bool 198 * @return bool True if it's the reply edit page, false if not 192 199 */ 193 200 function bbp_is_reply_edit() { … … 211 218 * @uses bbp_is_user_profile_page() To check if it's the user profile page 212 219 * @uses bbp_get_query_name() To get the query name 213 * @return bool 220 * @return bool True if it's the favorites page, false if not 214 221 */ 215 222 function bbp_is_favorites( $query_name_check = true ) { … … 234 241 * @uses bbp_is_user_profile_page() To check if it's the user profile page 235 242 * @uses bbp_get_query_name() To get the query name 236 * @return bool 243 * @return bool True if it's the subscriptions page, false if not 237 244 */ 238 245 function bbp_is_subscriptions( $query_name_check = true ) { … … 258 265 * @uses bbp_is_user_profile_page() To check if it's the user profile page 259 266 * @uses bbp_get_query_name() To get the query name 260 * @return bool 267 * @return bool True if it's the topics created page, false if not 261 268 */ 262 269 function bbp_is_topics_created( $query_name_check = true ) { … … 273 280 * Check if current page is the currently logged in users author page 274 281 * 282 * @since bbPress (r2688) 283 * 275 284 * @uses bbPres Checks if bbPress::displayed_user is set and if 276 285 * bbPress::displayed_user::ID equals bbPress::current_user::ID 277 286 * or not 278 * @return bool 287 * @return bool True if it's the user's home, false if not 279 288 */ 280 289 function bbp_is_user_home() { … … 293 302 * 294 303 * @uses WP_Query Checks if WP_Query::bbp_is_user_profile_page is set to true 295 * @return bool 304 * @return bool True if it's a user's profile page, false if not 296 305 */ 297 306 function bbp_is_user_profile_page() { … … 310 319 * 311 320 * @uses WP_Query Checks if WP_Query::bbp_is_user_profile_edit is set to true 312 * @return bool 321 * @return bool True if it's a user's profile edit page, false if not 313 322 */ 314 323 function bbp_is_user_profile_edit() { … … 345 354 * @param array $wp_classes 346 355 * @param array $custom_classes 347 *348 356 * @uses bbp_is_forum() 349 357 * @uses bbp_is_topic() … … 361 369 * @uses bbp_is_favorites() 362 370 * @uses bbp_is_topics_created() 363 * 364 * @return array 371 * @return array Body Classes 365 372 */ 366 373 function bbp_body_class( $wp_classes, $custom_classes = false ) { … … 478 485 $url = $_SERVER['REQUEST_URI']; 479 486 480 $url = (string) esc_attr( $url ); 487 // Remove loggedout query arg if it's there 488 $url = (string) esc_attr( remove_query_arg( 'loggedout', $url ) ); 481 489 482 490 $referer_field = '<input type="hidden" name="redirect_to" value="' . $url . '" />'; … … 631 639 * @uses current_user_can() To check if the current user can read 632 640 * private forums 641 * @uses bbp_get_forum_post_type() To get the forum post type 642 * @uses bbp_get_topic_post_type() To get the topic post type 633 643 * @uses walk_page_dropdown_tree() To generate the dropdown using the 634 644 * walker … … 1009 1019 * @since bbPress (r2692) 1010 1020 * 1011 * @uses bbp_set_query_name() To set the query var '_bbp_query_name' to ''1021 * @uses bbp_set_query_name() To set the query var '_bbp_query_name' value to '' 1012 1022 */ 1013 1023 function bbp_reset_query_name() { … … 1051 1061 * @uses bbp_get_reply_permalink() To get the reply link 1052 1062 * @uses get_permalink() To get the permalink 1063 * @uses bbp_get_forum_post_type() To get the forum post type 1064 * @uses bbp_get_topic_post_type() To get the topic post type 1065 * @uses bbp_get_reply_post_type() To get the reply post type 1053 1066 * @uses bbp_get_forum_title() To get the forum title 1054 1067 * @uses bbp_get_topic_title() To get the topic title … … 1142 1155 } 1143 1156 1144 /** Errors ********************************************************************/1145 1146 /** 1147 * Display possible error messages inside a template file1157 /** Errors & Messages *********************************************************/ 1158 1159 /** 1160 * Display possible errors & messages inside a template file 1148 1161 * 1149 1162 * @since bbPress (r2688) … … 1154 1167 * @uses is_wp_error() To check if it's a {@link WP_Error} 1155 1168 */ 1156 function bbp_ error_messages() {1169 function bbp_template_notices() { 1157 1170 global $bbp; 1158 1171 1159 if ( isset( $bbp->errors ) && is_wp_error( $bbp->errors ) && $bbp->errors->get_error_codes() ) : ?> 1172 // Bail if no notices or errors 1173 if ( !isset( $bbp->errors ) || !is_wp_error( $bbp->errors ) || !$bbp->errors->get_error_codes() ) 1174 return; 1175 1176 // Prevent debug notices 1177 $errors = $messages = array(); 1178 1179 // Loop through notices 1180 foreach ( $bbp->errors->get_error_codes() as $code ) { 1181 1182 // Get notice severity 1183 $severity = $bbp->errors->get_error_data( $code ); 1184 1185 // Loop through notices and separate errors from messages 1186 foreach ( $bbp->errors->get_error_messages( $code ) as $error ) { 1187 if ( 'message' == $severity ) { 1188 $messages[] = $error; 1189 } else { 1190 $errors[] = $error; 1191 } 1192 } 1193 } 1194 1195 // Display errors first... 1196 if ( !empty( $errors ) ) : ?> 1160 1197 1161 1198 <div class="bbp-template-notice error"> 1162 1199 <p> 1163 <?php echo implode( "</p>\n<p>", $ bbp->errors->get_error_messages()); ?>1200 <?php echo implode( "</p>\n<p>", $errors ); ?> 1164 1201 </p> 1165 1202 </div> 1166 1203 1167 <?php endif; 1204 <?php endif; 1205 1206 // ...and messages last 1207 if ( !empty( $messages ) ) : ?> 1208 1209 <div class="bbp-template-notice"> 1210 <p> 1211 <?php echo implode( "</p>\n<p>", $messages ); ?> 1212 </p> 1213 </div> 1214 1215 <?php endif; 1168 1216 } 1169 1217 … … 1193 1241 */ 1194 1242 function bbp_get_logout_link( $redirect_to = '' ) { 1195 return apply_filters( 'bbp_get_logout_link', '<a href="' . wp_logout_url( ) . '" class="button logout-link">' . __( 'Log Out', 'bbpress' ) . '</a>', $redirect_to );1243 return apply_filters( 'bbp_get_logout_link', '<a href="' . wp_logout_url( $redirect_to ) . '" class="button logout-link">' . __( 'Log Out', 'bbpress' ) . '</a>', $redirect_to ); 1196 1244 } 1197 1245 -
branches/plugin/bbp-includes/bbp-hooks.php
r2965 r2970 36 36 * bbp_loaded - Attached to 'plugins_loaded' above 37 37 * 38 * Attach various loader actions sto the bbp_loaded action.38 * Attach various loader actions to the bbp_loaded action. 39 39 * The load order helps to load code at the correct time. 40 40 * v---Load order … … 49 49 * bbp_init - Attached to 'init' above 50 50 * 51 * Attach various initialization actions sto the init action.51 * Attach various initialization actions to the init action. 52 52 * The load order helps to load code at the correct time. 53 53 * v---Load order … … 76 76 add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Replies_Widget");' ) ); 77 77 78 // Template - Head, foot, errors and notices 79 add_action( 'wp_head', 'bbp_head' ); 80 add_filter( 'wp_title', 'bbp_title', 10, 3 ); 81 add_action( 'wp_footer', 'bbp_footer' ); 82 add_action( 'bbp_template_notices', 'bbp_error_messages' ); 83 add_action( 'bbp_template_notices', 'bbp_topic_notices' ); 78 // Template - Head, foot, errors and messages 79 add_action( 'wp_head', 'bbp_head' ); 80 add_filter( 'wp_title', 'bbp_title', 10, 3 ); 81 add_action( 'wp_footer', 'bbp_footer' ); 82 add_action( 'bbp_loaded', 'bbp_login_notices' ); 83 add_action( 'bbp_head', 'bbp_topic_notices' ); 84 add_action( 'bbp_template_notices', 'bbp_template_notices' ); 84 85 85 86 // Add to body class … … 311 312 312 313 /** 313 * On multiblog installations you must first allow themes to be activated and show314 * up on the theme selection screen. This function will let the bbPress bundled315 * themes show up and bypass this step.314 * On multiblog installations you must first allow themes to be activated and 315 * show up on the theme selection screen. This function will let the bbPress 316 * bundled themes show up and bypass this step. 316 317 * 317 318 * @since bbPress (r2944) 318 319 * 319 * @uses is_super_admin() 320 * @uses apply_filters() 320 * @uses is_super_admin() To check if the user is site admin 321 * @uses apply_filters() Calls 'bbp_allowed_themes' with the allowed themes list 321 322 */ 322 323 function bbp_allowed_themes( $themes ) { -
branches/plugin/bbp-includes/bbp-topic-functions.php
r2955 r2970 9 9 10 10 /** Post Form Handlers ********************************************************/ 11 12 /** 13 * Insert a topic. 14 * 15 * If $topicarr has 'ID' set to a value, then topic will be updated. 16 * 17 * You can set the topic date manually, by setting the values for 'post_date' 18 * and 'post_date_gmt' keys. You can open or close replies by setting the value 19 * for 'post_status' key. 20 * 21 * The defaults for the parameter $postarr are: 22 * 'post_status' - Default is 'draft'. 23 * 'post_type' - Default is 'post'. 24 * 'post_author' - Default is current user ID ($user_ID). The ID of the user who added the post. 25 * 'ping_status' - Default is the value in 'default_ping_status' option. 26 * Whether the attachment can accept pings. 27 * 'post_parent' - Default is 0. Set this for the post it belongs to, if any. 28 * 'menu_order' - Default is 0. The order it is displayed. 29 * 'to_ping' - Whether to ping. 30 * 'pinged' - Default is empty string. 31 * 'post_password' - Default is empty string. The password to access the attachment. 32 * 'guid' - Global Unique ID for referencing the attachment. 33 * 'post_content_filtered' - Post content filtered. 34 * 'post_excerpt' - Post excerpt. 35 * 36 * @since 1.0.0 37 * 38 * @uses $wpdb 39 * @uses $wp_rewrite 40 * @uses $user_ID 41 * 42 * @uses do_action() Calls 'pre_post_update' on post ID if this is an update. 43 * @uses do_action() Calls 'edit_post' action on post ID and post data if this is an update. 44 * @uses do_action() Calls 'save_post' and 'wp_insert_post' on post id and post data just before returning. 45 * @uses apply_filters() Calls 'wp_insert_post_data' passing $data, $postarr prior to database update or insert. 46 * @uses wp_transition_post_status() 47 * 48 * @param array $postarr Elements that make up post to insert. 49 * @param bool $wp_error Optional. Allow return of WP_Error on failure. 50 * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success. 51 */ 52 function bbp_insert_topic( $post_args = '', $meta_args = '' ) { 53 global $bbp, $wpdb, $wp_rewrite; 54 55 // Default post fields and post meta 56 $post_defaults = array( 57 58 // Pass a topic_id if you want to update rather than insert 59 'topic_id' => 0, 60 61 // Essential post fields 62 'post_title' => '', 63 'post_content' => '', 64 'post_content_filtered' => '', 65 'post_excerpt' => '', 66 'post_author' => $user_ID, 67 'post_status' => 'publish', 68 'post_type' => bbp_get_topic_post_type(), 69 'post_parent' => 0, 70 'post_password' => '', 71 'menu_order' => 0, 72 73 // Ping fields - (Not yet used by bbPress core) 74 'ping_status' => get_option( 'default_ping_status' ), 75 'to_ping' => '', 76 'pinged' => '', 77 78 // Additional post fields 79 'guid' => '', 80 'import_id' => 0, 81 82 ); 83 84 // Parse 85 $p = wp_parse_args( $post_args, $post_defaults ); 86 extract( $p, EXTR_SKIP ); 87 88 // Additional parameters for bbPress topics 89 $meta_defaults = array( 90 91 // 'forum_id' typically be synced with post_parent above 92 'forum_id' => 0, 93 94 // Anonymous user 95 'anonymous_name' => '', 96 'anonymous_email' => '', 97 'anonymous_ip' => '', 98 'anonymous_website' => '', 99 100 // Reply and voice counts 101 'anonymous_reply_count' => 0, 102 'reply_count' => 0, 103 'hidden_reply_count' => 0, 104 'voice_count' => 0, 105 106 // Last active 107 'last_active_id' => 0, 108 'last_active_time' => '', 109 'last_reply_id' => 0, 110 111 // Additional post meta 112 'revision_log' => false, 113 'status' => '', 114 'spam_meta_status' => '', 115 'pre_trashed_replies' => '', 116 117 ); 118 119 // Parse 120 $m = wp_parse_args( $meta_args, $meta_defaults ); 121 extract( $m, EXTR_SKIP ); 122 123 // Handle the post insertion 124 $topic = wp_insert_post( $r ); 125 126 // 127 foreach( $m as $meta_key => $meta_value ) { 128 update_post_meta( $topic->ID, '_bbp_' . $meta_key, $meta_value ); 129 } 130 bbp_update_topic_last_active_id( $topic->ID, $last_active_id ); 131 132 $post = wp_insert_post( $r ); 133 134 // Updating an existing post 135 if ( !empty( $ID ) ) { 136 $update = true; 137 $previous_status = get_post_field( 'post_status', $ID ); 138 $post_ID = (int) $ID; 139 $guid = get_post_field( 'guid', $post_ID ); 140 $post_before = get_post( $post_ID ); 141 142 // Not updating 143 } else { 144 $update = false; 145 $previous_status = 'new'; 146 } 147 148 } 11 149 12 150 /** … … 1745 1883 do_action( 'bbp_close_topic', $topic_id ); 1746 1884 1747 add_post_meta( $topic_id, '_bbp_ topic_status', $topic['post_status'] );1885 add_post_meta( $topic_id, '_bbp_status', $topic['post_status'] ); 1748 1886 1749 1887 $topic['post_status'] = $bbp->closed_status_id; … … 1781 1919 do_action( 'bbp_open_topic', $topic_id ); 1782 1920 1783 $topic_status = get_post_meta( $topic_id, '_bbp_ topic_status', true );1921 $topic_status = get_post_meta( $topic_id, '_bbp_status', true ); 1784 1922 $topic['post_status'] = $topic_status; 1785 1923 1786 delete_post_meta( $topic_id, '_bbp_ topic_status' );1924 delete_post_meta( $topic_id, '_bbp_status' ); 1787 1925 1788 1926 $topic_id = wp_insert_post( $topic ); -
branches/plugin/bbp-includes/bbp-topic-template.php
r2968 r2970 11 11 12 12 /** 13 * Returnthe unique ID of the custom post type for topics13 * Output the unique ID of the custom post type for topics 14 14 * 15 15 * @since bbPress (r2857) 16 16 * 17 * @global bbPress $bbp 18 * @return string 17 * @uses bbp_get_topic_post_type() To get the topic post type 19 18 */ 20 19 function bbp_topic_post_type() { … … 26 25 * @since bbPress (r2857) 27 26 * 28 * @global bbPress $bbp 29 * @return string 27 * @uses apply_filters() Calls 'bbp_get_topic_post_type' with the topic 28 * post type id 29 * @return string The unique topic post type id 30 30 */ 31 31 function bbp_get_topic_post_type() { 32 32 global $bbp; 33 33 34 return apply_filters( 'bbp_get_topic_post_type', $bbp->topic_post_type ); 34 35 } … … 42 43 * 43 44 * @param mixed $args All the arguments supported by {@link WP_Query} 44 * @uses bbp_is_user_profile_page() To check if it's the profile page45 * @uses get_the_ID() To get the id45 * @uses current_user_can() To check if the current user can edit other's topics 46 * @uses bbp_get_topic_post_type() To get the topic post type 46 47 * @uses WP_Query To make query and get the topics 47 48 * @uses is_page() To check if it's a page 48 49 * @uses bbp_is_forum() To check if it's a forum 50 * @uses bbp_get_forum_id() To get the forum id 49 51 * @uses bbp_get_paged() To get the current page value 50 52 * @uses bbp_get_super_stickies() To get the super stickies … … 284 286 * @uses bbp_is_reply_edit() To check if it's a reply edit page 285 287 * @uses bbp_get_reply_topic_edit() To get the reply topic id 288 * @uses get_post_field() To get the post's post type 286 289 * @uses WP_Query::post::ID To get the topic id 287 * @uses apply_filters() Calls 'bbp_get_topic_id' with the topic id 290 * @uses apply_filters() Calls 'bbp_get_topic_id' with the topic id and 291 * supplied topic id 292 * @return int The topic id 288 293 */ 289 294 function bbp_get_topic_id( $topic_id = 0 ) { … … 610 615 * @uses bbp_get_topic_raw_revision_log() To get the raw revision log 611 616 * @uses bbp_get_topic_author_display_name() To get the topic author 612 * @uses bbp_get_ topic_author_link() To get the topic author link617 * @uses bbp_get_author_link() To get the topic author link 613 618 * @uses bbp_convert_date() To convert the date 614 619 * @uses bbp_get_time_since() To get the time in since format … … 839 844 * @uses bbp_get_topic_id() To get the topic id 840 845 * @uses bbp_get_topic_status() To get the topic status 841 * @return bool True if spam, false if not.846 * @return bool True if trashed, false if not. 842 847 */ 843 848 function bbp_is_topic_trash( $topic_id = 0 ) { … … 895 900 * @uses bbp_is_topic_anonymous() To check if the topic is by an 896 901 * anonymous user 902 * @uses bbp_get_topic_author_id() To get the topic author id 903 * @uses get_the_author_meta() To get the display name of the author 904 * @uses get_post_meta() To get the name of the anonymous poster 897 905 * @uses apply_filters() Calls 'bbp_get_topic_author' with the author 898 906 * and topic id … … 1197 1205 * @param int $topic_id Optional. Topic id 1198 1206 * @uses bbp_get_topic_id() To get topic id 1199 * @uses get_post_field() To get get topic's parent 1207 * @uses get_post_meta() To retrieve get topic's forum id meta 1208 * @uses get_post_field() To get the topic's parent, i.e. forum id 1209 * @uses bbp_update_topic_forum_id() To update the topic forum id 1200 1210 * @uses apply_filters() Calls 'bbp_get_topic_forum_id' with the forum 1201 * id and topic id1211 * id and topic id 1202 1212 * @return int Topic forum id 1203 1213 */ … … 1220 1230 * @since bbPress (r2860) 1221 1231 * 1232 * @param int $topic_id Optional. Forum id 1222 1233 * @uses bbp_get_topic_last_active_id() To get the topic's last active id 1223 * @param int $topic_id Optional. Forum id1224 1234 */ 1225 1235 function bbp_topic_last_active_id( $topic_id = 0 ) { … … 1564 1574 * @uses apply_filters() Calls 'bbp_get_topic_post_count' with the 1565 1575 * post count and topic id 1566 * @return int post count1576 * @return int Post count 1567 1577 */ 1568 1578 function bbp_get_topic_post_count( $topic_id = 0 ) { … … 1927 1937 * @uses current_user_can() To check if the current user can delete the 1928 1938 * topic 1939 * @uses bbp_is_topic_trash() To check if the topic is trashed 1929 1940 * @uses bbp_get_topic_status() To get the topic status 1930 1941 * @uses add_query_arg() To add custom args to the url … … 2300 2311 * @uses bbp_is_topic() To check if it's a topic page 2301 2312 * @uses bbp_get_topic_status() To get the topic status 2313 * @uses bbp_get_topic_id() To get the topic id 2314 * @uses apply_filters() Calls 'bbp_topic_notices' with the notice text, topic 2315 * status and topic id 2316 * @uses bbPress::errors::add() To add the notices to the error handler 2302 2317 */ 2303 2318 function bbp_topic_notices() { … … 2331 2346 2332 2347 // Filter notice text and bail if empty 2333 if ( ! $notice_text = apply_filters( 'bbp_topic_notices', $notice_text, $topic_status, bbp_get_topic_id() ) ) 2334 return; ?> 2335 2336 <div class="bbp-template-notice error"> 2337 <p><?php echo $notice_text; ?></p> 2338 </div> 2339 2340 <?php 2348 if ( !$notice_text = apply_filters( 'bbp_topic_notices', $notice_text, $topic_status, bbp_get_topic_id() ) ) 2349 return; 2350 2351 $bbp->errors->add( 'topic_notice', $notice_text, 'message' ); 2341 2352 } 2342 2353 … … 2416 2427 * @since bbPress (r2860) 2417 2428 * 2429 * @param array $args See {@link bbp_get_single_topic_description()} 2418 2430 * @uses bbp_get_single_topic_description() Return the eventual output 2419 *2420 * @param arr $args Arguments passed to alter output2421 2431 */ 2422 2432 function bbp_single_topic_description( $args = '' ) { … … 2429 2439 * @since bbPress (r2860) 2430 2440 * 2431 * @ uses wp_parse_args()2432 * @uses bbp_get_topic_id()2433 * @uses bbp_get_topic_topic_count()2434 * @uses bbp_get_topic_reply_count()2435 * @uses bbp_get_topic_subtopic_count()2436 * @uses bbp_get_topic_ freshness_link()2437 * @uses bbp_get_topic_ last_reply_id()2438 * @uses bbp_get_ reply_author_avatar()2439 * @uses bbp_get_ reply_author_link()2440 * @uses apply_filters()2441 * 2442 * @ param arr $args Arguments passed to alter output2443 * 2441 * @param mixed $args This function supports these arguments: 2442 * - topic_id: Topic id 2443 * - before: Before the text 2444 * - after: After the text 2445 * - size: Size of the avatar 2446 * @uses bbp_get_topic_id() To get the topic id 2447 * @uses bbp_get_topic_voice_count() To get the topic voice count 2448 * @uses bbp_get_topic_reply_count() To get the topic reply count 2449 * @uses bbp_get_topic_freshness_link() To get the topic freshness link 2450 * @uses bbp_get_topic_last_active_id() To get the topic last active id 2451 * @uses bbp_get_reply_author_link() To get the reply author link 2452 * @uses apply_filters() Calls 'bbp_get_single_topic_description' with 2453 * the description and args 2444 2454 * @return string Filtered topic description 2445 2455 */ -
branches/plugin/bbp-includes/bbp-update.php
r2955 r2970 122 122 } 123 123 } 124 125 // Rename topic postmeta keys from _bbp_topic_status to _bbp_status 126 if ( 108 > (int) $db_version ) { 127 128 // Rename topic postmeta keys from _bbp_topic_status to _bbp_status 129 $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_key = '_bbp_status' WHERE meta_key = '_bbp_topic_status'" ) ); 130 131 // Set the new DB version 132 update_option( '_bbp_db_version', '108' ); 133 } 124 134 } 125 135 add_action( 'init', 'bbp_update', 1 ); -
branches/plugin/bbp-includes/bbp-user-template.php
r2914 r2970 146 146 global $user_identity; 147 147 148 if ( is_user_logged_in() ) 149 $current_user_name = $user_identity; 150 else 151 $current_user_name = __( 'Anonymous', 'bbpress' ); 148 $current_user_name = is_user_logged_in() ? $user_identity : __( 'Anonymous', 'bbpress' ); 152 149 153 150 return apply_filters( 'bbp_get_current_user_name', $current_user_name ); … … 538 535 * @param int $user_id Optional. User id 539 536 * @uses bbp_get_user_profile_url() To get the user profile url 540 * @uses apply_filters() Calls 'bbp_get_ favorites_permalink' with the541 * user profile url and user id537 * @uses apply_filters() Calls 'bbp_get_subscriptions_permalink' with 538 * the user profile url and user id 542 539 * @return string Permanent link to user subscriptions page 543 540 */ … … 759 756 global $bbp; 760 757 761 return _wp_get_user_contactmethods( $bbp->displayed_user ); 758 // Get the core WordPress contact methods 759 $contact_methods = _wp_get_user_contactmethods( $bbp->displayed_user ); 760 761 return apply_filters( 'bbp_edit_user_contact_methods', $contact_methods ); 762 762 } 763 763 764 764 /** Login *********************************************************************/ 765 766 /** 767 * Handle the login and registration template notices 768 * 769 * @since bbPress (r2970) 770 */ 771 function bbp_login_notices() { 772 global $bbp; 773 774 // loggedout was passed 775 if ( !empty( $_GET['loggedout'] ) && ( true == $_GET['loggedout'] ) ) { 776 $bbp->errors->add( 'loggedout', __( 'You are now logged out.', 'bbpress' ), 'message' ); 777 778 // registration is disabled 779 } elseif ( !empty( $_GET['registration'] ) && ( 'disabled' == $_GET['registration'] ) ) { 780 $bbp->errors->add( 'registerdisabled', __( 'New user registration is currently not allowed.', 'bbpress' ) ); 781 782 // Prompt user to check their email 783 } elseif ( !empty( $_GET['checkemail'] ) && in_array( $_GET['checkemail'], array( 'confirm', 'newpass', 'registered' ) ) ) { 784 785 switch ( $_GET['checkemail'] ) { 786 787 // Email needs confirmation 788 case 'confirm' : 789 $bbp->errors->add( 'confirm', __( 'Check your e-mail for the confirmation link.', 'bbpress' ), 'message' ); 790 break; 791 792 // User requested a new password 793 case 'newpass' : 794 $bbp->errors->add( 'newpass', __( 'Check your e-mail for your new password.', 'bbpress' ), 'message' ); 795 break; 796 797 // User is newly registered 798 case 'registered' : 799 $bbp->errors->add( 'registered', __( 'Registration complete. Please check your e-mail.', 'bbpress' ), 'message' ); 800 break; 801 } 802 } 803 } 765 804 766 805 /** … … 779 818 */ 780 819 function bbp_logged_in_redirect( $url = '' ) { 820 821 // Bail if user is not logged in 781 822 if ( !is_user_logged_in() ) 782 823 return; 783 824 825 // Setup the profile page to redirect to 784 826 $redirect_to = !empty( $url ) ? $url : bbp_get_user_profile_url( bbp_get_current_user_id() ); 827 828 // Do a safe redirect and exit 785 829 wp_safe_redirect( $redirect_to ); 786 830 exit; … … 813 857 * @since bbPress (r2815) 814 858 * 859 * @uses bbp_login_url() To get the login url 860 * @uses bbp_redirect_to_field() To output the redirect to field 815 861 * @uses wp_nonce_field() To generate hidden nonce fields 816 862 */ … … 818 864 ?> 819 865 820 <input type="hidden" name="action" value=" bbp-user-register" id="bbp_user_register" />866 <input type="hidden" name="action" value="register" /> 821 867 <input type="hidden" name="user-cookie" value="1" /> 868 869 <?php bbp_redirect_to_field( add_query_arg( array( 'checkemail' => 'registered' ), bbp_login_url() ) ); ?> 822 870 823 871 <?php wp_nonce_field( 'bbp-user-register' ); … … 862 910 * 863 911 * @param mixed $args Optional. If an integer, it is used as reply id. 864 * @uses bbp_get_reply_id() To get the reply id865 912 * @uses bbp_is_topic() To check if it's a topic page 913 * @uses bbp_get_topic_author_link() To get the topic author link 866 914 * @uses bbp_is_reply() To check if it's a reply page 915 * @uses bbp_get_reply_author_link() To get the reply author link 916 * @uses get_post_field() To get the post author 867 917 * @uses bbp_is_reply_anonymous() To check if the reply is by an 868 918 * anonymous user 869 * @uses bbp_get_reply_author() To get the replyauthor name870 * @uses bbp_get_ reply_author_url() To get the reply authorurl871 * @uses bbp_get_reply_author_avatar() To get the replyauthor avatar919 * @uses get_the_author_meta() To get the author name 920 * @uses bbp_get_user_profile_url() To get the author profile url 921 * @uses get_avatar() To get the author avatar 872 922 * @uses apply_filters() Calls 'bbp_get_reply_author_link' with the 873 923 * author link and args -
branches/plugin/bbp-includes/bbp-widgets.php
r2939 r2970 66 66 <legend><?php _e( 'Login', 'bbpress' ); ?></legend> 67 67 68 <?php do_action( 'bbp_template_notices' ); ?>69 70 68 <div class="bbp-username"> 71 69 <label for="user_login"><?php _e( 'Username', 'bbpress' ); ?>: </label> … … 183 181 * @param array $instance Instance 184 182 * @uses apply_filters() Calls 'bbp_forum_widget_title' with the title 183 * @uses get_option() To get the forums per page option 184 * @uses current_user_can() To check if the current user can read 185 * private() To resety name 186 * @uses bbp_set_query_name() To set the query name to 'bbp_widget' 187 * @uses bbp_reset_query_name() To reset the query name 185 188 * @uses bbp_has_forums() The main forum loop 186 189 * @uses bbp_forums() To check whether there are more forums available … … 315 318 * @param array $instance 316 319 * @uses apply_filters() Calls 'bbp_topic_widget_title' with the title 320 * @uses bbp_set_query_name() To set the query name to 'bbp_widget' 321 * @uses bbp_reset_query_name() To reset the query name 317 322 * @uses bbp_has_topics() The main topic loop 318 323 * @uses bbp_topics() To check whether there are more topics available … … 321 326 * @uses bbp_topic_permalink() To display the topic permalink 322 327 * @uses bbp_topic_title() To display the topic title 323 * @uses bbp_get_topic_last_active_time() To get the topic last active time 328 * @uses bbp_get_topic_last_active_time() To get the topic last active 329 * time 324 330 * @uses bbp_get_topic_id() To get the topic id 325 331 * @uses bbp_get_topic_reply_count() To get the topic reply count -
branches/plugin/bbp-themes/bbp-twentyten/bbpress/form-user-login.php
r2943 r2970 13 13 <fieldset> 14 14 <legend><?php _e( 'Login', 'bbpress' ); ?></legend> 15 16 <?php do_action( 'bbp_template_notices' ); ?>17 15 18 16 <div class="bbp-username"> -
branches/plugin/bbp-themes/bbp-twentyten/bbpress/form-user-register.php
r2943 r2970 10 10 ?> 11 11 12 <form method="post" action="<?php bbp_wp_login_action( array( ' action' => 'register', 'context' => 'login_post' ) ); ?>" class="bbp-login-form">12 <form method="post" action="<?php bbp_wp_login_action( array( 'context' => 'login_post' ) ); ?>" class="bbp-login-form"> 13 13 <fieldset> 14 14 <legend><?php _e( 'Register', 'bbpress' ); ?></legend> 15 16 <?php do_action( 'bbp_template_notices' ); ?>17 15 18 16 <div class="bbp-username"> … … 26 24 </div> 27 25 26 <?php do_action( 'register_form' ); ?> 27 28 <p id="reg_passmail"><?php _e( 'A password will be e-mailed to you.', 'bbpress' ) ?></p> 29 28 30 <div class="bbp-submit-wrapper"> 29 30 <?php do_action( 'register_form' ); ?>31 31 32 32 <button type="submit" name="user-submit" tabindex="<?php bbp_tab_index(); ?>" class="user-submit"><?php _e( 'Register', 'bbpress' ); ?></button>
Note: See TracChangeset
for help on using the changeset viewer.