Skip to content

Instantly share code, notes, and snippets.

View digitalchild's full-sized avatar

Jamie Madden digitalchild

View GitHub Profile
### Keybase proof
I hereby claim:
* I am digitalchild on github.
* I am digitalchild (https://keybase.io/digitalchild) on keybase.
* I have a public key whose fingerprint is CB38 6F3C 4BB3 09EF F3B4 D65E 6C71 8445 A94D 14BC
To claim this, I am signing this object:
@digitalchild
digitalchild / gist:3ae1539f5ee8fb69711f
Last active December 11, 2022 07:22
Product Vendor Recent Products
/*
The following code will create a pv_recent_products short code that is a duplicate of the internal woocommerce
shortcode for recent products (See : http://docs.woothemes.com/document/woocommerce-shortcodes/) but provides a
new attribute 'login'. This will filter the results by author allowing you to have recent products per vendor.
Please Note: This code relies on a 3rd party plugin from Matt Gates. (http://shop.mgates.me/shop/wc-marketing/wc-product-vendor/)
Usage: [pv_recent_products per_page="5" login="usernicename" ]
All attributes are documentent on the woocommerce docs page above.
@digitalchild
digitalchild / Jplayeraction
Last active August 29, 2015 14:03
JPlayer code to store via WPUF
function jplayer_custom_field ( $post_id ) {
$title = $_POST['jplayer_title'];
# get the files media id
$file_id = get_post_meta( $post_id, 'jplayer_file', true );
# create the path for upload
$file_path = wp_get_attachment_url( $file_id ) ;
$jplayer_data[] = array( 'title' => $title, 'path' => $file_path );
@digitalchild
digitalchild / Vendor Store Notify
Last active August 29, 2015 14:04
Notify Vendors if They Haven't Configured Their Stores
$author_id = get_current_user_id();
$shop_name_set = PV_Vendors::get_vendor_shop_name( $author_id );
$vendor_login = get_userdata($author_id);
if ($shop_name_set == $vendor_login->user_login) {
// Only choose one of the following lines depending on what theme you have.
// Use the following line if you have a WooThemes theme.
echo do_shortcode( '[box type="alert"]<strong><h3>You havent configured your store name!</h3><p>More message text here.<br><br><a href="'.$settings_page.'">Click here to set your store name</a></p>.[/box]' );
// Use this line for any other theme
echo '<h3>You havent configured your store name!</h3><p>More message text here.<br><br><a href="'.$settings_page.'">Click here to set your store name</a>.</p>';
@digitalchild
digitalchild / krb5.cnf
Created August 4, 2014 04:29
Samba 4 KRB5.CNF
[libdefaults]
default_realm = MYDOMAIN.COM.AU
dns_lookup_realm = false
dns_lookup_kdc = true
@digitalchild
digitalchild / paypal_ap.php
Last active December 11, 2022 08:26
[WC Vendors] Paypal Adaptive Payments - Chained
<?php
if ( !class_exists( 'WC_Payment_Gateway' ) ) return false;
/**
* Add the gateway to WooCommerce
*
* @access public
* @param array $methods
* @return array
@digitalchild
digitalchild / gist:a174794637203c85b94f
Created October 13, 2014 05:34
Force vendor to accept new terms
<?php
add_action('wp_login','check_terms_accepted');
//check if user has accepted the terms when logging in
function check_terms_accepted($login) {
$user = get_user_by('login', $login);
$terms_accepted = get_user_meta( $user->ID, 'new_terms');
@digitalchild
digitalchild / gist:02c0730deebb3e3fca68
Created October 16, 2014 23:33
Using BuddyPress Message system in other parts of your WC Vendors Site
<?php
/* Buddypress Private Messaging Mod */
/*
Usage :
Put this in your templates to create a message link you can then style
templates this could go in :
* description.php (put the message link in the end of the description)
@digitalchild
digitalchild / gist:5ff5bf34571a4adef995
Last active October 18, 2016 22:58
Add a WC Vendors Tab to the Buddy Press profile
<?php
// This snippet will add an extra tab to the buddy press user profile that can call any shortcode defined in WC Vendors.
// This code should be inserted into your bp-custom.php file.
function my_bp_nav_adder() {
if (class_exists('WC_Vendors')) {
$wcv_profile_id = bp_displayed_user_id();
$wcv_profile_info = get_userdata( bp_displayed_user_id() );
@digitalchild
digitalchild / gist:2d326756686793d6f0e9
Created October 20, 2014 23:57
Replacement orders.php until next update
<?php
global $woocommerce; ?>
<?php if ( function_exists( 'wc_print_notices' ) ) { wc_print_notices(); } ?>
<h2><?php printf( 'Orders for %s', get_product( $product_id )->get_title() ); ?></h2>
<table class="table table-striped table-bordered">
<thead>