Skip to content

Instantly share code, notes, and snippets.

@BronsonQuick
BronsonQuick / populate_gravity_forms_pre_submission.php
Created May 30, 2012 06:39
Populate a hidden field in Gravity Forms before submission
<?php
/* gform_pre_submission will do all forms. gform_pre_submission_1 will do a form with an ID of 1
* Keep an eye on the priority of the filter. In this case I used 9 because the Salesforce plugin we used ran a presubmission filter at 10 so we needed this to happen before it
*/
add_filter( "gform_pre_submission_1", "add_salesforce_campaign_id_footer", 9 );
function add_salesforce_campaign_id_footer( $form ){
foreach($form["fields"] as &$field)
if($field["id"] == 2){
/* Set the variable you want here - in some cases you might need a switch based on the page ID.
* $page_id = get_the_ID();
@codearachnid
codearachnid / woocommerce_update_stock_status.php
Created July 7, 2013 14:11
set the stock status for all products in your WooCommerce store
<?php
/**
* set the stock status for all products in your WooCommerce store
* @return void
*/
function woocommerce_update_stock_status(){
global $wpdb;
// set all status for products with 0 or less stocked quantity
@meghuizen
meghuizen / sysctl-gigabit.txt
Created July 26, 2013 09:33
Linux gigabit tuning
##
## Please make sure to change this according to your own needs/configuration
## Some values won't be helpful for some configurations (like routers or firewalls)
## If you have a normal server, these settings should work fine
##
## Tested on Dell PowerEdge/PowerVault servers with gigabit, iSCSI, multipathing with Citrix XenServer clients
## Large performance improvement on the default settings!
##
## Carefull selected values!
##
$(".data").mask("AB/CD/0000", {
translation:{
A: {pattern: /[0-3]/},
B: {pattern: /[0-9]/},
C: {pattern: /[0-1]/},
D: {pattern: /[0-9]/},
},
onKeyPress: function(a, b, c, d) {
if (!a) return;
var m = a.match(/(\d{2})/g);
@gevans
gevans / README.md
Last active August 29, 2015 13:57
Patches to add --no-client-reconnect CLI option to bfgminer 3.10.0, cgminer 3.7.2, and sgminer 4.1.153

These patches add a new CLI option: --no-client-reconnect. The changes are adapted from Kalroth's cgminer fork to be compatible with BFGMiner, CGMiner, and SGMiner. This solves a few reported security issues.

Usage

Patches can be applied to the source in a number of ways...

BFGMiner

# In a git clone:
@woogist
woogist / product-documents-logged-in-users.php
Last active August 22, 2017 16:32
Show Product Documents to Logged In Users Only - add everything after the <?php tag to the bottom of your theme's functions.php file.
<?php
add_filter( 'wc_product_documents_get_sections', 'show_documents_only_for_logged_in_users', 10, 3 );
/**
* Don't return document sections unless there is a logged in user.
*
* @param array $sections array of sections
* @param WC_Product_Documents_Collection $collection the collection object
* @param boolean $include_empty whether to include empty sections in the result
@mohammadmursaleen
mohammadmursaleen / gist:9622098e43afdab6025e
Last active October 15, 2021 18:29
Adding custom fields above WOOCOMMERCE add to cart button
<?php
// To add custom data above add to cart button in woocommerce
// step 1
add_action('wp_ajax_wdm_add_user_custom_data_options', 'wdm_add_user_custom_data_options_callback');
add_action('wp_ajax_nopriv_wdm_add_user_custom_data_options', 'wdm_add_user_custom_data_options_callback');
function wdm_add_user_custom_data_options_callback()
@ultimatemember
ultimatemember / gist:f7eab149cb33df735b08
Last active May 30, 2024 18:03
Extend Ultimate Member Account page with custom tabs/content
/* add new tab called "mytab" */
add_filter('um_account_page_default_tabs_hook', 'my_custom_tab_in_um', 100 );
function my_custom_tab_in_um( $tabs ) {
$tabs[800]['mytab']['icon'] = 'um-faicon-pencil';
$tabs[800]['mytab']['title'] = 'My Custom Tab';
$tabs[800]['mytab']['custom'] = true;
return $tabs;
}
@pryley
pryley / UltimateMembersMods
Created May 4, 2015 22:45
This Wordpress plugin adds custom features and modifications to the Ultimate Member plugin family.
<?php
/**
* Plugin Name: Ultimate Member Modifications
* Plugin URI: http://geminilabs.io
* Description: This plugin adds custom features and modifications to the Ultimate Member plugin family.
* Version: 1.0.0
* Author: Gemini Labs
* Author URI: http://geminilabs.io
* License: MIT License
*/
@kittenlane
kittenlane / 1-remove-woocommerce-tabs.php
Last active October 5, 2024 14:18
Remove tabs but keep product description in WooCommerce
//* http://gasolicious.com/remove-tabs-keep-product-description-woocommerce/
// Location: add to functions.php
// Output: removes woocommerce tabs
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );