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 | |
/* | |
Plugin Name: PMPro Fields | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-fields/ | |
Description: Register Helper Initialization Example | |
Version: .1 | |
Author: Stranger Studios | |
Author URI: http://www.strangerstudios.com | |
*/ | |
/* |
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 | |
/* | |
If checking out for ANY level with an expiration, add remaining days to the enddate. | |
Pulled in from: https://gist.github.com/3678054 | |
*/ | |
function my_pmpro_checkout_level_extend_memberships($level) | |
{ | |
global $pmpro_msg, $pmpro_msgt, $current_user; | |
//does this level expire? are they an existing members with an expiration date? |
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
/* | |
Get PMPro Pay By Check and PMPro Add PayPal Express to work together. | |
*/ | |
//remove the checkout_boxes code from both plugins | |
function my_init_pmpro_payment_options() | |
{ | |
remove_action("pmpro_checkout_boxes", "pmpropbc_checkout_boxes"); | |
remove_action("pmpro_checkout_boxes", "pmproappe_pmpro_checkout_boxes", 20); | |
add_action("pmpro_checkout_boxes", "my_pmpro_checkout_boxes_payment_options"); |
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
function my_pmpro_confirmation_url($url, $user_id, $level) { | |
$already_member = get_user_meta($user_id, 'already_member', true); | |
if(!$already_member) { | |
update_user_meta($user_id, 'already_member', 1); | |
$url = home_url('/my-dashboard'); | |
} | |
return $url; | |
} | |
add_filter('pmpro_confirmation_url', 'my_pmpro_confirmation_url'); |
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
/* | |
Only let level 1 members sign up if they use a discount code. | |
Place this code in your active theme's functions.php or a custom plugin. | |
*/ | |
function my_pmpro_registration_checks_require_code_to_register($pmpro_continue_registration) | |
{ | |
//only bother if things are okay so far | |
if(!$pmpro_continue_registration) | |
return $pmpro_continue_registration; |
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 employer, title, and department columns to the members list CSV export. | |
Just add this code to your functions.php or a custom plugin. | |
The first function here defines the column headers and a callback function for each column. | |
*/ | |
function my_pmpro_members_list_csv_extra_columns($columns) | |
{ | |
$columns["employer"] = "my_extra_column_employer"; |
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
/* | |
Require specific category user meta to view posts in designated categories. | |
Custom price-adjusting fields are added via PMPro Register Helper add on (required). | |
Add all of this code to your active theme's functions.php or a custom plugin. | |
*/ | |
add_filter("pmpro_has_membership_access_filter", "my_pmpro_additional_categories", 10, 4); | |
function my_pmpro_additional_categories($hasaccess, $thepost, $theuser, $post_membership_levels) | |
{ | |
global $wpdb; | |
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
* | |
Create a page with the slug /my-user-page/, | |
or if something different be sure to change the code below. | |
You can then link to /my-user-page/ or add that as a link to your menu | |
that will redirect to a user's user page. | |
Redirect /my-user-page/ to a user's user page | |
or checkout if they do not have one. | |
*/ |
NewerOlder