Hello,
I'm using metabox type user with the custom table users.
I want to use this action:
add_action( 'rwmb_my_custom_field_A_after_save_field', 'usuario_aprobado_con_codigo_acceso' , 20, 5 );
function usuario_aprobado_con_codigo_acceso ( $null, $field, $new, $old, $post_id ) {
Depending of the field my_custom_field_A (the value is in $new), I want to update another custom field of the custom table users, my_custom_field_B
I see in another posts
https://support.metabox.io/topic/using-custom-attributes-from-rwmb_before_save_post-action/
something like this:
$storage = $field['storage'];
$storage->update( $post_id, 'last_name', "blablabla" );
And it run well, it update the filed last_name. It run well with the populate user fields.
But if I want to update another custom fields that I added in this table, I don't know what I have to do to update the value...
I try:
$storage->update( $post_id, 'my_custom_field_B', "blablabla" );
don't work...
I try a query:
global $wpdb;
$wpdb->update('usuarios', array( 'my_custom_field_B' => 'blablabla'), array( 'ID' => $post_id ) );
and don't work...
Do you know what I'm doing wrong?
Thanks,
Sergio