Skip to content

Instantly share code, notes, and snippets.

View champsupertramp's full-sized avatar
🏕️
Working from home

Champ Camba champsupertramp

🏕️
Working from home
View GitHub Profile
@champsupertramp
champsupertramp / gdpr-register.php ​
Created August 18, 2020 13:47
Ultimate Member - Open GDPR terms and condition link to a new tab
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
<!-- This file should primarily consist of HTML with a little bit of PHP. -->
<div class="um-field um-field-type_terms_conditions" data-key="use_terms_conditions_agreement" style="display:block;padding:0;">
<div class="um-field-area">
<?php $confirm = ! empty( $args['use_gdpr_agreement'] ) ? $args['use_gdpr_agreement'] : __( 'Please confirm that you agree to our privacy policy', 'ultimate-member' ); ?>
<label class="um-field-checkbox">
@champsupertramp
champsupertramp / um-terms-conditions-public-display.php
Last active August 18, 2020 14:30
Ultimate Member - Terms & Conditions : Open to a new tab instead of displaying the full content in the form
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
<div class="um-field um-field-type_terms_conditions" data-key="use_terms_conditions_agreement" style="display: block;padding:0px">
<div class="um-field-area">
<div class="um-terms-conditions-content" style="display:none">
<?php if ( ! empty( $args['use_terms_conditions_content_id'] ) ) {
if ( isset( $um_content_query ) ) { ?>
<a href="<?php echo get_the_permalink( $args['use_terms_conditions_content_id'] );?>" target="_blank" class="um-hide-terms">
<?php echo ! empty( $args['use_terms_conditions_toggle_hide'] ) ? $args['use_terms_conditions_toggle_hide'] : __( 'Hide Terms', 'um-terms-conditions' ); ?>
</a>
<?php echo apply_filters( 'um_terms_conditions_tc_page_content', $um_content_query->post_content, $args );
@champsupertramp
champsupertramp / Ultimate Member 2.1.6 - Open files in the current window
Created August 11, 2020 12:25
Ultimate Member 2.1.6 - Open files in the current window
<?php
/**
* Open files in the current window
* @author www.champ.ninja
*
**/
add_filter("um_profile_field_filter_hook__file","um_custom_profile_field_filter_hook__file", 100);
function um_custom_profile_field_filter_hook__file( $output ){
$output = str_replace("_blank","", $output );
return $output;
@champsupertramp
champsupertramp / Ultimate Member 2.3 - Mass update to add new role to content restrictions in all posts
Created July 28, 2020 08:05
Ultimate Member 2.3 - Mass update to add new role to content restrictions in all posts
add_action("template_redirect","um_custom_add_new_role_posts_restriction");
function um_custom_add_new_role_posts_restriction(){
$p_query = new WP_Query;
$posts = $p_query->query( array(
'post_type' => 'any',
'posts_per_page' => -1,
'fields' => 'ids'
) );
if ( ! empty( $posts ) ) {
@champsupertramp
champsupertramp / Social Login 2.3 - Enable WeChat authentication
Last active July 31, 2020 13:01
Social Login 2.3 - Enable WeChat authentication
add_filter("um_social_login_networks","um_sso_add_wechat_network", 10, 1 );
function um_sso_add_wechat_network( $networks ){
$networks["wechat"] = array(
'name' => __( 'WeChat', 'um-social-login' ),
'button' => __( 'Sign in with WeChat', 'um-social-login' ),
'color' => '#ffffff',
'bg' => '#444444',
'bg_hover' => '#000000',
'icon' => 'um-faicon-weixin',
@champsupertramp
champsupertramp / Ultimate Member - Custom Profile tab with custom link
Created June 6, 2020 07:40
Ultimate Member - Custom Profile tab with custom link
@champsupertramp
champsupertramp / profile-tab.php
Last active November 24, 2022 00:46
Ultimate Member - Custom Profile template without headers
<?php /* Template: Profile Tab */ ?>
<div class="um <?php echo $this->get_class( $mode ); ?> um-<?php echo $form_id; ?>">
<div class="um-form">
<?php
$edit = ( isset( $_GET['um_action'] ) && $_GET['um_action'] == 'edit' );
if ( $edit && ! isset( UM()->user()->cannot_edit ) ) {
echo '<form method="post" action="">';
}
@champsupertramp
champsupertramp / Ultimate Member - Private Messages - Hide Message button in current viewing profile for Specific User Role
Created May 20, 2020 16:14
Ultimate Member - Private Messages - Hide Message button in current viewing profile for Specific User Role
/** More UM tutorial at www.champ.ninja **/
function um_private_message_button_visiblity(){
if ( class_exists( 'UM_Messaging_API' ) && ! um_is_myprofile() ) { // Apply this logic when not in his own profile
$user_id = get_current_user_id();
um_fetch_user( $user_id );
if( um_user("role") == "free-tier-member" ){ // Hide member buttons from Free Tier roles
remove_action( 'um_profile_navbar', array( UM()->Messaging_API()->profile(), 'add_profile_bar' ), 5 );
@champsupertramp
champsupertramp / Ultimate Member Cron - Delete users awaiting email confirmation after 5 days without getting confirmed
Last active December 15, 2021 14:20
Ultimate Member Cron - Delete users awaiting email confirmation after 5 days without getting confirmed
/**
* More Ultimate Member tutorials at www.champ.ninja
*/
add_action( 'um_cron_delete_users_cron', 'um_delete_users_awaiting_email' );
function um_delete_users_awaiting_email(){
$args = array(
'fields' => 'ID',
'number' => -1,
'date_query' => array(
array( 'after' => '5 days ago midnight', 'inclusive' => true ),
@champsupertramp
champsupertramp / Ultimate Member Private Messaging - Email recipients everytime there's a new message in chat
Created May 18, 2020 13:41
Ultimate Member Private Messaging - Email recipients everytime there's a new message in chat
/**
* Author: Champ
* Website: www.champ.ninja
*/
function um_custom_messaging_user_got_message($to, $from, $conversation_id ){
if ( ! UM()->Messaging_API()->api()->enabled_email( $to, '_enable_reminder_pm' ) ) {
return;
}
remove_action( 'um_after_existing_conversation', 'um_messaging_user_got_message', 20, 3 ); // Remove the original email notification with timestamp