WordPress.org

Ready to get started?Download WordPress

Forums

Attachments
[resolved] Update / alter field values from code (4 posts)

  1. IoanPokorny
    Member
    Posted 1 year ago #

    Hi, sorry to be bothering again, I really enjoy your plugin and it's helping a lot on my projects.

    I have a question though, is there a way, existing function, code or anything so I can alter field values from the php file.

    for example as there is the $atachments->field('ANY_FIELD') function to return the value for that specific field, I need to be able to complete my project to be able to change the value of a given field from php code ( field('field_here')='my_value').

    How could I be doing this?

    Thanks

    http://wordpress.org/extend/plugins/attachments/

  2. Jonathan Christopher
    Member
    Plugin Author

    Posted 1 year ago #

    That seems like a strange use case for Attachments to be honest. It sounds like you're trying to get around your issue of needing to dynamically set a field value based on something else your users are doing. I would suggest not using an Attachments field for this since they are intended to be manually populated by users and instead set up your own (hidden) post meta key that manages this field for you.

  3. IoanPokorny
    Member
    Posted 1 year ago #

    I just want to be able to store some values in the fields

    I have made this function

    function fute($name, $valoare)
    {
    $this->attachments[$this->attachments_ref]->fields->$name=$valoare;

    }

    if I call it as fute('field_name', 'value'), it stores the new field value and if I echo that field using your standard function it displays me the new value.

    The single problem would be what to do so I can store the new value in the database

  4. IoanPokorny
    Member
    Posted 1 year ago #

    I need to dinamicaly populate a field of an attachment to set a value based on an activity a user does so I know it has been claimed by somebody.

    The only thing I would need for you is to let me know how to save the the value from the above function or do it another way if it's appliable, not sure what else I could use as I need that field for any individual attachment.

    I really appreciate your work and it helps me a lot, I noticed that the premium version is not available, I can make a financial support to help you carry on with development but I really would need to be able to do that as your plugin offers exactly what I need and as it's displayed using PHP I can arrange it in the exact layout I needd.

    Thanks,
    Ioan

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic