I am not very advanced in php.
I found function that i can use in WP header - then when login from “small green box” in header user stay on page from that he try to login.
Here is my page with WP: http://www.computers-and-control.com/service/manuals/
Now i have other issue, i copied file /wp-login.php to /wp-logincc.php this new file is used for login in my template WP-Download Manager - when click file - that need login before download than is used /wp-logincc.php for function login.
Problem is that after login from wp-logincc.php i am redirected to “Dashboard/Admin Panel” - i would go back to the subpage i come from.
I use different subpages for downloading files with required login and allways need come back to this one i come from.
I try in my wp-logincc.php code:
enter code here
<?php
/**
* WordPress User Page
*
* Handles authentication, registering, resetting passwords, forgot password,
* and other user handling.
*
* @package WordPress
*/
/** Make sure that the WordPress bootstrap has run before continuing. */
require( dirname(__FILE__) . '/wp-load.php' );
// dankam tu cos ewentualnie zmienic ---- Redirect to https login if forced to use SSL
$dankam_aaa = apply_filters( 'fromwhereyoucame', $fromwhereyoucame );
function fromwhereyoucame( $link ) {
$currenturl = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if ( !is_user_logged_in() )
$link = str_replace( '">', '?redirect_to=' . urlencode( $currenturl ) . '">', $link );
else
$link = str_replace( '">', '&redirect_to=' . urlencode( $currenturl ) . '">', $link );
return $link;
}
if ( force_ssl_admin() && ! is_ssl() && $dankam_aaa ) {
if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
exit();
} else {
wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
exit();
}
}
===========================END CODE
But this do nothing in wp-logincc.php
(But this enclosed function works in “green box”)
Please help to modify wp-logincc.php
Read more here: redirect to current page wp-login