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
View redirect.php
function wpum_my_redirect() {
if ( is_page( wpum_get_core_page_id('register') ) && is_user_logged_in() ) {
wp_safe_redirect( get_permalink( 9999 ) );
exit;
}
}
add_action( 'template_redirect', 'wpum_my_redirect' );
@alessandrotesoro
alessandrotesoro / email.php
Created Jun 1, 2018
WPUM 2.0.0 Double email confirmation
View email.php
function wpum_add_custom_email_field( $fields ) {
$fields['verify_email'] = array(
'label' => 'Verify email',
'type' => 'email',
'required' => true,
'description' => 'Verify your email address.',
'priority' => 9998,
);
@alessandrotesoro
alessandrotesoro / gist:661f2e2e1bfcb09df652d8bd7c68588e
Created Jun 1, 2018
WPUM 2.0.0 Disable remember me in login form
View gist:661f2e2e1bfcb09df652d8bd7c68588e
function wpum_disable_remember_me( $fields ) {
if ( isset( $fields['login']['remember'] ) ) {
unset( $fields['login']['remember'] );
}
return $fields;
}
add_filter( 'login_form_fields', 'wpum_disable_remember_me' );
@alessandrotesoro
alessandrotesoro / class-settings-test.php
Last active Jun 8, 2016
WP Tidy Settings test plugin
View class-settings-test.php
<?php
namespace TDS;
if ( ! defined( 'ABSPATH' ) ) exit;
class Settings_Test extends Settings_Page {
public function __construct() {
$this->id = 'test';
View gist:52a4ed3086b47758ed0d
function wpum_add_sample_email_tag( $user_id ) {
wpum_add_email_tag( 'admin_email', 'This tag can be used to output the admin email', 'wpum_site_get_admin_email' );
}
add_action( 'wpum_add_email_tags', 'wpum_add_sample_email_tag' );
function wpum_site_get_admin_email() {
return get_bloginfo( 'admin_email' );
}
@alessandrotesoro
alessandrotesoro / gist:be18855eddde18a43f81
Created Feb 2, 2016
WPUM add email confirmation at registration
View gist:be18855eddde18a43f81
function wpum_add_new_email_field( $fields ) {
$fields[ 'confirm_email' ] = array(
'label' => 'Confirm Email',
'type' => 'email',
'meta' => 'email_confirmation',
'required' => true,
'description' => 'Add something here if needed',
);
View wp-api-select2.js
this.$el.find( '.taxonomy-terms' ).select2({
multiple: true,
ajax: {
url: WP_API_Settings.root + 'wp/v2/terms/' + this.options.taxonomy.slug,
data: function( term, page ) {
return {
search: term,
page: page,
_envelope: true
}
@alessandrotesoro
alessandrotesoro / gist:84369b9bd0f3438d43fc
Created Oct 20, 2015
Example of adding custom content above registration form in WPUM
View gist:84369b9bd0f3438d43fc
function wpum_my_custom_content() {
?>
here goes your custom content.
<?php
}
add_action('wpum_before_register_form_template', 'wpum_my_custom_content');
@alessandrotesoro
alessandrotesoro / edit_profile.php
Last active Sep 17, 2015
WPUM Add new profile field
View edit_profile.php
function wpum_add_field_to_edit_profile( $fields ) {
$meta_value = get_user_meta( get_current_user_id(), 'my_field', true );
$fields[ 'my_field' ] = array(
'label' => 'My Field',
'type' => 'text',
'required' => false,
'placeholder' => '',
'priority' => 9999,
@alessandrotesoro
alessandrotesoro / gist:6ac03a21c7f4f00e003c
Last active Sep 14, 2015
WPUM Hide remember me field from login form
View gist:6ac03a21c7f4f00e003c
function wpum_hide_remember_me( $args ) {
$args['remember'] = false;
return $args;
}
add_filter( 'wpum_login_shortcode_args', 'wpum_hide_remember_me' );
You can’t perform that action at this time.