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 / redirect_users_after_login.php
Last active July 20, 2021 09:31 — forked from andrewlimaza/redirect_users_after_login.php
Redirect Users After Login For WordPress
<?php
/**
* 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
* Visit https://yoohooplugins.com for more tutorials.
*/
function yh_redirect_after_login( $redirect_to, $request, $user ) {
if ( isset( $user->roles ) && is_array( $user->roles ) ) {
@femiyb
femiyb / custom-level-text-per-level-id.php
Created July 12, 2021 00:52 — forked from ipokkel/custom-level-text-per-level-id.php
Change level name and page title for a specific level checkout
<?php
function my_custom_level_cost_text( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Membership Level':
$translated_text = __( 'My Membership Level Name', 'paid-memberships-pro' );
break;
}
@femiyb
femiyb / my-pmpro-change-seat-to-student.php
Last active January 13, 2022 19:33 — forked from andrewlimaza/my-pmpro-change-seat-to-member.php
Change the word "Seat(s)" to "student(s)" for Paid Memberships Pro Sponsored Members Add On.
<?php
/**
* This will change all instances of seat(s) to student(s) for the Sponsored Members Add On - https://www.paidmembershipspro.com/add-ons/pmpro-sponsored-members/
* Add the code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_change_seat_to_student( $output_text, $input_text, $domain ) {
if ( 'pmpro-sponsored-members' === $domain ) {
$output_text = str_replace( 'seats', 'students', $output_text );
$output_text = str_replace( 'Seats', 'Students', $output_text );
@femiyb
femiyb / change-pmpro-reply-to.php
Last active July 8, 2021 08:50 — forked from andrewlimaza/change-pmpro-reply-to.php
Change the "Reply-To" for emails sent to admin [Paid Memberships Pro]
<?php
/**
* Add this code to your PMPro Customizations Plugin or via a code snippets plugin.
*/
function my_pmpro_adjust_reply_to_email( $headers, $email ) {
// Add "Reply-To" header and set it to the user that just cancelled.
if( strpos($email->template, "_admin")) {
$headers[] = "Reply-To: " . $email->data['user_email'];
@femiyb
femiyb / custom_pmpro_upcoming_recurring_payment_reminder.php
Last active June 23, 2021 08:58 — forked from michaelbeil/custom_pmpro_upcoming_recurring_payment_reminder.php
Filter to modify the days prior to renewal that the Recurring Payment Email Reminders Add On sends members the membership_recurring email notifcation.
<?php
/**
* Filter to modify the days prior to renewal that the Recurring Payment Email Reminders Add On
* sends members the membership_recurring email notifcation.
*
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function custom_pmpro_upcoming_recurring_payment_reminder( $rec_array ) {
$rec_array = array ( 30 => 'membership_recurring', 7 => ' membership_recurring' );
return $rec_array;
@femiyb
femiyb / my_pmpro_replace_mail_emailandusername.php
Last active June 21, 2021 07:34 — forked from MaryOJob/my_pmpro_replace_mail_emailandusername.php
Replace "Email Address" with "Username or Email Address" on PMPro Login Form
<?php // Do not copy this line please. Copy from below.
/**
* This filter will search your codebase for translatable strings and replace when an exact match is found.
* Replace "Email Address" with "Username or Email Address" on PMPro Login Form
* Add this code to your PMPro Customizations Plugin: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
add_filter( 'the_content', 'register_text', 25 );
@femiyb
femiyb / sequential-numeric-member-number.php
Last active August 12, 2021 17:24 — forked from ipokkel/sequential-numeric-member-number.php
Create sequential membership numbers. Display on user account page, edit profile page,memberslist page and membership card and include in memberslist csv export.
<?php
/**
* Sequential Member Numbers
* Member numbers are automatically increased from the value set for $starting_member_number after each member registration
*
* Add this code to your PMPro Customizations Plugin
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*
* Requirements:
@femiyb
femiyb / hide_discount_code_checkout.php
Created June 8, 2021 15:20 — forked from andrewlimaza/hide_discount_code_checkout.php
Hide Discount Code For PMPro Level
<?php
/**
* Hide discount code link on checkout for a specific level Paid Memberships Pro.
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Visit www.paidmembershipspro.com for more info.
*/
function pmpro_hide_discount_level_5() {
global $pmpro_pages;
@femiyb
femiyb / pmpro_move_name_fields.php
Created June 2, 2021 09:05 — forked from MaryOJob/pmpro_move_name_fields.php
This Code Gist Will Move the Fields in this order, First Name, Last Name, Email Address and Password When using the Code to Generate a username at PMPro checkout from email for users and hiding the username field with CSS - Links for this below
<?php // Do not Copy This Line
/**
* Add the following code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_move_name_fields() {
global $pmpro_pages;
?>
<script>
@femiyb
femiyb / disable-cf7-recaptcha.php
Created June 2, 2021 08:40 — forked from ipokkel/disable-cf7-recaptcha.php
Disable Contact Form 7's recaptcha on the checkout page for PMPro. #pmpro #paid-memberships-pro #wpcf7 #cf7 #recaptcha
<?php
/**
* This recipe stops Contact Form 7's recaptcha javascript from loading
* on the PMPro checkout page. This helps prevent conflicts from recaptcha
* being loaded twice.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/