Skip to content

Instantly share code, notes, and snippets.

@developius
developius / README.md
Last active April 25, 2024 22:15
Setup SSH keys for use with GitHub/GitLab/BitBucket etc

Create a new repository, or reuse an existing one.

Generate a new SSH key:

ssh-keygen -t rsa -C "your_email@example.com"

Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings (https://github.com/settings/keys).

Test SSH key:

@strangerstudios
strangerstudios / my_template_redirect_upgrade.php
Created April 14, 2015 16:12
Redirect away from the checkout page if you don't have a required level with Paid Memberships Pro.
/*
Redirect away from the checkout page if you don't have a required level.
*/
function my_template_redirect_upgrade()
{
global $pmpro_pages, $pmpro_level;
if(empty($pmpro_pages))
return;
@eighty20results
eighty20results / pmpro_cancel_on_next_payments_date.php
Last active July 17, 2019 20:22 — forked from strangerstudios/pmpro_cancel_on_next_payments_date.php
Change PMPro membership cancellation to set expiration date to be the end of the payment period, instead of cancelling immediately (except when payment gateway is causing cancellation)
<?php
/*
Change cancellation to set expiration date et expiration date to be the end of the current month, instead of cancelling immediately.
Assumes orders are generated for each payment (i.e. your webhooks/etc are setup correctly).
*/
function e20r_stripe_delete_action( $user_id ) {
@strangerstudios
strangerstudios / pmpro_is_page.php
Last active January 22, 2024 17:08
Tests to check if you are on certain PMPro pages.
<?php
global $pmpro_pages, $pmpro_level;
if(is_page($pmpro_pages['levels'])) {
//on the pricing/levels page
}
if(is_page($pmpro_pages['checkout'])) {
//on the checkout page
}
@strangerstudios
strangerstudios / $pmpro_non_renewal_levels.php
Created March 28, 2016 16:22
Don't allow early renewals for certain levels with Paid Memberships Pro.
/*
Don't allow early renewals for certain levels.
Change the level IDs in the $pmpro_non_renewal_levels global array, then
add this code to your active theme's functions.php or a custom plugins.
*/
//define levels in global
global $pmpro_non_renewal_levels;
$pmpro_non_renewal_levels = array(1,2,3); //change this to the level IDs of the levels you don't want users to renew for
@strangerstudios
strangerstudios / pmpro_hide_level_from_levels_page.php
Last active April 8, 2021 18:21 — forked from greathmaster/pmpro-restrict-visibility-of-levels-on-levels-page.php
Limits the visibility of a level on the Levels page. Unlike setting "Allow Signups" members can access the checkout page to renew if needed.
<?php
//Save the pmpro_show_level_ID field
function pmpro_hide_level_from_levels_page_save( $level_id ) {
if( $level_id <= 0 ) {
return;
}
$limit = $_REQUEST['pmpro_show_level'];
update_option( 'pmpro_show_level_'.$level_id, $limit );
}
add_action( 'pmpro_save_membership_level','pmpro_hide_level_from_levels_page_save' );
@strangerstudios
strangerstudios / my_pmpro_disable_member_emails.php
Created March 10, 2017 19:34
Disable member emails for specific levels.
function my_pmpro_disable_member_emails($recipient, $email)
{
$user = get_user_by('login', $email->data['user_login']);
$level = pmpro_getMembershipLevelForUser($user->ID);
$disabled_levels = array(1,2,3); //update this to include ids of all levels you want to disable emails for
if(!empty($level) && !empty($level->id) && in_array($level->id, $disabled_levels))
$recipient = NULL;
@andrewlimaza
andrewlimaza / remove_billing_example.php
Created June 12, 2017 07:48
Remove 'Billing' from 'Billing Address' title in Paid Memberships Pro.
<?php
/**
* Copy the function below into your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* This function uses the gettext filter which will change all text occurences of Billing Address to Address in Paid Memberships Pro.
*/
function change_text_billing_pmpro( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Billing Address' :
$translated_text = __( 'Address', 'paid-memberships-pro' );
break;
@andrewlimaza
andrewlimaza / pmpro-edit-other-emails.php
Last active August 20, 2020 12:31
Stop PMPro from editing other WordPress email formats. Remove email filter.
remove_filter( 'wp_mail_content_type', 'pmpro_wp_mail_content_type' );
@andrewlimaza
andrewlimaza / redirect_users_to_a_new_page.php
Created July 4, 2017 14:49
Redirect users away from 'account' page in PMPro if they do not have a membership/logged-in
<?php
/**
* Redirect user's to a new URL instead of the 'levels' page in PMPro.
* Add this code to your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function redirect_users_to_a_new_page( $url ){
return 'https://some-url.com'; //change this to the URL you would like to redirect your user's to.