Skip to content

Instantly share code, notes, and snippets.

🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
Block or report user

Report or block MaryOJob

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MaryOJob
MaryOJob / pmpro-prorate-initial-payment.php
Created May 20, 2020 — forked from greathmaster/pmpro-prorate-initial-payment.php
Prorate the initial payment. Useful for subscriptions that occur on the first of every month.
View pmpro-prorate-initial-payment.php
function my_pmpro_checkout_level($level)
{
$current_day = date('j');
$days_in_month = date('t');
$level->initial_payment = $level->initial_payment*(($days_in_month - $current_day)/$days_in_month);
return $level;
}
@MaryOJob
MaryOJob / my_change_text_giftaddon.php
Last active May 20, 2020 — forked from femiyb/my_change_text_mmpu.php
Change text with str_replace on the Gift Levels PMPro Add-On
View my_change_text_giftaddon.php
<?php
/*
Replace or translate text strings that's not translatable with gettext.
*/
// Check page content and replace text strings
function my_change_text_gift_addon( $text ) {
global $pmpro_pages;
@MaryOJob
MaryOJob / redirect_users_after_login.php
Last active May 15, 2020 — forked from andrewlimaza/redirect_users_after_login.php
Redirect Users After Login For WordPress
View redirect_users_after_login.php
<?php // DO NOT COPY THIS LINE
/**
* Redirect all non-admin user's after they login to your website's home page.
* Documentation for login_redirect filter - https://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect
*/
function pmpro_redirect_after_login( $redirect_to, $request, $user ) {
if ( isset( $user->roles ) && is_array( $user->roles ) ) {
@MaryOJob
MaryOJob / my_gettext_pay_by_check.php
Created May 14, 2020 — forked from strangerstudios/my_gettext_pay_by_check.php
Update Pay by Check wording in pmpro-pay-by-check to something else.
View my_gettext_pay_by_check.php
<?php
/*
Change "Pay by Check" language to "Pay by Wire Transfer"
Add this code to your active theme's functions.php
or a custom plugin.
*/
function my_gettext_pay_by_check($translated_text, $text, $domain)
{
if($domain == "pmpropbc" && $text == "Pay by Check")
@MaryOJob
MaryOJob / my_admin_fees_example.php
Created May 14, 2020 — forked from andrewlimaza/my_admin_fees_example.php
Adding custom tax to Paid Memberships Pro and renaming to admin fees instead.
View my_admin_fees_example.php
<?php
/**
* This gist is to add a 20% fee on all orders and rename 'Tax' to 'Admin Fees'.
* Please add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* www.paidmembershipspro.com
*/
/**
* This function will add 20% to all orders using the 'pmpro_tax' filter.
View pmpro-user-pages-enable-comments.php
//Enables comments for User Pages
function enable_comments_for_user_pages($postdata, $user, $level)
{
$postdata['comment_status'] = 'open';
return $postdata;
}
add_filter('pmpro_user_page_postdata', 'enable_comments_for_user_pages', 10, 3);
@MaryOJob
MaryOJob / my_pmpro_conditional_checkbox.php
Last active May 13, 2020
Conditional checkbox field example for an existing Register Helper Code
View my_pmpro_conditional_checkbox.php
<?php // DO NOT COPY THIS LINE
/**
* Conditional field example. Display two textfields depending on checkbox value
* This can be added to an existing register helper add fields code, if adding this type of field for the first time,
* be sure to check if function exists by adding this: function my_pmprorh_init() { if(!function_exists( "pmprorh_add_registration_field" )) { return false; }
**/
$fields[] = new PMProRH_Field(
@MaryOJob
MaryOJob / pmpro_isOrderRecurring.php
Last active May 15, 2020 — forked from strangerstudios/pmpro_isOrderRecurring.php
Perform an action on Paid Memberships Pro (PMPro) recurring orders only.
View pmpro_isOrderRecurring.php
/*
Perform an action on PMPro recurring orders only.
A recurring order here is one that
(1) Has an earlier order with the same subscription_transaction_id.
(2) Is not created at PMPro checkout.
Note that we are checking if function_exists for pmpro_isOrderRecurring incase
we add this to PMPro core. Also note that the $test_checkout param there is used
here to avoid #2 above. So this parameter will check if the currently running PHP
script is being fired at checkout, not necessarily if the order was created at checkout,
@MaryOJob
MaryOJob / my_pmpro_remove_mh_redirect.php
Created May 8, 2020
Removes the always redirect to Member Homepages (MH) for Members and Admins when using the PMPro MH Add-On
View my_pmpro_remove_mh_redirect.php
<?php // PLEASE DO NOT COPY THIS LINE
/**
* Removes the always redirect to member homepages. Only allows login redirect functionality.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function remove_memberhome_pages_redirect(){
remove_action('template_redirect', 'pmpromh_template_redirect_homepage');
}
@MaryOJob
MaryOJob / update_currency_per_level_to_rand.php
Last active Apr 27, 2020 — forked from strangerstudios/update_currency_per_level.php
Change currencies depending on Paid Memberships Pro level from your default to Rand
View update_currency_per_level_to_rand.php
<?php // DO NOT COPY THIS LINE PLEASE
/*
Change currencies depending on Paid Memberships Pro level.
Add this code to your active theme's functions.php or a custom plugin.
This changes currency for a membership level from the default currency on your site to Rand.
Other places to look into swapping currencies:
* Levels page.
* Invoices page.
You can’t perform that action at this time.