Skip to content

Instantly share code, notes, and snippets.

Avatar

wp-user-manager

View GitHub Profile
@wp-user-manager
wp-user-manager / wpum_remove_links_already_logged_in_template.php
Created Sep 14, 2022
WP User Manager - Remove links from the Already Logged In template
View wpum_remove_links_already_logged_in_template.php
@wp-user-manager
wp-user-manager / wpum_comment_author_url_as_profile.php
Last active Jul 26, 2022
WP User Manager - Make the comment author URL the user's profile URL
View wpum_comment_author_url_as_profile.php
<?php
add_filter( 'get_comment_author_url', function ( $url, $id, $comment ) {
if ( $comment->user_id == 0 ) {
// Comment left by guest
return $url;
}
$user = get_user_by( 'id', $comment->user_id );
@wp-user-manager
wp-user-manager / wpum_fix_account_profile_page_template.php
Last active Jul 26, 2022
WP User Manager - Fix account/profile sub-page templates in WP 6.0+
View wpum_fix_account_profile_page_template.php
<?php
add_filter( 'template_include', function ( $template ) {
global $wp;
if ( ! isset( $wp->query_vars ) ) {
return $template;
}
if ( ! isset( $wp->query_vars['page_id'] ) ) {
@wp-user-manager
wp-user-manager / wpum_disable_welcome_email_when_creating_user_manually.php
Created Jul 24, 2022
WP User Manager - Don't send welcome emails to users created via wp-admin
View wpum_disable_welcome_email_when_creating_user_manually.php
<?php
add_filter( 'wpum_send_registration_user_email', function ( $check ) {
if ( isset( $_POST['action'] ) && 'createuser' === $_POST['action'] ) {
return false;
}
return $check;
} );
@wp-user-manager
wp-user-manager / wpum_remove_account_nickname_validation.php
Created May 17, 2022
WP User Manager - Remove nickname validation from the account form
View wpum_remove_account_nickname_validation.php
<?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_content_restriction_by_users_or_groups.php
Created May 13, 2022
WP User Manager - Change the content restriction logic for users AND groups to users OR groups
View wpum_content_restriction_by_users_or_groups.php
<?php
add_filter( 'wpumcr_pre_post_restriction', function ( $is_restricted, $post ) {
$posts = array( 684, 685 ); // CHANGE THIS to the posts you want to restrict with the OR logic
if ( ! in_array( $post->ID, $posts ) ) {
return $is_restricted;
}
@wp-user-manager
wp-user-manager / wpum_rearrange_account_tabs.php
Created May 13, 2022
WP User Manager - Rearrange order of account page tabs
View wpum_rearrange_account_tabs.php
<?php
function my_wpum_rearrange_account_tabs( $tabs ) {
// Find the correct slug used in the URL, alter the priority
$tabs['email-subscriptions'] ['priority'] = 5;
return $tabs;
}
add_filter( 'wpum_get_account_page_tabs', 'my_wpum_rearrange_account_tabs', 100 );
@wp-user-manager
wp-user-manager / wpum_pass_url_query_strings_through_social_login.php
Created May 1, 2022
WP User Manager - Send URL query strings through the social login flow
View wpum_pass_url_query_strings_through_social_login.php
<?php
add_filter( 'wpum_login_redirect_to_url', function ( $url ) {
if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
$url .= urlencode( '?' . $_SERVER['QUERY_STRING'] );
}
return $url;
} );
@wp-user-manager
wp-user-manager / wpum_do_not_generate_password.php
Created Mar 8, 2022
WP User Manager - Disable WPUM from generating a password if user registration is handled by another plugin
View wpum_do_not_generate_password.php
<?php
add_filter( 'wpum_new_user_notification_generate_password', '__return_false' );
@wp-user-manager
wp-user-manager / wpum_elementor_customizer_fix.php
Created Feb 25, 2022
WP User Manager - Fix Elementor popups displaying in the WPUM email customizer screen
View wpum_elementor_customizer_fix.php
<?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