This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Add item to cart on visit | |
*/ | |
function add_product_to_cart() { | |
if ( ! is_admin() ) { | |
global $woocommerce; | |
$product_id = 64; | |
$found = false; | |
//check if product already in cart | |
if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_add_user_to_list_after_click_on_link ( $subscriber_id, $campaign_id, $target, $index ){ | |
$link = 'http://example.com'; | |
$list_id = 123; | |
$remove_from_old_lists = false; | |
if( $link == $target ){ | |
mailster('subscribers')->assign_lists($subscriber_id, $list_id, $remove_from_old_lists); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Via: http://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript | |
--> | |
<textarea class="js-copytextarea">Hello I'm some text</textarea> | |
<button class="js-textareacopybtn">Copy Text</button> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* This code goes into theme functions.php or a custom plugin | |
*/ | |
/** | |
* Add product to cart on page load | |
*/ | |
function add_product_to_cart() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Block Negative Balances | |
* Stop users from logging into your website if they have a negative | |
* myCRED balance. | |
* @version 1.0 | |
*/ | |
add_filter( 'authenticate', 'mycred_block_negative_balances', 990, 3 ); | |
function mycred_block_negative_balances( $user, $username, $password ) { | |
// Make sure myCRED is installed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Insert Comment Appreciation | |
* Lets insert the mycred_send shortcode after the comment | |
* text if a user can afford to use it (and is logged in. | |
* @version 1.0.1 | |
*/ | |
add_filter( 'comment_text', 'my_custom_comment_text', 10, 2 ); | |
function my_custom_comment_text( $comment_text, $comment = NULL ) { | |
// Make sure the current user is logged in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$info = affiliatewp_affiliate_info()->functions; | |
$name = $info->get_affiliate_name(); | |
$email = $info->get_affiliate_email(); | |
$website = $info->get_affiliate_website(); | |
$bio = $info->get_affiliate_bio(); | |
$gravatar = $info->get_affiliate_gravatar(); | |
$twitter = $info->get_twitter_username(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Additional Functions | |
// ============================================================================= | |
add_action( 'affwp_process_register_form', 'affwp_custom_process_register_form' ); | |
/* Auto enables the "Enable New Referral Notifications" checkbox on the "Settings" tab of the affiliate area when an affiliate is added. */ | |
function affwp_custom_auto_enable_affiliate_referral_notifications( $add ) { | |
update_user_meta( affwp_get_affiliate_user_id( $add ), 'affwp_referral_notifications', true ); | |
} | |
add_action( 'affwp_insert_affiliate', 'affwp_custom_auto_enable_affiliate_referral_notifications' ); | |
/** Adds a log out link to the top of the affiliate area */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!isset($_GET['ILoveMauticReallyIDo'])) { | |
echo 'The secret phrase is wrong.'; | |
die; | |
} | |
$link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; | |
$allowedTasks = array( | |
'cache:clear', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* add a custom tab to show user pages */ | |
add_filter('um_profile_tabs', 'pages_tab', 1000 ); | |
function pages_tab( $tabs ) { | |
$tabs['pages'] = array( | |
'name' => 'Pages', | |
'icon' => 'um-faicon-pencil', | |
'custom' => true | |
); | |
return $tabs; | |
} |