Skip to:
Content

bbPress.org


Ignore:
Timestamp:
02/18/2021 05:35:00 AM (5 years ago)
Author:
johnjamesjacoby
Message:

Users: Improve UX of form-user-passwords.php template part.

This change makes sure that the "Generate Password" UI is hidden by default if the browser has JavaScript enabled, and that the traditional UI is visible if JavaScript is not enabled.

It also includes the following related improvements:

  • Introduce bbp_doing_script_debug() and bbp_doing_autosave() helpers, and use them where needed
  • Introduce bbp_asset_version() and bbp_get_asset_version() to bust asset cache when debugging
  • Update forum-user-passwords.php template part to swap out body class and add missing element ID
  • Update password form styling in bbpress.css default theme compat CSS

In trunk for 2.7.0. Fixes #3421.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/core/functions.php

    r6930 r7190  
    3333
    3434/**
     35 * Output the bbPress asset version
     36 *
     37 * @since 2.6.7 bbPress (r7188)
     38 */
     39function bbp_asset_version() {
     40    echo bbp_get_asset_version();
     41}
     42    /**
     43     * Return the bbPress asset version
     44     *
     45     * @since 2.6.7 bbPress (r7188)
     46     *
     47     * @retrun string The bbPress asset version
     48     */
     49    function bbp_get_asset_version() {
     50        return bbp_doing_script_debug()
     51            ? (string) time()
     52            : bbp_get_version();
     53    }
     54
     55/**
    3556 * Output the bbPress database version
    3657 *
     
    656677    exit();
    657678}
     679
     680/** Global Helpers ************************************************************/
     681
     682/**
     683 * Return if debugging scripts or not
     684 *
     685 * @since 2.6.7 (r7188)
     686 *
     687 * @return bool True if debugging scripts. False if not debugging scripts.
     688 */
     689function bbp_doing_script_debug() {
     690    return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;
     691}
     692
     693/**
     694 * Return if auto-saving or not
     695 *
     696 * @since 2.6.7 (r7188)
     697 *
     698 * @return bool True if mid auto-save. False if not mid auto-save.
     699 */
     700function bbp_doing_autosave() {
     701    return defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE;
     702}
Note: See TracChangeset for help on using the changeset viewer.