Home:ALL Converter>Don't allow register user url if it exists in wordpress

Don't allow register user url if it exists in wordpress

Ask Time:2012-09-22T02:04:49         Author:user1684652

Json Formatter

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.') ); 

Author:user1684652,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/12535827/dont-allow-register-user-url-if-it-exists-in-wordpress
Raul Illana :

You can try WangGuard plugin. :)",
2012-09-22T08:30:45
yy