Skip to content

Instantly share code, notes, and snippets.

View femiyb's full-sized avatar
🏠
Working from home

Samuel Femi Taiwo femiyb

🏠
Working from home
View GitHub Profile
@femiyb
femiyb / pmpro_changeMembershipLevel.php
Created January 16, 2020 11:25
When users cancel (are changed to membership level 0) we give them another "cancelled" level.
<?php
/**
* When users cancel (are changed to membership level 0) we give them another "cancelled" level.
* Can be used to downgrade someone to a free level when they cancel.
* Will allow members to the "cancel level" to cancel from that though.
*/
function pmpro_after_expiration_change_membership_levels( $level_id, $user_id ) {
// set this to the id of the level you want to give members when they cancel
$last_level_4 = 4;
$level_4_cancel_id = 3;
/*
Clear out all PMPro member and report data. (Back up your database first. Use at your own risk!!!)
This will delete all orders, members/level data, and reporting data.
Your levels, discount codes, and settings will remain in place.
All users will remain users (without memberships).
All subscriptions at the gateway will remain active.
To Use:
* Copy this code into your active theme's functions.php or a custom WP plugin.
* Navigate to /wp-admin/?pmprocleardata=1 when logged in as an admin.
<?php
/*
Add bcc for checkout emails
*/
function my_pmpro_email_headers_admin_emails($headers, $email)
{
//bcc checkout emails
if($email->template == "membership_expiring" || $email->template == "membership_expired")
{
//add bcc
@femiyb
femiyb / change_my_text_example.php
Last active December 15, 2022 22:47
Change text
<?php
// Add this code below to your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
add_filter( 'gettext', 'change_my_text_example', 20, 3 );
/**
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function change_my_text_example( $translated_text, $text, $domain ) {
@femiyb
femiyb / pmpro_move_name_fields.php
Created February 15, 2021 11:28
Move Name And Last Name fields
<?php
/**
* Add the following code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Move Email And Confirm Email fields before password
*/
function pmpro_move_name_fields() {
global $pmpro_pages;
if(is_page($pmpro_pages['checkout'])) {
@femiyb
femiyb / pmpro-adjust-the-join-now-login.php
Last active April 8, 2022 15:45 — forked from andrewlimaza/pmpro-adjust-the-join-now-login.php
Adjust the Paid Memberships Pro login "Join Now" Link.
<?php
/**
* Adjust the 'Join Now' link on the login page to a custom URL for Paid Memberships Pro.
* Follow this guide to add custom code to your membership site - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_custom_join_now_link( $links, $allowed_html ) {
$links['register'] = '<a href="https://www.thefixxsquad.stylefixxdaily.com/pricing/">' . __( 'Join Now', 'paid-memberships-pro' ) . '</a>';
return $links;
}
add_filter( 'pmpro_login_forms_handler_nav', 'my_pmpro_custom_join_now_link', 10, 2 );
@femiyb
femiyb / my_pmpro_change_text_example.php
Last active March 25, 2022 13:57 — forked from MaryOJob/my_pmpro_change_text_example.php
PMPro - Change "Discount Code" Text Example on Checkout Page
<?php // Do Not Copy This Line
/**
* This recipe will help you change text on the checkout paid in PMPro
* You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
// paste content from below this line
function pmproc_change_my_text( $translated_text, $text, $domain ) {
@femiyb
femiyb / gist:f527c23ce48e4d29bef69d61d2b69517
Created February 10, 2022 13:13 — forked from InpsydeNiklas/gist:8bf70de406a2ff8afef3aa7c2fcff7ac
List of available hooks for PayPal Payments smart buttons
woocommerce_paypal_payments_checkout_button_renderer_hook
woocommerce_paypal_payments_checkout_dcc_renderer_hook
woocommerce_paypal_payments_pay_order_dcc_renderer_hook
woocommerce_paypal_payments_proceed_to_checkout_button_renderer_hook
woocommerce_paypal_payments_mini_cart_button_renderer_hook
woocommerce_paypal_payments_single_product_renderer_hook
@femiyb
femiyb / add_state_country_to_account.php
Last active January 20, 2022 19:05
Add State and Country to Account Information
<?php
/**
* This recipe does Add State and Country to Account Information.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@femiyb
femiyb / my-pmpro-change-seat-to-student.php
Last active January 13, 2022 19:33 — forked from andrewlimaza/my-pmpro-change-seat-to-member.php
Change the word "Seat(s)" to "student(s)" for Paid Memberships Pro Sponsored Members Add On.
<?php
/**
* This will change all instances of seat(s) to student(s) for the Sponsored Members Add On - https://www.paidmembershipspro.com/add-ons/pmpro-sponsored-members/
* Add the code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_change_seat_to_student( $output_text, $input_text, $domain ) {
if ( 'pmpro-sponsored-members' === $domain ) {
$output_text = str_replace( 'seats', 'students', $output_text );
$output_text = str_replace( 'Seats', 'Students', $output_text );