Skip to content

Instantly share code, notes, and snippets.

View alessandrotesoro's full-sized avatar
👨‍💻
Probably coding right now...

Alessandro Tesoro alessandrotesoro

👨‍💻
Probably coding right now...
View GitHub Profile
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 June 1, 2018 12:18
WPUM 2.0.0 Double email confirmation
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 June 1, 2018 11:48
WPUM 2.0.0 Disable remember me in login form
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 June 8, 2016 18:03
WP Tidy Settings test plugin
<?php
namespace TDS;
if ( ! defined( 'ABSPATH' ) ) exit;
class Settings_Test extends Settings_Page {
public function __construct() {
$this->id = 'test';
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 February 2, 2016 13:45
WPUM add email confirmation at registration
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',
);
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 October 20, 2015 09:28
Example of adding custom content above registration form in WPUM
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 September 17, 2015 15:30
WPUM Add new profile field
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 September 14, 2015 12:43
WPUM Hide remember me field from login form
function wpum_hide_remember_me( $args ) {
$args['remember'] = false;
return $args;
}
add_filter( 'wpum_login_shortcode_args', 'wpum_hide_remember_me' );