Skip to content

Instantly share code, notes, and snippets.

Avatar
🏕️
Working from home

Champ Camba champsupertramp

🏕️
Working from home
View GitHub Profile
@champsupertramp
champsupertramp / gist:d3e252763eb0adf9fe7b
Last active Nov 13, 2017 — forked from vxnick/gist:380904
Array of country codes (ISO 3166-1 alpha-2) and corresponding names
View gist:d3e252763eb0adf9fe7b
<?php
$countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
@champsupertramp
champsupertramp / currency_list
Last active Sep 21, 2021 — forked from MindaugasR/currency_list
World Currency list in PHP Array
View currency_list
array (
'ALL' => 'Albania Lek',
'AFN' => 'Afghanistan Afghani',
'ARS' => 'Argentina Peso',
'AWG' => 'Aruba Guilder',
'AUD' => 'Australia Dollar',
'AZN' => 'Azerbaijan New Manat',
'BSD' => 'Bahamas Dollar',
'BBD' => 'Barbados Dollar',
'BDT' => 'Bangladeshi taka',
@champsupertramp
champsupertramp / currency_symbols.php
Last active Aug 31, 2015 — forked from gibbs/currency_symbols.php
An array of currency symbols as HTML entities
View currency_symbols.php
<?php
$currency_symbols = array(
'AED' => '&#1583;.&#1573;', // ?
'AFN' => '&#65;&#102;',
'ALL' => '&#76;&#101;&#107;',
'AMD' => '',
'ANG' => '&#402;',
'AOA' => '&#75;&#122;', // ?
'ARS' => '&#36;',
'AUD' => '&#36;',
@champsupertramp
champsupertramp / gist:e412635fee8701c759f7
Created Nov 9, 2015
Ultimate Member: Social Login – Redirecting to homepage, and not logging in or registering or CSRF tokens/state mismatch
View gist:e412635fee8701c759f7
/**
*** If you're using a custom WordPress theme, one of the possible causes of the issue is ' Post Relational Links ' added in the Header
*** ( https://developer.wordpress.org/reference/functions/adjacent_posts_rel_link/ )
** This feature loads pages in the background process and it causes the register page to load multiple times.
** It reloads the Social Tokens again and causes mismatch session keys during authentication
**
**/
remove_action('wp_head', 'start_post_rel_link', 10, 0 );
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
View Ultimate Member - Override default avatar
<?php
/***
*** @Dettach um default avatar
***/
add_filter('avatar_defaults', 'um_avatar_defaults', 99999 );
function um_avatar_defaults($avatar_defaults) {
remove_filter('get_avatar', 'um_get_avatar', 99999, 5);
return $avatar_defaults;
}
View Ultimate Member - Redirect after saving profile
<?php
/**
* @um_user_after_updating_profile
*/
function doggycom_redirect_after_updating_profile( $to_update ){
exit( wp_redirect( remove_query_arg( array('profiletab','um_action') ) ) );
}
add_action('um_user_after_updating_profile','doggycom_redirect_after_updating_profile',10,1);
?>
View Ultimate Member - Fix broken images in wall posts after updating profile
/**
* @detach action 'um_remove_unused_uploads'
*/
function detach_um_remove_unused_uploads( $arg ){
remove_action('um_after_user_upload','um_remove_unused_uploads', 10 );
}
add_action('um_after_user_updated','detach_um_remove_unused_uploads',10,1);
View Ultimate Member - Remove UM default avatar
<?php
/***
*** @Do not apply to backend default avatars
***/
add_filter('avatar_defaults', 'um_avatar_defaults', 99999 );
function um_avatar_defaults($avatar_defaults) {
remove_filter('get_avatar', 'um_get_avatar', 99999, 5);
return $avatar_defaults;
}
?>
View Ultimate Member - Get user avatar uri
<?php
/***
*** @Get user avatar uri
***/
// Call ultimatemember global variable
global $ultimatemember;
$user_id = 1;
// Set user ID
View Ultimate Member - Sanitize fields
<?php
/**
* Custom sanitization of fields
*/
add_filter('um_profile_field_filter_hook__','my_custom_sanitize_fields', 99, 2 );
function my_custom_sanitize_fields( $value, $data ){
// Add tags to mail value
if ( !is_array( $value ) ) {