Changeset 7764
- Timestamp:
- 01/29/2014 05:01:17 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-blogs/bp-blogs-template.php
r7555 r7764 1187 1187 return bp_get_button( apply_filters( 'bp_get_blogs_visit_blog_button', $button ) ); 1188 1188 } 1189 1190 /** Stats **********************************************************************/ 1191 1192 /** 1193 * Display the number of blogs in user's profile. 1194 * 1195 * @since BuddyPress (2.0.0) 1196 * 1197 * @param array $args before|after|user_id 1198 * @uses bp_blogs_admin_get_profile_stats() to get the stats 1199 */ 1200 function bp_blogs_profile_stats( $args = '' ) { 1201 echo bp_blogs_get_profile_stats( $args ); 1202 } 1203 add_action( 'bp_members_admin_user_stats', 'bp_blogs_profile_stats', 9, 1 ); 1204 1205 /** 1206 * Return the number of blogs in user's profile. 1207 * 1208 * @since BuddyPress (2.0.0) 1209 * 1210 * @param array $args before|after|user_id 1211 * @return string HTML for stats output. 1212 */ 1213 function bp_blogs_get_profile_stats( $args = '' ) { 1214 1215 // Parse the args 1216 $r = bp_parse_args( $args, array( 1217 'before' => '<li class="bp-blogs-profile-stats">', 1218 'after' => '</li>', 1219 'user_id' => bp_displayed_user_id(), 1220 'blogs' => 0, 1221 'output' => '' 1222 ), 'blogs_get_profile_stats' ); 1223 1224 // Allow completely overloaded output 1225 if ( is_multisite() && empty( $r['output'] ) ) { 1226 1227 // Only proceed if a user ID was passed 1228 if ( ! empty( $r['user_id'] ) ) { 1229 1230 // Get the user groups 1231 if ( empty( $r['blogs'] ) ) { 1232 $r['blogs'] = absint( bp_blogs_total_blogs_for_user( $r['user_id'] ) ); 1233 } 1234 1235 // If groups exist, show some formatted output 1236 $r['output'] = $r['before'] . sprintf( _n( '1 site', '<strong>%s</strong> sites', $r['blogs'], 'buddypress' ), $r['blogs'] ) . $r['after']; 1237 } 1238 } 1239 1240 // Filter and return 1241 return apply_filters( 'bp_blogs_get_profile_stats', $r['output'], $r ); 1242 } -
trunk/bp-friends/bp-friends-template.php
r7751 r7764 539 539 return apply_filters( 'bp_friend_get_total_requests_count', count( BP_Friends_Friendship::get_friend_user_ids( $user_id, true ) ) ); 540 540 } 541 542 /** Stats **********************************************************************/ 543 544 /** 545 * Display the number of friends in user's profile. 546 * 547 * @since BuddyPress (2.0.0) 548 * 549 * @param array $args before|after|user_id 550 * @uses bp_friends_get_profile_stats() to get the stats 551 */ 552 function bp_friends_profile_stats( $args = '' ) { 553 echo bp_friends_get_profile_stats( $args ); 554 } 555 add_action( 'bp_members_admin_user_stats', 'bp_friends_profile_stats', 7, 1 ); 556 557 /** 558 * Return the number of friends in user's profile. 559 * 560 * @since BuddyPress (2.0.0) 561 * 562 * @param array $args before|after|user_id 563 * @return string HTML for stats output. 564 */ 565 function bp_friends_get_profile_stats( $args = '' ) { 566 567 // Parse the args 568 $r = bp_parse_args( $args, array( 569 'before' => '<li class="bp-friends-profile-stats">', 570 'after' => '</li>', 571 'user_id' => bp_displayed_user_id(), 572 'friends' => 0, 573 'output' => '' 574 ), 'friends_get_profile_stats' ); 575 576 // Allow completely overloaded output 577 if ( empty( $r['output'] ) ) { 578 579 // Only proceed if a user ID was passed 580 if ( ! empty( $r['user_id'] ) ) { 581 582 // Get the user groups 583 if ( empty( $r['friends'] ) ) { 584 $r['friends'] = absint( friends_get_total_friend_count( $r['user_id'] ) ); 585 } 586 587 // If groups exist, show some formatted output 588 $r['output'] = $r['before'] . sprintf( _n( '1 friend', '<strong>%s</strong> friends', $r['friends'], 'buddypress' ), $r['friends'] ) . $r['after']; 589 } 590 } 591 592 // Filter and return 593 return apply_filters( 'bp_friends_get_profile_stats', $r['output'], $r ); 594 } -
trunk/bp-groups/bp-groups-template.php
r7751 r7764 3155 3155 return $url; 3156 3156 } 3157 3158 /** Stats **********************************************************************/ 3159 3160 /** 3161 * Display the number of groups in user's profile. 3162 * 3163 * @since BuddyPress (2.0.0) 3164 * 3165 * @param array $args before|after|user_id 3166 * @uses bp_groups_get_profile_stats() to get the stats 3167 */ 3168 function bp_groups_profile_stats( $args = '' ) { 3169 echo bp_groups_get_profile_stats( $args ); 3170 } 3171 add_action( 'bp_members_admin_user_stats', 'bp_groups_profile_stats', 8, 1 ); 3172 3173 /** 3174 * Return the number of groups in user's profile. 3175 * 3176 * @since BuddyPress (2.0.0) 3177 * 3178 * @param array $args before|after|user_id 3179 * @return string HTML for stats output. 3180 */ 3181 function bp_groups_get_profile_stats( $args = '' ) { 3182 3183 // Parse the args 3184 $r = bp_parse_args( $args, array( 3185 'before' => '<li class="bp-groups-profile-stats">', 3186 'after' => '</li>', 3187 'user_id' => bp_displayed_user_id(), 3188 'groups' => 0, 3189 'output' => '' 3190 ), 'groups_get_profile_stats' ); 3191 3192 // Allow completely overloaded output 3193 if ( empty( $r['output'] ) ) { 3194 3195 // Only proceed if a user ID was passed 3196 if ( ! empty( $r['user_id'] ) ) { 3197 3198 // Get the user groups 3199 if ( empty( $r['groups'] ) ) { 3200 $r['groups'] = absint( bp_get_total_group_count_for_user( $r['user_id'] ) ); 3201 } 3202 3203 // If groups exist, show some formatted output 3204 $r['output'] = $r['before'] . sprintf( _n( '1 group', '<strong>%s</strong> groups', $r['groups'], 'buddypress' ), $r['groups'] ) . $r['after']; 3205 } 3206 } 3207 3208 // Filter and return 3209 return apply_filters( 'bp_groups_get_profile_stats', $r['output'], $r ); 3210 } -
trunk/bp-members/bp-members-functions.php
r7675 r7764 564 564 remove_action( 'make_ham_user', 'bp_core_mark_user_ham_admin' ); 565 565 566 // Determine if we are on an admin page 567 $is_admin = is_admin(); 568 if ( $is_admin && ! defined( 'DOING_AJAX' ) ) { 569 $is_admin = (bool) ( buddypress()->members->admin->user_page !== get_current_screen()->id ); 570 } 571 566 572 // When marking as spam in the Dashboard, these actions are handled by WordPress 567 if ( ! is_admin()) {573 if ( ! $is_admin ) { 568 574 569 575 // Get the blogs for the user -
trunk/bp-members/bp-members-loader.php
r7756 r7764 46 46 'notifications', 47 47 ); 48 49 if ( is_admin() ) { 50 $includes[] = 'admin'; 51 } 52 48 53 parent::includes( $includes ); 49 54 } -
trunk/bp-xprofile/bp-xprofile-admin.php
r7271 r7764 467 467 <?php 468 468 } 469 470 if ( ! class_exists( 'BP_XProfile_User_Admin' ) ) : 471 /** 472 * Load xProfile Profile admin area. 473 * 474 * @package BuddyPress 475 * @subpackage xProfileAdministration 476 * 477 * @since BuddyPress (2.0.0) 478 */ 479 class BP_XProfile_User_Admin { 480 481 /** 482 * Setup xProfile User Admin. 483 * 484 * @access public 485 * @since BuddyPress (2.0.0) 486 * 487 * @uses buddypress() to get BuddyPress main instance 488 */ 489 public static function register_xprofile_user_admin() { 490 if( ! is_admin() ) 491 return; 492 493 $bp = buddypress(); 494 495 if( empty( $bp->profile->admin ) ) { 496 $bp->profile->admin = new self; 497 } 498 499 return $bp->profile->admin; 500 } 501 502 /** 503 * Constructor method. 504 * 505 * @access public 506 * @since BuddyPress (2.0.0) 507 */ 508 public function __construct() { 509 $this->setup_actions(); 510 } 511 512 /** 513 * Set admin-related actions and filters. 514 * 515 * @access private 516 * @since BuddyPress (2.0.0) 517 */ 518 private function setup_actions() { 519 520 /** Actions ***************************************************/ 521 522 // Register the metabox in Member's community admin profile 523 add_action( 'bp_members_admin_xprofile_metabox', array( $this, 'register_metaboxes' ), 10, 3 ); 524 525 // Saves the profile actions for user ( avatar, profile fields ) 526 add_action( 'bp_members_admin_update_user', array( $this, 'user_admin_load' ), 10, 4 ); 527 528 } 529 530 /** 531 * Register the xProfile metabox on Community Profile admin page. 532 * 533 * @access public 534 * @since BuddyPress (2.0.0) 535 * 536 * @param int $user_id ID of the user being edited. 537 * @param string $screen_id Screen ID to load the metabox in. 538 * @param object $stats_metabox Context and priority for the stats metabox. 539 */ 540 public function register_metaboxes( $user_id = 0, $screen_id = '', $stats_metabox = null ) { 541 542 if ( empty( $screen_id ) ) { 543 $screen_id = buddypress()->members->admin->user_page; 544 } 545 546 if ( empty( $stats_metabox ) ) { 547 $stats_metabox = new StdClass(); 548 } 549 550 // Moving the Stats Metabox 551 $stats_metabox->context = 'side'; 552 $stats_metabox->priority = 'low'; 553 554 // Each Group of fields will have his own metabox 555 if ( false == bp_is_user_spammer( $user_id ) && bp_has_profile( array( 'fetch_fields' => false ) ) ) { 556 while ( bp_profile_groups() ) : bp_the_profile_group(); 557 add_meta_box( 'bp_xprofile_user_admin_fields_' . sanitize_key( bp_get_the_profile_group_slug() ), esc_html( bp_get_the_profile_group_name() ), array( &$this, 'user_admin_profile_metaboxes' ), $screen_id, 'normal', 'core', array( 'profile_group_id' => absint( bp_get_the_profile_group_id() ) ) ); 558 endwhile; 559 560 // if a user has been mark as a spammer, his BuddyPress datas are removed ! 561 } else { 562 add_meta_box( 'bp_xprofile_user_admin_empty_profile', _x( 'User marked as a spammer', 'xprofile user-admin edit screen', 'buddypress' ), array( &$this, 'user_admin_spammer_metabox' ), $screen_id, 'normal', 'core' ); 563 } 564 565 // Avatar Metabox 566 add_meta_box( 'bp_xprofile_user_admin_avatar', _x( 'Avatar', 'xprofile user-admin edit screen', 'buddypress' ), array( &$this, 'user_admin_avatar_metabox' ), $screen_id, 'side', 'low' ); 567 568 } 569 570 /** 571 * Save the profile fields in Members community profile page. 572 * 573 * Loaded before the page is rendered, this function is processing form 574 * requests. 575 * 576 * @access public 577 * @since BuddyPress (2.0.0) 578 */ 579 public function user_admin_load( $doaction = '', $user_id = 0, $request = array(), $redirect_to = '' ) { 580 581 // Eventually delete avatar 582 if ( 'delete_avatar' == $doaction ) { 583 584 check_admin_referer( 'delete_avatar' ); 585 586 $redirect_to = remove_query_arg( '_wpnonce', $redirect_to ); 587 588 if ( bp_core_delete_existing_avatar( array( 'item_id' => $user_id ) ) ) { 589 $redirect_to = add_query_arg( 'updated', 'avatar', $redirect_to ); 590 } else { 591 $redirect_to = add_query_arg( 'error', 'avatar', $redirect_to ); 592 } 593 594 bp_core_redirect( $redirect_to ); 595 596 // Update profile fields 597 } else { 598 // Check to see if any new information has been submitted 599 if ( isset( $_POST['field_ids'] ) ) { 600 601 // Check the nonce 602 check_admin_referer( 'edit-bp-profile_' . $user_id ); 603 604 // Check we have field ID's 605 if ( empty( $_POST['field_ids'] ) ) { 606 $redirect_to = add_query_arg( 'error', '1', $redirect_to ); 607 bp_core_redirect( $redirect_to ); 608 } 609 610 $merge_ids = ''; 611 foreach ( $_POST['field_ids'] as $ids ) { 612 $merge_ids .= $ids . ','; 613 } 614 615 // Explode the posted field IDs into an array so we know which 616 // fields have been submitted 617 $posted_field_ids = array_filter( wp_parse_id_list( $merge_ids ) ); 618 $is_required = array(); 619 620 // Loop through the posted fields formatting any datebox values 621 // then validate the field 622 foreach ( (array) $posted_field_ids as $field_id ) { 623 if ( ! isset( $_POST['field_' . $field_id] ) ) { 624 if ( ! empty( $_POST['field_' . $field_id . '_day'] ) && ! empty( $_POST['field_' . $field_id . '_month'] ) && ! empty( $_POST['field_' . $field_id . '_year'] ) ) { 625 // Concatenate the values 626 $date_value = $_POST['field_' . $field_id . '_day'] . ' ' . $_POST['field_' . $field_id . '_month'] . ' ' . $_POST['field_' . $field_id . '_year']; 627 628 // Turn the concatenated value into a timestamp 629 $_POST['field_' . $field_id] = date( 'Y-m-d H:i:s', strtotime( $date_value ) ); 630 } 631 } 632 633 $is_required[ $field_id ] = xprofile_check_is_required_field( $field_id ); 634 if ( $is_required[ $field_id ] && empty( $_POST['field_' . $field_id] ) ) { 635 $redirect_to = add_query_arg( 'error', '2', $redirect_to ); 636 bp_core_redirect( $redirect_to ); 637 } 638 } 639 640 // Set the errors var 641 $errors = false; 642 643 // Now we've checked for required fields, lets save the values. 644 foreach ( (array) $posted_field_ids as $field_id ) { 645 646 // Certain types of fields (checkboxes, multiselects) may come through empty. Save them as an empty array so that they don't get overwritten by the default on the next edit. 647 if ( empty( $_POST['field_' . $field_id] ) ) { 648 $value = array(); 649 } else { 650 $value = $_POST['field_' . $field_id]; 651 } 652 653 if ( ! xprofile_set_field_data( $field_id, $user_id, $value, $is_required[ $field_id ] ) ) { 654 $errors = true; 655 } else { 656 do_action( 'xprofile_profile_field_data_updated', $field_id, $value ); 657 } 658 659 // Save the visibility level 660 $visibility_level = ! empty( $_POST['field_' . $field_id . '_visibility'] ) ? $_POST['field_' . $field_id . '_visibility'] : 'public'; 661 xprofile_set_field_visibility_level( $field_id, $user_id, $visibility_level ); 662 } 663 664 do_action( 'xprofile_updated_profile', $user_id, $posted_field_ids, $errors ); 665 666 // Set the feedback messages 667 if ( ! empty( $errors ) ) { 668 $redirect_to = add_query_arg( 'error', '3', $redirect_to ); 669 } else { 670 $redirect_to = add_query_arg( 'updated', '1', $redirect_to ); 671 } 672 673 bp_core_redirect( $redirect_to ); 674 } 675 } 676 } 677 678 /** 679 * Render the xprofile metabox for Community Profile screen. 680 * 681 * @access public 682 * @since BuddyPress (2.0.0) 683 * 684 * @param WP_User $user The WP_User object for the user being edited. 685 */ 686 public function user_admin_profile_metaboxes( $user = null, $args = array() ) { 687 688 if ( empty( $user->ID ) ) { 689 return; 690 } 691 692 $r = bp_parse_args( $args['args'], array( 693 'profile_group_id' => 0, 694 'user_id' => $user->ID 695 ), 'bp_xprofile_user_admin_profile_loop_args' ); 696 697 // We really need these args 698 if ( empty( $r['profile_group_id'] ) || empty( $r['user_id'] ) ) { 699 return; 700 } 701 702 if ( bp_has_profile( $r ) ) : 703 704 while ( bp_profile_groups() ) : bp_the_profile_group(); ?> 705 706 <p class="description"><?php bp_the_profile_group_description(); ?></p> 707 708 <table class="form-table"> 709 <tbody> 710 711 <?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?> 712 713 <tr> 714 715 <?php if ( 'textbox' === bp_get_the_profile_field_type() ) : ?> 716 717 <th><label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label></th> 718 <td class="admin-field-<?php bp_the_profile_field_type();?>"> 719 <input type="text" name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" value="<?php bp_the_profile_field_edit_value(); ?>" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>/> 720 <span class="description"><?php bp_the_profile_field_description(); ?></span> 721 </td> 722 723 <?php endif; ?> 724 725 <?php if ( 'textarea' === bp_get_the_profile_field_type() ) : ?> 726 727 <th><label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label></th> 728 <td class="admin-field-<?php bp_the_profile_field_type();?>"> 729 <textarea rows="5" cols="40" name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>><?php bp_the_profile_field_edit_value(); ?></textarea> 730 <p class="description"><?php bp_the_profile_field_description(); ?></p> 731 </td> 732 733 <?php endif; ?> 734 735 <?php if ( 'selectbox' === bp_get_the_profile_field_type() ) : ?> 736 737 <th><label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label></th> 738 <td class="admin-field-<?php bp_the_profile_field_type();?>"> 739 <select name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>> 740 <?php bp_the_profile_field_options( array( 'user_id' => $r['user_id'], ) ); ?> 741 </select> 742 <span class="description"><?php bp_the_profile_field_description(); ?></span> 743 </td> 744 745 <?php endif; ?> 746 747 <?php if ( 'multiselectbox' === bp_get_the_profile_field_type() ) : ?> 748 749 <th><label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label></th> 750 <td class="admin-field-<?php bp_the_profile_field_type();?>"> 751 <select name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" multiple="multiple" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>> 752 753 <?php bp_the_profile_field_options( array( 'user_id' => $r['user_id'], ) ); ?> 754 755 </select> 756 757 758 <?php if ( !bp_get_the_profile_field_is_required() ) : ?> 759 760 <p><a class="clear-value" href="javascript:clear( '<?php bp_the_profile_field_input_name(); ?>' );"><?php _e( 'Clear', 'buddypress' ); ?></a></p> 761 762 <?php endif; ?> 763 <p class="description"><?php bp_the_profile_field_description(); ?></p> 764 </td> 765 766 <?php endif; ?> 767 768 <?php if ( 'radio' === bp_get_the_profile_field_type() ) : ?> 769 770 <th> 771 <span class="label"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></span> 772 </th> 773 <td class="admin-field-<?php bp_the_profile_field_type();?>"> 774 <fieldset> 775 <legend class="screen-reader-text"><span><?php bp_the_profile_field_name(); ?></span></legend> 776 <?php bp_the_profile_field_options( array( 'user_id' => $r['user_id'], ) ); ?> 777 </fieldset> 778 779 <?php if ( !bp_get_the_profile_field_is_required() ) : ?> 780 781 <p><a class="clear-value" href="javascript:clear( '<?php bp_the_profile_field_input_name(); ?>' );"><?php _e( 'Clear', 'buddypress' ); ?></a></p> 782 783 <?php endif; ?> 784 <p class="description"><?php bp_the_profile_field_description(); ?></p> 785 </td> 786 787 <?php endif; ?> 788 789 <?php if ( 'checkbox' === bp_get_the_profile_field_type() ) : ?> 790 791 <th> 792 <span class="label"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></span> 793 </th> 794 <td class="admin-field-<?php bp_the_profile_field_type();?>"> 795 <?php bp_the_profile_field_options( array( 'user_id' => $r['user_id'], ) ); ?> 796 <p class="description"><?php bp_the_profile_field_description(); ?></p> 797 </td> 798 799 <?php endif; ?> 800 801 <?php if ( 'datebox' === bp_get_the_profile_field_type() ) : ?> 802 803 <th> 804 <label for="<?php bp_the_profile_field_input_name(); ?>_day"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label> 805 </th> 806 <td class="admin-field-<?php bp_the_profile_field_type();?>"> 807 <select name="<?php bp_the_profile_field_input_name(); ?>_day" id="<?php bp_the_profile_field_input_name(); ?>_day" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>> 808 809 <?php bp_the_profile_field_options( array( 'user_id' => $r['user_id'], 'type' => 'day', ) ); ?> 810 811 </select> 812 813 <select name="<?php bp_the_profile_field_input_name(); ?>_month" id="<?php bp_the_profile_field_input_name(); ?>_month" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>> 814 815 <?php bp_the_profile_field_options( array( 'user_id' => $r['user_id'], 'type' => 'month', ) ); ?> 816 817 </select> 818 819 <select name="<?php bp_the_profile_field_input_name(); ?>_year" id="<?php bp_the_profile_field_input_name(); ?>_year" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>> 820 821 <?php bp_the_profile_field_options( array( 'user_id' => $r['user_id'], 'type' => 'year', ) ); ?> 822 823 </select> 824 <p class="description"><?php bp_the_profile_field_description(); ?></p> 825 </td> 826 827 <?php endif; ?> 828 829 </tr> 830 831 <tr class="admin-field-visibility-tr"> 832 <td class="admin-field-visibility-td"> </td> 833 <td class="admin-field-visibility-td"> 834 835 <?php do_action( 'bp_custom_profile_edit_fields_pre_visibility' ); ?> 836 837 <?php if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?> 838 <p class="description field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>"> 839 <?php printf( __( 'This field can be seen by: <span class="current-visibility-level">%s</span>', 'buddypress' ), bp_get_the_profile_field_visibility_level_label() ) ?> <a href="#" class="visibility-toggle-link"><?php _e( 'Change', 'buddypress' ); ?></a> 840 </p> 841 842 <div class="field-visibility-settings" id="field-visibility-settings-<?php bp_the_profile_field_id() ?>"> 843 <fieldset> 844 <legend><?php esc_html_e( 'Who can see this field?', 'buddypress' ) ?></legend> 845 846 <?php bp_profile_visibility_radio_buttons() ?> 847 848 </fieldset> 849 <a class="field-visibility-settings-close" href="#"><?php esc_html_e( 'Close', 'buddypress' ) ?></a> 850 </div> 851 <?php else : ?> 852 <div class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>"> 853 <?php printf( __( 'This field can be seen by: <span class="current-visibility-level">%s</span>', 'buddypress' ), bp_get_the_profile_field_visibility_level_label() ) ?> 854 </div> 855 <?php endif ?> 856 857 </td> 858 </tr> 859 860 <?php endwhile; ?> 861 </tbody> 862 863 </table> 864 <input type="hidden" name="field_ids[]" id="field_ids_<?php bp_the_profile_group_slug(); ?>" value="<?php bp_the_profile_group_field_ids(); ?>" /> 865 <?php endwhile; 866 endif; 867 } 868 869 /** 870 * Render the fallback metabox in case a user has been marked as a spammer. 871 * 872 * @access public 873 * @since BuddyPress (2.0.0) 874 * 875 * @param WP_User $user The WP_User object for the user being edited. 876 */ 877 public function user_admin_spammer_metabox( $user = null ) { 878 ?> 879 <p><?php printf( __( '%s has been marked as a spammer, this user's BuddyPress datas were removed', 'buddypress' ), esc_html( bp_core_get_user_displayname( $user->ID ) ) ) ;?></p> 880 <?php 881 } 882 883 /** 884 * Render the Avatar metabox to moderate inappropriate images. 885 * 886 * @access public 887 * @since BuddyPress (2.0.0) 888 * 889 * @param WP_User $user The WP_User object for the user being edited. 890 */ 891 public function user_admin_avatar_metabox( $user = null ) { 892 893 if ( empty( $user->ID ) ) { 894 return; 895 } 896 897 $args = array( 898 'item_id' => $user->ID, 899 'object' => 'user', 900 'type' => 'full', 901 'title' => $user->display_name 902 ); 903 904 ?> 905 906 <div class="avatar"> 907 908 <?php echo bp_core_fetch_avatar( $args ); ?> 909 910 <?php if ( bp_get_user_has_avatar( $user->ID ) ) : 911 912 $query_args = array( 913 'user_id' => $user->ID, 914 'action' => 'delete_avatar' 915 ); 916 917 if ( ! empty( $_REQUEST['wp_http_referer'] ) ) 918 $query_args['wp_http_referer'] = urlencode( wp_unslash( $_REQUEST['wp_http_referer'] ) ); 919 920 $community_url = add_query_arg( $query_args, buddypress()->members->admin->edit_profile_url ); 921 $delete_link = wp_nonce_url( $community_url, 'delete_avatar' ); ?> 922 923 <a href="<?php echo esc_url( $delete_link ); ?>" title="<?php esc_attr_e( 'Delete Avatar', 'buddypress' ); ?>" class="bp-xprofile-avatar-user-admin"><?php esc_html_e( 'Delete Avatar', 'buddypress' ); ?></a></li> 924 925 <?php endif; ?> 926 927 </div> 928 <?php 929 } 930 931 } 932 endif; // class_exists check 933 934 // Load the xprofile user admin 935 add_action( 'bp_init', array( 'BP_XProfile_User_Admin', 'register_xprofile_user_admin' ), 11 ); -
trunk/bp-xprofile/bp-xprofile-filters.php
r6647 r7764 248 248 global $bp, $wpdb; 249 249 250 if ( bp_is_active( 'xprofile' ) ) { 251 $fullname_field_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s", bp_xprofile_fullname_field_name() ) ); 252 $user_id_names = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, value as fullname FROM {$bp->profile->table_name_data} WHERE user_id IN ({$user_ids_sql}) AND field_id = %d", $fullname_field_id ) ); 253 254 // Loop through names and override each user's fullname 255 foreach ( $user_id_names as $user ) { 256 if ( isset( $user_query->results[ $user->user_id ] ) ) { 257 $user_query->results[ $user->user_id ]->fullname = $user->fullname; 258 } 250 if ( ! bp_is_active( 'xprofile' ) ) { 251 return; 252 } 253 254 $fullname_field_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s", bp_xprofile_fullname_field_name() ) ); 255 $user_id_names = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, value as fullname FROM {$bp->profile->table_name_data} WHERE user_id IN ({$user_ids_sql}) AND field_id = %d", $fullname_field_id ) ); 256 257 // Loop through names and override each user's fullname 258 foreach ( $user_id_names as $user ) { 259 if ( isset( $user_query->results[ $user->user_id ] ) ) { 260 $user_query->results[ $user->user_id ]->fullname = $user->fullname; 259 261 } 260 262 } -
trunk/bp-xprofile/bp-xprofile-template.php
r7762 r7764 52 52 $this->current_group++; 53 53 54 $this->group = $this->groups[$this->current_group]; 55 $this->group->fields = apply_filters( 'xprofile_group_fields', $this->group->fields, $this->group->id ); 56 $this->field_count = count( $this->group->fields ); 54 $this->group = $this->groups[$this->current_group]; 55 $this->field_count = 0; 56 57 if( ! empty( $this->group->fields ) ) { 58 $this->group->fields = apply_filters( 'xprofile_group_fields', $this->group->fields, $this->group->id ); 59 $this->field_count = count( $this->group->fields ); 60 } 57 61 58 62 return $this->group;
Note: See TracChangeset
for help on using the changeset viewer.