Skip to content

Instantly share code, notes, and snippets.

👨‍💻
Probably coding right now...

Alessandro Tesoro alessandrotesoro

👨‍💻
Probably coding right now...
Block or report user

Report or block alessandrotesoro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alessandrotesoro
alessandrotesoro / gist:dfe2940c58ebe78af0b0
Last active Sep 2, 2015
RSA plugin integration with WPUM - allow registration page to be visible
View gist:dfe2940c58ebe78af0b0
function wpum_rsa_access( $is_restricted, $wp ) {
// Get registration page slug
$page_id = wpum_get_core_page_id( 'register' );
$register_page = get_post( $page_id );
// check query variables to see if this is the registration page
if ( $wp->query_vars['pagename'] == $register_page->post_name ) {
$is_restricted = false;
}
@alessandrotesoro
alessandrotesoro / gist:8bd4286306d21a094a1d
Created Aug 26, 2015
WPUM Get user profile page by author ID
View gist:8bd4286306d21a094a1d
<?php
$user = get_user_by( 'id', get_the_author_meta( 'ID' ) );
?>
<a href="<?php echo wpum_get_user_profile_url( $user ); ?>">Custom Text Here</a>
View gist:276f403c8ada52c87be3
function wprm_change_items_order( $args ) {
$args['orderby'] = 'date';
$args['order'] = 'DESC';
return $args;
}
add_filter( 'wprm_menu_category_args', 'wprm_change_items_order' );
add_filter( 'wprm_full_menu_args', 'wprm_change_items_order' );
@alessandrotesoro
alessandrotesoro / gist:c1401c359f83acffcb0e
Created Jul 20, 2015
Add custom directory template to dropdown
View gist:c1401c359f83acffcb0e
function wpum_add_custom_directory_template( $templates ) {
$templates['custom'] = 'Custom Template';
return $templates;
}
add_filter( 'wpum_get_directory_templates', 'wpum_add_custom_directory_template' );
View gist:b270ffc2bf9e4267b93d
function wprm_add_menu_order( $args ) {
$args['supports'] = array( 'title', 'editor', 'excerpt', 'thumbnail', 'page-attributes' );
return $args;
}
add_action( 'wprm_menu_post_type_args', 'wprm_add_menu_order' );
function wprm_change_items_order( $args ) {
View gist:916b9a6f7edbc5259d42
function wprm_add_24_h( $late_bookings ) {
$late_bookings['1440'] = __( 'At least 24 hours in advance', 'wprm' ),
return $late_bookings;
}
add_filter( 'wprm_get_late_bookings', 'wprm_add_24_h' );
@alessandrotesoro
alessandrotesoro / gist:a5b767bb2c5dddd822cd
Created Apr 16, 2015
WPRM Change admin email address for notifications.
View gist:a5b767bb2c5dddd822cd
function wprm_change_admin_email_address( $email ) {
return 'custom@email.com';
}
add_filter('wprm_admin_booking_notification_sendto_mail', 'wprm_change_admin_email_address');
View gist:734c8149ca57176d2bd8
/**
* Enable Taxonomy Archive
* @since 1.0.0
*/
function tdp_wprm_enable_taxonomy_archive($args) {
$args['exclude_from_search'] = false;
return $args;
}
@alessandrotesoro
alessandrotesoro / gist:3e80fc28da4d02f4e6ce
Created Dec 10, 2014
WPRM Move last custom field up at the top of the booking form
View gist:3e80fc28da4d02f4e6ce
class WPRM_Move_last_custom_field_up extends WPRM_Custom_Fields {
/**
* Add new fields to the metaboxes in the admin panel
*
* @since 1.0.0
* @return void
*/
public function add_new_fields_to_booking_form( $booking_fields ) {
@alessandrotesoro
alessandrotesoro / gist:5ed2dc1e4ec425c98c18
Created Dec 3, 2014
Display all users into the "Author" box
View gist:5ed2dc1e4ec425c98c18
add_filter('wp_dropdown_users', 'tdp_custom_wp_dropdown_users');
function tdp_custom_wp_dropdown_users($output) {
global $post;
$users = get_users();
$output = "<select id=\"post_author_override\" name=\"post_author_override\" class=\"\">";
$output .= "<option value=\"1\">Admin</option>";
foreach($users as $user) {
$sel = ($post->post_author == $user->ID)?"selected='selected'":'';
$output .= '<option value="'.$user->ID.'"'.$sel.'>'.$user->user_login.'</option>';
}
You can’t perform that action at this time.