Skip to:
Content

BuddyPress.org

Ticket #5775: 5775.patch

File 5775.patch, 7.7 KB (added by boonebgorges, 11 years ago)
  • src/bp-templates/bp-legacy/buddypress-functions.php

    diff --git src/bp-templates/bp-legacy/buddypress-functions.php src/bp-templates/bp-legacy/buddypress-functions.php
    index d933ca9..2511bca 100644
    class BP_Legacy extends BP_Theme_Compat { 
    8282
    8383                /** Scripts ***********************************************************/
    8484
    85                 add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_styles'   ) ); // Enqueue theme CSS
    86                 add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts'  ) ); // Enqueue theme JS
    87                 add_filter( 'bp_enqueue_scripts', array( $this, 'localize_scripts' ) ); // Enqueue theme script localization
    88                 add_action( 'bp_head',            array( $this, 'head_scripts'     ) ); // Output some extra JS in the <head>
     85                add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_styles'                        ) ); // Enqueue theme CSS
     86                add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts'                       ) ); // Enqueue theme JS
     87                add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_bp_pages_scripts'  ) ); // Enqueue theme JS on certain pages
     88                add_filter( 'bp_enqueue_scripts', array( $this, 'localize_scripts'                      ) ); // Enqueue theme script localization
     89                add_action( 'bp_head',            array( $this, 'head_scripts'                          ) ); // Output some extra JS in the <head>
    8990
    9091                /** Body no-js Class ********************************************************/
    9192                add_filter( 'body_class', array( $this, 'add_nojs_body_class' ), 20, 1 );
    class BP_Legacy extends BP_Theme_Compat { 
    254255                        wp_enqueue_script( 'comment-reply' );
    255256                }
    256257        }
     258       
     259        /**
     260         * Enqueue the required Javascript files on certain pages of BuddyPress
     261         *
     262         * @since BuddyPress (2.1)
     263         */
     264        public function enqueue_bp_pages_scripts() {
     265               
     266                // Get the BuddyPress pages option
     267                $bp_pages = get_option('bp-pages');
     268               
     269                // Registration page JS scripts
     270                if ( is_array( $bp_pages ) && isset( $bp_pages['register'] ) && is_page( $bp_pages['register'] ) ) {
     271               
     272                        $file = "register.js";
     273                       
     274                        // Locate the Register Page JS file
     275                        $asset = $this->locate_asset_in_stack( $file, 'js' );
     276                       
     277                        // Enqueue script
     278                        wp_enqueue_script( 'password-strength-meter' );
     279                        wp_enqueue_script( $asset['handle'] . '-register', $asset['location'], bp_core_get_js_dependencies(), $this->version, true );
     280                }
     281        }
    257282
    258283        /**
    259284         * Get the URL and handle of a web-accessible CSS or JS asset
  • 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 68b1d05..b674664 100644
     
    4040                                <label for="signup_password"><?php _e( 'Choose a Password', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
    4141                                <?php do_action( 'bp_signup_password_errors' ); ?>
    4242                                <input type="password" name="signup_password" id="signup_password" value="" />
     43                                <div id="pass-strength-result"></div>
    4344
    4445                                <label for="signup_password_confirm"><?php _e( 'Confirm Password', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
    4546                                <?php do_action( 'bp_signup_password_confirm_errors' ); ?>
  • src/bp-templates/bp-legacy/css/buddypress.css

    diff --git src/bp-templates/bp-legacy/css/buddypress.css src/bp-templates/bp-legacy/css/buddypress.css
    index 6441cd3..70977d2 100644
    body.activity-permalink #buddypress div.activity-comments div.acomment-content { 
    530530        border: 1px solid #591;
    531531        color: #250;
    532532}
     533#buddypress #signup_form.standard-form div#pass-strength-result {
     534    background-color: #eee;
     535    border-color: #ddd;
     536    border-style: solid;
     537    border-width: 1px;
     538    display: none;
     539    margin: 5px 5px 5px 0;
     540    padding: 5px;
     541    text-align: center;
     542    width: 200px;
     543}
     544#buddypress #signup_form.standard-form div#pass-strength-result.error,
     545#buddypress #signup_form.standard-form div#pass-strength-result.bad {
     546    background-color: #ffb78c;
     547    border-color: #ff853c !important;
     548        display: block;
     549}
     550#buddypress #signup_form.standard-form div#pass-strength-result.good {
     551    background-color: #ffec8b;
     552    border-color: #fc0 !important;
     553        display: block;
     554}
     555#buddypress #signup_form.standard-form div#pass-strength-result.short {
     556    background-color: #ffa0a0;
     557    border-color: #f04040 !important;
     558        display: block;
     559}
     560#buddypress #signup_form.standard-form div#pass-strength-result.strong {
     561    background-color: #c3ff88;
     562    border-color: #8dff1c !important;
     563        display: block;
     564}
    533565#buddypress .standard-form#signup_form div div.error {
    534566        background: #faa;
    535567        color: #a00;
  • new file src/bp-templates/bp-legacy/js/register.js

    diff --git src/bp-templates/bp-legacy/js/register.js src/bp-templates/bp-legacy/js/register.js
    new file mode 100644
    index 0000000..b931266
    - +  
     1/**
     2 * Register functions file
     3 */
     4 
     5( function( $ ) {
     6       
     7    // Bind to trigger the checkPassStrength
     8    $( 'body' ).on( 'keyup', 'input[name=signup_password], input[name=signup_password_confirm]',
     9        function( event ) {
     10            checkPassStrength(
     11                $('input[name=signup_password]'),                       // Password field
     12                $('input[name=signup_password_confirm]'),       // Password Confirmation field
     13                $('#pass-strength-result'),                                     // Strength meter container
     14                $('input[type=submit]'),                                        // Submit button
     15                []                                                                                      // Blacklisted words array
     16            );
     17        }
     18    );
     19
     20} )( jQuery );
     21
     22function checkPassStrength(
     23        $pass,
     24        $pass_confirm,
     25        $meterResult,
     26        $submitButton,
     27        blacklistArray ) {
     28   
     29        var pass                        = $pass.val();
     30    var pass_confirm    = $pass_confirm.val();
     31 
     32    // Reset the form & meter
     33        $meterResult.removeClass( 'short bad good strong' );
     34        $meterResult.html('');
     35 
     36    // Extend our blacklist array with those from the inputs & site data
     37    blacklistArray = blacklistArray.concat( wp.passwordStrength.userInputBlacklist() )
     38 
     39    // Get the password strength
     40    var strength = wp.passwordStrength.meter( pass, blacklistArray, pass_confirm );
     41 
     42    // Add the strength meter results
     43    switch ( strength ) {
     44 
     45        case 2:
     46                        $meterResult.addClass( 'bad' ).html( pwsL10n.bad );
     47                        break;
     48                case 3:
     49                        $meterResult.addClass( 'good' ).html( pwsL10n.good );
     50                        break;
     51                case 4:
     52                        $meterResult.addClass( 'strong' ).html( pwsL10n.strong );
     53                        break;
     54                case 5:
     55                        $meterResult.addClass( 'short' ).html( pwsL10n.mismatch );
     56                        break;
     57                default:
     58                        $meterResult.addClass( 'short' ).html( pwsL10n.short );
     59 
     60    }
     61 
     62    // This will happen when inserted password is strong.
     63    if ( 4 === strength && '' !== pass_confirm.trim() ) {
     64    }
     65 
     66    return strength;
     67}
     68 No newline at end of file
  • src/bp-xprofile/bp-xprofile-template.php

    diff --git src/bp-xprofile/bp-xprofile-template.php src/bp-xprofile/bp-xprofile-template.php
    index 2466104..9da6c87 100644
    function bp_profile_visibility_radio_buttons( $args = '' ) { 
    744744
    745745                                <?php foreach( bp_xprofile_get_visibility_levels() as $level ) : ?>
    746746
    747                                         <?php printf( $r['before_radio'], esc_attr( $level['id'] ) ); ?>
     747                                        <?php printf( $r['before_radio'], $level['id'] ); ?>
    748748
    749749                                        <label for="<?php echo esc_attr( 'see-field_' . $r['field_id'] . '_' . $level['id'] ); ?>">
    750750                                                <input type="radio" id="<?php echo esc_attr( 'see-field_' . $r['field_id'] . '_' . $level['id'] ); ?>" name="<?php echo esc_attr( 'field_' . $r['field_id'] . '_visibility' ); ?>" value="<?php echo esc_attr( $level['id'] ); ?>" <?php checked( $level['id'], bp_get_the_profile_field_visibility_level() ); ?> />