Skip to content

Instantly share code, notes, and snippets.

Avatar
🏕️
Working from home

Champ Camba champsupertramp

🏕️
Working from home
View GitHub Profile
View Ultimate Member - Change date format in front-end
<?php
/**
* Change Date format in front-end
*/
add_filter('um_profile_field_filter_hook__date','my_custom_sanitize_fields', 9999, 2 );
function my_custom_sanitize_fields( $value, $data ){
global $ultimatemember;
if( $data['metakey'] == 'date-pickah' ){
$value = $ultimatemember->datetime->format( $value, "d M Y");
View Ultimate Member - Integrate Co-author plus plugin
<?php
/***
*** @integrate co-author plus with Ultimate Member
***/
function um_integrate_coauthor( $args ){
global $ultimatemember;
$posts_query = $ultimatemember->query->make('post_type=post&posts_per_page=12&offset=0&author_name=' . um_user('user_login') );
return $posts_query;
View Ultimate Member - Get User Meta
<?php
/***
*** @Get User Meta
***/
// You can set the user id to retrieve the meta key value
// global $ultimatemember;
// $ultimatemember->user->set( $user_ID );
echo um_user('first_name');
// You can check some useful meta keys/values that you can
// retrieve with the above function here: https://codex.wordpress.org/Function_Reference/get_userdata#Notes
@champsupertramp
champsupertramp / Ultimate Member - Custom Email Template
Last active Dec 15, 2016
Ultimate Member - Custom Email Template
View Ultimate Member - Custom Email Template
<?php
/***
*** Custom Email Template
****/
function um_custom_email_template(){
global $ultimatemember, $user_ID;
um_fetch_user( $user_ID );
@champsupertramp
champsupertramp / Ultimate Member - Add custom tab & section
Created Dec 8, 2015
Ultimate Member - Add custom tab & section
View Ultimate Member - Add custom tab & section
<?php
/**
* Add profile content for 'Pages' tab's section
* @param Array $args
* @hook Action 'um_profile_content_pages'
*/
function um_custom_add_profile_content_pages( $args ){
echo "Hello World";
}
add_action('um_profile_content_pages','um_custom_add_profile_content_pages',10,1);
@champsupertramp
champsupertramp / Ultimate Member - Submit Search form on Enter
Created Jan 6, 2016
Ultimate Member - Submit Search form on Enter
View Ultimate Member - Submit Search form on Enter
jQuery(function(){
jQuery(".um-search form *").keypress(function(e){
if (e.which == 13) {
jQuery('.um-search form').submit();
return false;
}
});
});
@champsupertramp
champsupertramp / Ultimate Member - Modify fields values on Profile Edit submit
Created Jan 7, 2016
Ultimate Member - Modify fields values on Profile Edit submit
View Ultimate Member - Modify fields values on Profile Edit submit
<?php
/**
* Ultimate Member - Custom Profile Submit
* You can also use 'um_user_edit_profile' when there's no validation errors
*/
add_action("um_user_profile_extra_hook","um_custom_user_profile_extra_hook", 10, 1);
function um_custom_user_profile_extra_hook( $args ){
// var_dump ( $args ) ;
}
?>
@champsupertramp
champsupertramp / Ultimate Member Notification extension - Add a custom notification
Last active Jan 26, 2021
Ultimate Member Notification extension - Add a custom notification
View Ultimate Member Notification extension - Add a custom notification
<?php
/**
* Ultimate Member Notification extension - Add a custom notification
*/
if( class_exists("UM_Notifications_API") ){
global $um_notifications;
$um_notifications->api->store_notification( $author, 'my_custom_notification_type', $vars );
add_filter("um_notifications_core_log_types","custom_um_notifications_core_log_types",10,1);
function um_notifications_core_log_types( $array ){
@champsupertramp
champsupertramp / Ultimate Member: shortcode to show content for specific role
Last active Feb 26, 2016
Ultimate Member: shortcode to show content for specific role
View Ultimate Member: shortcode to show content for specific role
/**
* Usage:
* [um_show_content roles='member'] <!-- insert content here --> [/um_show_content]
* You can add multiple target roles, just use ',' e.g. [um_show_content roles='member,candidates,pets']
**/
if( ! function_exists("um_shortcode_show_content_for_role") ){
function um_shortcode_show_content_for_role( $atts = array() , $content = '' ) {
$a = shortcode_atts( array(
'roles' => 'member',
), $atts );
View Ultimate Member Followers and Online extensions
<?php
//Last Login
um_fetch_user( $user_id );
echo um_user("last_login");
// Last Active
global $um_online;
$users = $um_online->get_users();
if( isset( $users[ $user_id ] ) ){