Skip Navigation

[Résolu] Update Usermeta Repeating Field With PHP

This support ticket is created Il y a 3 années et 11 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 1 réponse, has 1 voix.

Last updated by Jo4nny8 Il y a 3 années et 11 mois.

Auteur
Publications
#1612883

Tell us what you are trying to do?
I am trying to use Ajax/php to update a repeating usermeta field

Is there any documentation that you are following?
No, just custom php programming
Is there a similar example that we can see?

What is the link to your site?
local-vacancies.dev.cc (is a local site)

Hi,

Im building a job search portal for users and am looking for a little help in saving job vacancies to user accounts.
Ive created a simple repeater user meta field which I can programmatically update via Ajax, however it doesnt add a NEW line to the repeater, it only overwrites the initial value in the repeater field.

I am using the default wordpress update user meta code (see below)

$saved = update_user_meta( $user_id, 'wpcf-js-saved-vacancy', $job);

Is there way to increment or add a repeater user meta field via php as my users will not have access to the admin of the site?
I should point out, I cannot use post relationships as the site is JavaScript driven and I am saving urls to the user meta and not posts.

#1612887

My issue is resolved now. Thank you!
I realised that I was using update_user_meta, when in fact I should have been using add_user_meta to add the saved job to the user, and delete_user_meta to delete the job from the repeater.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.