Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

login

Display first name instead of username

Change global $userdata,$user_identity; to global $userdata, $current_user, $user_identity; Then change echo ‘<div class=”login”>’ . $before_widget . $before_title . “Welcome “.$user_identity . $after_title . ‘</div>’; to echo ‘<div class=”login”>’ . $before_widget . $before_title . “Welcome “.$current_user->user_firstname . $after_title . ‘</div>’; You can see all the info in the codex : http://codex.wordpress.org/Function_Reference/get_currentuserinfo

Categories login Tags login, username

WordPress Login redirection according to user role

You’re using the filter wrong. If you got more than one @param, then you have to state them when adding the filter. function wpse40745_redirect_on_login( $redirect_to, isset( $_REQUEST[‘redirect_to’] ), $user ) { # uncomment the following line if it’s not working and replace $user->roles[0] with something that works // echo ‘<pre>’; print_r( $user ); echo ‘</pre>’; … Read more

Categories login Tags login, user-access, user-roles

Forcing frontend login with UI switch

This simple to implement, you could put this into functions.php if you want it tied to a theme, or else create your own plugin from this: add_action(‘init’,’my_force_login’); function my_force_login(){ if ( !is_user_logged_in() && !in_array( $GLOBALS[‘pagenow’], array( ‘wp-login.php’, ‘wp-register.php’ ) ) ) { $force_login=get_option(‘my_force_login’); if($force_login){ wp_redirect( wp_login_url() ); exit; } } } For this to work … Read more

Categories login Tags login, wp-login-form

Code for Log Out Button Yields Strange URL

According to the codex.. this part: urlencode($_SERVER[‘REQUEST_URI’]) . is unneeded… if you just wan’t to logout (pasting from wordpress codex) <a href=”https://wordpress.stackexchange.com/questions/54970/<?php echo wp_logout_url(); ?>” title=”Logout”>Logout</a> . Logout and Redirect to Current Page <a href=”https://wordpress.stackexchange.com/questions/54970/<?php echo wp_logout_url( get_permalink() ); ?>” title=”Logout”>Logout</a> . Logout and Redirect to Homepage <a href=”https://wordpress.stackexchange.com/questions/54970/<?php echo wp_logout_url( home_url() ); ?>” title=”Logout”>Logout</a> … Read more

Categories login Tags login

Login and Forgot password in Lightbox

First you need your login form. I put this in header.php. <div id=”inline-form” class=”page-login hidden”> <?php wp_login_form( array ( ‘redirect’ => site_url( $_SERVER[‘REQUEST_URI’] ), ‘value_remember’ => true ) ); ?> <a href=”https://wordpress.stackexchange.com/questions/58742/<?php echo esc_url( wp_login_url() ); ?>?action=register”>Register</a><br/> <a href=”<?php echo esc_url( wp_login_url() ); ?>?action=lostpassword”>Lost your password</a> </div> Next your link to login or register. <div … Read more

Categories login Tags login, wp-login-form

WordPress Login and Register Link

The function wp_register will display the register link if the user isn’t logged in. Edit: Here’s the code: if ( !is_user_logged_in() ) { return wp_login_form( ‘echo=0’ ) . wp_register( ”, ”, false ); }

Categories login Tags login

Invalidate username if it contains @ symbol

In a multi-site installation it is ‘wpmu_validate_user_signup’: add_filter( ‘wpmu_validate_user_signup’, ‘wpse_77904_mu_no_at_in_username’ ); function wpse_77904_mu_no_at_in_username( $user ) { if ( FALSE !== strpos( $user[‘user_name’], ‘@’ ) ) $user[‘errors’]->add(‘user_name’, __( ‘That username is not allowed.’ ) ); return $user; } On single-site it is ‘validate_username’: add_filter( ‘validate_username’, ‘wpse_77904_no_at_in_username’, 10, 2 ); function wpse_77904_no_at_in_username( $valid, $username ) { if … Read more

Categories login Tags email, login, sanitization, username

Is there anyway to get the inputted password string from the login form?

this should do the job, just add it to functions.php or put in a plugin: add_filter( ‘wp_authenticate_user’, ‘my_authenticate_user’, 10, 2 ); function my_authenticate_user( $user, $password ) { // do whatever you want with the $password variable here return $user; }

Categories login Tags login, password, wp-login-form

?login=failed only attached to URL under certain circumstances

Managed to resolve this with the help of the following code from http://css.dzone.com/articles/create-your-own-wordpress add_action( ‘authenticate’, ‘pu_blank_login’); function pu_blank_login( $user ){ // check what page the login attempt is coming from $referrer = $_SERVER[‘HTTP_REFERER’]; $error = false; if($user == null || $_POST[‘pwd’] == ”) { $error = true; } // check that were not on the … Read more

Categories login Tags login

how can redirect sign in and sign out link front-end page rather then wp-login .php in comment form in wordpress

Use the filter login_redirect to redirect users to a page of your choice after login, and logout_url to redirect them after logging out. An example would be the following: function my_login_redirect( $url, $request, $user ){ // Redirect non administrator users to a custom url. // Administrator gets redirected to default url if( !current_user_can( ‘administrator’ ) … Read more

Categories login Tags login
Older posts
Newer posts
← Previous Page1 … Page39 Page40 Page41 … Page75 Next →
+ More

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 2026 Read For Learn
Next Page »
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress