This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Select this option https://imgur.com/VM2tJhv | |
// for getting show verified users and active users(last login recent) first in result | |
function um_custom_verified_last_login( $query_args, $sortby ) { | |
if ( $sortby == 'verified_first' ) { | |
if ( empty( $query_args['meta_query'] ) ) { | |
$query_args['meta_query'] = array(); | |
} | |
$query_args['meta_query'][] = array( | |
'relation' => 'OR', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace um\core; | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
if ( ! class_exists( 'um\core\Form' ) ) { | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function um_customcb_populate_countries() { | |
$countries = array(); | |
if ( ! function_exists( 'get_countries' ) ) { | |
return $countries; | |
} | |
$all_countries = get_countries(); | |
if ( empty( $all_countries ) ) { | |
return $countries; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generate slug in format: {First Name}-{First letter of Last Name}~{hash} | |
function um_custom_generate_custom_slug( $user_obj ) { | |
return strtolower( $user_obj->first_name . '-' . substr( $user_obj->last_name, 0, 1 ) . '~' . substr( strrev( md5( uniqid( 'um_user_hash' . $user_obj->ID, true ) . $user_obj->ID ) ), 0, 5 ) ); | |
} | |
function um_update_custom_usermetaaa( $user_id ) { | |
$permalink_base = UM()->options()->get( 'permalink_base' ); | |
if ( 'custom_meta' === $permalink_base ) { | |
$custom_meta = UM()->options()->get( 'permalink_base_custom_meta' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Replace the function in ultimate-member/includes/core/class-rewrite.php | |
/** | |
* Locate/display a profile. | |
*/ | |
public function locate_user_profile() { | |
$permalink_base = UM()->options()->get( 'permalink_base' ); | |
if ( 'custom_meta' === $permalink_base ) { | |
$custom_meta = UM()->options()->get( 'permalink_base_custom_meta' ); | |
if ( empty( $custom_meta ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function um_custom_can_view_profile( $can_view, $user_id ) { | |
if ( ! is_user_logged_in() ) { | |
if ( user_can( $user_id, 'um_volunteer' ) ) { | |
$can_view = false; | |
} | |
} else { | |
if ( current_user_can( 'um_volunteer' ) && user_can( $user_id, 'um_volunteer' ) ) { | |
$can_view = false; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// remove required mark from form | |
function remove_required_attr( $args ) { | |
foreach ( $args['sections']['job-details']['fields'] as &$field_data ) { | |
if ( 'job_application' !== $field_data['id'] ) { | |
continue; | |
} | |
$field_data['required'] = false; | |
} | |
return $args; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function um_custom_disable_by_role( $disable_sending, $email, $template, $args ) { | |
$user = get_user_by( 'email', $email ); | |
if ( user_can( $user, '{necessary_role_for_disable}' ) ) { | |
$disable_sending = true; | |
} | |
return $disable_sending; | |
} | |
add_filter( 'um_disable_email_notification_sending', 'um_custom_disable_by_role', 10, 4 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_custom_date_add( $data, $postarr, $unsanitized_postarr, $update ) { | |
if ( 'jb-job' === $data->post_type ) { | |
$data->post_name = wp_date( 'Y-m-d', strtotime( $data->post_date ) ) . $data->post_name; | |
} | |
return $data; | |
} | |
add_filter( 'wp_insert_post_data', 'my_custom_date_add', 10, 4 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function jb_job_submission_form_args_custom( $args ) { | |
foreach ( $args['sections']['job-details']['fields'] as &$field ) { | |
if ( 'job_description' === $field['id'] ) { | |
$field['type'] = 'textarea'; | |
} | |
} | |
return $args; | |
} | |
add_filter( 'jb_job_submission_form_args', 'jb_job_submission_form_args_custom', 10, 1 ); |