Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
View GitHub Profile
@MaryOJob
MaryOJob / pmprowoo_redirect_member.php
Last active Dec 4, 2020 — forked from andrewlimaza/pmproc_redirect_member.php
Redirect logged in members on level "1" away from the Shop and Contact page, to a custom page you have created.
View pmprowoo_redirect_member.php
<?php // Do no copy this line
//Copy lines 5 onwards into your PMPro custom plugin -> http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
function pmprowoo_redirect_member(){
if( is_user_logged_in() && function_exists('pmpro_hasMembershipLevel') && pmpro_hasMembershipLevel() ){ //check if user is logged in, pmpro is installed and user has an active level.
global $current_user;
$current_user->membership_level = pmpro_getMembershipLevelForUser($current_user->ID); //get current users level ID
@MaryOJob
MaryOJob / my-pmprorh-avatar-and-logo.php
Last active Nov 27, 2020 — forked from ipokkel/my-pmprorh-avatar-and-logo.php
User avatar using PMPro Register Helper
View my-pmprorh-avatar-and-logo.php
<?php // Do NOT copy this line
/*
* Add WP User Avatar from Register Helper field during checkout.
*/
add_action( 'added_user_meta', 'my_updated_user_meta', 10, 4 );
add_action( 'updated_user_meta', 'my_updated_user_meta', 10, 4 );
function my_updated_user_meta( $meta_id, $user_id, $meta_key, $meta_value ) {
// Change user_avatar to your Register Helper file upload name.
@MaryOJob
MaryOJob / my_login_page_add_checkbox.php
Last active Nov 27, 2020
Add a Checkbox to Login Page on a WordPress Website
View my_login_page_add_checkbox.php
<?php // Do not copy this line please.
/*
* 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/
*/
// As part of WP authentication process, call our function
add_filter('wp_authenticate_user', 'wp_authenticate_user_acc', 10, 2);
function wp_authenticate_user_acc($user, $password) {
@MaryOJob
MaryOJob / my_pmpro_replace_mail_emailandusername.php
Last active Nov 6, 2020
Replace "Email Address" with "Username or Email Address" on PMPro Login Form
View my_pmpro_replace_mail_emailandusername.php
<?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( 'gettext', 'register_text' );
@MaryOJob
MaryOJob / adjust_pmpro_email_according_to_level.php
Created Nov 3, 2020 — forked from andrewlimaza/adjust_pmpro_email_according_to_level.php
Change confirmation email contents in Paid Memberships Pro according to user level checkout.
View adjust_pmpro_email_according_to_level.php
<?php
/**
* Adjust email template according to user's level that they are checking out for.
* Add this code to your PMPro Customizations plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* For more information in customizing emails in Paid Memberships Pro visit - https://www.paidmembershipspro.com/documentation/member-communications/customizing-email-templates/
* List of available email templates - https://www.paidmembershipspro.com/documentation/member-communications/list-of-pmpro-email-templates/
*/
function adjust_pmpro_email_according_to_level( $email ){
@MaryOJob
MaryOJob / my_pmpro_custom_fields_bio_profilepicture.php
Last active Nov 2, 2020
Added Custom Fields for Website, Profile Picture, & Syncing of Biographical Info field with Character Limit, all via Register Helper Add On (PMPro)
View my_pmpro_custom_fields_bio_profilepicture.php
<?php // Do not copy this tag please. Copy from below.
/**
* See the PMPro Register Helper readme for more information and examples: https://www.paidmembershipspro.com/documentation/register-helper-documentation/adding-fields/
* 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_default_wp_user_checkout_fields() {
if ( class_exists( 'PMProRH_Field' ) ) {
@MaryOJob
MaryOJob / my_pmpro_gift_level_2_example.php
Last active Oct 22, 2020
PMPro example configuration code for the Gift Membership Add-On (2)
View my_pmpro_gift_level_2_example.php
<?php // Do not copy this line please
/** PMPro Gift Levels Example - See full information here: https://www.paidmembershipspro.com/add-ons/pmpro-gift-levels
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* This example allows a member to check out on level 4 and after checkout, the member gets a code to give out that allows
* another user checkout on level 3, paying an initial amount of $100 for their membership which has no expiry date or recurring payment set
*/
global $pmprogl_gift_levels;
@MaryOJob
MaryOJob / my_pmpro_change_level_if_approved.php
Last active Oct 22, 2020
Change membership level on approval, if member is approved when using the Approvals Add On
View my_pmpro_change_level_if_approved.php
<?php // Do not copy this line
/**
* 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_pmpro_change_level_if_approved( $user_id, $level_id ) {
pmpro_changeMembershipLevel( 9, $user_id ); // where 9 is the level ID you want them changed to upon approval
}
@MaryOJob
MaryOJob / my_pmpro_custom_fields_character_limit.php
Created Oct 20, 2020
Add a Register Field TextArea field type which limits the number of characters Members can fill in
View my_pmpro_custom_fields_character_limit.php
<?php
/**
* See the PMPro Register Helper readme for more information and examples: https://www.paidmembershipspro.com/documentation/register-helper-documentation/adding-fields/
* 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/
*/
// We have to put everything in a function called on init, so we are sure Register Helper is loaded.
// Define the fields.
@MaryOJob
MaryOJob / my_wp_stay_on_edit_profile_page_after_adding_new_user.php
Last active Oct 15, 2020
Stay on the WordPress Edit User Profile Page After Adding A New User to your WordPress website
View my_wp_stay_on_edit_profile_page_after_adding_new_user.php
<?php // Do not copy this line
/**
* Source: https://wordpress.stackexchange.com/questions/242170/how-to-add-additional-information-to-a-user-on-user-creation
* 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/
*/
add_action('user_register','post_user_reg_redirect');
function post_user_reg_redirect( $user_id )
{
You can’t perform that action at this time.