Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/16/2021 05:37:03 AM (5 years ago)
Author:
imath
Message:

Update both Template Pack registration forms to use signup fields

  • Nouveau and Legacy are now usinf the bp_xprofile_signup_args() to build the argument of their registration's form xProfile loop.
  • Include a backward compatibility mechanism if the register.php page has been overriden from a theme or a plugin.
  • This commit also includes PHP Unit tests about the xProfile loop and Signup Fields.

Props johnjamesjacoby, boonebgorges, DJPaul, Offereins

Fixes #6347

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/includes/xprofile/template-tags.php

    r12082 r12887  
    44 *
    55 * @since 3.0.0
    6  * @version 3.0.0
     6 * @version 8.0.0
    77 */
    88
     
    6363 *
    6464 * @since 3.0.0
     65 * @deprecated 8.0.0
    6566 */
    6667function bp_nouveau_base_account_has_xprofile() {
    67     return (bool) bp_has_profile(
    68         array(
    69             'profile_group_id' => 1,
    70             'fetch_field_data' => false,
    71         )
    72     );
     68    _deprecated_function( __FUNCTION__, '8.0.0', 'bp_nouveau_has_signup_xprofile_fields()' );
     69    return bp_nouveau_has_signup_xprofile_fields();
    7370}
     71
     72/**
     73 * Checks whether there are signup profile fields to display.
     74 *
     75 * @since 8.0.0
     76 *
     77 * @param bool Whether to init an xProfile loop.
     78 * @return bool True if there are signup profile fields to display. False otherwise.
     79 */
     80function bp_nouveau_has_signup_xprofile_fields( $do_loop = false ) {
     81    if ( ! $do_loop ) {
     82        $signup_fields = (array) bp_xprofile_get_signup_field_ids();
     83        return 1 <= count( $signup_fields );
     84    }
     85
     86    return bp_has_profile( bp_xprofile_signup_args() );
     87}
Note: See TracChangeset for help on using the changeset viewer.