Skip to content

Instantly share code, notes, and snippets.

View andrewlimaza's full-sized avatar

Andrew Lima andrewlimaza

View GitHub Profile
@andrewlimaza
andrewlimaza / pmpro-customizations.php
Created March 22, 2024 08:24 — forked from indigetal/pmpro-spacesengine.php
Monetize SpacesEngine using Paid Memberships Pro and Selection of Addons. See link to accompanying tutorial in comments.
<?php
/*
Plugin Name: PMPro SpacesEngine Integration
Plugin URI: https://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for integrating Paid Memberships Pro with SpacesEngine
Version: 1.0
Author: Brandon Meyer
Author URI: https://collabanthnetwork.org
*/
@andrewlimaza
andrewlimaza / echo-enqueued-styles-scripts-wordpress.php
Created March 8, 2024 07:19 — forked from omurphy27/echo-enqueued-styles-scripts-wordpress.php
Wordpress - Print Out All Enqueued Scripts And Styles On A Page
<?php
// add the below to your functions file
// then visit the page that you want to see
// the enqueued scripts and stylesheets for
function se_inspect_styles() {
global $wp_styles;
echo "<h2>Enqueued CSS Stylesheets</h2><ul>";
foreach( $wp_styles->queue as $handle ) :
echo "<li>" . $handle . "</li>";
@andrewlimaza
andrewlimaza / stop_users_from_logging_in_pmpro.php
Created November 23, 2022 14:04 — forked from kimwhite/stop_users_from_logging_in_pmpro.php
Stop users from logging in if they are not validated (PMPro Email Confirmation)
<?php
/**
* This function will stop any user's that aren't validated from logging into your WordPress website.
* This requires PMPro Email Confirmation - https://www.paidmembershipspro.com/add-ons/email-confirmation-add-on/
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Visit https://paidmembershipspro.com for further assistance.
*/
function pmpro_check_login( $user, $password ) {
@andrewlimaza
andrewlimaza / pmpro-australia-gst.php
Created September 26, 2022 14:32 — forked from ideadude/pmpro-australia-gst.php
Paid Memberships Pro - Australia GST
<?php
/*
Plugin Name: Paid Memberships Pro - Australia GST
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-australia-gst/
Description: Apply Australia GST to Checkouts with PMPro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*
@andrewlimaza
andrewlimaza / test_set_expiration_dates.php
Created August 24, 2022 15:00 — forked from ideadude/test_set_expiration_dates.php
Testing the pmprosed_fixDate() function of PMPro Set Expiration Dates
/**
* Testing the pmprosed_fixDate function.
* 1. Make sure PMPro and PMPro Set Expiration Dates is active.
* 2. Add this code to a custom plugin.
* 3. Visit ?test_date_functions=1 to a URL
* 4. Remember to remove the code when done.
*/
function test_set_expiration_dates() {
if( empty( $_REQUEST['test_date_functions'] ) ) {
return;
@andrewlimaza
andrewlimaza / my_pmpro_email_headers_admin_emails.php
Last active September 27, 2021 11:36 — forked from strangerstudios/my_pmpro_email_headers_admin_emails.php
BCC an additional email on PMPro admin checkout emails only.
/*
Add bcc for PMPro admin emails
*/
function my_pmpro_email_headers_admin_emails($headers, $email) {
//bcc emails already going to admin_email
if(strpos($email->template, "_admin") !== false && strpos($email->template, "checkout") !== false)
{
//add bcc
$headers[] = "Bcc:" . "otheremail@domain.com";
}
@andrewlimaza
andrewlimaza / my_template_redirect_require_membership_access.php
Last active September 8, 2021 07:49 — forked from kimcoleman/my_template_redirect_require_membership_access.php
Redirects members-only content to the Membership Levels page if a user is logged out or not a member.
<?php
/*
* Redirects members-only content to the Membership Levels page if a user is logged out or not a member.
*/
function my_template_redirect_require_membership_access() {
if ( function_exists( 'pmpro_has_membership_access' ) && ( ! pmpro_has_membership_access() || pmpro_hasMembershipLevel( array( '1' ) ) ) ) {
wp_redirect( pmpro_url( 'levels' ) );
exit;
}
@andrewlimaza
andrewlimaza / checkout_levels_api_demo.php
Created August 16, 2021 08:00 — forked from dparker1005/checkout_levels_api_demo.php
2 demos to demonstrate the PMPro checkout_levels API call.
<?php
// Copy from below here...
/*
* Add widget to checkout to get result of checkout_levels API call when button is pressed.
*/
function my_pmpro_test_checkout_levels_api() {
?>
<hr/>
@andrewlimaza
andrewlimaza / pmpro-customizations.php
Last active July 28, 2021 10:52 — forked from strangerstudios/pmpro-customizations.php
Tax solution for British Columbia, Canada to be used with Paid Memberships Pro
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for PMPro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*
@andrewlimaza
andrewlimaza / open_new_posts_to_non_members.php
Created July 15, 2021 08:43 — forked from strangerstudios/open_new_posts_to_non_members.php
PMPro Customizations to allow non-members to view restricted posts if they are less than 30 days old.
/*
Allow non-members to view restricted posts if they are less than 30 days old.
Add this code to a custom plugin.
Change the '-30 Days' below if you'd like to allow access for longer or shorter.
*/
function open_new_posts_to_non_members($hasaccess, $thepost, $theuser, $post_membership_levels)
{
global $wpdb;