Hi Julie,
Thank you for contacting us and I'll be happy to assist.
The way "cred_post_expiration_custom_actions" hook works, it is executed at the time when the CRED form is submitted and a post is created.
Only the custom field values passed through "$custom_actions" array will be updated through the CRON, at the time of post-expiry.
( ref: https://toolset.com/documentation/user-guides/automatic-post-expiration/#what-happens-when-posts-expire )
You can update one or more custom field values through it, e.g:
add_filter('cred_post_expiration_custom_actions', 'my_custom_actions', 10, 3);
function my_custom_actions($custom_actions, $post_id, $form_data) {
$custom_actions[] = array( 'meta_key' => 'custom_field_key_1', 'meta_value' =>'custom_field_value_1' );
$custom_actions[] = array( 'meta_key' => 'custom_field_key_2', 'meta_value' =>'custom_field_value_2' );
$custom_actions[] = array( 'meta_key' => 'custom_field_key_3', 'meta_value' =>'custom_field_value_3' );
return $custom_actions;
}
To change the user role at the time of post expiry, you can make use of "Post Status Transitions" hooks.
1. You'll first register a new post status, e.g. "Expired" ( https://codex.wordpress.org/Function_Reference/register_post_status ), and set it for "After expiration change the status of the post to" option in the CRED form.
( ref: https://toolset.com/documentation/user-guides/automatic-post-expiration/#enabling-automatic-expiration-of-posts )
2. After that, you can create a custom function that is hooked to execute when post's status is changed from non-expired to expired and in that, you can change the user's role.
To change/extend the post expiry date programmatically, complex custom code involving WordPress' "Transients API" ( https://codex.wordpress.org/Transients_API ) will be needed. I'm afraid, custom programming such as this is beyond the scope of support that we provide, but you can consult one of our certified consultants for this:
hidden link
I hope these points will help and please let me know if there's anything else I can help you with.
regards,
Waqar