Skip to content

Instantly share code, notes, and snippets.

@xujiaao
xujiaao / android-set-ntp-server.md
Last active April 17, 2024 03:40
Set the NTP server of your android device
tags
Android
Android Things

Set the NTP server of your android device

@developius
developius / README.md
Last active February 29, 2024 20:24
Setup SSH keys for use with GitHub/GitLab/BitBucket etc

Create a new repository, or reuse an existing one.

Generate a new SSH key:

ssh-keygen -t rsa -C "your_email@example.com"

Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings (https://github.com/settings/keys).

Test SSH key:

@strangerstudios
strangerstudios / pmpro_is_page.php
Last active January 22, 2024 17:08
Tests to check if you are on certain PMPro pages.
<?php
global $pmpro_pages, $pmpro_level;
if(is_page($pmpro_pages['levels'])) {
//on the pricing/levels page
}
if(is_page($pmpro_pages['checkout'])) {
//on the checkout page
}
@kimcoleman
kimcoleman / elementor_compatibility_for_pmpro.php
Last active October 26, 2023 08:40
Ensure Paid Memberships Pro compatibility when using the Elementor Page Builder.
<?php
/**
* Ensure Paid Memberships Pro compatibility when using the Elementor Page Builder:
* https://wordpress.org/plugins/elementor/
*
* Your administrator-level account must have a Membership Level in order to edit all of the pages assigned
* under Memberships > Pages.
*
* You must also set a Custom Field on the Membership Checkout page with the key 'pmpro_default_level' and
* value of a level ID in order to properly edit your Membership Checkout page using Elementor.
@kimcoleman
kimcoleman / my_pmpro_payment_method.css
Last active October 12, 2023 19:48 — forked from strangerstudios/my_pmpro_payment_method.css
Adds credit card logos and a PayPal logo to the "Select Payment Method" box on membership checkout.
/* CSS Document */
#pmpro_payment_method span a {
background-position: left bottom;
background-size: contain;
background-repeat: no-repeat;
display: inline-block;
margin-left: 1%;
max-width: 300px;
padding-bottom: 60px;
text-align: left;
@strangerstudios
strangerstudios / pmpro-disable-all-emails.php
Created September 7, 2012 16:24
Disable All PMPro Emails
<?php
/*
Plugin Name: PMPro Disable All Emails
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-disable-all-emails/
Description: Disable All PMPro Emails
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
Add this file to your /wp-content/plugins/ folder and then activate it from the Plugins page in your WP admin.
@andrewlimaza
andrewlimaza / filter-woo-store-membership-levels-pmpro.php
Last active February 21, 2023 11:43
Filter your WooCommerce store according to membership level for Paid Memberships Pro.
<?php
/**
* This code recipe will allow you to hide products on the shop page by their category according to user's membership levels.
* This example uses category-1, category-2 and category-3 as category examples.
* This code will also stop users from purchasing products if they manage to find these products directly.
* Add this code (from line 2) to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
/**
@andrewlimaza
andrewlimaza / show-renewal-link-on-30-days-or-less.php
Last active January 23, 2023 13:47
Change when to show the renewal link on Paid Memberships Pro account page.
@strangerstudios
strangerstudios / pmprobuddy_update_user_meta.php
Last active October 18, 2022 20:48
Sync WordPress user meta fields (e.g. those added by PMPro Register Helper) with BuddyPress profile fields.
/*
Sync PMPro fields to BuddyPress profile fields.
*/
function pmprobuddy_update_user_meta($meta_id, $object_id, $meta_key, $meta_value)
{
//make sure buddypress is loaded
do_action('bp_init');
//array of user meta to mirror
$um = array(
@strangerstudios
strangerstudios / my_pmpro_checkout_level_extend_memberships.php
Last active October 12, 2022 11:39
By default PMPro will only "extend" a membership level if you checkout for the same level. This code will make it so PMPro extends any expiring level with any new expiring level. E.g. if you change from a annual plan to a monthly plan it will add 30 days to the end of your existing membership.
<?php
/*
If checking out for ANY level with an expiration, add remaining days to the enddate.
Pulled in from: https://gist.github.com/3678054
*/
function my_pmpro_checkout_level_extend_memberships($level)
{
global $pmpro_msg, $pmpro_msgt, $current_user;
//does this level expire? are they an existing members with an expiration date?