Closed remcotolsma closed 3 years ago
@rvdsteege You mentioned that sometimes there were 2 meta values for the pronamic_payment_id
meta key? Should we figure out how this happens? According to https://docs.gravityforms.com/gform_update_meta/ this should not happen? It is nice to know why the empty
check is necessary.
@remcotolsma First time our update_entry_payment_meta()
is called, the pronamic_payment_id
entry meta got set to null
in the database.
In a subsequent call to gform_update_meta()
, the result of gform_get_meta()
in https://github.com/wp-premium/gravityforms/blob/2.4.20/forms_model.php#L7750-L7751 will be false
. Therefore the $meta_exists
also results in false
and a new meta item gets added.
Therefore, we either have to keep the empty()
check (or update to null !== $payment_id
check) or cast $payment->get_id()
to a string. In case there is no payment ID yet, an empty string will be added as pronamic_payment_id
meta. An empty string meta item updates correctly.
Related issue: some merge tags also resulted in empty text in notification with the Form is submitted event, even though the data was stored correctly in the entry. This has been resolved in https://github.com/wp-pay-extensions/gravityforms/commit/e293644c158e561d8b03c82a405fff0fdc7dea07.
Internal HelpScout tickets:
{pronamic_payment_id}
is missing since update 7.0.0