lhockley
Forum Replies Created
-
Forum: Plugins
In reply to: [Challonge] Unable to set API key.sure enough that was the problem. Installed cURL, restarted the webserver and BOOM! Thanks much.
Forum: Plugins
In reply to: [Challonge] Unable to set API key.Thank you for your quick response. I look forward to any update. Honestly, I would be happy for a version without the AJAX verification. Could just return an error once the form is submitted instead.
I initially looked at attributes and custom fields, but they don’t appear to be flexible enough of a solution. This also has to be very user friendly for the admins.
Forum: Hacks
In reply to: Deny "spaces" in usernames.ok, well. I figured it out by rethinking the logic. Just simply found some simple regex to see is $username has spaces, then set the $valid parameter to false. Seems to be working. Here is the code:
add_filter('validate_username' , 'custom_validate_username', 10, 2); function custom_validate_username($valid, $username ) { if (preg_match("/\\s/", $username)) { // there are spaces return $valid=false; } return $valid; }
Thank you so much for your help.
Forum: Hacks
In reply to: Deny "spaces" in usernames.hmm, it still doesn’t seem to be working completely. I mean, it’s not crashing anymore, but it is apparently having no effect. Still allowing registration w/ a space.
Forum: Hacks
In reply to: Deny "spaces" in usernames.ah, I see now. Thank you much for clearing that up. Was a slight misunderstanding on how hooks work. heh
Forum: Hacks
In reply to: Deny "spaces" in usernames.hmm, so… I am very new to using hooks/filters (only written two small plugins so far).
Here is what I came up with:
add_filter("validate_username" , "custom_validate_username"); function custom_validate_username( $username ) { $sanitized = sanitize_user( $username, true ); $final = str_replace (" ", "", $sanitized); $valid = ( $final == $username ); return apply_filters( 'validate_username', $valid, $username ); }
When the plugin is activated, it gives me an error that the page cannot be found (at registration). The goal was to simply replace the existing function with my own replacement, am I missing something?
ps, thanks tons for the help thus far.