WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 4 years ago

#15389 closed enhancement (fixed)

Make New Site & New User Network form pluggable.

Reported by: ptahdunbar Owned by: jeremyfelt
Milestone: 4.5 Priority: normal
Severity: normal Version: 3.1
Component: Networks and Sites Keywords: has-patch
Focuses: multisite, administration Cc:
PR Number:

Description

Problem: Currently the only way to add additional fields to the new site & new user network form is by dynamically injecting them using javascript.

Solution: They should either have action hooks or use the settings API. I'll provide patches for both methods.

In addition, I've added semantic ids to the current form fields so they can be selectively hidden.

Attachments (2)

ticket.15389.network-forms-hooks.diff (2.7 KB) - added by ptahdunbar 9 years ago.
This patch uses the hooks approach
15389.diff (774 bytes) - added by jeremyfelt 4 years ago.

Download all attachments as: .zip

Change History (12)

#1 @ptahdunbar
9 years ago

  • Cc trac@… added

Axing the settings api approach as that'll involve moving all the form processing to a new network/post.php file for just these two forms.

#2 @ptahdunbar
9 years ago

Alternatively, we could just have this within the forms:

do_settings_fields( 'wpms_new_site', 'default' );

Then:

add_settings_field( 'twitter-id', 'Twitter username', 'wpms_twitter_callback', 'wpmu_new_site', 'default' );

Which works, but that's only using half of the settings API as it won't make use of register_setting() (you'd have to handle form processing on your own).

@ptahdunbar
9 years ago

This patch uses the hooks approach

#3 @ocean90
9 years ago

  • Type changed from defect (bug) to enhancement

#4 @nacin
9 years ago

  • Milestone changed from Awaiting Review to Future Release

#5 @nacin
6 years ago

  • Component changed from Network Admin to Networks and Sites
  • Focuses administration added

#6 @jeremyfelt
6 years ago

  • Keywords needs-patch dev-feedback added; has-patch removed
  • Milestone changed from Future Release to 3.9

Having a hook on both these pages would be great. In the standard user-new.php, we fire user_new_form after the closing table tag. It may be worth having some consistency, though per [25631] via #18709, this is a different form. Firing that outside the table would allow for more flexible output by plugins.

We should consider hitting this in 3.9 if possible.

#7 @jeremyfelt
6 years ago

  • Milestone changed from 3.9 to Future Release

Going to push this to another release so that we can make sure we do it the right way. Ideally, this would be refactored quite a bit to make any extension easier. As it is, any new action added to the form would need a matching action to handle it on save to avoid even more hacky implementations.

#8 @chriscct7
4 years ago

  • Keywords needs-refresh added; needs-patch removed

@jeremyfelt
4 years ago

#9 @jeremyfelt
4 years ago

  • Keywords has-patch added; dev-feedback needs-refresh removed
  • Milestone changed from Future Release to 4.5

I think we can use the same approach for users as we did for sites in #34739. 15389.diff does this.

#10 @jeremyfelt
4 years ago

  • Owner set to jeremyfelt
  • Resolution set to fixed
  • Status changed from new to closed

In 36556:

Multisite: Add a hook to the end of the network's Add New User form.

The network_user_new_form action can be used to extend the new user form.

Props ptahdunbar.
Fixes #15389.

Note: See TracTickets for help on using tickets.