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
/* | |
Save IP address and country to user meta on checkout in PMPro. | |
Requires the Geo IP Detect plugin (https://wordpress.org/plugins/geoip-detect/) | |
to be installed and activated | |
*/ | |
function save_ip_and_country_after_checkout($user_id, $morder) | |
{ | |
$country = ''; | |
$ip = ''; |
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 pmprobe_manage_posts_columns( $columns, $post_type) | |
{ | |
$post_types = apply_filters('pmprobe_post_type_columns', array('post')); | |
if (in_array($post_type, $post_types)) | |
{ | |
$columns[ 'pmpro_membership_levels' ] = 'Membership Levels'; | |
} | |
return $columns; |
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 my_pmpro_confirmation_url($rurl, $user_id, $pmpro_level) | |
{ | |
global $wpdb; | |
$code = $wpdb->get_row("SELECT * FROM $wpdb->pmpro_discount_codes WHERE id = $pmpro_level->code_id LIMIT 1"); | |
/* | |
Example of $code content: | |
object(stdClass) { | |
public 'id' => string '7' (length=1) | |
public 'code' => string 'SC916E8F9CC' (length=11) |
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
/* | |
If a parent account checks out and distributes the discount code to 3/10 of its child accounts, | |
the parent account should still have 7 remaining. This 7 remaining uses should persist after a | |
renewal by the parent account. | |
By default the discount codes have an expiration period of one year. | |
Even if they renew, the discount code expiration date is not updated. | |
We are hard coding the start and end date of the discount code itself in the function pmprosm_createSponsorCode() |
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
.pmpro_level-highlight{ | |
background-color:#ADD8E6 !important | |
} | |
.pmpro_level-current{ | |
background-color:#ADD8E6 !important | |
} |
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
/* | |
Remove "Membership Level" on the BuddyPress profile page, and instead only show the membership level name | |
*/ | |
function my_pmpro_bp_show_level_on_bp_profile() { | |
if ( !function_exists('pmpro_getMembershipLevelForUser') ) { | |
return; | |
} | |
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 | |
/* | |
This shortcode will display the members list and additional content based on the defined attributes. | |
*/ | |
function pmpromd_shortcode($atts, $content=null, $code="") | |
{ | |
// $atts ::= array of attributes | |
// $content ::= text within enclosing form of shortcode element | |
// $code ::= the shortcode found, when == callback name | |
// examples: [pmpro_member_directory show_avatar="false" show_email="false" levels="1,2"] |
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
/* | |
Restrict membership access based on parent category | |
*/ | |
function category_restrictions($hasaccess, $mypost, $myuser, $post_membership_levels) | |
{ | |
global $post, $current_user; | |
$categories = wp_get_post_categories($mypost->ID); | |
$restrict = false; |
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
/* | |
Restrict membership access based on parent category | |
*/ | |
function category_restrictions($hasaccess, $mypost, $myuser, $post_membership_levels) | |
{ | |
global $post, $current_user; | |
$categories = wp_get_post_categories($mypost->ID); | |
$restrict = false; |
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 a "How did you hear about us?" field Membership Checkout for new members only. | |
Display the field for admins-only in the profile and in the Members List CSV export. | |
*/ | |
function my_pmpro_how_hear_fields() { | |
global $current_user; | |
if(class_exists( 'PMProRH_Field' ) && (!pmpro_hasMembershipLevel() || current_user_can( 'edit_users' ) ) ) { | |
pmprorh_add_checkout_box( 'additional', 'Additional Information' ); |