Archive
Archive for the ‘General PHP/MySQL interview Questions’ Category
How to login with email only no username in wordpress
January 19, 2016
Leave a comment
It’s possible, you must change the filter for the name.
// remove the default filter
remove_filter( 'authenticate', 'wp_authenticate_username_password', 20, 3 );
// add custom filter
add_filter( 'authenticate', 'fb_authenticate_username_password', 20, 3 );
function fb_authenticate_username_password( $user, $username, $password ) {
// If an email address is entered in the username box,
// then look up the matching username and authenticate as per normal, using that.
if ( ! empty( $username ) )
$user = get_user_by( 'email', $username );
if ( isset( $user->user_login, $user ) )
$username = $user->user_login;
// using the username found when looking up via email
return wp_authenticate_username_password( NULL, $username, $password );
}
===============================
http://wordpress.stackexchange.com/questions/51678/how-to-login-with-email-only-no-username
Categories: General PHP/MySQL interview Questions, Techanical
One Url to another url via htaccess
December 8, 2015
Leave a comment
RewriteRule ^article/?$ http://www.new-domain.com/article/ [R=301,NC,L] # Permanent Move
If the move is permanent, append “=301” to the “R” flag to have Apache tell the browser the move is considered permanent. Unlike the default “R”, “R=301” will also tell the browser to display the new address in the address bar.
This is one of the most common methods of rewriting URLs of items that have moved to a new URL (for example, it is in use extensively on this site to forward users to new post URLs whenever they are changed).
https://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/
Categories: General PHP/MySQL interview Questions, Techanical
Listing all information about the users browser
January 15, 2015
Leave a comment
echo $_SERVER['HTTP_USER_AGENT'] . "\n\n";
$browser = get_browser(null, true);
print_r($browser);