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 / 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' ) ) :
<?php // do not copy this line
/**
* When registering, add the member to a specific membership level
* @param integer $user_id
* Add this to a PMPro customizations or Code Snippets Plugin: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
**/
//Disables the pmpro redirect to levels page when user tries to register
add_filter("pmpro_login_redirect", "__return_false");
@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;
});
<?php // do not copy this line please
/* PMPro Gift Levels Example */
global $pmprogl_gift_levels;
$pmprogl_gift_levels = array(
// Set level 11 as a "Purchase Gift" membership level to create a gift code for a free level 16 gift.
11 => array( // "Purchase Gift" level ID
@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_pmpro_email_headers_cc_admin_emails.php
Last active September 28, 2021 09:57 — forked from strangerstudios/my_pmpro_email_headers_admin_emails.php
CC two additional emails on PMPro admin emails.
<?php // do not copy this line
/* Add CC for PMPro admin emails
* Add this snippet to your PMPro Customization Plugin: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_email_headers_admin_emails($headers, $email) {
//cc emails already going to admin_email
if(strpos($email->template, '_admin') !== false)
{
@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.
*
@MaryOJob
MaryOJob / update_currency_per_level_to_rand.php
Last active April 27, 2020 09:21 — forked from strangerstudios/update_currency_per_level.php
Change currencies depending on Paid Memberships Pro level from your default to Rand
<?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.
@MaryOJob
MaryOJob / my_pmpro_remove_mh_redirect.php
Created May 8, 2020 21:24
Removes the always redirect to Member Homepages (MH) for Members and Admins when using the PMPro MH Add-On
<?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');
}