Gravity Forms – User Registered Role Assignment

add_action( ‘gform_user_updated’, ‘add_additional_roles’, 10, 4 ); function add_additional_roles( $user_id, $feed, $entry, $user_pass ) { if ( rgar( $entry, ‘form_id’ ) != 1 ) { return; } $user = new WP_User( $user_id ); $selected_role_array = explode( ‘|’, rgar( $entry, ’26’ )…Continue reading

GF State Abbreviation

add_filter( ‘gform_us_states’, ‘us_states’ ); function us_states( $states ) { $new_states = array(); foreach ( $states as $state ) { $new_states[ GF_Fields::get( ‘address’ )->get_us_state_code( $state ) ] = $state; } return $new_states; }Continue reading

MemberPress: Bulk Delete All Expired Subscriptions

function mepr_delete_expired_txns() { $subscriptions = MeprSubscription::get_all(); if( is_array( $subscriptions ) && !empty( $subscriptions ) ) { foreach( $subscriptions as $subscription ) { $subscription = new MeprSubscription( $subscription->id ); if( $subscription->is_cancelled() && $subscription->is_expired() ) { $subscription->destroy(); } } } } add_action(…Continue reading