WordPress-specific xprofile (meta) fields not saving
-
I’m trying to allow users to edit certain WordPress metadata fields on the frontend, namely contact and social information such as website, twitter link, etc. This functionality is outlined e.g. here https://bpdevel.wordpress.com/tag/wordpress/, however it only partially seems to work.
I’ve added 4 custom fields to the profile:
– Bio [type: Biography]
– Website [type: WordPress Text Field: Website]
– Twitter [type: WordPress Text Field: Twitter]
– Twitter [type: WordPress Text Field: Instagram]When I fill them out on the frontend, only Bio and Website are correctly stored to the user-meta table, Twitter and Instagram content seems to be lost. I can however edit them in the WordPress backend and they get correctly displayed on the front-end profile.
I’ve managed to synchronize them by updating them manually via code using update_user_meta() on save, but I feel like this defeats the point or shouldn’t be the way to go if the functionality is there on the admin menu.
Or am I doing something wrong here?
-
I have the same problem with Twitter saving. Backend works but frontend not! It’s a bug as I think!
Then why not you use any tool for this purpose who can automatically tracks the meta fields as you can see on this profile here I am using the same facility.
@hayeu74 Are you using Rank Math SEO?
I faced some field problems some years ago in my site but then I took guide form the moderator of the buddypress you can apply that guide on it may be it works.
Hi @maelscuttle
Thanks for your report. If these fields are generated filtering the
wp_get_user_contact_methods()
function they should be included into/updated from the front-end xprofile form.I’ll give it a look and will be back soon.
Hi, I’m back 🙂
I confirm this is working as expected. I’ve used this code to generate the Twitter WP Contact method: https://gist.github.com/imath/c634d9bfb575f128d76a25aaa76fc2e5
Then, I’ve created a new xProfile field using the WordPress text field type, as shown in the below screenshot.
Once done, I was able to find the new input inside the user’s profile edit screen on front-end, see screenshot below.
When I’ve submitted my edits, the twitter link was saved successfully and on the user’s profile view screen, it is displayed as a clickable link:
The same goes for the WP Dashboard profile, see below:
Since this is months old, I’ve already settled back then with the plugin “BuddyPress to WordPress Full Sync” which allows me to sync any arbitary xProfile fields to WordPress fields.
@imath I can confirm by now this works as expected when following your steps. Without being able to verify anymore what my problem was back then, I have a feeling this must have been related to validation as sometimes BuddyPress provides zero feedback when something was wrong. In my current WordPress version (5.8.3), the Twitter field is expected to be a simple username (not full URL / @), other fields like Instagram are expected to be the full URL. So perhaps the issue was that some fields didn’t match validation criteria, so BuddyPress just silently swallowed the input?Cheers
I was having the same issue; likely reason was my SEO plugin (Yoast SEO) only runs wp_get_user_contact_methods() in wp-admin. I re-registered the contact methods, and the BuddyPress-WordPress Text Fields now save the user contact data.
- You must be logged in to reply to this topic.