Skip to content

Instantly share code, notes, and snippets.

@jcasabona
jcasabona / wc-membership-learndash.php
Created April 28, 2020 14:22
Update LearnDash Groups based on WooCommerce Membership
<?php
// Update group status when member status changes.
function cc_update_ld_group_from_member_status( $user_membership, $old_status, $new_status ) {
$ld_group_id = LEARNDASH_GROUP_ID;
$user_id = $user_membership->get_user_id();
$wp_user = get_userdata( $user_id );
if ( wc_memberships_is_user_active_member( $user_id, $user_membership->get_plan_id() ) ) {
ld_update_group_access( $user_id, $ld_group_id, false );
@verygoodplugins
verygoodplugins / wpf-learndash-require-enrolled.php
Created April 21, 2020 08:11
Modifies WP Fusion's course access permissions for LearnDash so users must be enrolled in the course to see the course page
<?php
// Check course access
function check_ld_access( $can_access, $user_id, $post_id ) {
if ( ! function_exists( 'sfwd_lms_has_access' ) ) {
return $can_access;
}
@yanknudtskov
yanknudtskov / functions.php
Last active May 13, 2020 03:17
WooCommerce Subscriptions and LearnDash, based on the work of https://thomaslecoz.com/learndash-with-woocommerce-subscriptions/#code-update
<?php
add_action('cancelled_subscription', 'remove_course_access', 10, 2);
add_action('subscription_put_on-hold', 'remove_course_access', 10, 2);
add_action('subscription_expired', 'remove_course_access', 10, 2);
add_action('activated_subscription', 'give_course_access', 10, 2);
function send_receipt($order_id){
//if($new_status == 'processing' && $status != 'completed' || $new_status == 'completed' && $status == 'processing'){
if($status != 'processing' && $status != 'completed') {
@tatianamac
tatianamac / tatiana-mac-speaker-rider.md
Last active March 24, 2024 12:22
Tatiana Mac's Speaker Rider

Speaker Rider

by Tatiana Mac

Last updated 14 April 2021

What is a speaker rider?

As speaking comes with immense privilege, I have crafted a speaker rider to set expectations and boundaries around my engagement. I am grateful to all the conference organisers who have brilliantly hosted me. I would love to continue to exercise this privilege to speak at conferences, and use this privilege to make the landscape more accessible and beneficial to tech's most historically excluded and marginalised communities.

Considerations

😫 I provide a lot of explanations for those of you who never had to consider these things. Most thoughtful conferences I've attended check most of these boxes intrinsically, particularly when conference runners are experienced speakers. They get it.

@mgibbs189
mgibbs189 / test.js
Created July 31, 2018 17:21
Redirect when a facet is interacted with
<script>
(function($) {
$(document).on('facetwp-refresh', function() {
if (FWP.loaded && '' == FWP_HTTP.uri) { // if not the initial pageload, and we're on the homepage
window.location.href = '/listings/?' + FWP.build_query_string(); // redirect
}
});
})(jQuery);
@leepettijohn
leepettijohn / functions.php
Last active July 28, 2020 09:24
Gravity Forms - Dynamic Dropdown, Radio Button, Multi Select
<?php
/*-----------------------------------------------------------------------------------*/
/* Putting Locations in a Dropdown, Radio Button, or Multi-Select */
/* Helpful article - https://www.gravityhelp.com/documentation/article/dynamically-populating-drop-down-fields/ */
/*-----------------------------------------------------------------------------------*/
$location_form_id = 9;
add_filter( 'gform_pre_render_'.$location_form_id, 'populate_posts' );
add_filter( 'gform_pre_validation_'.$location_form_id, 'populate_posts' );
add_filter( 'gform_pre_submission_'.$location_form_id, 'populate_posts' );
add_filter( 'gform_pre_submission_filter_'.$location_form_id, 'populate_posts' );
@neilgee
neilgee / acf-js.js
Last active September 5, 2022 13:52
ACF Google Map - Get Directions Link
(function($) {
/*
* new_map
*
* This function will render a Google Map onto the selected jQuery element
*
* @type function
* @date 8/11/2013
* @since 4.3.0
@spivurno
spivurno / gw-gravity-forms-advanced-conditional-shortcodes.php
Last active October 21, 2020 17:51
Gravity Wiz // Gravity Forms // Advanced Conditional Shortcodes
<?php
/**
* Gravity Wiz // Gravity Forms // Advanced Conditional Shortcodes
*
* [gravityforms action="conditional" relation="any"
value="{:2}" operator="is" compare="First Choice"
value2="{:1}" operator2="isnot" compare2="Second Choice"]
Content you would like to conditionally display.
[/gravityforms]
*
@alenabdula
alenabdula / GravityForm-Dynamic-Selects.php
Created December 22, 2015 18:47
Gravity form dynamically populate select drop down with taxonomy terms
<?php
/**
* --------------------------------------------------
* Gravity Form dynamically populate drop-down
* select for Questions form ID 15
* 'gform_pre_render_14' - _14 represents form ID to filter
* --------------------------------------------------
*/
add_filter( 'gform_pre_render_14', 'pre_populate_gravity_select_for_MY_TAX' );
add_filter( 'gform_pre_validation_14', 'pre_populate_gravity_select_for_MY_TAX' );
@mgibbs189
mgibbs189 / 01_Query_Arguments.php
Last active August 27, 2023 10:11
FacetWP - show both a Google Map and a result listings
<?php
return array(
"post_type" => "park",
"post_status" => "publish",
"posts_per_page" => 100
);