Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
@ipokkel
ipokkel / pmpro-adjust-the-join-now-login.php
Last active February 27, 2024 10:51 — forked from andrewlimaza/pmpro-adjust-the-join-now-login.php
Adjust the Paid Memberships Pro login "Join Now" Link.
<?php
/**
* Adjust the 'Join Now' link on the login page to a custom URL for Paid Memberships Pro.
* Follow this guide to add custom code to your membership site - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_custom_join_now_link( $links, $allowed_html ) {
$links['register'] = '<a href="https://example.com/join-now/">' . __( 'Join Now', 'paid-memberships-pro' ) . '</a>';
return $links;
}
add_filter( 'pmpro_login_forms_handler_nav', 'my_pmpro_custom_join_now_link', 10, 2 );
@ipokkel
ipokkel / my_pmpro_change_text_example.php
Last active August 1, 2022 07:34
PMPro - Change Text Example on Checkout Page by LEVEL
<?php // Do Not Copy This Line
/**
* This recipe will help you change text on the checkout paid by 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/
*/
// paste content from below this line
@ipokkel
ipokkel / my-pmpro-redirect-to-referring-page-after-checkout.php
Last active April 8, 2024 13:01 — forked from sc0ttkclark/my-pmpro-redirect-to-referring-page-after-checkout.md
Redirect new members and existing members that changes their existing level back to the referring page after checkout.
<?php
/**
* Display the last visited non-PMPro page in the confirmation message, OR
* redirect the member back to the last visited page.
*
* Usage Guide:
*
* 1. Set your preference to either display the link or redirect back to
* the referrer page by setting the $toggle_display_redirect variable
* to true or false.
@ipokkel
ipokkel / my-pmpro-custom-order-code-with-date.php
Last active September 6, 2021 10:28 — forked from andrewlimaza/custom-pmpro-order-codes.php
Generate custom order codes / order numbers that increment for Paid Memberships Pro Orders [Date + Custom order sequence]
<? php
/**
* Custom order codes for Paid Memberships Pro Orders.
*
* This code will take the date and order ID and create
* an order code from that such as "INV060920211", "INV060920212", "INV060920213"
* and increment with each order added.
*
* A fallback is in place that if "INV060920211" already exists for some order,
* it will just generate a random code to be safe.
@ipokkel
ipokkel / reset-pmpro-visits-views-logins.php
Created August 30, 2021 09:22 — forked from andrewlimaza/reset-pmpro-visits-views-logins.php
Reset visits, views and logins for Paid Memberships Pro.
<?php
/**
* Add &pmpro_reset_analytics=1 to your WordPress dashboard URL/Paid Memberships Pro reports page.
* Add this code to your Code Snippets / Custom Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* You may remove this code from your site when you don't need it any longer.
*/
function my_pmpro_reset_visit_data() {
// Check if URL parameter pmpro_reset_analytics is set
if ( isset( $_REQUEST['pmpro_reset_analytics'] ) ) {
@ipokkel
ipokkel / restrict-all-pages-non-members.php
Last active October 3, 2023 15:31 — forked from andrewlimaza/restrict-all-pages-non-members.php
Restrict all pages except home, Paid Memberships Pro pages, and specific pages for non-members.
<?php
/**
* This recipe will restrict all pages except Paid Memberships Pro pages,
* or the home page of your website, the search results page, the 404 page, or defined post/pages to non-members,
* non-approved members, or logged-out users.
*
* This won't affect administrators.
*
* 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.
@ipokkel
ipokkel / my_first_last_display_name.php
Last active April 16, 2021 05:45 — forked from kimcoleman/my_first_last_display_name.php
Set Display Name on Membership Checkout and for BuddyPress Name field.
<?php
/**
* Set Display Name on Membership Checkout and for BuddyPress Name field.
*/
function my_first_last_display_name( $user_id, $morder ) {
// Get user's first and last name.
$first_name = get_user_meta( $user_id, 'first_name', true );
$last_name = get_user_meta( $user_id, 'last_name', true );
@ipokkel
ipokkel / my_pmprorh_init_user_avatar.php
Last active March 10, 2021 22:48 — forked from kimcoleman/my_pmprorh_init_user_avatar.php
Allow members to upload their avatar using a Register Helper field during checkout or on the Member Profile Edit page.
<?php
/*
* Allow members to upload their avatar using a Register Helper field during checkout or on the Member Profile Edit page.
*
* Requires: Paid Memberships Pro, Register Helper 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/
@ipokkel
ipokkel / my_pmpro_replace_mail_emailandusername.php
Last active December 8, 2020 07:55 — forked from MaryOJob/my_pmpro_replace_mail_emailandusername.php
Replace "Email Address" with "Username or Email Address" on PMPro Login Form
<?php
/**
* This recipe will search your codebase for
* translatable strings and replace when an exact match is found.
*
* 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/
*/
@ipokkel
ipokkel / my-show-user-enddate.php
Last active November 16, 2020 06:03 — forked from kimwhite/my-show-user-enddate.php
Custom shortcode to show member expiration dates or recurring. [show_enddate]
<?php
/**
* Show the user's expiration date, or their next payment date.
* [show_enddate] ( show end date, show enddate, show_endate )
* Show the user's previously expired date if they were cancelled, expired or cancelled by an admin.
* If none of thhe above is found, the string 'nothing found' will be returned.
*
* 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.