Skip to content

Instantly share code, notes, and snippets.

View indigetal's full-sized avatar

Brandon Meyer indigetal

  • The Collaborative Anthropology Network
  • NC
View GitHub Profile
@indigetal
indigetal / bb-recent-posts.json
Created February 20, 2025 18:06
(BB) Recent Post Block Pattern
{
"__file": "wp_block",
"title": "(BB) Recent Posts",
"content": "<!-- wp:greenshift-blocks/element {\"id\":\"gsbp-e27805b\",\"inlineCssStyles\":null,\"type\":\"inner\",\"localId\":\"gsbp-e27805b\",\"styleAttributes\":{\"paddingTop\":[\"1.25rem\"],\"backgroundColor\":[\"var(\\u002d\\u002dbb-content-background-color)\"],\"borderRadius\":[\"var(\\u002d\\u002dbb-block-radius)\"],\"borderWidth\":[\"1px\"],\"borderStyle\":[\"solid\"],\"borderColor\":[\"#f0f1f1\"],\"paddingBottom\":[\"1.5625rem\"],\"paddingRight\":[\"1.25rem\"],\"paddingLeft\":[\"1.25rem\"],\"borderTopLeftRadius\":[\"10px\"],\"borderRadiusLink_Extra\":true,\"borderBottomLeftRadius\":[\"10px\"],\"borderTopRightRadius\":[\"10px\"],\"borderBottomRightRadius\":[\"10px\"]},\"blockVisibility\":{\"query_by\":\"user\",\"user_logged_in\":true,\"user_roles\":[{\"label\":\"Administrator\",\"id\":\"administrator\",\"value\":\"administrator\"}]}} -->\n<div class=\"gsbp-e27805b\"><!-- wp:greenshift-blocks/element {\"id\":\"gsbp-fdfda2d\",\"inlineCssStyles\
@indigetal
indigetal / tutor-lms-course-grid.json
Last active January 13, 2025 15:56
GreenShift: Tutor LMS Course Grid Layout
{
"__file": "wp_block",
"title": "Tutor LMS Course Grid",
"content": "<!-- wp:html -->\n<style>\n/* Format course duration display */\n.course-duration {\n display: inline-flex;\n align-items: center;\n gap: 0.25em; /* Optional spacing between elements */\n}\n\n/* Add \"h\" after the hours span */\n.course-duration .gspb_meta_result_tags span:first-child::after {\n content: \"h\";\n margin-right: 0.25em;\n}\n\n/* Add \"m\" after the minutes span */\n.course-duration .gspb_meta_result_tags span:nth-child(2)::after {\n content: \"m\";\n}\n/* Hide the seconds span */\n.course-duration .gspb_meta_result_tags span:nth-child(3) {\n display: none;\n}\n\n/* Grey out the course price when it is on sale */\n.course-cost-container .tutor-course-price {\n color: inherit;\n text-decoration: none;\n}\n.course-cost-container .tutor-course-price + .tutor-sale-price,\n.course-cost-container .tutor-sale-price ~ .tutor-course-price {\n opacity: .5;\n font-weight: 400;\n text-decoration:
@indigetal
indigetal / job-listings.json
Last active December 3, 2024 00:15
Grid of Job Listings for WPJM with GreenShift
{
"__file": "wp_block",
"title": "job-listings",
"content": "<!-- wp:greenshift-blocks/querygrid {\"id\":\"gsbp-7e5a45e\",\"inlineCssStyles\":\".gspbgrid_id-gsbp-7e5a45e .wp-block-post-template {list-style:none;margin:0;padding:0} .gspbgrid_id-gsbp-7e5a45e .wp-block-post-template:before{display:none!important}.gspbgrid_id-gsbp-7e5a45e .wp-block-post-template \\u003e li {width:100%!important}.gspbgrid_id-gsbp-7e5a45e .gspb_ajax_pagination_btn{display:inline-block;cursor:pointer}.gspbgrid_id-gsbp-7e5a45e .wp-block-post-template \\u003e .gspbgrid_item:hover{box-shadow: 0 5px 23px 0 rgba(188, 207, 219, 0.35);}.gspbgrid_id-gsbp-7e5a45e .wp-block-post-template \\u003e .gspbgrid_item{overflow:hidden;}.gspbgrid_id-gsbp-7e5a45e .wp-block-post-template \\u003e .gspbgrid_item{border-top-left-radius:6px;border-top-right-radius:6px;border-bottom-right-radius:6px;border-bottom-left-radius:6px;}.gspbgrid_id-gsbp-7e5a45e .wp-block-post-template \\u003e .gspbgrid_item{border-style:solid;border-width:1px;border-color:#7
@indigetal
indigetal / content-blocks-controls.php
Last active February 14, 2024 17:13
Add filter's to Content Block's of the Blocksy Theme
<?php
/**
* This snippet allows custom filtering based on a content block's ID.
*
* To use, create a content-blocks-controls.php file in the child theme and add the followng line to the functions.php file:
* require_once get_stylesheet_directory() . '/content-blocks-controls.php';
*/
// Add a filter to modify the condition match for Blocksy Pro content blocks
add_filter(
@indigetal
indigetal / bp_subset.js
Last active November 14, 2023 19:43
Example node.js scripts to modify a SQL dump file imported from a WordPress single site and multisite installation to only retain the first 10 records from the wp_posts and wp_users tables
// Export BuddyPress-related tables for the first 10 users of the main site (subdirectory 1)
const exportMainSiteBPCommand = `
mysqldump -u ${dbConfig.user} -p${dbConfig.password} -h ${dbConfig.host} ${dbConfig.database} wp_1_bp_follow wp_1_bp_friends wp_1_bp_document wp_1_bp_document_folder wp_1_bp_document_folder_meta wp_1_bp_groups wp_1_bp_groups_groupmeta wp_1_bp_groups_membermeta wp_1_bp_groups_members wp_1_bp_invitations wp_1_bp_invitations_invitemeta wp_1_bp_messages_messages wp_1_bp_messages_meta wp_1_bp_messages_notices wp_1_bp_messages_recipients --where="user_id IN (SELECT ID FROM wp_1_users LIMIT 10)"
> db-export-main-site-bp.sql
`;
// Export BuddyPress-related tables for the first 10 users of the second site (subdirectory 2)
const exportSecondSiteBPCommand = `
mysqldump -u ${dbConfig.user} -p${dbConfig.password} -h ${dbConfig.host} ${dbConfig.database} wp_2_bp_follow wp_2_bp_friends wp_2_bp_document wp_2_bp_document_folder wp_2_bp_document_folder_meta wp_2_bp_groups wp_2_bp_groups_groupme
@indigetal
indigetal / add_custom_settings_tab.php
Last active August 12, 2023 17:50
Add a custom settings tab to the user account page in BuddyBoss. Place code in theme child's functions.php file
<?php
function my_custom_user_settings_tab() {
// create the Custom Tab in the settings navigation
bp_core_new_subnav_item(
array(
'name' => __( 'Custom Tab', 'buddyboss-theme' ), // Replace 'Custom Tab' with the name of your tab
'slug' => 'custom-tab', // Change this to your desired slug
'parent_url' => bp_loggedin_user_domain() . 'settings/',
'parent_slug' => 'settings',
'screen_function' => 'add_custom_user_settings_tab',
@indigetal
indigetal / pmpro-spacesengine.php
Last active May 14, 2024 00:32
WORK IN PROGRESS: Monetize SpacesEngine using Paid Memberships Pro and Selection of Addons. See link to accompanying tutorial in comments.
<?php
/*
Plugin Name: Paid Memberships Pro Integration with SpacesEngine for BuddyBoss
Plugin URI: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
Description: Integrate Paid Memberships Pro With SpacesEngine for BuddyBoss
Version: 0.2.6
Author: Brandon Meyer
Author URI: indigetal.com
*/
@indigetal
indigetal / my_pmpro_adjustable_level_cost_v1.3.php
Last active August 4, 2023 16:21
For Paid Memberships Pro - Adjusts the cost of a level at checkout based on the selection of a custom user field checkbox for upselling an additional option to a plan. Accounts for both recurring plans and adjust the fee based on if it's a monthly or an annual plan (fixes and expands on the code snippet at https://www.paidmembershipspro.com/mult…
<?php
function my_pmpro_adjustable_level_cost($level) {
$monthly_levels = array(1, 2); // specify monthly level IDs here
$annual_levels = array(3, 4); // specify annual level IDs here
$extra_fee = 0;
if (in_array($level->id, $monthly_levels)) {
$extra_fee = 10; //specify the cost of the selected option for monthly plans
}
@indigetal
indigetal / my_pmpro_adjustable_level_cost_v1.2.php
Last active August 4, 2023 16:20
For Paid Memberships Pro - Adjusts the cost of a level at checkout based on the selection of a custom user field checkbox for upselling an additional option to a plan and accounts for a recurring plan (fixes code snippet in https://www.paidmembershipspro.com/multiple-membership-levels-per-user-pmpro-workarounds/ )
<?php
function my_pmpro_adjustable_level_cost($level) {
$extra_fee = 0; // Default extra fee value
if(isset($_REQUEST['field_name'])) {
//specify the cost of the selected option
$extra_fee = 100;
// Check if the level has a recurring subscription
if (pmpro_isLevelRecurring($level)) {
@indigetal
indigetal / my_pmpro_adjustable_level_cost_v1.1.php
Last active August 9, 2023 15:31
The PMPro code snippet in https://www.paidmembershipspro.com/multiple-membership-levels-per-user-pmpro-workarounds/ does not work as-is. It is a very simple premise, only checking for one option. Recurring payments do not work the way it was originally written either. This does the same thing using a checkbox and only allowing for a one-time pay…
<?php
function my_pmpro_adjustable_level_cost($level)
{
if(isset($_REQUEST['field_name']))
{
$level->initial_payment = $level->initial_payment + 100; //specify the cost of the selected option
// You cannot update recurring payments with this code as-is, see comment below
}
return $level;