Skip to content

Instantly share code, notes, and snippets.

add_action( 'um_before_new_user_register', 'require_whitelisted_email_for_signup' );
function require_whitelisted_email_for_signup( $args ) {
$user_email = $args['user_email'];
$approved_domains = array( 'yahoo.com', 'gmail.com', 'hotmail.com' );
$email_approved = false;
foreach ( $approved_domains as $domain ) {
$prefixed_domain = '@' . $domain;
if ( str_ends_with( $user_email, $prefixed_domain ) ) {
$email_approved = true;
@filipecsweb
filipecsweb / functions.php
Last active November 2, 2017 07:17
Display Simple Product SKU, in WooCommerce loop pages, before item name
<?php
/**
* Display Simple Product SKU, in WooCommerce loop pages, before item name
*
* @return void
*/
function simple_product_sku_before_loop_item_title(){
global $product;
$type = $product->product_type;
<?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 ) ) {
<?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");
@Jany-M
Jany-M / WP_remove_product_name_woocommerce_breadcrumbs.php
Created November 30, 2015 12:54
[WordPress] Remove Product Name & URL from WooCommerce Breadcrumbs
<?php
// In your theme, make a new folder woocommerce/global/
// Add this function in a file called breadcrumbs.php, in that folder
// or integrate the existing function accordingly.
/**
* Shop breadcrumb
*
* @author WooThemes
* @package WooCommerce/Templates
@lots0logs
lots0logs / functions.php
Created December 18, 2015 01:10
Divi - Custom Sidebar For WooCommerce Pages
<?php /* Don't include this line if your child theme functions.php already includes it */
function my_et_divi_output_content_wrapper_end() {
echo '</div> <!-- #left-area -->';
if (
( is_product() && 'et_full_width_page' !== get_post_meta( get_the_ID(), '_et_pb_page_layout', true ) )
||
( ( is_shop() || is_product_category() || is_product_tag() ) && 'et_full_width_page' !== et_get_option( 'divi_shop_page_sidebar', 'et_right_sidebar' ) )
) {
dynamic_sidebar( 'eCommerce Sidebar' );
@plusplugins
plusplugins / filter.php
Created December 23, 2015 18:46
Adding a custom field to Ultimate Members directory search options
add_filter('um_admin_custom_search_filters','add_my_custom_search_fields', 10, 1);
function add_my_custom_search_fields($fields) {
$fields['field_meta_key'] = array('title' => 'Enter field title'); // replace 'field_meta_key' with your field meta key
return $fields;
}
@anstak
anstak / gist:045d2f79934b3eea171fd2198feff4a5
Last active May 29, 2023 05:01 — forked from seanmcn/gist:62a021a765ad4f8e593b
The Perfect Web Server - Nginx, Ajenti, Ubuntu
#Insall Ajenti
apt-get update
wget http://repo.ajenti.org/debian/key -O- | apt-key add -
echo "deb http://repo.ajenti.org/ng/debian main main ubuntu" >> /etc/apt/sources.list
apt-get update
apt-get install ajenti
service ajenti restart
# Uninstall Apache2
@champsupertramp
champsupertramp / Ultimate Member - User meta shortcodes
Last active December 8, 2024 04:32
Ultimate Member - User meta shortcodes
/**
* Returns a user meta value
* Usage [um_user user_id="" meta_key="" ] // leave user_id empty if you want to retrive the current user's meta value.
* meta_key is the field name that you've set in the UM form builder
* You can modify the return meta_value with filter hook 'um_user_shortcode_filter__{$meta_key}'
*/
function um_user_shortcode( $atts ) {
$atts = extract( shortcode_atts( array(
'user_id' => get_current_user_id(),
'meta_key' => '',
@champsupertramp
champsupertramp / Ultimate Member - UM Custom user query in Member Directory
Last active April 16, 2021 06:44
Ultimate Member - UM Custom user query in Member Directory
<?php
/**
* Show users with a Job Title "'WP Plugin developer " only
**/
add_filter('um_prepare_user_query_args', 'um_my_custom_query_args', 99, 2);
function um_my_custom_query_args( $query_args, $args ) {
if( $args["form_id"] == "1" ) { // you can validate the current member directory form ID
$query_args['meta_query'][] = array(