Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/21/2014 11:08:04 PM (8 years ago)
Author:
johnjamesjacoby
Message:

First pass at Profile Settings for improved profile field visibility UX:

  • Adds /members/single/settings/profile.php template to bp-legacy and bp-default.
  • Introduces bp-xprofile.settings.php for Settings specific functionality going forward.
  • Introduces actions & screens for handling output and saving of profile visibility data.
  • Introduces _is_ function for identifying the new component/action URL.
  • See #5352. (still more @todo...)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile/bp-xprofile-template.php

    r7914 r7960  
    937937}
    938938
     939/** Visibility ****************************************************************/
     940
    939941/**
    940942 * Echo the field visibility radio buttons
     
    963965        return apply_filters( 'bp_profile_get_visibility_radio_buttons', $html );
    964966    }
     967
     968/**
     969 * Output the XProfile field visibility select list for settings
     970 *
     971 * @since BuddyPress (2.0.0)
     972 */
     973function bp_xprofile_settings_visibility_select( $args = '' ) {
     974    echo bp_xprofile_get_settings_visibility_select( $args );
     975}
     976    /**
     977     * Return the XProfile field visibility select list for settings
     978     *
     979     * @since BuddyPress (2.0.0)
     980     */
     981    function bp_xprofile_get_settings_visibility_select( $args = '' ) {
     982
     983        // Parse optional arguments
     984        $r = bp_parse_args( $args, array(
     985            'before' => '',
     986            'after'  => '',
     987            'class'  => 'bp-xprofile-visibility'
     988        ), 'xprofile_settings_visibility_select' );
     989
     990        // Start the output buffer
     991        ob_start();
     992
     993        // Anything before
     994        echo $r['before']; ?>
     995
     996        <?php if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?>
     997
     998            <select class="<?php echo esc_attr( $r['class'] ); ?>" name="field_<?php bp_the_profile_field_id(); ?>_visibility">
     999
     1000                <?php foreach ( bp_xprofile_get_visibility_levels() as $level ) : ?>
     1001
     1002                    <option value="<?php echo esc_attr( $level['id'] ); ?>" <?php selected( $level['id'], bp_get_the_profile_field_visibility_level() ); ?>><?php echo esc_html( $level['label'] ); ?></option>
     1003
     1004                <?php endforeach; ?>
     1005
     1006            </select>
     1007
     1008        <?php else : ?>
     1009
     1010            <span class="field-visibility-settings-notoggle" title="<?php _e( "This field's visibility cannot be changed.", 'buddypress' ); ?>"><?php bp_the_profile_field_visibility_level_label(); ?></span>
     1011
     1012        <?php endif;
     1013
     1014        // Anything after
     1015        echo $r['after'];
     1016
     1017        // Output the dropdown list
     1018        return apply_filters( 'bp_xprofile_settings_visibility_select', ob_get_clean() );
     1019    }
Note: See TracChangeset for help on using the changeset viewer.