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

How can I make a login just like on wordpress.org?

this should give you the same look unless your theme’s css overwrites it: <form name=”loginformfooter” class=”loginform” id=”loginformfooter” action=”https://wordpress.stackexchange.com/questions/19222/<?php bloginfo(“url’); ?>/wp-login.php” method=”post”> <p><label>Username <input type=”text” value=”” maxlength=”40″ size=”13″ id=”user_login” name=”user_login” class=”text”> </label> <label>Password <input type=”password” maxlength=”40″ size=”13″ id=”password” name=”password” class=”text”> </label> <input type=”hidden” value=”” name=”re”> <input type=”submit” value=”Log in” id=”submit” name=”Submit” class=”button-secondary”> (<a href=”https://wordpress.stackexchange.com/questions/19222/<?php bloginfo(“url’); ?>/wp-login.php?action=lostpassword”>forgot?</a>) … Read more

Categories login Tags login

Custom Login Page — wp_signon Headers Already Sent?

You have to hook earlier in the request to log someone in, you can’t do it from a page template because, as the error says, headers have been sent to the browser already, so it’s too late at that point. <?php add_action(‘template_redirect’, ‘my_check_login’); function my_check_login(){ if( is_page(‘my-login-page’) && isset($_POST[’email’]) ){ // check input and // … Read more

Categories plugins Tags headers, login, plugin-development, plugins

How can I password protect a WordPress site without requiring users to log in?

You could add a statement to the end that require them to answer a question if they dont have a cookie set and sets a cookie when they do, allowing them access to the site. I’m on my phone but something like this. <?php if($_POST[‘q’] == ‘answer’) { // set cookie } elseif($_COOKIE[‘q’] != ‘cookie’) … Read more

Categories login Tags login, password, security

Edit page shown after login in WordPress?

add_filter( “login_redirect”, “my_login_redirect”, 10, 3 ); function my_login_redirect( $redirect_to, $request, $user ) { return home_url( “/your_page/” ); } Should about do it for you. Modified from a script that I had running in wp3.3.1. Docs: home_url(), login_redirect

Categories pages Tags login, pages

Getting a person’s username from a wordpress cookie

get_currentuserinfo(); $username = $current_user->user_login That should work to get the current user’s username. You can read more about get_currentuserinfo(); here in the codex. It pulls all the base info about a user – username, display name, email, first/last name, and user ID. This will be handy since you can verify the user based on username, … Read more

Categories login Tags cookies, 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

Get ‘Headers already sent’ error for the plugin I am creating when I try to login

Your syntax is wrong. You have a closing PHP tag where there is no opening PHP tag at the end of the script. This means you are creating output before the headers are being sent. Change this: function prodmanager_html_page() { ?> <div> <h2>Product Manager</h2> <!–usual HTML and PHP Code–> </div> ?> To this: function prodmanager_html_page() … Read more

Categories plugins Tags headers, login, php, plugins

firing function at login within class

wp_signon doesn’t exist (at least according to http://codex.wordpress.org/Plugin_API/Action_Reference) but I tried tossing this into a fresh theme and it seems to work: class TestThing { function __construct() { add_action( ‘wp_login’, array($this, ‘login_pull_updates’) ); } function login_pull_updates($login, &$user) { update_option(‘ap_login_run’, ‘YES I DID’); } } $test = new TestThing();

Categories wp-admin Tags login, wp-admin
Older posts
Newer posts
← Previous Page1 … Page84 Page85 Page86 … Page164 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