[buddypress-trac] [BuddyPress Trac] #6347: XProfile fields used for signup should be configurable
noreply at wordpress.org
Wed Mar 31 18:36:04 UTC 2021
#6347: XProfile fields used for signup should be configurable
Reporter: johnjamesjacoby | Owner: johnjamesjacoby
Type: enhancement | Status: reopened
Priority: high | Milestone: 8.0.0
Component: Extended Profile | Version: 1.0
Severity: normal | Resolution:
Keywords: has-patch |
Changes (by imath):
* keywords: needs-patch => has-patch
I've been working on an alternative way of achieving this. Instead of
improving the `BP_XProfile_Field` object adding methods to
fetch/cache/query/delete/add etc.. I suggest to use what we have so far
inside the `BP_XProfile_Group` object.
this alternative patch] I've kept in mind @offereins comment below because
I agree it's a very important point.
> The patch contains the signup-position metabox, but there's no screen
where the user could get an overview of all selected fields and manually
rearrange them. I think that is a required addition. Can I help with that
or should we wait untill all the query/caching-stuff is in?
In the patch I'm editing the xProfile WP Admin Screen to simulate a new
Group for the signup fields. This "fake" group is used to enjoy the UI we
have to sort and move fields from one Group to another one.
This group doesn't exist into the db table and nothing is changed about
the profile fields we drag on it. They are not moving from the field group
they are attached to. It's I believe a nice way to pick the fields of the
various groups we want to display into the signup form.
into the "Signup Fields" tab. Once cloned into this tab you can reorder
the signup fields.
To **only** fetch the signup fields using the `bp_has_profile()` loop,
I've added a new parameter `signup_fields_only` to inform
`BP_XProfile_Group::get()` it needs to ignore all other fields. So fields
are fetched using the order of their belonging group at first. Then into
`BP_XProfile_Data_Template` just after we got Groups and fields, I'm using
a query to build an array of signup field IDs ordered according to their
`signup_position` metadata, I'm then faking a new group looping into the
fetched ones to reorder the fields according to this array.
And it works, check [https://vimeo.com/531370819 this demo] :)
Other things the patch is handling:
- The array of ordered signup field IDs is cached
- Installation sets the fullname field by default as the first and
required signup field.
- A migrate task does the same during 8.0.0 upgrade.
- Template packs has both been updated.
Things I still need to work on:
- I still need to improve it to select all Base group fields if signup are
- I still need to add a filter if the user has overriden the register
template to improve backcompat.
into the Signup fields tab, as it's not removing the dragged field from
the original Groups tab, the group fields can be sorted differently
(moving the dragged field at the top).
- I still need to add a metabox into the field's edit screen to enjoy the
things @johnjamesjacoby previously added for the `signup_position` metabox
to remove a field from the signup form from this screen.
About this last point I have 2 options:
- use a toggle to swith between sorting/moving fields
- use up/down arrow buttons in field containers like the WordPress
Dashboard metaboxes now includes.
What do you think of this alternative?
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6347#comment:32>
BuddyPress Trac <http://buddypress.org/>
More information about the buddypress-trac