Skip to content

Instantly share code, notes, and snippets.

View tannerm's full-sized avatar

Tanner Moushey tannerm

View GitHub Profile
<?php
/**
* Filter the subscriptions that can be used in the upgrade path
* original filter: https://docs.google.com/document/d/19-H7iF-6M_xuKQIF_V6VdeuwXyXaGgWAU9zrJnxavOw/edit
*/
function trm_filter_subscriptions( $subscriptions, $user_id ) {
// make sure the user is active and get the subscription ID
$user_subscription = ( rcp_is_recurring( $user_id ) && rcp_is_active( $user_id ) && 'cancelled' !== rcp_get_status() ) ? rcp_get_subscription_id( $user_id ) : '';
$subscriptions = rcp_get_subscription_levels( 'active' );
add_action( 'wpmu_new_user', function( $user_id ) {
add_user_to_blog( 19, $user_id, 'participant' ); // add user to forum site as participant
// subscribe user to forum
$forum_id = 0; // update the forum id
switch_to_blog( 19 ); // switch to the correct site
bbp_add_user_forum_subscription( $user_id, $forum_id ); // add user to the forum
restore_current_blog(); // switch back to the original site
} );
@tannerm
tannerm / CLI.php
Last active November 15, 2021 15:35
Migrate WP CLI script
/**
*
* ## OPTIONS
*
* <environment>
* : The environment you are going to. 'local' or 'stage'. Defaults to 'local'
*
* <language>
* : The language to import the content to
*
<?php
// Edited by Mission Lab on 7/31/2023 to add SubStack posts
$api_url = 'https://substackapi.com/api/feeds/[your-username].substack.com?sort=new&limit=4';
// Set up cURL to fetch data from the Substack API
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);