Skip to content

Instantly share code, notes, and snippets.

View dancameron's full-sized avatar
💭
🍻Cheersing

Dan Cameron dancameron

💭
🍻Cheersing
View GitHub Profile
@dancameron
dancameron / functions.php
Created November 15, 2019 18:38
Get all Dashboard Links
<?php // don't include this line in your functions.php, since it already starts with it.
remove_action( 'pre_si_invoice_view', array( 'SI_Payment_Terms_Fees', 'show_message_about_term_due' ), 20, 1 );
function _si_get_user_dashboard_links() {
if ( class_exists( 'SI_Client_Dashboard' ) ) {
$args = apply_filters( 'si_get_users_for_association_args', array( 'fields' => array( 'ID', 'user_email', 'display_name' ) ) );
$users = get_users( $args );
@dancameron
dancameron / functions.php
Created November 12, 2019 17:10
Remove Payment Terms Header Messages
<?php // don't include this line in your functions.php, since it already starts with it.
remove_action( 'pre_si_invoice_view', array( 'SI_Payment_Terms_Fees', 'show_message_about_term_due' ), 20, 1 );
@dancameron
dancameron / functions.php
Created November 12, 2019 17:03
Don't Show Payment Term Fee Labels if Zero
<?php // don't include this line in your functions.php, since it already starts with it.
function si_change_doc_fees_labels( $fees, $doc ) {
foreach ( $fees as $key => $fee ) {
$fees[ $key ]['always_show'] = 0;
}
return $fees;
}
add_filter( 'si_doc_fees', 'si_change_doc_fees_labels', 100, 2 );
@dancameron
dancameron / functions.php
Created November 4, 2019 16:07
Change Default Estimate Expiration Date
<?php // don't include this line in your functions.php, since it already starts with it.
function _change_si_default_expiration_for_estimates( $days = 30 ) {
return 120; // change to the number of days for new expiration
}
add_filter( 'si_default_expiration_in_days', '_change_si_default_expiration_for_estimates' );
@dancameron
dancameron / functions.php
Created October 24, 2019 21:48
Use Different Status to Mark Payment Complete
<?php // don't include this line in your functions.php, since it already starts with it.
function _use_processing_payment_status( $status = '' ) {
return 'processing';
}
add_filter( 'si_woo_payment_status_for_completion', '_use_processing_payment_status' );
@dancameron
dancameron / functions.php
Created October 17, 2019 15:29
Default Line Items
<?php // don't include this line in your functions.php, since it already starts with it.
function set_line_item_defaults( $columns = array(), $type ) {
if ( 'service' !== $type ) {
return $columns;
}
$columns['desc']['value'] = 'This is the default text';
$columns['rate']['value'] = 125;
@dancameron
dancameron / functions.php
Created October 16, 2019 17:58
Set Default Line Item based on PreDefined Line Item
<?php // don't add this line since it's already in your functions.php file
function si_lineitem_default_on_pdli( $columns = array(), $type ) {
if ( '' != $type || 'default' != $type ) {
return $columns;
}
$columns['desc']['value'] = $item->get_content();
$columns['rate']['value'] = $item->get_default_rate();
@dancameron
dancameron / functions.php
Last active October 16, 2019 17:59
Set default values for line items
<?php // don't add this line since it's already in your functions.php file
function si_rate_default( $columns = array(), $type ) {
if ( '' != $type || 'default' != $type ) {
return $columns;
}
$columns['rate']['value'] = 125;
$columns['qty']['value'] = 1;
@dancameron
dancameron / functions.php
Created October 8, 2019 17:51
Modifying Column Titles
<?php // don't include this line in your functions.php, since it already starts with it.
function si_convert_perc_to_discount_column_label( $columns = array() ) {
if ( is_admin() ) {
return $columns;
}
$columns['rate']['label'] = 'Fee';
$columns['tax']['label'] = 'VAT';
$columns['total']['label'] = 'Total';
@dancameron
dancameron / functions.php
Last active October 8, 2019 17:39
Disable Notification Preview
<?php // don't include this line in your functions.php, since it already starts with it.
remove_action( 'admin_init', array( 'SI_Notifications_Control', 'return_notification_html' ) );