Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
View GitHub Profile
@MaryOJob
MaryOJob / my_pmpro_gift_level_2_example.php
Last active Oct 22, 2020
PMPro example configuration code for the Gift Membership Add-On (2)
View my_pmpro_gift_level_2_example.php
<?php // Do not copy this line please
/** PMPro Gift Levels Example - See full information here: https://www.paidmembershipspro.com/add-ons/pmpro-gift-levels
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* This example allows a member to check out on level 4 and after checkout, the member gets a code to give out that allows
* another user checkout on level 3, paying an initial amount of $100 for their membership which has no expiry date or recurring payment set
*/
global $pmprogl_gift_levels;
@MaryOJob
MaryOJob / my_pmpro_change_level_if_approved.php
Last active Oct 22, 2020
Change membership level on approval, if member is approved when using the Approvals Add On
View my_pmpro_change_level_if_approved.php
<?php // Do not copy this line
/**
* Please add the below code to your custom plugin or Code Snippets Plugin by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_change_level_if_approved( $user_id, $level_id ) {
pmpro_changeMembershipLevel( 9, $user_id ); // where 9 is the level ID you want them changed to upon approval
}
@MaryOJob
MaryOJob / my_pmpro_custom_fields_character_limit.php
Created Oct 20, 2020
Add a Register Field TextArea field type which limits the number of characters Members can fill in
View my_pmpro_custom_fields_character_limit.php
<?php
/**
* See the PMPro Register Helper readme for more information and examples: https://www.paidmembershipspro.com/documentation/register-helper-documentation/adding-fields/
* Please add the below code to your custom plugin or Code Snippets Plugin by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
// We have to put everything in a function called on init, so we are sure Register Helper is loaded.
// Define the fields.
@MaryOJob
MaryOJob / my_wp_stay_on_edit_profile_page_after_adding_new_user.php
Last active Oct 15, 2020
Stay on the WordPress Edit User Profile Page After Adding A New User to your WordPress website
View my_wp_stay_on_edit_profile_page_after_adding_new_user.php
<?php // Do not copy this line
/**
* Source: https://wordpress.stackexchange.com/questions/242170/how-to-add-additional-information-to-a-user-on-user-creation
* Please add the below code to your custom plugin or Code Snippets Plugin by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
add_action('user_register','post_user_reg_redirect');
function post_user_reg_redirect( $user_id )
{
@MaryOJob
MaryOJob / my_pmpro_gettext_sponsored_members.php
Created Oct 6, 2020
Change some of the text strings in PMPro Sponsored Members Add On via the WP gettext filter.
View my_pmpro_gettext_sponsored_members.php
<?php // Do not copy this line
/**
* This filter will search your codebase for translatable strings and replace when an exact match is found.
*
* Here we're changing 'Number of Seats' to 'Number of Dependents/Spouse/Children' for Sponsored Members.
*
* Add this code to your PMPro Customizations Plugin
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Note: When adding to your Customizations Plugin, be careful not to include the opening php tag on line 1 above.
@MaryOJob
MaryOJob / a-gettext-filter-4-pmpro.php
Last active Sep 22, 2020 — forked from pbrocks/a-gettext-filter-4-pmpro.php
Sometimes we may want to change the wording of the language used in a plugin or theme, but don't want to edit code directly. A cleaner way to go is to use the built in filter that WordPress has called 'gettext'. This filter will search your codebase for translatable strings and replace when an exact match is found.
View a-gettext-filter-4-pmpro.php
<?php // Do not copy this line
/**
* This filter will search your codebase for translatable strings and replace when an exact match is found.
*
* Here we're changing 'Membership' to 'Subscription' for Paid Memberships Pro.
*
* Add this code to your PMPro Customizations Plugin
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Note: When adding to your Customizations Plugin, be careful not to include the opening php tag on line 1 above.
*
@MaryOJob
MaryOJob / my_pmpro_fields_for_tonis.php
Last active Sep 22, 2020
Add Custom Fields Example in a Checkbox Area with a Custom Name
View my_pmpro_fields_for_tonis.php
<?php // Do not copy this line.
/**
* See the PMPro Register Helper readme for more information and examples: https://www.paidmembershipspro.com/documentation/register-helper-documentation/adding-fields/
* Please add the below code to your custom plugin or Code Snippets Plugin by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
// We have to put everything in a function called on init, so we are sure Register Helper is loaded.
function pmpro_register_field_peakbagger_init() {
// Don't break if Register Helper is not loaded.
@MaryOJob
MaryOJob / my_pmpro_sync_xprofile_to_member_directory.php
Last active Sep 21, 2020
Sync BuddyPress Profile Fields with PMPro using Register Helper
View my_pmpro_sync_xprofile_to_member_directory.php
<?php
/**
* Based on the Register Helper example.
* We've added a "buddypress" option for each field
* set to the XProfile name we used when setting up
* the fields in the BuddyPress extended profile.
* If the PMPro BuddyPress Add On is activated
* then the fields will be synchronized.
* Register Helper: https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/
@MaryOJob
MaryOJob / my_pmpro_sponsored_members_example.php
Last active Sep 17, 2020
My PMPro Sponsored Members Code Example
View my_pmpro_sponsored_members_example.php
<?php // Do not copy this line please.
/**
* This Sample shows how a Sponsor can create users (child accounts) at checkout
* Using the Sponsored/Group Members Add On for PMPro
* https://www.paidmembershipspro.com/add-ons/pmpro-sponsored-members/#checkoutoptions
* 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/
View pmpro account page edit
// overwite the account shortcode
function overwite_pmpro_shortcode_account($atts, $content=null, $code="")
{
global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels;
// $atts ::= array of attributes
// $content ::= text within enclosing form of shortcode element
// $code ::= the shortcode found, when == callback name
// examples: [pmpro_account] [pmpro_account sections="membership,profile"/]
You can’t perform that action at this time.