Skip to:
Content

BuddyPress.org

Ticket #4747: 4747-3.patch

File 4747-3.patch, 12.1 KB (added by vapvarun, 3 years ago)

updated template files

  • src/bp-templates/bp-legacy/buddypress/members/register.php

    diff --git src/bp-templates/bp-legacy/buddypress/members/register.php src/bp-templates/bp-legacy/buddypress/members/register.php
    index 4e8418e7f..622f14cab 100644
     
    183183                                                         */
    184184                                                        do_action( 'bp_custom_profile_edit_fields_pre_visibility' );
    185185
    186                                                         if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?>
    187                                                                 <p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>"><span id="<?php bp_the_profile_field_input_name(); ?>-2">
    188                                                                         <?php
    189                                                                         printf(
    190                                                                                 /* translators: %s: level of visibility */
    191                                                                                 __( 'This field can be seen by: %s', 'buddypress' ),
    192                                                                                 '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>'
    193                                                                         );
     186                                                        if ( 'checkbox_acceptance' !== bp_get_the_profile_field_type() ) {
     187                                                                if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) :
    194188                                                                        ?>
    195                                                                         </span>
    196                                                                         <button type="button" class="visibility-toggle-link" aria-describedby="<?php bp_the_profile_field_input_name(); ?>-2" aria-expanded="false"><?php _ex( 'Change', 'Change profile field visibility level', 'buddypress' ); ?></button>
    197                                                                 </p>
    198 
    199                                                                 <div class="field-visibility-settings" id="field-visibility-settings-<?php bp_the_profile_field_id() ?>">
    200                                                                         <fieldset>
    201                                                                                 <legend><?php _e( 'Who can see this field?', 'buddypress' ) ?></legend>
    202 
    203                                                                                 <?php bp_profile_visibility_radio_buttons() ?>
    204 
    205                                                                         </fieldset>
    206                                                                         <button type="button" class="field-visibility-settings-close"><?php _e( 'Close', 'buddypress' ) ?></button>
    207 
    208                                                                 </div>
    209                                                         <?php else : ?>
    210                                                                 <p class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>">
     189                                                        <p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id(); ?>"><span id="<?php bp_the_profile_field_input_name(); ?>-2">
     190                                                                                <?php
     191                                                                                printf(
     192                                                                                        /* translators: %s: level of visibility */
     193                                                                                        __( 'This field can be seen by: %s', 'buddypress' ),
     194                                                                                        '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>'
     195                                                                                );
     196                                                                                ?>
     197                                                                </span>
     198                                                                <button type="button" class="visibility-toggle-link" aria-describedby="<?php bp_the_profile_field_input_name(); ?>-2" aria-expanded="false"><?php _ex( 'Change', 'Change profile field visibility level', 'buddypress' ); ?></button>
     199                                                        </p>
     200                                                        <div class="field-visibility-settings" id="field-visibility-settings-<?php bp_the_profile_field_id(); ?>">
     201                                                                <fieldset>
     202                                                                        <legend><?php _e( 'Who can see this field?', 'buddypress' ); ?></legend>
     203                                                                        <?php bp_profile_visibility_radio_buttons(); ?>
     204                                                                </fieldset>
     205                                                                <button type="button" class="field-visibility-settings-close"><?php _e( 'Close', 'buddypress' ); ?></button>
     206                                                        </div>
     207                                                                <?php else : ?>
     208                                                        <p class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id(); ?>">
    211209                                                                        <?php
    212210                                                                        printf(
    213211                                                                                __( 'This field can be seen by: %s', 'buddypress' ),
    214212                                                                                '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>'
    215213                                                                        );
    216214                                                                        ?>
    217                                                                 </p>
    218                                                         <?php endif ?>
     215                                                        </p>
     216                                                <?php endif ?>
     217
     218                                                                <?php
     219                                                        }
    219220
    220221                                                        <?php
    221222
  • src/bp-templates/bp-legacy/buddypress/members/single/profile/edit.php

    diff --git src/bp-templates/bp-legacy/buddypress/members/single/profile/edit.php src/bp-templates/bp-legacy/buddypress/members/single/profile/edit.php
    index 6353cccb0..6254a324c 100644
    if ( bp_has_profile( 'profile_group_id=' . bp_get_current_profile_group_id() ) ) 
    5757                                 */
    5858                                do_action( 'bp_custom_profile_edit_fields_pre_visibility' );
    5959                                ?>
    60 
    61                                 <?php if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?>
    62                                         <p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>"><span id="<?php bp_the_profile_field_input_name(); ?>-2">
    63                                                 <?php
    64                                                 printf(
    65                                                         __( 'This field can be seen by: %s', 'buddypress' ),
    66                                                         '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>'
    67                                                 );
    68                                                 ?>
    69                                                 </span>
    70                                                 <button type="button" class="visibility-toggle-link" aria-describedby="<?php bp_the_profile_field_input_name(); ?>-2" aria-expanded="false"><?php _ex( 'Change', 'Change profile field visibility level', 'buddypress' ); ?></button>
    71                                         </p>
    72 
    73                                         <div class="field-visibility-settings" id="field-visibility-settings-<?php bp_the_profile_field_id() ?>">
    74                                                 <fieldset>
    75                                                         <legend><?php _e( 'Who can see this field?', 'buddypress' ) ?></legend>
    76 
    77                                                         <?php bp_profile_visibility_radio_buttons() ?>
    78 
    79                                                 </fieldset>
    80                                                 <button type="button" class="field-visibility-settings-close"><?php _e( 'Close', 'buddypress' ) ?></button>
    81                                         </div>
    82                                 <?php else : ?>
    83                                         <div class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>">
    84                                                 <?php
    85                                                 printf(
    86                                                         __( 'This field can be seen by: %s', 'buddypress' ),
    87                                                         '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>'
    88                                                 );
    89                                                 ?>
    90                                         </div>
    91                                 <?php endif ?>
     60                                <?php if ( 'checkbox_acceptance' !== bp_get_the_profile_field_type() ) {
     61                                        ?>
     62                                        <?php if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?>
     63                                                <p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>"><span id="<?php bp_the_profile_field_input_name(); ?>-2">
     64                                                        <?php
     65                                                        printf(
     66                                                                __( 'This field can be seen by: %s', 'buddypress' ),
     67                                                                '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>'
     68                                                        );
     69                                                        ?>
     70                                                        </span>
     71                                                        <button type="button" class="visibility-toggle-link" aria-describedby="<?php bp_the_profile_field_input_name(); ?>-2" aria-expanded="false"><?php _ex( 'Change', 'Change profile field visibility level', 'buddypress' ); ?></button>
     72                                                </p>
     73
     74                                                <div class="field-visibility-settings" id="field-visibility-settings-<?php bp_the_profile_field_id() ?>">
     75                                                        <fieldset>
     76                                                                <legend><?php _e( 'Who can see this field?', 'buddypress' ) ?></legend>
     77
     78                                                                <?php bp_profile_visibility_radio_buttons() ?>
     79
     80                                                        </fieldset>
     81                                                        <button type="button" class="field-visibility-settings-close"><?php _e( 'Close', 'buddypress' ) ?></button>
     82                                                </div>
     83                                        <?php else : ?>
     84                                                <div class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>">
     85                                                        <?php
     86                                                        printf(
     87                                                                __( 'This field can be seen by: %s', 'buddypress' ),
     88                                                                '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>'
     89                                                        );
     90                                                        ?>
     91                                                </div>
     92                                        <?php endif ?>
    9293
    9394                                <?php
     95                        }
    9496
    9597                                /**
    9698                                 * Fires after the visibility options for a field.
  • src/bp-templates/bp-legacy/buddypress/members/single/profile/profile-loop.php

    diff --git src/bp-templates/bp-legacy/buddypress/members/single/profile/profile-loop.php src/bp-templates/bp-legacy/buddypress/members/single/profile/profile-loop.php
    index 4f2185051..eb25a3c85 100644
    do_action( 'bp_before_profile_loop_content' ); ?> 
    2727
    2828                                <table class="profile-fields">
    2929
    30                                         <?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
     30                                        <?php while ( bp_profile_fields() ) : bp_the_profile_field();
     31
     32                                                if ( 'checkbox_acceptance' === bp_get_the_profile_field_type() ) {
     33                                                        continue;
     34                                                }
     35                                                ?>
    3136
    3237                                                <?php if ( bp_field_has_data() ) : ?>
    3338
  • src/bp-templates/bp-nouveau/buddypress/members/single/parts/profile-visibility.php

    diff --git src/bp-templates/bp-nouveau/buddypress/members/single/parts/profile-visibility.php src/bp-templates/bp-nouveau/buddypress/members/single/parts/profile-visibility.php
    index 24d9b43db..bba640059 100644
     
    99if ( empty( $GLOBALS['profile_template'] ) ) {
    1010        return;
    1111}
     12
     13if ( 'checkbox_acceptance' === bp_get_the_profile_field_type() ) {
     14        return;
     15}
     16
    1217?>
    1318
    1419<?php if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?>
  • src/bp-templates/bp-nouveau/buddypress/members/single/profile/profile-loop.php

    diff --git src/bp-templates/bp-nouveau/buddypress/members/single/profile/profile-loop.php src/bp-templates/bp-nouveau/buddypress/members/single/profile/profile-loop.php
    index 2edf47815..22f2f20fd 100644
     
    3434                                        <?php
    3535                                        while ( bp_profile_fields() ) :
    3636                                                bp_the_profile_field();
    37                                         ?>
     37                                                if ( 'checkbox_acceptance' === bp_get_the_profile_field_type() ) {
     38                                                        continue;
     39                                                }
     40                                                ?>
    3841
    3942                                                <?php if ( bp_field_has_data() ) : ?>
    4043
  • src/bp-xprofile/bp-xprofile-functions.php

    diff --git src/bp-xprofile/bp-xprofile-functions.php src/bp-xprofile/bp-xprofile-functions.php
    index 9764102f4..ba9159252 100644
    function xprofile_update_field_group_position( $field_group_id = 0, $position = 
    147147 *
    148148 * @return array Key/value pairs (field type => class name).
    149149 */
    150 function bp_xprofile_get_field_types() {
    151         $fields = array(
    152                 'checkbox'       => 'BP_XProfile_Field_Type_Checkbox',
    153                 'datebox'        => 'BP_XProfile_Field_Type_Datebox',
    154                 'multiselectbox' => 'BP_XProfile_Field_Type_Multiselectbox',
    155                 'number'         => 'BP_XProfile_Field_Type_Number',
    156                 'url'            => 'BP_XProfile_Field_Type_URL',
    157                 'radio'          => 'BP_XProfile_Field_Type_Radiobutton',
    158                 'selectbox'      => 'BP_XProfile_Field_Type_Selectbox',
    159                 'textarea'       => 'BP_XProfile_Field_Type_Textarea',
    160                 'textbox'        => 'BP_XProfile_Field_Type_Textbox',
    161                 'telephone'      => 'BP_XProfile_Field_Type_Telephone',
    162                 'wp-biography'   => 'BP_XProfile_Field_Type_WordPress_Biography',
    163                 'wp-textbox'     => 'BP_XProfile_Field_Type_WordPress_Textbox',
    164         );
     150 function bp_xprofile_get_field_types() {
     151        $fields = array(
     152                'checkbox'            => 'BP_XProfile_Field_Type_Checkbox',
     153                'datebox'             => 'BP_XProfile_Field_Type_Datebox',
     154                'multiselectbox'      => 'BP_XProfile_Field_Type_Multiselectbox',
     155                'number'              => 'BP_XProfile_Field_Type_Number',
     156                'url'                 => 'BP_XProfile_Field_Type_URL',
     157                'radio'               => 'BP_XProfile_Field_Type_Radiobutton',
     158                'selectbox'           => 'BP_XProfile_Field_Type_Selectbox',
     159                'textarea'            => 'BP_XProfile_Field_Type_Textarea',
     160                'textbox'             => 'BP_XProfile_Field_Type_Textbox',
     161                'telephone'           => 'BP_XProfile_Field_Type_Telephone',
     162                'wp-biography'        => 'BP_XProfile_Field_Type_WordPress_Biography',
     163                'wp-textbox'          => 'BP_XProfile_Field_Type_WordPress_Textbox',
     164                'checkbox_acceptance' => 'BP_XProfile_Field_Type_Checkbox_Acceptance',
     165        );
    165166
    166167        /**
    167168         * Filters the list of all xprofile field types.
  • src/bp-xprofile/classes/class-bp-xprofile-user-admin.php

    diff --git src/bp-xprofile/classes/class-bp-xprofile-user-admin.php src/bp-xprofile/classes/class-bp-xprofile-user-admin.php
    index ef71072c5..7eff5f446 100644
    class BP_XProfile_User_Admin { 
    273273                $r = bp_parse_args( $args['args'], array(
    274274                        'profile_group_id' => 0,
    275275                        'user_id'          => $user->ID,
    276                         'hide_field_types' => array( 'wp-textbox', 'wp-biography' ),
     276                        'hide_field_types' => array( 'wp-textbox', 'wp-biography', 'checkbox_acceptance' ),
    277277                ), 'bp_xprofile_user_admin_profile_loop_args' );
    278278
    279279                // We really need these args.