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 | |
add_action('user_register', 'keyy_auto_send_qr_on_signup', 10, 1); | |
function keyy_auto_send_qr_on_signup($user) { | |
$keyy = Keyy_Login_Plugin_Premium(); | |
$user_obj = get_user_by('id', $user); | |
$keyy->user_send_connection_code($user_obj, 30); | |
} |
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
/* | |
Plugin Name: Custom Upload Dirs | |
Description: Changes the upload directory to what we would like, instead of what WordPress likes. | |
Author: Mark | |
Version: 1.0 | |
Author URI: http://google.com | |
*/ | |
add_action( 'init', 'change_upload_dir' ) ; |
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 sv_free_checkout_fields() { | |
global $woocommerce ; | |
// Bail we're not at checkout, or if we're at checkout but payment is needed | |
if ( ! is_checkout() || ( is_checkout() && WC()->cart->needs_payment() ) ) { | |
return; | |
} |
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 | |
/* | |
Plugin Name: Keyy compat fix for Jetpack | |
*/ | |
add_action('plugins_loaded', 'keyy_compat'); | |
function keyy_compat() { | |
if ( is_multisite() && ! is_main_site() ) { | |
switch_to_blog( $this->get_main_blog_id() ); |
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
class PRELOAD_FULLPAGE_CACHE | |
{ | |
function __construct() { | |
add_action( 'wp_insert_post', array( $this, 'preload_desktop' ), 900, 3 ); // let's fetch the post very late | |
add_action( 'wp_insert_post', array( $this, 'preload_mobile' ), 990, 3 ); // let's fetch mobile version even later | |
add_action( 'wp_insert_post', array( $this, 'preload_amp' ), 999, 3 ); // let's fetch AMP version at last; only works on posts | |
} | |
// verison to fetch: desktop | |
// user-agent: Chrome 62 on a macOS Sierra 10.12.6 |
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 | |
class Staged_Sleep_Task extends Updraft_Task_1_0 { | |
public function initialise() { | |
$sleep_for = $this->get_random_time_intervals(); | |
$this->update_option('sleep_for', $sleep_for); | |
} | |
public function run() { |
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( 'user_register', 'add_user_to_network_sites', 10, 1 ); | |
function add_user_to_network_sites( $user_id ) { | |
// Put sites here | |
$blogs = array ( 1 ,2 ,3 ,5 ,8) ; | |
foreach ( $blogs as $blog_id ) : | |
add_user_to_blog( $user_id, $blog_id , 'subscriber' ); | |
endforeach; |
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_filter('bp_member_avatar', 'bp_role_in_class'); | |
function bp_role_in_class( $args ) { | |
global $members_template ; | |
$user = new WP_User( $members_template->member->id ); | |
if ( !empty( $user->roles ) && is_array( $user->roles ) ) { | |
foreach ( $user->roles as $role ) | |
$args['class'] .= " " . $role; |
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('ms_gateway_cancel_membership', 'm2_delete_user', 999, 1) ; | |
function m2_delete_user( $sub ) { | |
wp_delete_user( $sub->user_id ); | |
} |
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
$api = ms_api(); | |
$member = $api->get_current_member(); | |
| |
// Check if current user is in certain membership: | |
$membership_id = 100; // hardcode the ID. | |
$membership_id = $api->get_membership_id( 'premium' ); // fetch by membership name. | |
if ( $member->has_membership( $membership_id ) ) { | |
echo "You are member of " . $membership_id; | |
} | |
|