Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
<?php
/**
* Customize the no access message HTML.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_custom_no_access_message_html( $no_access_message_html, $level_ids ) {
@ipokkel
ipokkel / custom-no-access-message-header.php
Created July 26, 2024 09:11
Set a custom header to replace the default "Membership Required" heading for the PMPro non-member message.
<?php
/**
* Customize the no access message header.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_custom_no_access_message_header( $header, $level_ids ) {
<?php
/**
* Adds "Roles" column to Members List.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_add_memberslist_col_roles( $columns ) {
@ipokkel
ipokkel / give-access-to-specific-posts-for-specific-users.php
Created July 22, 2024 14:42
Unlock specific PMPro member-only post for a specified set of user IDs.
<?php
/**
* Unlock specific posts for specific users.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function give_access_to_specific_posts_for_specific_users( $hasaccess, $thepost, $theuser, $post_membership_levels ) {
<?php
/**
* Add custom HTML to the checkout page below the discount code field using JavaScript.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_wp_footer_js_discount_code_text() {
<?php
/**
* BCC admin emails to different recipients based on user meta.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_bcc_admin_emails_on_user_meta( $headers, $email ) {
<?php
/**
* This recipe is an example of adding custom registration checks.
*
* In this example we require that the user has at least one cat and
* have filled in the number of pets field and checked the I have cats checkbox.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
<?php
/**
* Customize the registration error message.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function custom_registration_error_message( $errors, $sanitized_user_login, $user_email ) {
<?php
/**
* Change the end date of a membership level when a user is approved.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_change_level_enddate_on_approval( $user_id, $level_id ) {
<?php
/**
* Hide the submit button on the member profile edit page.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_profile_edit_page_hide_submit_button() {