This file contains 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 | |
add_action( 'members_register_caps', 'cp_members_register_caps' ); | |
/** | |
* Register a custom capability in Members. | |
* | |
* @return void | |
*/ | |
function cp_members_register_caps() { | |
members_register_cap( 'capability_key', array( 'label' => 'Capability Label' ) ); |
This file contains 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 | |
add_filter( 'mepr-pre-run-rule-content', 'cp_maybe_show_content_last_chance', 10, 2 ); | |
/** | |
* Runs some checks on the post before applying the MemberPress rule. | |
* This allows for excluding posts from a rule based on any custom criteria. | |
* | |
* @param boolean $apply Whether to apply the rule | |
* @param object $post Post object | |
* |
This file contains 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 | |
add_filter( 'display_post_states', 'rv_add_post_states', 10, 2 ); | |
/** | |
* Displays post states (in the admin list table, next to the title) | |
* | |
* @param array $states Post display states | |
* @param object $post Current post | |
* | |
* @return array |
This file contains 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 | |
add_action( 'mepr-event-store', 'stop_recording_mp_logins' ); | |
/** | |
* Stop recording login events | |
* | |
* @param object $event Mepr_Event | |
* | |
* @return void | |
*/ |
This file contains 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 | |
add_shortcode( 'mp_membership_price', 'mp_memberpress_price_shortcode' ); | |
/** | |
* Displays a membership's price. | |
* | |
* Use: | |
* [mp_membership_price id="{membership_id}" display={price|terms}] | |
* id - ID of membership product | |
* display - What to display |
This file contains 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 | |
add_action( 'edd_customer_before_stats', 'edd_customer_switch_to_link' ); | |
/** | |
* Adds a "Switch To" link to EDD Customer Details page --> Profile tab. | |
* Requires User Switching plugin. | |
* | |
* @author Ren Ventura <renventura.com> | |
* | |
* @param object $customer EDD_Customer |
This file contains 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 | |
add_filter( 'mepr_fetch_options', 'mp_filter_custom_fields' ); | |
/** | |
* Filter the MemberPress options to set a dynamic value for custom fields. | |
* | |
* @param object $options MeprOptions | |
* | |
* @return object MeprOptions | |
*/ |
This file contains 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 | |
add_shortcode( 'optin_download', 'formsync_optin_download_shortcode' ); | |
/** | |
* Checks if a given email is registered/subscribed to a MailChimp list/audience | |
*/ | |
function formsync_optin_download_shortcode( $atts ) { | |
// Bail if email is not set as a query param | |
if ( ! isset( $_GET['email'] ) ) { |
This file contains 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 | |
add_action( 'init', 'formsync_register_ebooks_cpt' ); | |
/** | |
* Registers an "E-Books" custom post type | |
*/ | |
function formsync_register_ebooks_cpt() { | |
$labels = array( | |
'name' => 'eBooks', |