Skip to content

Instantly share code, notes, and snippets.

Avatar
🏕️
Working from home

Champ Camba champsupertramp

🏕️
Working from home
View GitHub Profile
@champsupertramp
champsupertramp / Ultimate Member - Account Activation Email Template
Created Sep 15, 2021
Ultimate Member - Account Activation Email Template
View Ultimate Member - Account Activation Email Template
<div style="max-width: 560px; padding: 20px; background: #ffffff; border-radius: 5px; margin: 40px auto; font-family: Open Sans,Helvetica,Arial; font-size: 15px; color: #666;">
<div style="color: #444444; font-weight: normal;">
<div style="text-align: center; font-weight: 600; font-size: 26px; padding: 10px 0; border-bottom: solid 3px #eeeeee;">{site_name}</div>
<div style="clear: both;"> </div>
</div>
<div style="padding: 0 30px 30px 30px; border-bottom: 3px solid #eeeeee;">
<div style="padding: 30px 0; font-size: 24px; text-align: center; line-height: 40px;">Thank you for signing up!Please click the following link to activate your account.</div>
<div style="padding: 10px 0 50px 0; text-align: center;"><a style="background: #555555; color: #fff; padding: 12px 30px; text-decoration: none; border-radius: 3px; letter-spacing: 0.3px;" href="{account_activation_link}">Activate your Account</a></div>
<div style="padding: 15px; background: #eee; border-radius: 3px; text-align: center;">Need help? <a style="color: #
@champsupertramp
champsupertramp / Pre and Post Title for custom Display name in UItimate Member
Created Sep 13, 2021
Pre and Post Title for custom Display name in UItimate Member
View Pre and Post Title for custom Display name in UItimate Member
add_filter("um_user_display_name_filter",function( $value, $user_id ){
if( um_is_core_page('user') ){
preg_match_all('`"([^"]*)"`', $value, $results);
$pre_title = serialize( [ str_replace('"',"", $results[0][0] ) ] );
$post_title = serialize( [ str_replace('"',"", $results[0][1] ) ] );
$value = str_replace( $pre_title, str_replace('"',"", $results[0][0] ), $value );
$value = str_replace( $post_title, str_replace('"',"", $results[0][1] ), $value );
@champsupertramp
champsupertramp / Modify change passwords requirements( minimum & maximum )
Created Aug 24, 2021
Modify change passwords requirements( minimum & maximum )
View Modify change passwords requirements( minimum & maximum )
add_action( 'um_change_password_errors_hook','um_081821_change_password_errors_hook', 1 );
function um_081821_change_password_errors_hook( $args ){
if ( strlen( utf8_decode( $args['user_password'] ) ) < 12 ) {
UM()->form()->add_error( 'user_password', __( 'Your password must contain at least 12 characters', 'ultimate-member' ) );
}
if ( strlen( utf8_decode( $args['user_password'] ) ) > 15 ) {
UM()->form()->add_error( 'user_password', __( 'Your password must contain less than 15 characters', 'ultimate-member' ) );
}
@champsupertramp
champsupertramp / Display Specific Profile with a Shortcode on a Page
Created Aug 23, 2021
Display Specific Profile with a Shortcode on a Page
View Display Specific Profile with a Shortcode on a Page
/**
* Sample usage: [um_embed_profile user_id="123" form_id="3"]
*/
add_shortcode("um_embed_profile","um_082321_embed_specific_profile");
function um_082321_embed_specific_profile( $atts ){
$atts = shortcode_atts( array(
'user_id' => get_current_user_id(),
'form_id' => 0,
), $atts );
View Site language custom field
function um_051221_site_locale(){
$arr = [
"en" => "English (United States)",
'cs_CZ' => "Čeština",
'es_AR' => "Español de Argentina",
];
return $arr;
}
@champsupertramp
champsupertramp / Ultimate Member - Account form Image upload function
Last active Jun 2, 2021
Ultimate Member - Account form Image upload function
View Ultimate Member - Account form Image upload function
/**
* Tutorial: https://www.champ.ninja/2020/05/add-a-custom-account-tab-with-profile-form-fields/
*/
add_filter("um_user_pre_updating_files_array", function($files ){
$user_id = get_current_user_id();
if( empty( $user_id ) ) return $files;
$new_files = array();
@champsupertramp
champsupertramp / Ultimate Member - show tabs at the last tab
Created Mar 23, 2021
Ultimate Member - show tabs at the last tab
View Ultimate Member - show tabs at the last tab
add_filter("um_user_profile_tabs", function( $tabs ){
$arr_followers = $tabs['followers'];
$arr_following = $tabs['following'];
unset( $tabs['followers'] );
unset( $tabs['following'] );
$tabs['followers'] = $arr_followers;
@champsupertramp
champsupertramp / Ultimate Member Profile Tabs with Contact Form 7
Last active Feb 19, 2021
Ultimate Member Profile Tabs with Contact Form 7
View Ultimate Member Profile Tabs with Contact Form 7
add_filter( 'wpcf7_mail_components', 'um_020821_change_email_to_profile_owner_email', 10, 3 );
function um_020821_change_email_to_profile_owner_email( $args, $contact_form, $class){
if ( class_exists( '\WPCF7_Submission' ) ) {
$submission = \WPCF7_Submission::get_instance();
$page = $submission->get_meta( 'container_post_id' );
if ( intval( UM()->options()->get( 'core_user' ) ) == intval( $page ) ) {
if ( ! empty( $_REQUEST['_wpcf7_um_profile_id'] ) ) {
$user = get_user_by( 'ID', absint( $_REQUEST['_wpcf7_um_profile_id'] ) );
if ( ! is_wp_error( $user ) && isset( $user->user_email ) && is_email( $user->user_email ) ) {
@champsupertramp
champsupertramp / Ultimate Member - Password Reset Link in Welcome Email
Last active Jan 6, 2021
Ultimate Member - Password Reset Link in Welcome Email
View Ultimate Member - Password Reset Link in Welcome Email
@champsupertramp
champsupertramp / Ultimate Member - Shortcode for Login URL with redirect in Global Access Message
Last active Dec 15, 2020
Ultimate Member - Shortcode for Login URL with redirect in Global Access Message
View Ultimate Member - Shortcode for Login URL with redirect in Global Access Message
/**
* Add a shortcode to display the Login URL with redirection URL
* e.g. http://www.yoursite.com/login/?redirect_to=http://www.yoursite.com/content-restriction/
* www.champ.ninja
*/
add_shortcode("um_login_redirect","um_login_redirect",10, 2 );
function um_login_redirect( $atts, $content ){
global $wp;