Setting values via code

This topic contains 5 replies, has 3 voices, and was last updated by  Stiofan O’Connor 6 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #1683

    gxwpm
    Buyer
    Post count: 8

    Hey,

    May I get an example about how can I set a field’s value via code?

    Let’s say I have a custom field on UWP called “pet_name” and I want to set “Puppy” as it’s value via script not UWP interface. Can I get a little snippet for it?

    Thanks,

    #1688

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    The forum is for support of the plugin as designed, and we are unable to perform customizations here.

    You can try something like this, though: https://stackoverflow.com/questions/2930396/can-you-set-a-form-field-value-with-php

    I will flag your question for the developers in case they have an easy fix.

    #1694

    gxwpm
    Buyer
    Post count: 8

    Hey,

    Thanks for the link, I’ve checked it. I don’t ask for a customization though, just looking for a sample function to set a field value for UsersWP.

    #1700

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hello,

    We have our own user meta functions that fuction like the standard WP ones, you can see them here: https://github.com/UsersWP/userswp/blob/master/includes/helpers/meta.php#L64

    All UWP metas are prefixed with “uwp_account_” so in your example above you would do this:

    uwp_update_usermeta( $user_id, "uwp_account_pet_name", "Puppy" );

    Thanks,

    Stiofan

    #1717

    gxwpm
    Buyer
    Post count: 8

    Perfect! You’re a life-saver Stiofan 🙂

    #1721

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    🙂

Viewing 6 posts - 1 through 6 (of 6 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket