Skip to content

Instantly share code, notes, and snippets.

View femiyb's full-sized avatar
🏠
Working from home

Femi YB femiyb

🏠
Working from home
View GitHub Profile
@femiyb
femiyb / register_helper_dropdown.php
Last active July 5, 2019 20:06
Register Helper Dropdown
<?php
//add lines 5 onwards to your custom PMPro plugin -> http://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 my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
}
<?php
/**
* Add the code below to your PMPro Customizations Plugin - 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' )) {
return false;
}
<?php
function limit_text_area()
{
echo
"
<script>
jQuery(document).ready(function() {
jQuery('#company_info').on('keyup', function() {
var words = this.value.match(/\S+/g).length;
<?php
function my_pmprorh_init_2()
{
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
}
global $pmpro_countries;
<?php
function my_pmprorh_init_2()
{
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
}
<?php
/**
* Add this code to your PMPro Customizations Plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* This function below sends a custom HTML email to the user that checks out for a pmpro membership level, easily extendible to send to admins, or specific users and so on.
* Website: https://paidmembershipspro.com
*/
//this gist will send a custom email when a new member is added using the add member add on
@femiyb
femiyb / pmpro_add_member_notification.php
Last active September 19, 2019 14:46 — forked from LMNTL/pmpro_add_member_notification.php
Generate checkout email when using Add Member from Admin Add On for Paid Memberships Pro
<?php
/* Generate checkout email when using Add Member from Admin Add On for Paid Memberships Pro
*/
function pmpro_send_member_notification( $user_id ) {
$pmproemail = new PMProEmail();
$pmproemail->sendCheckoutEmail( get_userdata( $user_id ) );
}
add_action( 'pmpro_add_member_added', 'pmpro_send_member_notification', 10, 2 );
@femiyb
femiyb / disable_registration_based_on_rh_fields_value.php
Last active September 30, 2019 10:53
Disable Registration based on Register Helper field value
<?php
/*
Disable Registration based on Register Helper field value
Add this code to your active theme's functions.php or
a custom plugin.
*/
function my_pmpro_registration_checks($okay)
{
//only check if things are okay so far
if($okay)
@femiyb
femiyb / pmpro_redirect_after_checkout.php
Created October 8, 2019 06:34
Redirect After Checkout
<?php
function my_pmpro_confirmation_url($rurl, $user_id, $pmpro_level)
{
$rurl = 'http://google.com'; //change this URL
return $rurl;
}
add_filter('pmpro_confirmation_url', 'my_pmpro_confirmation_url', 10, 3);
@femiyb
femiyb / billing-fields-optional.php
Last active October 10, 2019 13:27 — forked from andrewlimaza/billing-fields-optional.php
Make billing details optional for Paid Memberships Pro
<?php
//add lines 4-15 to your custom plugin or functions.php of your active theme
function pmpro_remove_bfields( $pmpro_required_billing_fields ){
//remove field ID's from array to make fields required
$remove_field = array('bphone');
//loop through the $remove_field array and unset each billing field to make it optional.
foreach($remove_field as $field){