Skip to content

Instantly share code, notes, and snippets.

Femi YB femiyb

Block or report user

Report or block femiyb

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
@femiyb
femiyb / pmpro_rh.php
Created Apr 8, 2020
Help with Adding Checkbox to Form
View pmpro_rh.php
<?php
/**
* This example is to show you the 'niche' options each Paid Memberships Pro - Register Helper Add-on field can take and how to use it.
* For more information on the Register Helper Add-on please visit https://www.paidmembershipspro.com/add-ons/free-add-ons/pmpro-register-helper-add-checkout-and-profile-fields/
**/
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
View translate-pmpro.php
<?php
// Please add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
function my_pmpro_translate_to_french($translated_text, $original_text, $domain) {
switch ( $translated_text ) {
case 'My Memberships' :
$translated_text = __( 'Change this.', 'paid-memberships-pro' );
break;
}
View hide_fname_lname.php
<?php // Do NOT copy this line
/* Copy from below this line */
function pmpro_remove_bfields( $pmpro_required_billing_fields ){
//remove field ID's from array to make fields required
$remove_field = array('bfirstname', 'blastname');
//loop through the $remove_field array and unset each billing field to make it optional.
View add_role.php
<?php
function action_pmpro_after_change_membership_level( $level_id, $user_id )
{
$user = get_userdata($user_id);
$role_levels = array(1,2,3);
if(in_array($level_id, $role_levels))
{
$user->add_role( 'subscriber' );
@femiyb
femiyb / remove-custom-trial-for-existing-members.php
Last active Feb 26, 2020 — forked from andrewlimaza/remove-custom-trial-for-existing-members.php
Remove trial limit for existing members. [Paid Memberships Pro]
View remove-custom-trial-for-existing-members.php
<?php
/**
* Remove custom trial for existing members (when existing member changes levels/renews)
* Adjust the level ID on line 16 to match your needs.
* Add this code to your WordPress site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_level_adjustment( $level ) {
// Bail if the user currently doesn't have a membership level.
@femiyb
femiyb / add_new_role.php
Created Feb 21, 2020
Add new role on level change
View add_new_role.php
<?php
function action_pmpro_after_change_membership_level( $level_id, $user_id, $cancel_level )
{
$user = get_userdata($user_id);
if($level_id == 1)
{
$user->add_role( 'editor' );
}
View custom_fields_specific_memberships.php
<?php
function my_pmprorh_init() {
//don't break if Register Helper is not loaded
if(!function_exists( "pmprorh_add_registration_field" )) {
return false;
}
$fields = array();
$fields[] = new PMProRH_Field(
View pmpro_checkout_after_level_cost.php
<?php
/**
* Adds text after the level cost text.
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function add_text_before_submit() {
echo 'Add additional text here';
}
add_action( 'pmpro_checkout_after_level_cost', 'add_text_before_submit' );
@femiyb
femiyb / check_valid_date.php
Created Feb 14, 2020
Set default date and check valid date
View check_valid_date.php
<?php
/**
* PMPro Customization: Register Helper - Add date of birth date picker to checkout
*/
//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
View pmpro_check_age.php
<?php
/**
* add Register Helper
*/
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists( 'pmprorh_add_registration_field' )) {
return false;
}
You can’t perform that action at this time.