Skip to content

Instantly share code, notes, and snippets.

Avatar

Theuns Coetzee ipokkel

View GitHub Profile
@andrewlimaza
andrewlimaza / change-2co-locale.php
Created Nov 18, 2020
Set 2Checkout hosted checkout page language for Paid Memberships Pro.
View change-2co-locale.php
<?php
/**
* Change the 2Checkout hosted checkout default language for Paid Memberships Pro WordPress Plugin.
* Please see https://www.2checkout.com/documentation/checkout/parameter-sets/pass-through-products/ (Additional Parameters) for available languages.
*
* 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/
*/
@andrewlimaza
andrewlimaza / require-ap-for-checkout.php
Last active Nov 17, 2020
Require an Addon Package to be purchased for certain membership levels. [Paid Memberships Pro]
View require-ap-for-checkout.php
<?php
/**
* This code recipe requires an Addon Package to be purchased for a particular level. Please adjust the level ID on line 18.
*
* 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_require_ap_for_checkout( $continue ) {
@andrewlimaza
andrewlimaza / bulk-update-users-expiration-date-pmpro.sql
Created Nov 9, 2020
Bulk update user's expiration dates via SQL - Paid Memberships Pro
View bulk-update-users-expiration-date-pmpro.sql
/**
* Bulk update all users to have an expiration date that belong to a specific membership level.
* This code should be run directly inside your WordPress database.
* Please update the wp_ prefix to match that of your database as well as the membership_id and enddate value (YYYY-MM-DD).
*
* IMPORTANT: Have a backup of your site before running this code.
*/
UPDATE wp_pmpro_memberships_users SET enddate = '2020-12-31 00:00:00' WHERE status = 'active' AND membership_id = 1;
@ronalfy
ronalfy / pmpro-add-start-date-membership-account-table.php
Created Nov 6, 2020
PMPro - Add Start Date Membership Account Table
View pmpro-add-start-date-membership-account-table.php
<?php
/**
* Gets the start date for a user and outputs it to the account page membership table.
*
* 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_extra_column_members_table() {
@andrewlimaza
andrewlimaza / qr-code-invite-members.php
Created Oct 9, 2020
Integrate Membership Card with Invite Only Member Add On [Paid Memberships Pro]
View qr-code-invite-members.php
<?php
/**
* Set the QR code to link to a checkout with an invite code when someone scans a Q.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_membership_card_qr_invite_code( $card_user, $option ) {
global $pmproio_invite_required_levels;
if ( $option == 'other' ) {
@dparker1005
dparker1005 / pmproiufcsv_email.php
Created Sep 18, 2020
Send a welcome email for each user after CSV import.
View pmproiufcsv_email.php
<?php
// Copy from below here...
/**
* Send a welcome email for each user after CSV import.
*/
global $pmproiufcsv_email;
$pmproiufcsv_email = array(
'subject' => sprintf('Welcome to %s', get_bloginfo('sitename')), //email subject, "Welcome to Sitename"
@andrewlimaza
andrewlimaza / my-pmpro-change-display-name-member-directory.php
Created Aug 27, 2020
Change the display name for Member Directory and Profile Pages Add On
View my-pmpro-change-display-name-member-directory.php
<?php
/**
* Replace a user's display name on directory and profile page with their full name.
* This requires the latest version (1.0+) of the Member Directory and Profile Pages Add On - https://www.paidmembershipspro.com/add-ons/member-directory/
*
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_member_directory_change_display_name( $display_name, $user ) {
$first_name = isset( $user->first_name ) ? $user->first_name : get_user_meta( $user->ID, 'first_name', true );
$last_name = isset( $user->last_name ) ? $user->last_name : get_user_meta( $user->ID, 'last_name', true );
@ronalfy
ronalfy / pmpro-template-user-pages-level-id.php
Last active Aug 28, 2020
PMPro - Template for User Pages Based on Level ID.
View pmpro-template-user-pages-level-id.php
<?php
/**
* Load a page template for a user page based on level.
*/
function pmpro_user_page_redirect_per_level() {
// Make sure user is logged in.
if ( ! is_user_logged_in() ) {
return;
}
// Make sure we are on a page.
@andrewlimaza
andrewlimaza / rh-file-upload-members-csv.php
Created Jul 31, 2020
Add Register Helper File Upload Field to Member's CSV Export
View rh-file-upload-members-csv.php
<?php
/**
* Add the full URL of a file upload field to member export CSV.
* Adjust the 'my_image' value with the relevant Register Helper field key.
* You can add this code snippet to your WordPress site following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
// Add a custom column to the CSV export.
function my_pmpro_members_list_csv_extra_columns ( $columns ) {
$columns["uploaded"] = "my_pmpro_members_list_uploaded";
@kimcoleman
kimcoleman / remove_the_pmpro_actions_nav_separator.php
Last active Aug 5, 2020
Remove the vertical bar | in the various action nav groups on Membership Account, Log In widget, and more.
View remove_the_pmpro_actions_nav_separator.php
<?php
/**
* Remove the vertical bar | in the various action nav groups on Membership Account, Log In widget, and more.
*
* 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/
*
*/
You can’t perform that action at this time.