Skip to content

Instantly share code, notes, and snippets.

View goatboy91587's full-sized avatar

Brett Widmann goatboy91587

View GitHub Profile
@goatboy91587
goatboy91587 / add-cap-functions.php
Created June 9, 2019 21:20
Adding Capabilities to Roles in WordPress via Hook
// Make private posts and pages available to subscribers
function subs_read_private_content(){
$subRole = get_role( 'subscriber' );
$subRole->add_cap( 'read_private_posts' );
$subRole->add_cap( 'read_private_pages' );
}
add_action( 'init', 'subs_read_private_content' );
@goatboy91587
goatboy91587 / role-extender.php
Last active June 10, 2019 04:13
Extending Roles via Plugin
<?php
/**
* Plugin Name: Allow Subscribers to Read Private Content
* Plugin URI: https://brettwidmann.com
* Description: A plugin that allows subscribers to read private posts and pages
* Version: 1.0
* Author: Brett Widmann
* Author URI: https://brettwidmann.com
*/
@goatboy91587
goatboy91587 / gravity-form-header-goldmine.php
Created March 30, 2023 12:36
Add Header to Gravity Forms Notification Email for GoldMine CRM and WebImporting
//Add email header to Gravity Forms notification email for GoldMine WebImporting
//This adds to all notification emails. Use logic for specific forms via form ID
add_filter( 'gform_pre_send_email', function( $email ) {
$email['headers']['Content-type'] = 'Content-Type: text/x-gm-impdata';
return $email;
} );