Skip to content

Instantly share code, notes, and snippets.

View pippinsplugins's full-sized avatar

Pippin Williamson pippinsplugins

View GitHub Profile
<?php
function change_author_capabilities() {
$role = get_role( 'shop_vendor' ) ;
$role->add_cap( 'delete_products' );
}
add_action( 'admin_init', 'change_author_capabilities' );
@pippinsplugins
pippinsplugins / edd-slack-slash-command.php
Last active July 11, 2021 18:17 — forked from jameslaws/edd-slack-slash-command.php
A Slash command to retrieve earnings in Restrict Content Pro for the specified time period. Based on http://wpninjas.com/using-slack-slash-commands-to-get-edd-sales-info/
<?php
function pw_rcp_earnings_slash_command() {
# Check to make sure this is a Slash Command Request
if ( ! isset( $_REQUEST['slack_slash'] ) && 'your_custom_string' != $_REQUEST['slack_slash'] )
return false;
# Check to see if a token has been passed as well
if ( ! isset( $_REQUEST['token'] ) )
<?php
add_filter( 'mailchimp_sync_subscriber_data', function( MC4WP_MailChimp_Subscriber $subscriber, $user ) {
$affiliate = affiliate_wp()->affiliates->get_by( 'user_id', $user->ID );
if( ! empty( $affiliate ) ) {
$subscriber->merge_fields['MERGE6'] = $affiliate->affiliate_id;
}
return $subscriber;
}, 10, 2 );
@pippinsplugins
pippinsplugins / Warn when saving any EDD payment
Last active April 25, 2019 18:23 — forked from mintplugins/Warn when saving any EDD payment
Just a quick sample to demonstrate how you could approach asking "Are you sure" when saving a payment
function custom_prefix_warn_about_old_refunds_js() {
if ( ! isset( $_GET['prevent_accidental_refunds_js'] ) ) {
return false;
}
header('Content-Type: application/javascript');
?>