Skip to content

Instantly share code, notes, and snippets.

View wp-user-manager's full-sized avatar

wp-user-manager

View GitHub Profile
@wp-user-manager
wp-user-manager / wpum_elementor_customizer_fix.php
Created February 25, 2022 21:59
WP User Manager - Fix Elementor popups displaying in the WPUM email customizer screen
<?php
/**
* Remove an object filter.
*
* @param string $tag Hook name.
* @param string $class Class name. Use 'Closure' for anonymous functions.
* @param string|void $method Method name. Leave empty for anonymous functions.
* @param string|int|void $priority Priority
@wp-user-manager
wp-user-manager / wpum_oceanwp_theme_customizer_fix.php
Created February 25, 2022 21:56
WP User Manager - Fix for WPUM email customizer not loading properly when using the OceanWP theme
<?php
add_action( 'after_setup_theme', function () {
if ( isset( $_GET['wpum_email_customizer'] ) ) {
class OceanWP_Customizer {}
}
}, 3 );
@wp-user-manager
wp-user-manager / wpum_registration_pages.php
Created February 24, 2022 14:54
WP User Manager - Allow other registration form pages to be access when the site is locked
<?php
add_filter( 'wpum_registration_pages', function ( $pages ) {
$pages[] = home_url( '/captains-registration' );
return $pages;
} );
@wp-user-manager
wp-user-manager / wpum_colibri_customizer_fix.php
Created February 19, 2022 18:28
WP User Manager - Compatibility code to make sure the WPUM Email customizer screen works when using the Colibri WP theme
<?php
add_filter( 'colibri_page_builder/customizer/supports', function ( $supported ) {
if ( isset( $_GET['wpum_email_customizer'] ) ) {
return false;
}
return $supported;
} );
@wp-user-manager
wp-user-manager / wpum_display_videos_in_user_admin.php
Created February 1, 2022 11:12
WP User Manager - Show the user submitted videos in the edit-user admin screen of WordPress
<?php
add_filter( 'wpumcf_user_carbon_field', function ( $carbon_field, $field ) {
if ( $field->get_type() !== 'video' ) {
return $carbon_field;
}
global $pagenow;
$user_id = false;
@wp-user-manager
wp-user-manager / wpum_password_reset_label.php
Created December 20, 2021 16:59
WP User Manager - Change password recovery username label
<?php
add_filter( 'password_recover_form_fields', function ( $fields ) {
$authentication_method = wpum_get_option( 'login_method' );
$username_label = __( 'Username or email', 'wp-user-manager' );
if ( $authentication_method == 'username' ) {
$username_label = __( 'Username', 'wp-user-manager' );
}
if ( $authentication_method == 'email' ) {
$username_label = __( 'Email', 'wp-user-manager' );
@wp-user-manager
wp-user-manager / wpum_newsletters_account.php
Created November 15, 2021 11:24
WP User Manager - Add account management for the Newsletters addon
<?php
function wpum_newsletter_register_new_account_tabs( $tabs ) {
$tabs['posts'] = [
'name' => esc_html( apply_filters( 'wpum_newsletters_account_title', __( 'Newsletters', 'wpum-newsletters' ) ) ),
'priority' => 0,
];
return $tabs;
}
@wp-user-manager
wp-user-manager / wpum_recaptcha_score.php
Created October 18, 2021 09:12
WP User Manager - Lower the Google reCAPTCHA v3 score threshold
<?php
add_filter( 'wpum_recaptcha_score_threshold', function( $score ) { return 0.3 } );
@wp-user-manager
wp-user-manager / wpum_show_first_paragraph_restricted.php
Last active October 5, 2021 10:29
WP User Manager - Show the first paragraph of a restricted post when using the Content Restriction addon
<?php
add_filter( 'wpum_restricted_post_content', function ( $restricted_content, $post_id, $post ) {
$str = wpautop( $post->original_content );
$str = substr( $str, 0, strpos( $str, '</p>' ) + 4 );
$str = strip_tags( $str, '<a><strong><em>' );
return '<p>' . $str . '</p>' . $restricted_content;
}, 10, 3 );
@wp-user-manager
wp-user-manager / wpum_registration_form_field_default.php
Last active September 17, 2021 10:24
WP User Manager - Conditional field default value
<?php
add_filter( 'wpum_registration_form_field_default', function( $value, $field, $key, $form_id ) {
if ( 'wpum_field_12' != $key ) { // Change the field key to the one you are targetting
return $value;
}
if ( $form_id == 2 ) {
$value = 'some value';