Skip to content

Instantly share code, notes, and snippets.

View dwanjuki's full-sized avatar

David Wanjuki dwanjuki

  • Nairobi, Kenya
  • 05:24 (UTC +03:00)
View GitHub Profile
@dwanjuki
dwanjuki / get_user_metadata_pmpro_prepop.php
Last active December 14, 2023 14:19 — forked from strangerstudios/get_user_metadata_pmpro_prepop.php
Default some PMPro fields based on other user meta.
<?php // copy from below
/**
* Synchronize WooCommerce Billing Address and PMPro Billing Address
*
* 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 get_user_metadata_pmpro_prepop($value, $user_id, $meta_key, $single) {
@dwanjuki
dwanjuki / mypmpromm-remove-map-directory-pages.php
Last active January 25, 2024 13:47 — forked from JarrydLong/mypmpromm-remove-map-directory-pages.php
This recipe will remove the map from the directory page when using the Membership Directory Add On
<?php
/**
* This recipe will remove the map from the directory page
* when using the Membership Directory Add On
*
* 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/
*/
@dwanjuki
dwanjuki / pmpro-signup-shortcode-gettext-.php
Last active February 5, 2024 11:50 — forked from ipokkel/pmpro-signup-shortcode-gettext-example.php
Translate or change a text string in the PMPro Signup Shortcode
<?php
/**
* Translate or change a text string in the PMPro Signup Shortcode.
*
* 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_signup_shortcode_gettext( $translated, $text, $domain ) {
@dwanjuki
dwanjuki / period_to_lock_member_only_content_per_membership_level.php
Created February 12, 2024 15:02 — forked from ipokkel/period_to_lock_member_only_content_per_membership_level.php
Lock membership content for an additional period. This is handy for memberships that should have access to a members-only post after a certain time has passed depending on their level. E.g. Gold level has immediate access, silver has access after 7 days and bronze after one month the post was published.
<?php
/**
* Set a waiting period before unlocking a members-only post that
* the member's membership level has access to.
*
* To set which posts to unlock and their individual period (days)
* set the post id's as the array key and the period as the
* value of the array key of the $posts_to_unlock variable.
*
* You can add this recipe to your site by creating a custom plugin
@dwanjuki
dwanjuki / gettext-multiple-memberships-per-user-with-context.php
Last active February 19, 2024 09:50 — forked from kimwhite/gettext-multiple-memberships-per-user.php
Change or translate text strings for PMPro Multiple Memberships Per User.
<?php
/**
* Change or translate text strings for PMPro Multiple Memberships Per User.
*
* This recipe assumes and requires that both PMPro core and PMPro Multiple Memberships Per User are active.
*
* 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/
@dwanjuki
dwanjuki / remove_confirm_email.php
Last active February 23, 2024 13:27 — forked from kimwhite/remove_confirm_email_password.php
Remove the "Confirm Email" field on checkout page
<?php
/**
* This recipe will remove the "Confirm Email" field on checkout
*
* 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/
*/
@dwanjuki
dwanjuki / mypmpro-geocode-users-only.php
Last active February 29, 2024 09:15 — forked from JarrydLong/mypmpro-geocode-users-only.php
This recipe will geocode users based on their WooCommerce billing address
<?php
/**
* This recipe will geocode users based on their WooCommerce billing address.
* Run /wp-admin/?pmpromm_process_users=true to run the script.
*
* 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/
*/
@dwanjuki
dwanjuki / pmpro-defult-country-code.php
Last active March 27, 2024 13:57 — forked from kimwhite/pmpro-defult-country-code.php
Set a default billing country and VAT country
<?php // do not copy this line.
/**
* This recipe sets a default billing country and VAT country
*
* 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/
*/
@dwanjuki
dwanjuki / pmpro_register_redirect.php
Last active April 9, 2024 10:23 — forked from strangerstudios/pmpro_register_redirect.php
Disable the PMPro redirect from default WordPress register page to PMPro levels page.
<?php
/**
* Disable the PMPro redirect from default WordPress register page to PMPro levels 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/
*/
add_filter('pmpro_register_redirect', '__return_false');
@dwanjuki
dwanjuki / pmpro-discount-code-for-membersonly.php
Last active October 28, 2024 13:41 — forked from kimwhite/pmpro-discount-code-for-membersonly.php
Discount Code for Members of Certain Levels Only
<?php // do not copy this line.
/**
* Restrict discount code usage to members of certain levels
*
* 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/
*/