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 / 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 / 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: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>
@digitalchild
digitalchild / hijackmenu.php
Created October 24, 2014 11:25
Hijack Wordpress menu to insert shop link
<?php
// Hijack menu to insert vendor shop link.
add_filter('wp_nav_menu_items', 'vendor_shop_link', 10, 2);
function vendor_shop_link($items, $args) {
$wcv_settings = get_option('wc_prd_vendor_options');
$wcv_perm = $wcv_settings['vendor_shop_permalink'];
@digitalchild
digitalchild / gist:35d4a33509c2c4dcd9ee
Created December 18, 2014 14:33
WC Vendors - Vendor Shop Name as Full Name
/**
* Format WordPress User's "Display Name" to Full Name on Login
* ------------------------------------------------------------------------------
*/
add_action( 'wp_login', 'wpse_9326315_format_user_display_name_on_login' );
function wpse_9326315_format_user_display_name_on_login( $username ) {
$user = get_user_by( 'login', $username );
@digitalchild
digitalchild / gist:327630fd1c92c2be3a2e
Created January 21, 2015 06:00
Disable WordPress admin bar
<?php
/**
* Place this in your functions.php
*/
if ( is_user_logged_in() ) {
add_filter('show_admin_bar', '__return_false');
}
?>