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 | |
| //copy lines 5 down into your theme's function.php or custom plugin. | |
| function my_sponsored_redirect( $redirect_to, $request, $user){ | |
| $user->membership_level = pmpro_getMembershipLevelForUser($user->ID); | |
| if(pmprosm_isSponsoredLevel($user->membership_level->ID)){ | |
| //redirect goes here |
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 | |
| //Copy lines 5 onwards into your PMPro custom plugin -> http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| function pmproc_redirect_member(){ | |
| if( is_user_logged_in() && function_exists('pmpro_hasMembershipLevel') && pmpro_hasMembershipLevel() ){ //check if user is logged in, pmpro is installed and user has an active level. | |
| global $current_user; | |
| $current_user->membership_level = pmpro_getMembershipLevelForUser($current_user->ID); //get current users level ID |
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 | |
| //copy lines 5 onwards into your active theme's function.php or custom plugin for code snippets. | |
| function my_logout_go_home(){ | |
| wp_redirect( home_url() ); | |
| exit(); | |
| } | |
| add_action( 'wp_logout', 'my_logout_go_home' ); |
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 | |
| //Copy line 5 down into your PMPRO Customizations plugin -> http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| function pmproc_my_login_non_member(){ | |
| if( !pmpro_hasMembershipLevel() ){ | |
| wp_redirect('http://SOMEURL'); //Change this to the homepage URL for non-members. | |
| exit; | |
| } | |
| } |
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 | |
| //Add lines 5 onwards to your PMPro Customizations plugin -> http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| function hide_discount_code_link( $show ){ | |
| $levels = array('1','2','3'); //membership level ID's | |
| $show = true; //show by default | |
| foreach($levels as $level){ |
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 some custom fields to Membership>Orders page | |
| */ | |
| function my_pmpro_orders_extra_cols_header($theusers) { | |
| ?> | |
| <th>Name</th> | |
| <?php | |
| } | |
| add_action('pmpro_orders_extra_cols_header', 'my_pmpro_orders_extra_cols_header'); | |
| function my_pmpro_orders_extra_cols_body($theuser) { |
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 | |
| //Copy the code below into your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| function add_my_report_dashboard(){ | |
| if( ! defined( 'PMPRO_DIR' ) || ! current_user_can( 'manage_options' ) ){ | |
| return; | |
| } | |
| wp_add_dashboard_widget( | |
| 'pmpro_membership_dashboard', // Widget slug. |
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 | |
| //paste the following into your PMPro Customizations plugin (http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/) or your active theme's functions.php | |
| function pmproc_add_my_message(){ | |
| _e( 'my custom text that will change.', 'pmpro'); | |
| } | |
| add_action( 'pmpro_checkout_before_submit_button', 'pmproc_add_my_message' ); |
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 decodeHtmlEntities(str) { | |
| console.log(str); | |
| var special = { | |
| "<" : "<", | |
| ">" : ">", | |
| """ : '"', | |
| "'" : "'", | |
| "'" : "'", | |
| "&" : "&", | |
| "\\" : "" |
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 | |
| //copy lines 5 onwards into your PMPro Customizations plugin -> http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| function edit_pmpro_level_title( $levels ){ | |
| foreach ( $levels as $level ) { | |
| if ( $level->id == 1 || $level->id == 2 || $level->id == 3 ) { | |
| $level->name = '<img src="some-image-url.png" alt-text="alt-text"/>' . $level->name; | |
| }elseif ( $level->id == 4 || $level->id == 5 || $level->id == 6 ) { |