Skip to content

Instantly share code, notes, and snippets.

View kimcoleman's full-sized avatar

Kim Coleman kimcoleman

View GitHub Profile
@kimcoleman
kimcoleman / my_pmprommr_change_caps.php
Created July 7, 2020 19:31 — forked from dparker1005/my_pmprommr_change_caps.php
Changes membership manager so that they can only view the members list and add new members via PMPro Add Member.
<?php
// Copy from below here...
/*
* Changes membership manager so that they can only view
* the members list and add new members via PMPro Add Member.
*
* Can customize using your own caps from here:
* https://github.com/strangerstudios/pmpro-membership-manager-role/blob/35725b5cc9d7fd403255e4143a5bd5f1564b022d/pmpro-membership-manager-role.php#L16-L42
*/
@kimcoleman
kimcoleman / ninja_forms_field_membership_level.php
Last active April 4, 2021 03:55 — forked from ipokkel/ninja_forms_field_membership_level.php
Hidden Ninja Forms form field that captures PMPro membership level
<?php
/*
* Add a hidden field in Ninja Forms to capture Membership Level (if user is logged in).
*
* For Ninja Forms version 3 and higher.
*/
// Create Membership Level field for Ninja Forms
add_filter( 'ninja_forms_register_fields', function( $fields ) {
if ( class_exists( 'PMProMembershipLevelNFInput' ) ) {
$fields['pmpromembershiplevel'] = new PMProMembershipLevelNFInput;
@kimcoleman
kimcoleman / redirect_non_members_to_levels_page.php
Last active April 3, 2021 03:11 — forked from andrewlimaza/redirect_users_to_a_new_page.php
Redirect non-members to the Membership Levels page in PMPro if they do not have a membership level.
<?php
/**
* Redirect non-members to the Membership Levels page if they do not have a membership level.
*
* 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/
*
*/
@kimcoleman
kimcoleman / my_pmpro_disable_member_emails.php
Last active April 14, 2021 03:30 — forked from strangerstudios/my_pmpro_disable_member_emails.php
Disable any email sent to the Member/User by Paid Memberships Pro
<?php
/**
* The function below will disable any email sent to the Member/User by Paid Memberships Pro.
* The admin emails will still be sent as intended.
*
* 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/
*/
@kimcoleman
kimcoleman / my_pmpro_paypal_button_image.php
Last active April 14, 2021 03:27 — forked from strangerstudios/my_pmpro_paypal_button_image.php
Using the pmpro_paypal_button_image filter to change the PayPal button image on the PMPro checkout page.
<?php
/**
* Change the PayPal button image on the Paid Memberships Pro - Membership Checkout 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_paypal_button_image( $url ) {
@kimcoleman
kimcoleman / my_pmpro_member_links.php
Last active April 10, 2023 12:51 — forked from strangerstudios/my_pmpro_member_links
Example of how to add links to the Member Links list on the Membership Account page.
@kimcoleman
kimcoleman / my_default_wp_user_checkout_fields.php
Last active April 13, 2021 03:01 — forked from strangerstudios/my_default_wp_user_checkout_fields.php
Capture default user profile fields at Membership Checkout using Register Helper
<?php
/**
* Add Website and Biographical Info to Membership Checkout
*/
function my_default_wp_user_checkout_fields() {
if ( class_exists( 'PMProRH_Field') ) {
pmprorh_add_checkout_box( 'additional', 'Additional Information' );
$fields = array();
//user_url field
@kimcoleman
kimcoleman / my_init_pmpro_mini_api.php
Last active April 3, 2021 03:51 — forked from strangerstudios/my_init_pmpro_mini_api.php
Very basic custom RESTful API to check the membership level of a Paid Memberships Pro User
<?php
/**
* Call to http://yoursite.com/?verify=email@domain.com&secret=SOMESECRETHERE to check the membership level of a user.
*/
function my_init_pmpro_mini_api() {
if ( function_exists( 'pmpro_getMembershipLevelForUser' ) &&
! empty( $_REQUEST[ 'verify' ] ) &&
! empty( $_REQUEST[ 'secret' ] ) )
{
if ( $_REQUEST[ 'secret' ] != 'SOMESECRETHERE' ) {
@kimcoleman
kimcoleman / pmpro-sponsored-members-assign-to-parent.php
Last active April 3, 2021 03:51 — forked from greathmaster/pmpro-sponsored-members-assign-to-parent.php
Retroactively assign a user to a Parent account when using the Sponsored Members Add On.
/**
* Retroactively assign a user to a Parent account when using the Sponsored Members Add On.
* Enter the user ID of parent account in the "Assign to Parent Account" on the "Edit Profile" screen.
*
* Note: The user's active Membership Level must be the correct "Child" level for that Parent/Child relationship.
*
*/
function pmprosm_assign_child_members( $profileuser ) {
if ( function_exists( 'pmprosm_getSponsor' ) && current_user_can( 'edit_users' ) ) {
@kimcoleman
kimcoleman / my_pmpro_memberslist_extra_cols.php
Last active December 7, 2019 15:30 — forked from strangerstudios/my_pmpro_memberslist_extra_cols.php
Add a custom column to the Memberships > Members admin page for a user field added via Register Helper using the PMPro hook method.
<?php
/**
* Add a custom column to the Memberships > Members admin page for a user field
* added via Register Helper using the PMPro hook method.
*
* 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/
*/