Introduced in Version 1.4
A new action hook has been added at the time of access being granted
rup_sell_ind_posts_access_granted
This new action hook passes the following variables:
- user_id
- post_id
- order_id
- price_id
Use Case:
You want to use WP cron to remove access after, say, 30 days from your use.r This can be achieved using a code snippet being triggered by that action hook. An example of that code is below
<?phpadd_action( 'rup_sell_ind_posts_access_granted', 'rup_schedule_access_removal', 10, 1 );function rup_schedule_access_removal( $payload ) { // now everything is self-documenting: $user_id = $payload['user_id']; $post_id = $payload['post_id']; $order_id = $payload['order_id']; $price_id = $payload['price_id']; rup_sell_ind_posts_log_debug( sprintf( 'Scheduling removal — user_id: %d, post_id: %d, order_id: %s, price_id: %s', $user_id, $post_id, $order_id, $price_id ) ); if ( ! wp_next_scheduled( 'rup_remove_access_event', [ $user_id, $post_id ] ) ) { wp_schedule_single_event( time() + 30 * DAY_IN_SECONDS, 'rup_remove_access_event', [ $user_id, $post_id ] ); }}
You will then get your Cron array looking like this
In the above case, user 1 will get their access revoked to post 38 on the 24th May 2025
You can also use the plugin action method in automators such as flowmattic to automatically do this using a custom delay or to do something else using this information, i.e store it in a table.. The data received by this action hook in Flowmattic would look like the below