View my_pmpro_registration_checks.php
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 a certain level before registering for another level. | |
Add this code to your active theme's functions.php or | |
a custom plugin. | |
*/ | |
function my_pmpro_registration_checks($okay) | |
{ | |
//only check if things are okay so far | |
if($okay) | |
{ |
View gist:4027538
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
/* | |
Don't show confirm password or email fields on the checkout page. | |
Add this code to your active theme's functions.php or a custom plugin. | |
*/ | |
add_filter("pmpro_checkout_confirm_password", "__return_false"); | |
add_filter("pmpro_checkout_confirm_email", "__return_false"); |
View pmpro-limit-members-per-level.php
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 | |
/* | |
Set a maximum number of members allowed to register for a membership level. | |
Add this code to a plugin for PMPro Customizations. | |
Set the "Maximum" for a level on the Memberships > Membership Levels > Edit Level admin page. | |
*/ | |
function pmproml_pmpro_save_membership_level( $level_id) { | |
if( $level_id <= 0 ) { |
View my_pmpro_dashboard_report.php
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 | |
/* | |
Show Members Reports on the WordPress Admin Dashboard. | |
Update the my_pmpro_dashboard_report() function to remove or add core or custom reports. | |
*/ | |
//Create a Dashboard Reports widget for Paid Memberships Pro | |
function add_my_report_dashboard() { | |
if( ! defined( 'PMPRO_DIR' ) || ! current_user_can( 'manage_options' ) ) | |
{ |
View pmpro_after_change_membership_level_default_level.php
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
/* | |
When users cancel (are changed to membership level 0) we give them another "cancelled" level. | |
Can be used to downgrade someone to a free level when they cancel. | |
Will allow members to the "cancel level" to cancel from that though. | |
*/ | |
function my_pmpro_after_change_membership_level_default_level($level_id, $user_id) | |
{ | |
//set this to the id of the level you want to give members when they cancel | |
$cancel_level_id = 1; |
View my_pmpro_checkout_start_date.php
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
/* | |
Adjust start date to the first following Sunday | |
*/ | |
//at checkout | |
function my_pmpro_checkout_start_date($startdate) | |
{ | |
//which day is it | |
$checkout_day = date("N"); | |
//days to sunday |
View pmpro_network_new_site.php
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 pmpro_network_new_site_editor($blog_id, $user_id) | |
{ | |
//switch to new blog | |
switch_to_blog($blog_id); | |
//change user's role on blog to "editor" | |
$wp_user_object = get_userdata($user_id); | |
$wp_user_object->set_role('editor'); | |
//switch back to main blog |
View my_pmpro_members_list_csv_extra_columns.php
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"; |
View my_cpt_404_redirects.php
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
/* | |
If 404 on a post, look for a gallery or portfolio with the same slug. | |
Borrows from: https://wordpress.stackexchange.com/a/45081/3652 | |
*/ | |
function my_cpt_404_redirects($template) | |
{ | |
if(is_404()) | |
{ | |
//see if we know the exact post ID |
NewerOlder