WordPress.org

Ready to get started?Download WordPress

Forums

Don't allow user url if it exists to register wordpress (1 post)

  1. Creator2
    Member
    Posted 1 year ago #

    I'm trying to set up registration on WordPress that doesn't allow user's website to register more times. Simply said - I don't want one user to register many times with the same website. This works with emails and username. If the email is already in use won't allow registration. The same thing but for the users urls. Do you have any suggestion how to set up? Thanks!

    I have tried to create a function that checks for url and if it finds it will create an error. But I'm not sure if there are other instances that prevents my set up because it doesn't work. Also I'm using wp-members plugin for registration. The code I was trying to edit was in wp-includes/users.php

    function user_url_exists( $user_url ) {
    if ( $user_url = get_user_by('url', $user_url) ) {
    return $user_url->ID;
    } else {
    return null;
    }}

    if ( !$update && ! defined( 'WP_IMPORTING' ) && user_url_exists($user_url) ) return new WP_Error('existing_user_url', __('This website address is already registered.') );

Topic Closed

This topic has been closed to new replies.

About this Topic