• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 Making your own login screen

Robby

Well-known member
#1
Hello,

My main site is wordpress and i would like to make a login screen in my wordpress site.
Any ideas how this can be done? copying the code from the login page doesn't work...
 

Brogan

XenForo moderator
Staff member
#3
If you want to customise your WP site, wouldn't this be better asked on a WP support forum?

I have never used WP so can't help.
 

Robby

Well-known member
#4
Touché but i thaught there would be some specialists here that can guide me.
On a wp support forum they just say the opposite, time for figure it out myself i suppose.;)
Sorry for the trouble...
 

Tracy Perry

Well-known member
#5
Touché but i thaught there would be some specialists here that can guide me.
On a wp support forum they just say the opposite, time for figure it out myself i suppose.;)
Sorry for the trouble...
Sounds more like you are wanting a bridge? Or are you going to have two different user bases - one in WP and one in xenForo? If two different ones, can't you just set a link to the forum login (in my case it would be http://sayapple.com/login). Or are you wanting a custom coded WP module that ties into the WP theme with a minimal login screen (you would have to figure out how to get it to open the login in overlay mode or get a custom login screen - and in that case the best place to ask would be here)?
 

LPH

Well-known member
#6
Sorry - I'm back at work - so not always able to see these types of posts. Try this code and modify to your liking.

PHP:
<div id="xenlogin">
   <form action="http://path/to/community/login/login" method="post" id="pageLogin">
  
     <div class="ctrlWrapper">
       <dl class="ctrlUnit">
         <label for="LoginControl">Your name or email address:</label>
         <input type="text" name="login" id="LoginControl" class="textCtrl" tabindex="101" />
  
         <label for="ctrl_password">Password:</label></dt>
         <input type="password" name="password" id="ctrl_password" class="textCtrl" tabindex="102" />
  
         <input type="submit" class="button primary" value="log_in" tabindex="104" data-loginPhrase="log_in" data-signupPhrase="sign_up" />
         <label for="ctrl_remember" class="rememberPassword">
         <input type="checkbox" name="remember" value="1" id="ctrl_remember" tabindex="103" /> stay_logged_in</label>
     </div>
  
     <input type="hidden" name="cookie_check" value="1" />
     <input type="hidden" name="redirect" value=" ' . get_permalink( $post->ID ) . ' " />
     <input type="hidden" name="_xfToken" value=" ' . $XF->visitor->get( 'visitor.csrf_token_page' ) . ' " />

   </form>
</div>
Now that get_permalink may not work for you and you'll want to play around with things for the xf_token and redirects.....

http://xenforo.com/community/threads/login-from-external-page-needs-redirect-to-original-page.51393/

Feel free to look over some other instructions.
 
Last edited:

Robby

Well-known member
#8
Sorry - I'm back at work - so not always able to see these types of posts. Try this code and modify to your liking.

PHP:
<div id="xenlogin">
   <form action="http://path/to/community/login/login" method="post" id="pageLogin">
 
     <div class="ctrlWrapper">
       <dl class="ctrlUnit">
         <label for="LoginControl">Your name or email address:</label>
         <input type="text" name="login" id="LoginControl" class="textCtrl" tabindex="101" />
 
         <label for="ctrl_password">Password:</label></dt>
         <input type="password" name="password" id="ctrl_password" class="textCtrl" tabindex="102" />
 
         <input type="submit" class="button primary" value="log_in" tabindex="104" data-loginPhrase="log_in" data-signupPhrase="sign_up" />
         <label for="ctrl_remember" class="rememberPassword">
         <input type="checkbox" name="remember" value="1" id="ctrl_remember" tabindex="103" /> stay_logged_in</label>
     </div>
 
     <input type="hidden" name="cookie_check" value="1" />
     <input type="hidden" name="redirect" value=" ' . get_permalink( $post->ID ) . ' " />
     <input type="hidden" name="_xfToken" value=" ' . $XF->visitor->get( 'visitor.csrf_token_page' ) . ' " />

   </form>
</div>
Now that get_permalink may not work for you and you'll want to play around with things for the xf_token and redirects.....

http://xenforo.com/community/threads/login-from-external-page-needs-redirect-to-original-page.51393/

Feel free to look over some other instructions.
Ok I have it working but when i put in a false password, it redirects to xenforo login page, is it possible to redirect to wordpress page?
 

dknife

Active member
#12
I was using this external login form suggestion for my custom site and it works great, however I'm confused about the cookie check component

Code:
<input type="hidden" name="cookie_check" value="1" />
What is the reason to include this? If I have it present in the form, the member cannot login on the external site unless they check the box for remember password, it goes to the forum and displays an error that cookies must be enabled. However removing the cookie_check from the form results in perfect external login allowing temp session or permanent via checkbox.