Changeset 5729 for trunk/bp-forums/bp-forums-functions.php
- Timestamp:
- 02/11/2012 09:32:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-forums/bp-forums-functions.php
r5567 r5729 66 66 extract( $r, EXTR_SKIP ); 67 67 68 return bb_update_forum( array( 'forum_id' => (int) $forum_id, 'forum_name' => stripslashes( $forum_name ), 'forum_desc' => stripslashes( $forum_desc ), 'forum_slug' => stripslashes( $forum_slug ), 'forum_parent' => $forum_parent_id, 'forum_order' => $forum_order, 'forum_is_category' => $forum_is_category ) );68 return bb_update_forum( array( 'forum_id' => (int) $forum_id, 'forum_name' => stripslashes( $forum_name ), 'forum_desc' => stripslashes( $forum_desc ), 'forum_slug' => stripslashes( $forum_slug ), 'forum_parent' => $forum_parent_id, 'forum_order' => $forum_order, 'forum_is_category' => $forum_is_category ) ); 69 69 } 70 70 … … 175 175 $topic_slug = sanitize_title( $topic_title ); 176 176 177 if ( !$topic_id = bb_insert_topic( array( 'topic_title' => stripslashes( $topic_title ), 'topic_slug' => $topic_slug, 'topic_poster' => $topic_poster, 'topic_poster_name' => $topic_poster_name, 'topic_last_poster' => $topic_last_poster, 'topic_last_poster_name' => $topic_last_poster_name, 'topic_start_time' => $topic_start_time, 'topic_time' => $topic_time, 'topic_open' => $topic_open, 'forum_id' => (int) $forum_id, 'tags' => $topic_tags ) ) )177 if ( !$topic_id = bb_insert_topic( array( 'topic_title' => stripslashes( $topic_title ), 'topic_slug' => $topic_slug, 'topic_poster' => $topic_poster, 'topic_poster_name' => $topic_poster_name, 'topic_last_poster' => $topic_last_poster, 'topic_last_poster_name' => $topic_last_poster_name, 'topic_start_time' => $topic_start_time, 'topic_time' => $topic_time, 'topic_open' => $topic_open, 'forum_id' => (int) $forum_id, 'tags' => $topic_tags ) ) ) 178 178 return false; 179 179 … … 293 293 } 294 294 $count = $bbdb->get_results( $bbdb->prepare( "SELECT t.topic_id FROM {$bbdb->topics} AS t {$groups_table_sql} WHERE {$groups_where_sql}" ) ); 295 $count = count( (array) $count );295 $count = count( (array) $count ); 296 296 } else { 297 297 $count = 0; … … 426 426 427 427 // Get the topic ids 428 foreach ( (array) $topics as $topic ) $topic_ids[] = $topic->topic_id;429 $topic_ids = $wpdb->escape( join( ',', (array) $topic_ids ) );428 foreach ( (array) $topics as $topic ) $topic_ids[] = $topic->topic_id; 429 $topic_ids = $wpdb->escape( join( ',', (array) $topic_ids ) ); 430 430 431 431 // Fetch the topic's last poster details 432 432 $poster_details = $wpdb->get_results( $wpdb->prepare( "SELECT t.topic_id, t.topic_last_poster, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$wpdb->users} u, {$bbdb->topics} t WHERE u.ID = t.topic_last_poster AND t.topic_id IN ( {$topic_ids} )" ) ); 433 433 for ( $i = 0, $count = count( $topics ); $i < $count; ++$i ) { 434 foreach ( (array) $poster_details as $poster ) {434 foreach ( (array) $poster_details as $poster ) { 435 435 if ( $poster->topic_id == $topics[$i]->topic_id ) { 436 436 $topics[$i]->topic_last_poster_email = $poster->user_email; … … 446 446 $poster_names = $wpdb->get_results( $wpdb->prepare( "SELECT t.topic_id, pd.value FROM {$bp->profile->table_name_data} pd, {$bbdb->topics} t WHERE pd.user_id = t.topic_last_poster AND pd.field_id = 1 AND t.topic_id IN ( {$topic_ids} )" ) ); 447 447 for ( $i = 0, $count = count( $topics ); $i < $count; ++$i ) { 448 foreach ( (array) $poster_names as $name ) {448 foreach ( (array) $poster_names as $name ) { 449 449 if ( $name->topic_id == $topics[$i]->topic_id ) 450 450 $topics[$i]->topic_last_poster_displayname = $name->value; … … 455 455 // Loop through to make sure that each topic has the proper values set. This covers the 456 456 // case of deleted users 457 foreach ( (array) $topics as $key => $topic ) {457 foreach ( (array) $topics as $key => $topic ) { 458 458 if ( !isset( $topic->topic_last_poster_email ) ) 459 459 $topics[$key]->topic_last_poster_email = ''; … … 565 565 566 566 // Get the user ids 567 foreach ( (array) $posts as $post ) $user_ids[] = $post->poster_id;568 $user_ids = $wpdb->escape( join( ',', (array) $user_ids ) );567 foreach ( (array) $posts as $post ) $user_ids[] = $post->poster_id; 568 $user_ids = $wpdb->escape( join( ',', (array) $user_ids ) ); 569 569 570 570 // Fetch the poster's user_email, user_nicename and user_login … … 572 572 573 573 for ( $i = 0, $count = count( $posts ); $i < $count; ++$i ) { 574 foreach ( (array) $poster_details as $poster ) {574 foreach ( (array) $poster_details as $poster ) { 575 575 if ( $poster->user_id == $posts[$i]->poster_id ) { 576 576 $posts[$i]->poster_email = $poster->user_email; … … 586 586 $poster_names = $wpdb->get_results( $wpdb->prepare( "SELECT pd.user_id, pd.value FROM {$bp->profile->table_name_data} pd WHERE pd.user_id IN ( {$user_ids} )" ) ); 587 587 for ( $i = 0, $count = count( $posts ); $i < $count; ++$i ) { 588 foreach ( (array) $poster_names as $name ) {588 foreach ( (array) $poster_names as $name ) { 589 589 if ( isset( $topics[$i] ) && $name->user_id == $topics[$i]->user_id ) 590 590 $posts[$i]->poster_name = $poster->value;
Note: See TracChangeset
for help on using the changeset viewer.