Skip to:
Content

BuddyPress.org

Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#7472 closed defect (bug) (fixed)

Admin - Cannot edit profile fields when on multisite and BP is not network-activated

Reported by: NicolasKulka Owned by: r-a-y
Milestone: 2.8.3 Priority: high
Severity: major Version: 2.8.2
Component: Administration Keywords: has-patch
Cc:

Description

Hello,

On the "User Fields Management" page, when the plugin is not activated on the network, you can not modify or delete a field. (wp-admin/users.php?page=bp-profile-setup)

I solved the problem by correcting the lines 616 and 626 of file buddypress/bp-xprofile/bp-xprofile-admin.php.

Replace : network_admin_url by admin_url

<?php
$field_edit_url = add_query_arg(
                array(
                        'page'     => 'bp-profile-setup',
                        'group_id' => (int) $field->group_id,
                        'field_id' => (int) $field->id,
                        'mode'     => 'edit_field'
                ),
                admin_url( 'users.php' )
        );

        if ( $field->can_delete ) {
                $field_delete_url = add_query_arg(
                        array(
                                'page'     => 'bp-profile-setup',
                                'field_id' => (int) $field->id,
                                'mode'     => 'delete_field'
                        ),
                        admin_url( 'users.php' ) . '#tabs-' . (int) $field->group_id
                );
        }

]

Think you correct it?

Thank you

Attachments (1)

bp-xprofile-admin.php (22.4 KB) - added by NicolasKulka 3 years ago.
Patch

Download all attachments as: .zip

Change History (10)

@NicolasKulka
3 years ago

Patch

#1 @dcavins
3 years ago

Hi @NicolasKulka-

Thanks for your patch! Looking into network_admin_url(), it should fall back to using admin_url() if is_multisite() returns false:
https://developer.wordpress.org/reference/functions/network_admin_url/

Before you made the change, what URLs were being produced by the function? (Can you provide an example?)

Best,

-David

#2 @r-a-y
3 years ago

  • Component changed from Core to Administration
  • Milestone changed from Awaiting Review to 2.8.3
  • Owner set to slaFFik
  • Summary changed from Law problem on the user field page to Admin - Cannot edit profile fields when on multisite and BP is not network-activated

See #7445 where I made the change to use network_admin_url().

Looks like @NicolasKulka is using multisite, but has only activated BuddyPress on one site. This would cause the bug that he is experiencing.

Boo Ray!

@johnjamesjacoby was right that we should probably use bp_get_admin_url(). See his comment here:
https://buddypress.trac.wordpress.org/ticket/7445#comment:7

@NicolasKulka - Can you check to see if using bp_get_admin_url() will fix your problem?

#3 @r-a-y
3 years ago

  • Owner changed from slaFFik to r-a-y
  • Status changed from new to reviewing

Sorry, didn't mean to assign to slaFFik. For some reason, Trac made that change when I posted.

#4 @NicolasKulka
3 years ago

bp_get_admin_url() fix my problem

#5 @r-a-y
3 years ago

  • Status changed from reviewing to accepted

Thanks for verifying, @NicolasKulka.

Going to commit this now.

#6 @r-a-y
3 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 11519:

XProfile Admin: Fix profile field edit and delete URLs for multisite installs where BuddyPress is not network-activated.

r11432 fixed the profile field edit and delete URLs for multisite installs
where BuddyPress is network-activated, but broke the URLs where
BuddyPress is not network-activated on a multisite install. See #7445,

This changeset rectifies the problem by using bp_get_admin_url() instead
of network_admin_url(). (JJJ is always right!)

Props johnjamesjacoby, NicolasKulka.

Anti-props r-a-y.

Fixes #7472 (trunk)

#7 @r-a-y
3 years ago

In 11520:

XProfile Admin: Fix profile field edit and delete URLs for multisite installs where BuddyPress is not network-activated.

r11432 fixed the profile field edit and delete URLs for multisite installs
where BuddyPress is network-activated, but broke the URLs where
BuddyPress is not network-activated on a multisite install. See #7445,

This changeset rectifies the problem by using bp_get_admin_url() instead
of network_admin_url(). (JJJ is always right!)

Props johnjamesjacoby, NicolasKulka.

Anti-props r-a-y.

Fixes #7472 (2.8-branch)

#8 @r-a-y
3 years ago

  • Keywords needs-testing removed

This ticket was mentioned in Slack in #buddypress by r-a-y. View the logs.


2 years ago

Note: See TracTickets for help on using tickets.