Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/12/2023 10:12:37 PM (12 months ago)
Author:
imath
Message:

Administration: add a new settings tab to manage slugs customization

Compared to [13442], change the logic of Components user navigation
generation by introducing a BP_Component::register_nav() method to
globalize the nav items early (ie: the registration step) and make them
available for the new settings tab to manage slugs customization.

After a second thought, the BP_Component::setup_nav() should remain the
navigation generation step instead of playing the registration role. This
will maximize backward compatibility & third party plugins wishing their
slugs to be customizable will need to "opt-in" for BP Rewrites using the
BP_Component::register_nav() method.

This first version of the URLs settings tab does not handle slugs
customization yet, its first usage is to make sure all BP Components user
navigation slugs were registered & to put the Accordion UI in place.

Props r-a-y, johnjamesjacoby, boonebgorges

Closes https://github.com/buddypress/buddypress/pull/84
See #4954

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-settings/bp-settings-functions.php

    r13140 r13450  
    362362<?php
    363363}
     364
     365/**
     366 * Whether a user can delete self account from front-end.
     367 *
     368 * @since 12.0.0
     369 *
     370 * @return boolean True if user can delete self account from front-end. False otherwise.
     371 */
     372function bp_settings_can_delete_self_account() {
     373    return ! user_can( bp_displayed_user_id(), 'delete_users' );
     374}
     375
     376/**
     377 * Whether to show the Delete account front-end nav.
     378 *
     379 * @since 12.0.0
     380 *
     381 * @return boolean True if user can be shown the Delete account nav. False otherwise.
     382 */
     383function bp_settings_show_delete_account_nav() {
     384    return ( ! bp_disable_account_deletion() && bp_is_my_profile() ) || bp_current_user_can( 'delete_users' );
     385}
     386
     387/**
     388 * Whether to show the Capability front-end nav.
     389 *
     390 * @since 12.0.0
     391 *
     392 * @return boolean True if user can be shown the Capability nav. False otherwise.
     393 */
     394function bp_settings_show_capability_nav() {
     395    return ! bp_is_my_profile();
     396}
Note: See TracChangeset for help on using the changeset viewer.