Skip to content

Instantly share code, notes, and snippets.

View MaryOJob's full-sized avatar
🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
View GitHub Profile
@MaryOJob
MaryOJob / register-helper-test1.php
Last active November 21, 2019 12:21
Adding Five Custom Fields to PMPro Accounts Page
<?php
/**
* Register Helper example for five fields. This is a test Register Helper example.
* 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_pmprorh_init() {
//don't break if Register Helper is not loaded
if(!function_exists( "pmprorh_add_registration_field" )) {
@MaryOJob
MaryOJob / my_pmpro_email_headers_admin_emails.php
Last active December 12, 2019 08:11 — forked from femiyb/my_pmpro_email_headers_admin_emails.php
BCC all PMPro Register/Checkout Emails to a Certain Address
<?php
/*
Add bcc for checkout emails
*/
function my_pmpro_email_headers_admin_emails($headers, $email) {
//bcc checkout emails
if(strpos($email->template, "checkout_") !== false) {
//add bcc
$headers[] = "Bcc:" . "otheremail@domain.com";
}
@MaryOJob
MaryOJob / my_pmpro_custom_select_and_text_fields_to_register_helper.php
Last active January 6, 2020 10:03
Adding A Custom Field (Select & Text) to Register Helper
<?php
/**
* Register Helper example for a select and text field.
* 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_pmprorh_init() {
//don't break if Register Helper is not loaded
if(!function_exists( "pmprorh_add_registration_field" )) {
@MaryOJob
MaryOJob / my_pmpro_login_redirect_url.php
Created January 15, 2020 11:41 — forked from travislima/my_pmpro_login_redirect_url.php
Redirect on login if user has any failed payments. (Requires Paid Memberships Pro Failed Payment Limit Add On)
<?php
/*
* Redirect on login if user has any failed payments. (Requires Paid Memberships Pro Failed Payment Limit Add On)
* Adjust the code on the line the line "site_url( ' payment-failed')" to redirect to page of your prefereance.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_login_redirect_url( $url, $request, $user ) {
@MaryOJob
MaryOJob / show_buddypress_email_on_xprofile_page.php
Created January 16, 2020 23:40
Show WordPress email on BuddyPress user xprofiles page
<?php // do not copy this line, doing so will give you a fatal error when you run this script
/*
If you are using this code, please be aware of privacy laws in your region and also beware of spambots harvesting your users'
emails from your website.
*/
function tiquality_add_custom_field() {
if ( bp_is_active( 'xprofile' ) ) :
@MaryOJob
MaryOJob / my_pmpro_sponsored_members_charge_recievers.php
Last active January 22, 2020 11:21
Allows sponsored recipients to individually pay for the seats given by their sponsored giver.
<?php
/* This codes requires you to have the sponsored Members Add On up and configured.
This code should also be added together with your configured sponsored members code in your PMPro customizations Plugin: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
This script is an example that allows level 2 to purchase 5 membership accounts for level 3 but
have level 3 individualy pay $20 for their membership accounts.
Please see the add on guide for more attributes that can be configured for your sponsored members add on here: https://www.paidmembershipspro.com/add-ons/pmpro-sponsored-members/
*/
global $pmprosm_sponsored_account_levels;
@MaryOJob
MaryOJob / my_caldera_nigeria_country_code.php
Created February 9, 2020 20:01
Set the default country code to Nigeria for Caldera Forms
<?php // do not copy this line
add_filter( 'caldera_forms_phone_js_options', function( $options){
//Use ISO_3166-1_alpha-2 formatted country code
$options[ 'initialCountry' ] = 'NG';
return $options;
});
@MaryOJob
MaryOJob / my_pmproz_after_checkout_data1.php
Last active February 27, 2020 13:52 — forked from dparker1005/my_pmproz_after_change_membership_level_data.php
Adds a custom field created via RH to zap 'pmpro_after_checkout_data'.
<?php // do not copy this line
// Copy from below here
function my_pmproz_after_checkout_data( $data, $user_id, $level, $order ) {
$data['my_usermeta'] = get_user_meta($user_id, 'my_usermeta', true); // add your custom usermeta key in place of my_usermeta
return $data;
}
add_filter( 'pmproz_after_checkout_data', 'my_pmproz_after_checkout_data', 10, 4 );
@MaryOJob
MaryOJob / my_pmproal_before_level_member_badge.php
Last active April 7, 2020 09:51 — forked from strangerstudios/my_pmproal_before_level_member_badge.php
Show the Member Badge for each level on the 3 column layout Membership Levels page
<?php
/*
Sample method to show a level's Member Badge on the three column layout of the
Membership Levels page when using the Advanced Levels Page Shortcode Add On.
*/
function my_pmproal_before_level_member_badge( $level_id, $layout ) {
if( function_exists( 'pmpromb_getBadgeForLevel' ) ) {
$image = pmpromb_getBadgeForLevel($level_id);
if( ! empty( $image ) && $layout == '3col' ) {
echo '<img class="pmpro_member_badge" src="' . esc_url($image) . '" border="0" />';
@MaryOJob
MaryOJob / mary_wp_custom_login_example.php
Last active April 20, 2020 11:07
Change the WordPress default Login to a Custom Login on your website
<?php
add_filter( 'login_url', 'marypmpro_custom_login_url', 10, 3 ); // marypmpro here is the name of my site
/**
* Filters the login URL.
*
* @since 2.8.0
* @since 4.2.0 The `$force_reauth` parameter was added.
*