[Hỏi đáp] I want to redirect to user profile after login

  Bài viết hay nhất1
I want to redirect to user profile after login. I know how to redirect portal. But I don't know what will be the code for redirecting user profile.


I can use

Code:
/login?redirect=u1


But this will redirect the admin profile page for every user. I want to make it for all. How can I do that?

Here is my login code
Code:
<form action="/login" method="post"><table cellspacing="1" cellpadding="3" border="0"><tbody><tr><td width="45%" align="right"> Username:</td><td><input type="text" name="username" size="25" maxlength="40" /></td></tr><tr><td align="right">Password:</td><td><input type="password" name="password" size="25" maxlength="32" /></td></tr><tr align="center"><td colspan="2">Log me on automatically each visit: <input type="checkbox" name="autologin" checked="true" /></td></tr><tr align="center"><td colspan="2"><input type="submit" class="mainoption" name="login" value="Log in" /></td></tr></tbody></table></form>
  Bài viết hay nhất2

@ashik4u wrote: I want to redirect to user profile after login. I know how to redirect portal. But I don't know what will be the code for redirecting user profile.


I can use

Code:
 /login?redirect=u1


But this will redirect the admin profile page for every user. I want to make it for all. How can I do that?

Here is my login code
<form action="/login" method="post"><table cellspacing="1" cellpadding="3" border="0"><tbody><tr><td width="45%" align="right"> Username:</td><td><input type="text" name="username" size="25" maxlength="40" /></td></tr><tr><td align="right">Password:</td><td><input type="password" name="password" size="25" maxlength="32" /></td></tr><tr align="center"><td colspan="2">Log me on automatically each visit: <input type="checkbox" name="autologin" checked="true" /></td></tr><tr align="center"><td colspan="2"><input type="submit" class="mainoption" name="login" value="Log in" /></td></tr></tbody></table></form>

Cant not use redirect page profile after login unless using ajax login
  Bài viết hay nhất3
e chả thấy hoạt động
not working
link: http://enlovers.forumvi.com/
  Bài viết hay nhất4

@markai30 wrote:
Cant not use redirect page profile after login unless using ajax login

How to do that?
  Bài viết hay nhất5

@ashik4u wrote:
@markai30 wrote:
Cant not use redirect page profile after login unless using ajax login

How to do that?

Use ajax login.

Example code login ajax.

Code:

$(function(){
   $('form[action="/login"]').submit(function(event){
      event.preventDefault();
      var name = $(this).find('input[name="username"]').val();
      var pass = $(this).find('input[name="password"]').val();
      $(this).find('input').attr('disabled','disabled');
      alert('Processing, please wait...');
      $.post('/login',{
         username: name,
         password: pass,
         autologin:1,
         login: 1
      }).done(function(a){
         alert('Login successful...');
         var u_id = a.split('["user_id"] = ');
         var u_id = u_id[1].split(';')[0];
         location.href = '/u'+u_id+'';
      });
   });
});
  Bài viết hay nhất6
I am not good at code. Here is my forum http://www.sablc.co
can you make it work for me?
  Bài viết hay nhất7

@ashik4u wrote:I am not good at code. Here is my forum http://www.sablc.co
can you make it work for me?

You goto Admin Control Panel -> Modules -> Javascript codes management -> Create a new javascript.
Enable Javascript code management : Yes.
You write Title : Login Ajax.
Placement : Check box In all the pages.

Javascript Code * : Copy code:

Code:

$(function(){
  $('form[action="/login"]').submit(function(event){
      event.preventDefault();
      var name = $(this).find('input[name="username"]').val();
      var pass = $(this).find('input[name="password"]').val();
      $(this).find('input').attr('disabled','disabled');
      alert('Processing, please wait...');
      $.post('/login',{
        username: name,
        password: pass,
        autologin:1,
        login: 1
      }).done(function(a){
        alert('Login successful...');
        var u_id = a.split('["user_id"] = ');
        var u_id = u_id[1].split(';')[0];
        location.href = '/u'+u_id+'';
      });
  });
});

Done. You can design loading to better effect.
  Bài viết hay nhất8
I don't see any change :(
  Bài viết hay nhất9

@ashik4u wrote:I don't see any change :(


Your website http://www.sablc.co/99309.js cause faulty code. Better that you should not use this code again.

Sorry my English is bad. Can not be fully expressed.
  Bài viết hay nhất10
Okay, but I could not find any js in my forum
  Bài viết hay nhất11
bump, plz help
You cannot reply to topics in this forum