Skip to content

Instantly share code, notes, and snippets.

View codelion7's full-sized avatar

Christian Freeman codelion7

  • Team Extreme
  • United States
View GitHub Profile
@codelion7
codelion7 / course_list_template
Created January 7, 2016 23:46
LearnDash Course Grid Update
<?php
/**
* @package nmbs
*/
$col = empty($shortcode_atts["col"])? 3:intval($shortcode_atts["col"]);
$smcol = $col/1.5;
$col = empty($col)? 1:($col >= 12)? 12:$col;
$smcol = empty($smcol)? 1:($smcol >= 12)? 12:$smcol;
$col = intVal(12/$col);
$smcol = intVal(12/$smcol);
@codelion7
codelion7 / mycred-users-rank-progress-shortcode
Last active September 19, 2016 11:52
myCRED Custom Shortcode: Rank Progress
<?php
// Get user's rank progress
function get_mycred_users_rank_progress( $user_id, $show_rank ) {
global $wpdb;
if ( ! function_exists( 'mycred' ) ) return '';
// Change rank data to displayed user when on a user's profile
if ( function_exists( 'bp_is_user' ) && bp_is_user() && empty( $user_id ) ) {
@codelion7
codelion7 / mlm-remove-upline-data.php
Last active January 18, 2017 20:44
Removes Specific MLM Affiliate Data from the Sub Affiliates Tooltip (Upline Only)
// Run if AffiliateWP MLM is Active
if ( class_exists( 'AffiliateWP_Multi_Level_Marketing' ) ) {
/**
* Removes Specific MLM Affiliate Data from the Sub Affiliates Tooltip (Upline Only)
*
* @since 1.1.1
* @return array
*/
function affwp_mlm_remove_upline_aff_data( $aff_data = array(), $affiliate_id = 0 ) {
@codelion7
codelion7 / affwp-remove-url-field.php
Created January 18, 2017 21:40
Removes the Website URL field from the list of required affiliate registration form fields
// Run if AffiliateWP is active
if ( class_exists( 'Affiliate_WP' ) ) {
/**
* Removes the Website URL field from the list of required affiliate registration form fields
*
* @return array
*/
function affwp_remove_url_field( $required_fields = array() ) {
@codelion7
codelion7 / filters.php
Created May 8, 2017 23:56
Add Custom Driver Status Column to Affiliates Export CSV
<?php
/**
* Add Driver Status column to the exported affiliates CSV file
*
* @since 1.0
*/
function affwp_mobbyd_export_affiliates_csv_cols( $cols ) {
$cols['driver_status'] = 'Driver Status';
@codelion7
codelion7 / mycred-hook-learndash
Created November 24, 2014 13:10
myCRED Custom Hook: LearnDash
/**
* Register Custom myCRED Hook
* @since 1.0
* @version 1.0
*/
add_filter( 'mycred_setup_hooks', 'Learndash_myCRED_Hook' );
function Learndash_myCRED_Hook( $installed ) {
$installed['hook_learndash'] = array(
'title' => __( 'LearnDash', 'mycred' ),
@codelion7
codelion7 / mlm-remove-downline-data.php
Created August 23, 2017 15:44
Removes Specific MLM Affiliate Data from the Sub Affiliates Tooltip (Downline Only)
// Run if AffiliateWP MLM is Active
if ( class_exists( 'AffiliateWP_Multi_Level_Marketing' ) ) {
/**
* Removes Specific MLM Affiliate Data from the Sub Affiliates Tooltip (Downline Only)
*
* @since 1.1.1
* @return array
*/
function affwp_mlm_remove_downline_aff_data( $aff_data = array(), $affiliate_id = 0 ) {
@codelion7
codelion7 / non-parent-rate.php
Last active October 17, 2017 09:08
AffiliateWP MLM - Apply a 30% Direct Commission Rate for Affiliates without Sub Affiliates
/**
* Apply a 30% direct commission rate for affiliates without Sub Affiliates
*/
function affwp_mlm_get_non_parent_rate( $rate, $affiliate_id, $type, $reference ) {
// If a per-affiliate rate is set, use that
if ( affiliate_wp()->affiliates->get_column( 'rate', $affiliate_id ) ) {
return $rate;
}
@codelion7
codelion7 / vendor_can_add_product.php
Created October 18, 2017 16:48
Add a filter to the product limit
/**
* Allowed WooCommerce Post Types
*
* @return bool
* @since 1.2.0
* @author Andrea Grillo <andrea.grillo@yithemes.com>
*/
public function vendor_can_add_products( $vendor, $post_type ){
$enable_amount = 'yes' == get_option( 'yith_wpv_enable_product_amount' ) ? true : false;
if( $enable_amount && 'product' == $post_type ){