Support » Plugin: NextGEN Custom Fields » [Plugin: NextGEN Custom Fields] Set field value by a function

  • Resolved tricks

    (@tricks)


    Hi,
    Is it possible to set a field value directly via a php-function instead of via the WP Dashboard?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author shauno

    (@shauno)

    Hey tricks

    Unfortunately this was actually my first released plugin, and I hadn’t got into the habit of breaking EVERYTHING down into the simplest APIs.

    That being said, inserting directly into the table is pretty simple. Have a look at the nggcf_save_pics() function for a basic idea. It takes all the pictures when saving a gallery in NGG and loops through them INSERTING or UPDATING wp_nggcf_field_values.

    Essentially the fields in wp_nggcf_field_values are:

    • pid – The picture’s ID
    • fid – The custom field’s id (from wp_nggcf_fields)
    • field_value – The value string
    • dateadded – Just a timestamp (date(‘Y-m-d H:i:s’, time()))
    • ngg_type – The constant numeric 1 for images (2 is for gallery custom fields)

    Thanks for your quick reply. Sorry I forgot to reply myself. Issue has been solved.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: NextGEN Custom Fields] Set field value by a function’ is closed to new replies.