User management fields#2921
Conversation
There was a problem hiding this comment.
This is a great start. See the specific code comments, but there are also some functional issues:
- When using the new user form, the submit doesn't work because it returns an API error
- When changing fields of an existing user, they don't automatically save like they used to. We need to hook up the code to capture change events and trigger the API requests
- Those will probably require js changes. Try to find the js code that was specific to the old form fields and remove it as you implement the new code for the components.
There was a problem hiding this comment.
Looking better.
- We still need the margin adjustments on the user management page for editing existing users.
- I found a weird issue when editing users. I set the gender of a user to Female (had been blank), and then when I opened up any other user, it also showed Female even though they should have been blank. I'm having trouble reproducing it again after setting those values.
- Related to that, as I was trying to reproduce it, I also had a situation where I changed another user to Male from blank, it saved, I closed to modal and then opened the same user, but the gender was blank again. If I refreshed the page, it correctly showed Male. I think whatever js is loading the modal had the original value instead of the updated one.
|
Just fixed those bugs! Let me know any other suggestions. For the Gender bug, I realize it was because I had |
cairocoder01
left a comment
There was a problem hiding this comment.
I pushed one commit to reset all of the component fields before loading in new values. It was causing an issue where saved icons were still displaying on a second user modal and the gender field wasn't cleared out if the value was "none" and the previous had a value.
As I was looking in the subassigned code, I see there's a feature to check the URL for a query param and preset the subassigned field (/user-management/add-user?contact_id=691). Let's make sure that still works. It happens when you're on a contact, open the Admin Actions dropdown, and select the option to make that contact into a user.
| <div class="user-field"> | ||
| <?php DT_Components::render_connection( 'subassigned[query]', [ | ||
| 'subassigned[query]' => [ | ||
| 'name' => __( 'Contact to make a user (optional)', 'disciple_tools' ), | ||
| 'default' => '', | ||
| 'type' => 'connection', | ||
| 'post_type' => 'contacts', | ||
| ] | ||
| ], [], [ 'placeholder' => __( 'Search multipliers and contacts', 'disciple_tools' ) ] ) ?> |
There was a problem hiding this comment.
This is a much better code style. However, if I select a contact in this field and save the new user, it still creates a new contact instead of using this value.
Also, we should add 'allowAdd' => false to the params so that users can't add a new contact in the field.
Code ReviewHigh1. Password field rendered as plain text —
|


@cairocoder01 This resolves #2847 to replace user management fields w dt-web-components.
Please specifically look at the syntax and formatting of my changes to make sure it's what you're looking for!