Skip to content

Instantly share code, notes, and snippets.

View scottopolis's full-sized avatar

Scott Bolinger scottopolis

View GitHub Profile
@scottopolis
scottopolis / holler-box-custom-form.php
Last active October 15, 2020 16:48
Holler Box Custom Form
<?php
// add this code to a plugin or theme functions.php
add_action('hwp_email_form', function() {
?>
<!-- put your custom form code here -->
<?php
}
@scottopolis
scottopolis / replace-image-source.css
Created September 16, 2020 18:23
Replace image source with CSS
/* Works even if the image has no class or id */
img[src="https://mysite.com/my-image.jpg"] {
content:url("https://mysite.com/my-image-2.jpg");
}
@scottopolis
scottopolis / appcommunity-activity-type-filter.php
Created September 9, 2020 18:07
AppCommunity Activity Type Filter
<?php
// this code needs to go in a plugin
add_filter('bp_rest_activity_get_items_query_args', function( $args, $request ) {
// you can change the default value of activity type
$args['filter']['action'] = array('new_blog_post', 'activity_update');
return $args;
}, 10, 2 );
@scottopolis
scottopolis / drop-tables.txt
Created September 8, 2020 17:50
SQL - drop tables based on partial table name
Using the below as a SQL statement prints out a statement that will drop each table one by one. Copy and paste the statement it prints to drop the tables.
SELECT CONCAT('DROP TABLE ', TABLE_SCHEMA, '.', TABLE_NAME, ';') AS stmt FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE '%_rg_%' AND TABLE_SCHEMA = 'db_yourdbname' LIMIT 400
@scottopolis
scottopolis / apppresser-filter-login-data.php
Last active August 25, 2020 19:09
Filter AppPresser login data
<?php
// when a user logs in, get WordPress data that can be used in the app, for example a membership level
// put this code in a custom plugin
add_filter( 'appp_login_data', 'apppresser_filter_login_data', 10, 2 );
function apppresser_filter_login_data( $login_data, $user_id ) {
$member_subscription = rcp_get_subscription_id( $user_id );
if( $member_subscription ) {
@scottopolis
scottopolis / apppresser-iap-pmp.php
Last active December 10, 2023 16:11
AppPresser In App Purchase integration for Paid Memberships Pro
<?php
/*
Plugin Name: AppPresser In App Purchases for Paid Memberships Pro
Plugin URI: https://apppresser.com
Description: This plugin listens for in app purchases or cancellations and adds/removes members from a membership level.
Version: 2.0.0
Author: Scott Bolinger
Author URI: https://apppresser.com
License: GPLv2
*/
@scottopolis
scottopolis / apppresser-featured-images.php
Created June 22, 2020 17:26
AppPresser add Featured Images to Post Detail View
@scottopolis
scottopolis / iap-learndash-2020.php
Last active May 30, 2020 15:34
LearnDash In App Purchases plugin for AppPresser
<?php
/*
Plugin Name: AppPresser In App Purchases for LearnDash
Plugin URI: https://apppresser.com
Description: This plugin listens for in app purchases or cancellations and adds/removes members from a LearnDash course.
Version: 1.0.0
Author: Scott Bolinger
Author URI: https://apppresser.com
License: GPLv2
*/
@scottopolis
scottopolis / zip-clean-alias.sh
Last active May 28, 2020 20:27
ZSH alias to zip current folder, remove git and DS Store files, and show in finder
# put this in your .zshrc file, change path to store zip, restart terminal
# run command `releasezip my-files-1.0`, which would create a zip at ../my-files-1.0.zip
# change output path (../) to whatever you want, for example Users/Me/Plugins/Releases/$1.zip
releasezip() {
zip -r ../$1.zip . -x '*.git*' --exclude=\*.DS_Store\*
open ../
}
@scottopolis
scottopolis / ap4-iap-page.html
Created May 22, 2020 15:17
AppPresser 4 In App Purchase Form
<div class="ion-padding">
<h2>Purchase</h2>
<p>For $9 per month, get access to analysis and commentary. Your subscription will automatically renew, cancel any time.</p>
<p>Enter your information below and click subscribe. By subscribing, you agree to the <a href="https://mysite.com/terms/" target="_blank" rel="noopener noreferrer">terms of service.</a></p>
<p>If you already have an account, please login. If you do not have an account, enter your email before clicking purchase, and one will be created for you.</p>
<in-app-purchase isSubscription="true" productId="my-product"></in-app-purchase>