Skip to content

Instantly share code, notes, and snippets.

View MaximilianoRicoTabo's full-sized avatar

Maximiliano Rico MaximilianoRicoTabo

  • -
  • Montevideo - La Paloma
  • 23:32 (UTC -03:00)
View GitHub Profile
@MaximilianoRicoTabo
MaximilianoRicoTabo / bulk_level_change.php
Last active May 16, 2024 18:22
Add a level dropdown at the top and bottom of the users table view than add support to bulk add level memberships to users.
<?php
/**
*
* Add a level dropdown at the top and bottom of the users table view than add support to bulk
* add level memberships to users. Use at your own risk. Users can expect timeouts and rate limiting often
* when bulk editing even a relatively small number of members depending on their hosting and how things are wired up.
* link: TBD
*
* 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.
@MaximilianoRicoTabo
MaximilianoRicoTabo / members_table_list_sort_by_first_and_last_name.php
Created May 9, 2024 18:00
Make Members table list first name and last name columns sortable
<?php
/**
* Make Members table list first name and last name columns sortable
*
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_members_list_sql( $sqlQuery ) {
global $wpdb;
// Bail if the query is not for ordering by last name or first name. Check request
@MaximilianoRicoTabo
MaximilianoRicoTabo / catchup_v3.php
Created May 6, 2024 18:11
Check if required tables exist and create them if they don't.
<?php
/**
* Check if required tables exist and create them if they don't.
* This function is used to catch up missing tables that should have been created by Paid Memberships Pro when update to v3
*
* link: TBD
*
* 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.
@MaximilianoRicoTabo
MaximilianoRicoTabo / pmpro_get_text.php
Last active May 3, 2024 20:08
replace texts with gettext filter
<?php
/**
* replace texts with gettext filter
*
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_translate_text( $translated_text, $untranslated_text, $domain) {
//if the domain dosn't contains pmpro return the original text
if( $domain !== 'paid-memberships-pro' && $domain !== 'pmpro-group-accounts') {
@MaximilianoRicoTabo
MaximilianoRicoTabo / custom_filtered_pmpro_members_list_sql.php
Created May 3, 2024 18:00
Generate a custom member list query by filtering the original SQL Query and modifying as needed
<?php
/**
* Generate a custom member list query by filtering the original SQL Query and modifying as needed
*
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function custom_filtered_pmpro_members_list_sql( $sqlQuery ) {
@MaximilianoRicoTabo
MaximilianoRicoTabo / pmpro-sponsored-members-assign-to-parent.php
Last active May 1, 2024 18:09 — forked from kimcoleman/pmpro-sponsored-members-assign-to-parent.php
Retroactively assign a user to a Parent account when using the Sponsored Members Add On.
<?php
/**
* 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.
* This gist assume user being edited has an active membership and it's a sponsored level.
*
* Note: The user's active Membership Level must be the correct "Child" level for that Parent/Child relationship.
*
*/
function pmprosm_assign_child_members( $profileuser ) {
@MaximilianoRicoTabo
MaximilianoRicoTabo / custom-select2.js
Last active April 5, 2024 14:09
Customize select2 labels
$( '#pmprogroupacct_child_level_ids' ).select2({
templateSelection: function( option ) {
// Customize the display label of each selected option
if ( option.text === 'Option 1' ) {
return 'Custom Label 1';
} else if ( option.text === 'Option 2' ) {
return 'Custom Label 2';
} else if ( option.text === 'Option 3' ) {
return 'Custom Label 3';
} else {
@MaximilianoRicoTabo
MaximilianoRicoTabo / pmpromh_template_redirect_homepage.php
Last active April 3, 2024 17:11
custom function to redirect member to their membership level's homepage when trying to access your site's front page (static page or posts page).
<?php
/**
* Function to redirect member to their membership level's homepage when
* trying to access your site's front page (static page or posts 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/
@MaximilianoRicoTabo
MaximilianoRicoTabo / skip_user_fields.php
Created March 7, 2024 13:13
Remove user fields at checkout page. Skip required fields check as well.
<?php
/**
*
* Custom recipe to hide user fields at checkout
*
* link: TBD
*
* 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.
@MaximilianoRicoTabo
MaximilianoRicoTabo / custom-level-cost-text.php
Created March 4, 2024 14:07
Customize level cost description depending on the date.
<?php
/**
*
* Custom function to add a late fee to the checkout page in Paid Memberships Pro
*
* link: TBD
*
* 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.