This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| var getUrlParams = function() { | |
| var params = {}, hash; | |
| var hashes = decodeURI(window.location.href).replace(/\+/g," ").slice(window.location.href.indexOf('?') + 1).split('&'); | |
| for (var i=0; i<hashes.length; i++) { | |
| hash = hashes[i].split('='); | |
| params[hash[0]] = hash[1]; | |
| } | |
| return params; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Copyright 2011 Martin Hawksey | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| PMPro Example Offering Monthly and Annual Options on Checkout Page | |
| This code assumes your levels have an annual recurring cost. | |
| The first function converts your annual prices into monthly prices. | |
| */ | |
| function my_getMonthlyPriceFromAnnualPrice($price) | |
| { | |
| //divide by 10 and round down to nearest dollar | |
| return floor($price / 10); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Requires PMPro v1.4+ | |
| Code to delete WP user accounts when a member cancels their PMPro account. | |
| Users are not deleted if: | |
| (1) They are not cancelling their membership (i.e. $level_id != 0) | |
| (2) They are an admin. | |
| (3) The level change was initiated from the WP Admin Dashboard | |
| (e.g. when an admin changes a user's level via the edit user's page) | |
| */ | |
| function my_pmpro_after_change_membership_level($level_id, $user_id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| This code will redirect users from the default PMPro confirmation page to a specific page depending on their level. | |
| Set the confirmation_pages array. Array keys should be membership level ids and the values are the page ids. So array(1=>2) will redirect membership level with id = 1 to the page with id = 2. | |
| */ | |
| function my_pmpro_confirmation_redirect() | |
| { | |
| $confirmation_pages = array(1 => 2); //change this use your membership level ids and page ids | |
| global $pmpro_pages; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: Remote Login | |
| Description: Log into the site with creds that work on remote site (as defined in plugin). The remote site must have XML-RPC enabled. | |
| Author: Kailey Lampert | |
| Author URI: http://kaileylampert.com/ | |
| THIS IS NOT COMPLETE - DO NOT USE IN PRODUCTION | |
| The remote site (defined below in $server) is the "master" site. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Run this code on 'after_theme_setup', when plugins have already been loaded. | |
| add_action('after_setup_theme', 'my_load_plugin'); | |
| // This function loads the plugin. | |
| function my_load_plugin() { | |
| // Check to see if your plugin has already been loaded. This can be done in several | |
| // ways - here are a few examples: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Customize Adjacent Post Link Order | |
| */ | |
| function my_custom_adjacent_post_where($sql) { | |
| if ( !is_main_query() || !is_singular() ) | |
| return $sql; | |
| $the_post = get_post( get_the_ID() ); | |
| $patterns = array(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Set levels as "all access levels" so members of these levels will be able to view all Addon Packages. | |
| Requires Paid Memberships Pro and the pmpro-addon-packages plugin. | |
| */ | |
| function my_pmproap_all_access_levels($levels, $user_id, $post_id) | |
| { | |
| //I'm just adding the level, but I could do some calculation based on the user and post id to programatically give access to content | |
| $levels = array(16); | |
| return $levels; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function pw_edd_license_length( $length, $payment_id, $download_id, $license_id ) { | |
| if( $download_id == 14 ) | |
| return '+2 year'; // give a 2 year expiration for product ID 14 | |
| return '+1 year'; // this is default | |
| } | |
| add_filter( 'edd_sl_license_exp_length', 'pw_edd_license_length', 10, 4 ); |
OlderNewer