Skip to content

Instantly share code, notes, and snippets.

View andrewlimaza's full-sized avatar

Andrew Lima andrewlimaza

View GitHub Profile
@andrewlimaza
andrewlimaza / init_session_var_test.php
Last active April 21, 2020 08:07 — forked from strangerstudios/init_session_var_test.php
Testing if $_SESSION variables work in WordPress/PHP. Test session
function init_session_var_test()
{
//must set /?sessiontest=SOMETHING to get this to run
if(empty($_REQUEST['sessiontest']))
return;
//start session
if (version_compare(phpversion(), '5.4.0', '>=')) {
if (session_status() == PHP_SESSION_NONE)
session_start();
@andrewlimaza
andrewlimaza / jquery-datepicker-wp-admin
Created July 24, 2017 10:59 — forked from slushman/jquery-datepicker-wp-admin
How to Add the jQuery UI Datepicker to the WordPress Admin
/**
* Adds the datepicker settings to the admin footer.
* Only loads on the plugin-name settings page
*/
function admin_footer() {
$screen = get_current_screen();
if ( $screen->id == 'settings_page_plugin-name' ) {
<?php
/*
* Load iFlyChat Support or Chatroom for Members in Level 1 and 2 Only
* Update line 11 with your Membership Level IDs
*/
function my_pmpro_iflychat_check_access_filter($access) {
$access = true;
/** Get current user information **/
global $current_user;
wp_get_current_user();
@andrewlimaza
andrewlimaza / show_pmpro_address_fields_on_edit_profile.php
Last active April 18, 2017 07:12 — forked from strangerstudios/show_pmpro_address_fields_on_edit_profile.php
Use PMPro Register Helper to add PMPro Billing Address fields to the edit user page for admins or users.
/*
Use PMPro Register Helper to add PMPro Billing Address fields to the edit user page for admins.
*/
function show_pmpro_address_fields_on_edit_profile()
{
//require PMPro and PMPro Register Helper
if(!defined('PMPRO_VERSION') || !defined('PMPRORH_VERSION'))
return;
$address_fields = array(
@andrewlimaza
andrewlimaza / gist:0eff5977c9aa188bd001fdd9d0a00d85
Created October 20, 2016 13:45 — forked from r-a-y/gist:5578432
Disable BuddyPress' registration and use WP's instead. Paste this in /wp-content/plugins/bp-custom.php.
/**
* Disables BuddyPress' registration process and fallsback to WordPress' one.
*/
function my_disable_bp_registration() {
remove_action( 'bp_init', 'bp_core_wpsignup_redirect' );
remove_action( 'bp_screens', 'bp_core_screen_signup' );
}
add_action( 'bp_loaded', 'my_disable_bp_registration' );
@andrewlimaza
andrewlimaza / decode_html_entities.js
Created October 7, 2016 09:38 — forked from DylanCodeCabin/decode_html_entities.js
Decodes html entities back to normal html
function decodeHtmlEntities(str) {
console.log(str);
var special = {
"&lt;" : "<",
"&gt;" : ">",
"&quot;" : '"',
"&apos;" : "'",
"&#039;" : "'",
"&amp;" : "&",
"\\" : ""