This file contains 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 member start date to their user registered date instead of membership start date. | |
*/ | |
function my_pmpro_member_startdate($timestamp, $user_id) | |
{ | |
$user = get_userdata($user_id); | |
return strtotime($user->user_registered); | |
} | |
add_filter('pmpro_member_startdate', 'my_pmpro_member_startdate', 10, 2); |
This file contains 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 custom_pmpro_getMemberStartdate($timestamp, $user_id, $level_id) | |
{ | |
global $wpdb; | |
//get timestamp | |
$sqlQuery = "SELECT UNIX_TIMESTAMP(startdate) FROM $wpdb->pmpro_memberships_users WHERE user_id = '" . esc_sql($user_id) . "' ORDER BY id LIMIT 1"; | |
$timestamp = $wpdb->get_var($sqlQuery); | |
//convert to 6am | |
$datetime = date("Y-m-d", $timestamp) . " 06:00"; |
This file contains 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
/* | |
Make sure people use their Minecraft username when registering. | |
*/ | |
//uses Minecraft website to test a username and returns true or false | |
function mc_isMinecraftUsername($username, $force = false) | |
{ | |
global $premium_minecraft_usernames; | |
if(!is_array($premium_minecraft_usernames)) | |
$premium_minecraft_usernames = array(); |
This file contains 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 xmlrpc_template($template) | |
{ | |
if($_SERVER['SCRIPT_NAME'] == "/xmlrpc.php") | |
return "twentyten"; | |
else | |
return $template; | |
} | |
add_filter('template', 'xmlrpc_template'); | |
add_filter('option_template', 'xmlrpc_template'); | |
add_filter('option_stylesheet', 'xmlrpc_template'); |
This file contains 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
#Back up first. USE AT YOUR OWN RISK | |
TRUNCATE TABLE `wp_pmpro_memberships_users`; | |
TRUNCATE TABLE `wp_pmpro_membership_orders`; | |
TRUNCATE TABLE `wp_pmpro_discount_codes_uses`; |
This file contains 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 | |
/** | |
* Define the XMLRPC Methods We Add | |
* Since v2.0 | |
*/ | |
add_filter('xmlrpc_methods', 'pmpro_xmlrpc_methods'); | |
function pmpro_xmlrpc_methods($methods) | |
{ | |
$methods['pmpro.getMembershipLevelForUser'] = 'pmpro_xmlrpc_getMembershipLevelForUser'; | |
$methods['pmpro.hasMembershipAccess'] = 'pmpro_xmlrpc_hasMembershipAccess'; |
This file contains 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 | |
/** | |
* API method to check if a user has access to a certain post. | |
* Since v2.0 | |
*/ | |
function pmpro_xmlrpc_hasMembershipAccess($args) | |
{ | |
// Parse the arguments, assuming they're in the correct order | |
$username = $args[0]; | |
$password = $args[1]; |
This file contains 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 | |
function my_init_test() | |
{ | |
//check for ?test=1 or do nothing | |
if(empty($_REQUEST['test'])) | |
return; | |
//user id to test | |
$remote_user_id = 1; | |
This file contains 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
NameVirtualHost *:80 | |
<VirtualHost *:80> | |
ServerAdmin email@domain.com | |
ServerName domain1.com | |
ServerAlias www.domain1.com | |
DocumentRoot /var/www/vhosts/domain1.com/httpdocs/ | |
ErrorLog /var/www/vhosts/domain1.com/logs/error.log | |
CustomLog /var/www/vhosts/domain1.com/logs/access.log combined | |
</VirtualHost> |
This file contains 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
add_action( 'ninja_forms_email_admin', 'ninja_forms_change_from_address' ); | |
function ninja_forms_change_from_address(){ | |
global $ninja_forms_processing; | |
if( 1 == $ninja_forms_processing->get_form_ID() ) { | |
$user_email = $ninja_forms_processing->get_field_value( 2 ); | |
$user_name = $ninja_forms_processing->get_field_value( 1 ); | |
$ninja_forms_processing->update_form_setting( 'email_from', $user_email ); | |
$ninja_forms_processing->update_form_setting( 'email_from_name', $user_name ); | |
} | |
} |