• Resolved Diagoras Vougas

    (@dvougasgr)


    Hello thank for your very useful plugin. If it is possible I would like to have your support on the following.
    I am trying to create a simple upload media page with WPforms and MLA.
    I want assign an att. Category (e.g. wedding) when the user uploads photos and videos through specific form id.
    Is that possible with MLA ?

    Thank you in advance

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

    (@dglingren)

    MLA does not have any form of conditional logic to do something like “if form id is 5 then attachment_category=wedding”. You will have to put the value, e.g., wedding, somewhere in the form so it is sent to the server when the form is submitted. You could add a dropdown control to the form with a list of values or you could define a hidden field containing a form-specific value like “wedding”. In either case, note the field id at the top of the Field Options tab, e.g. “(ID #2)”. Here’s an example of the values passed to the server from my test form:

    wpforms[fields][4]: 
    wpforms[fields][3]:
    wpforms[fields][1][first]: David
    wpforms[fields][1][last]: Lingren
    wpforms[fields][2]: wedding
    wpforms[id]: 9762
    wpforms[nonce]: f8eee17696
    page_title: Form Preview
    page_url: https://l.mladev/?wpforms_form_preview=9762&new_window=1
    page_id: 9762
    wpforms[post_id]: 9762
    wpforms[submit]: wpforms-submit
    wpforms[token]: e342ab73b470c09d58072cb1171bd03c
    action: wpforms_submit

    You can see the value I selected in my dropdown control, wpforms[fields][2]: wedding.

    Now you can define an MLA mapping rule to be applied when an image is uploaded to the Media Library:

    1. Go to the Settings/Media Library Assistant IPTC/EXIF/WP tab.
    2. Since you want to apply the rule to new items as they are uploaded, check the “Enable IPTC/EXIF Mapping when adding new media” and “Enable IPTC/EXIF Mapping when updating media metadata” boxes.
    3. Find the rule name that corresponds to the taxonomy you are using, e.g., Att. Categories
    4. Hover over the rule name and click the “Edit” rollover action.
    5. In the “IPTC Value” dropdown control leave the default, “- None (select a value) -” value in place.
    6. In the “EXIF/Template Value” text box, enter template:([+request:wpforms.fields.2+]). This assigns the term named in the dropdown control (or hidden field). Substitute the field id value from your form.
    7. In the “Priority” dropdown, select “EXIF”.
    8. In the “Existing Text” dropdown, select “Replace” to replace the current field content, or select “Keep” to retain any terms assigned by other means. For new uploads you can use either option.
    9. In the “Status” text box, select “Active”.
    10. Scroll down to the bottom of the screen and click “Update”.

    This works well if you have only one form. If you have multiple forms you would need to ensure that the same field id is used on all forms to assign an atttachment_category or be present with an empty value. If that’s not possible, you can use the hooks MLA provides to customize the rule processing logic. For example, test the wpforms[id]: 9762 value and only look for your field if the form id matches. If you need more details on that solution, let me know.

    I hope that gets you started on a solution for your application. I will leave this topic unresolved for now in case you have problems or further questions regarding the above suggestions. Thank you for your interest in the plugin.

    Plugin Author David Lingren

    (@dglingren)

    It has been five weeks since my last post in this topic. I assume you have found a solution that works for your application.

    I am marking this topic resolved, but please post an update if you would like further help with it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.