Changeset 2670
- Timestamp:
- 12/03/2010 10:48:46 AM (16 years ago)
- Location:
- branches/plugin
- Files:
-
- 1 added
- 7 edited
-
bbp-admin/bbp-admin.php (modified) (5 diffs)
-
bbp-includes/bbp-functions.php (modified) (7 diffs)
-
bbp-includes/bbp-template.php (modified) (8 diffs)
-
bbp-themes/bbp-twentyten/form-bbp_anonymous.php (added)
-
bbp-themes/bbp-twentyten/form-bbp_reply.php (modified) (2 diffs)
-
bbp-themes/bbp-twentyten/form-bbp_topic.php (modified) (3 diffs)
-
bbp-themes/bbp-twentyten/loop-bbp_replies.php (modified) (1 diff)
-
bbp-themes/bbp-twentyten/single-bbp_topic.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-admin/bbp-admin.php
r2651 r2670 311 311 <?php if ( bbp_is_forum() || bbp_is_topic() || bbp_is_reply() ) : ?> 312 312 313 .column-author, .column-bbp_forum_topic_count, .column-bbp_forum_reply_count, .column-bbp_topic_forum, .column-bbp_topic_reply_count, .column-bbp_topic_voice_count, .column-bbp_reply_ topic, .column-bbp_reply_forum { width: 10% !important; }314 .column-bbp_forum_freshness, .column-bbp_topic_freshness, .column-bbp_reply_posted { width: 15% !important; }313 .column-author, .column-bbp_forum_topic_count, .column-bbp_forum_reply_count, .column-bbp_topic_forum, .column-bbp_topic_reply_count, .column-bbp_topic_voice_count, .column-bbp_reply_forum { width: 10% !important; } 314 .column-bbp_forum_freshness, .column-bbp_topic_freshness, .column-bbp_reply_posted, .column-bbp_topic_author, .column-bbp_reply_author, .column-bbp_reply_topic { width: 15% !important; } 315 315 316 316 <?php endif; ?> … … 455 455 'bbp_topic_reply_count' => __( 'Replies', 'bbpress' ), 456 456 'bbp_topic_voice_count' => __( 'Voices', 'bbpress' ), 457 ' author'=> __( 'Author', 'bbpress' ),457 'bbp_topic_author' => __( 'Author', 'bbpress' ), 458 458 'bbp_topic_freshness' => __( 'Freshness', 'bbpress' ) 459 459 ); … … 510 510 break; 511 511 512 // Author 513 case 'bbp_topic_author' : 514 bbp_topic_author_display_name ( $topic_id ); 515 break; 516 512 517 // Freshness 513 518 case 'bbp_topic_freshness' : … … 557 562 'bbp_reply_forum' => __( 'Forum', 'bbpress' ), 558 563 'bbp_reply_topic' => __( 'Topic', 'bbpress' ), 559 ' author'=> __( 'Author', 'bbpress' ),564 'bbp_reply_author' => __( 'Author', 'bbpress' ), 560 565 'bbp_reply_posted' => __( 'Posted' , 'bbpress' ), 561 566 ); … … 622 627 //echo '<div class="row-actions">' . implode( ' | ', $formatted_actions ) . '</div>'; 623 628 629 break; 630 631 // Author 632 case 'bbp_reply_author' : 633 bbp_reply_author_display_name ( $reply_id ); 624 634 break; 625 635 -
branches/plugin/bbp-includes/bbp-functions.php
r2668 r2670 95 95 96 96 // Check users ability to create new reply 97 if ( !current_user_can( 'publish_replies' ) || ( !is_user_logged_in() && !bbp_allow_anonymous() ) ) 98 return false; 97 if ( !$is_anonymous = bbp_is_anonymous() ) 98 if ( !current_user_can( 'publish_replies' ) ) 99 return false; 99 100 100 101 // Nonce check … … 133 134 134 135 // Insert reply 135 $reply_id = wp_insert_post( $reply_data ); 136 136 $reply_id = wp_insert_post( $reply_data ); 137 $reply_data['ID'] = $reply_id; 138 139 // If anonymous post, store name, email and website in post_meta 140 // @todo - validate 141 if ( true == $is_anonymous ) { 142 add_post_meta( $reply_id, '_bbp_anonymous_name', $_POST['bbp_anonymous_name'], false ); 143 add_post_meta( $reply_id, '_bbp_anonymous_email', $_POST['bbp_anonymous_email'], false ); 144 add_post_meta( $reply_id, '_bbp_anonymous_website', $_POST['bbp_anonymous_website'], false ); 145 add_post_meta( $reply_id, '_bbp_anonymous_ip', $_POST['bbp_anonymous_ip'], false ); 146 } 147 137 148 // Update counts, etc... 138 149 do_action( 'bbp_new_reply', $reply_data ); … … 177 188 178 189 // Check users ability to create new topic 179 if ( !current_user_can( 'publish_topics' ) || ( !is_user_logged_in() && !bbp_allow_anonymous() ) ) 180 return false; 190 if ( !$is_anonymous = bbp_is_anonymous() ) 191 if ( !current_user_can( 'publish_topics' ) ) 192 return false; 181 193 182 194 // Nonce check … … 229 241 $topic_id = wp_insert_post( $topic_data ); 230 242 243 // If anonymous post, store name, email and website in post_meta 244 // @todo - validation 245 if ( true == $is_anonymous ) { 246 add_post_meta( $topic_id, '_bbp_anonymous_name', $_POST['bbp_anonymous_name'], false ); 247 add_post_meta( $topic_id, '_bbp_anonymous_email', $_POST['bbp_anonymous_email'], false ); 248 add_post_meta( $topic_id, '_bbp_anonymous_website', $_POST['bbp_anonymous_website'], false ); 249 add_post_meta( $topic_id, '_bbp_anonymous_ip', $_POST['bbp_anonymous_ip'], false ); 250 } 251 231 252 // Update counts, etc... 232 253 do_action( 'bbp_new_topic', $topic_data ); … … 551 572 * @return bool True on success, false on failure 552 573 */ 553 function bbp_notify_subscribers ( $ reply_id = 0) {574 function bbp_notify_subscribers ( $args = '' ) { 554 575 global $bbp, $wpdb; 555 576 … … 557 578 return false; 558 579 559 if ( !$reply = get_post( $reply_id ) ) 580 $defaults = array ( 581 'ID' => bbp_get_reply_id(), 582 'post_author' => bbp_get_current_user_id(), 583 'post_title' => '', 584 'post_content' => '', 585 'post_parent' => '', 586 'post_status' => 'publish', 587 'post_type' => $bbp->reply_id 588 ); 589 590 $args = wp_parse_args( $args, $defaults ); 591 592 if ( !$reply = get_post( $args['ID'] ) ) 560 593 return false; 561 594 … … 568 601 $reply_id = $reply->ID; 569 602 $topic_id = $topic->ID; 570 571 if ( !$poster_name = get_the_author_meta( 'display_name', $reply->post_author ) )572 return false;573 603 574 604 do_action( 'bbp_pre_notify_subscribers', $reply_id, $topic_id ); -
branches/plugin/bbp-includes/bbp-template.php
r2668 r2670 1325 1325 $topic_id = bbp_get_topic_id( $topic_id ); 1326 1326 1327 return apply_filters( 'bbp_get_topic_author', get_the_author() ); 1327 if ( get_post_field( 'post_author', $topic_id ) ) 1328 $author = get_the_author(); 1329 else 1330 $author = get_post_meta( $topic_id, '_bbp_anonymous_name', true ); 1331 1332 return apply_filters( 'bbp_get_topic_author', $author ); 1328 1333 } 1329 1334 … … 1395 1400 $topic_id = bbp_get_topic_id( $topic_id ); 1396 1401 1397 return apply_filters( 'bbp_get_topic_author_id', esc_attr( get_the_author_meta( 'display_name' ) ) ); 1402 // Check for anonymous user 1403 if ( $author_id = get_post_field( 'post_author', $topic_id ) ) 1404 $author_name = get_the_author_meta( 'display_name', $author_id ); 1405 else 1406 $author_name = get_post_meta( $topic_id, '_bbp_anonymous_name', true ); 1407 1408 return apply_filters( 'bbp_get_topic_author_id', esc_attr( $author_name ) ); 1398 1409 } 1399 1410 … … 1465 1476 $topic_id = bbp_get_topic_id( $topic_id ); 1466 1477 1467 return apply_filters( 'bbp_get_topic_author_url', get_author_posts_url( get_post_field( 'post_author', $topic_id ) ) ); 1478 // Check for anonymous user 1479 if ( $author_id = get_post_field( 'post_author', $topic_id ) ) 1480 $author_url = get_author_posts_url( $author_id ); 1481 else 1482 $author_url = get_post_meta( $topic_id, '_bbp_anonymous_website', true ); 1483 1484 return apply_filters( 'bbp_get_topic_author_url', $author_url ); 1468 1485 } 1469 1486 … … 2392 2409 $reply_id = bbp_get_reply_id( $reply_id ); 2393 2410 2394 return apply_filters( 'bbp_get_reply_author', get_the_author() ); 2411 if ( get_post_field( 'post_author', $reply_id ) ) 2412 $author = get_the_author(); 2413 else 2414 $author = get_post_meta( $topic_id, '_bbp_anonymous_name', true ); 2415 2416 return apply_filters( 'bbp_get_reply_author', $author ); 2395 2417 } 2396 2418 … … 2462 2484 $reply_id = bbp_get_reply_id( $reply_id ); 2463 2485 2464 return apply_filters( 'bbp_get_reply_author_id', esc_attr( get_the_author_meta( 'display_name' ) ) ); 2486 // Check for anonymous user 2487 if ( $author_id = get_post_field( 'post_author', $reply_id ) ) 2488 $author_name = get_the_author_meta( 'display_name', $author_id ); 2489 else 2490 $author_name = get_post_meta( $reply_id, '_bbp_anonymous_name', true ); 2491 2492 return apply_filters( 'bbp_get_reply_author_id', esc_attr( $author_name ) ); 2465 2493 } 2466 2494 … … 2532 2560 $reply_id = bbp_get_reply_id( $reply_id ); 2533 2561 2534 return apply_filters( 'bbp_get_reply_author_url', get_author_posts_url( get_post_field( 'post_author', $reply_id ) ) ); 2562 // Check for anonymous user 2563 if ( $author_id = get_post_field( 'post_author', $reply_id ) ) 2564 $author_url = get_author_posts_url( $author_id ); 2565 else 2566 $author_url = get_post_meta( $reply_id, '_bbp_anonymous_website', true ); 2567 2568 return apply_filters( 'bbp_get_reply_author_url', $author_url ); 2535 2569 } 2536 2570 … … 2858 2892 2859 2893 return apply_filters( 'bbp_is_user_home', $retval, $current_user ); 2894 } 2895 2896 /** 2897 * bbp_is_anonymous () 2898 * 2899 * Return true if anonymous is allowed and user is not logged in. 2900 * Return false if anonymous is not allowed or user is logged in 2901 * 2902 * @return bool 2903 */ 2904 function bbp_is_anonymous () { 2905 if ( !is_user_logged_in() && bbp_allow_anonymous() ) 2906 $is_anonymous = true; 2907 else 2908 $is_anonymous = false; 2909 2910 return apply_filters( 'bbp_is_anonymous', $is_anonymous ); 2860 2911 } 2861 2912 … … 3100 3151 $current_user_id = $current_user->ID; 3101 3152 else 3102 $current_user_id = -1;3153 $current_user_id = 0; 3103 3154 3104 3155 return apply_filters( 'bbp_get_current_user_id', $current_user_id ); -
branches/plugin/bbp-themes/bbp-twentyten/form-bbp_reply.php
r2668 r2670 14 14 15 15 <div class="alignleft"> 16 17 <?php get_template_part( 'form', 'bbp_anonymous' ); ?> 18 16 19 <p> 17 20 <label for="bbp_reply_content"><?php _e( 'Reply:', 'bbpress' ); ?></label><br /> 18 <textarea id="bbp_reply_content" tabindex=" 3" name="bbp_reply_content" cols="52" rows="6"></textarea>21 <textarea id="bbp_reply_content" tabindex="8" name="bbp_reply_content" cols="52" rows="6"></textarea> 19 22 </p> 20 23 21 24 <p> 22 25 <label for="bbp_topic_tags"><?php _e( 'Tags:', 'bbpress' ); ?></label><br /> 23 <input id="bbp_topic_tags" type="text" value="" tabindex=" 5" size="40" name="bbp_topic_tags" id="post_tags" />26 <input id="bbp_topic_tags" type="text" value="" tabindex="10" size="40" name="bbp_topic_tags" id="post_tags" /> 24 27 </p> 25 28 26 <?php if ( bbp_is_subscriptions_active() ) : ?>29 <?php if ( bbp_is_subscriptions_active() && !bbp_is_anonymous() ) : ?> 27 30 28 31 <p> 29 <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe"<?php checked( true, bbp_is_user_subscribed() ); ?> tabindex=" 7" />32 <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe"<?php checked( true, bbp_is_user_subscribed() ); ?> tabindex="12" /> 30 33 <label for="bbp_topic_subscription"><?php _e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label> 31 34 </p> … … 34 37 35 38 <p align="right"> 36 <button type="submit" tabindex=" 9" id="bbp_reply_submit" name="bbp_reply_submit"><?php _e( 'Submit', 'bbpress' ); ?></button>39 <button type="submit" tabindex="14" id="bbp_reply_submit" name="bbp_reply_submit"><?php _e( 'Submit', 'bbpress' ); ?></button> 37 40 </p> 38 41 </div> -
branches/plugin/bbp-themes/bbp-twentyten/form-bbp_topic.php
r2668 r2670 14 14 15 15 <div class="alignleft"> 16 17 <?php get_template_part( 'form', 'bbp_anonymous' ); ?> 18 16 19 <p> 17 20 <label for="bbp_topic_title"><?php _e( 'Title:', 'bbpress' ); ?></label><br /> 18 <input type="text" id="bbp_topic_title" value="" tabindex=" 1" size="40" name="bbp_topic_title" />21 <input type="text" id="bbp_topic_title" value="" tabindex="8" size="40" name="bbp_topic_title" /> 19 22 </p> 20 23 21 24 <p> 22 25 <label for="bbp_topic_content"><?php _e( 'Topic:', 'bbpress' ); ?></label><br /> 23 <textarea id="bbp_topic_content" tabindex=" 3" name="bbp_topic_content" cols="52" rows="6"></textarea>26 <textarea id="bbp_topic_content" tabindex="10" name="bbp_topic_content" cols="52" rows="6"></textarea> 24 27 </p> 25 28 26 29 <p> 27 30 <label for="bbp_topic_tags"><?php _e( 'Tags:', 'bbpress' ); ?></label><br /> 28 <input type="text" value="" tabindex=" 5" size="40" name="bbp_topic_tags" id="post_tags" />31 <input type="text" value="" tabindex="12" size="40" name="bbp_topic_tags" id="post_tags" /> 29 32 </p> 30 33 … … 38 41 <?php endif; ?> 39 42 40 <?php if ( bbp_is_subscriptions_active() ) : ?>43 <?php if ( bbp_is_subscriptions_active() && !bbp_is_anonymous() ) : ?> 41 44 42 45 <p> 43 <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" tabindex=" 9" />46 <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" tabindex="16" /> 44 47 <label for="bbp_topic_subscription"><?php _e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label> 45 48 </p> … … 48 51 49 52 <p align="right"> 50 <button type="submit" tabindex="1 1" id="bbp_topic_submit" name="bbp_topic_submit"><?php _e( 'Submit', 'bbpress' ); ?></button>53 <button type="submit" tabindex="18" id="bbp_topic_submit" name="bbp_topic_submit"><?php _e( 'Submit', 'bbpress' ); ?></button> 51 54 </p> 52 55 </div> -
branches/plugin/bbp-themes/bbp-twentyten/loop-bbp_replies.php
r2667 r2670 61 61 printf ( 62 62 '<a href="%1$s" title="%2$s">%3$s</a>', 63 get_author_posts_url( get_the_author_meta( 'ID' )),64 sprintf( __( 'View %s\'s profile' ), bbp_get_reply_author_display_name() ),63 bbp_get_reply_author_url(), 64 sprintf( get_the_author_meta( 'ID' ) ? __( 'View %s\'s profile', 'bbpress' ) : __( 'Visit %s\'s Website' ), bbp_get_reply_author_display_name() ), 65 65 bbp_get_reply_author_avatar( 0, 80 ) 66 66 ); -
branches/plugin/bbp-themes/bbp-twentyten/single-bbp_topic.php
r2668 r2670 68 68 <td class="bbp-topic-author"> 69 69 70 <?php bbp_topic_author_avatar( 0, 100 ); ?> 70 <?php 71 // @todo - abstract 72 printf ( 73 '<a href="%1$s" title="%2$s">%3$s</a>', 74 bbp_get_topic_author_url(), 75 sprintf( get_the_author_meta( 'ID' ) ? __( 'View %s\'s profile', 'bbpress' ) : __( 'Visit %s\'s Website' ), bbp_get_topic_author_display_name() ), 76 bbp_get_topic_author_avatar( 0, 100 ) 77 ); 78 ?> 71 79 72 80 </td>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)