Jump to content

adrianmak

Members
  • Posts

    533
  • Joined

  • Last visited

Everything posted by adrianmak

  1. simple but useful for e-commerce site
  2. It shown up now, by setting to development mode instead of detect mode
  3. I downloaded the module and enabled. But there is no tracy debugger bar shown on the front-end
  4. It will be good to add list of modules (locally) available for enable
  5. First time to came across $options['pageStack'] this variable., as I could not find it mentioned in https://processwire.com/docs/ Is it a global pw's variable similar as other pw's api variable like $page, $pages, $templates and etc. Any more details of this variable ?
  6. For a big website, in PW contest, there might have many non-content pages. Non-content pages are referring to those, log-in, log-out, register, store-check-out and etc which are just a template container response to a front-end url path. As an site content editor, these pages are not necessary to show at back-end with this user role. These pages are meaningful to a site builder, site administrator What roles should I set on these templates, so that they cannot be see by a content editor at back-end
  7. Honestly, the pw's api doc is pretty out-dated. There many stuffs didn't said in api doc. For instance, $users variable
  8. I'm going to build a form for front-end user password changing. There should be three input fields current password new password confirm new password I knew that, password stored in database is hashed. How could I compare the input current password with the password stored in database ?
  9. it's still not working. The same as using echo. After logged in, the page stay at login form, instead of go back to last page
  10. Any how to config from not using apache user account ? I';m testing in vm linux box I set the from as $mail->from('noreply@mydomain.com', 'No-Reply'); However the mail send from as www-data@mydomain.com
  11. From the OP, should I have to create a activation page template ?
  12. it didn't work. After logged in, the page stay at login form, instead of go back to last page
  13. I'm sorry. I could not follow This is my full code of login.php <?php $content = ""; if ($input->post->user && $input->post->pass) { $username = $sanitizer->username($input->post->user); $password = $input->post->pass; try { if ($session->login($username, $password)) { $session->redirect($pages->get("template=home")->url); // redirect to home after user login } else { $error = "Wrong username or password. Login failed."; } } catch (Exception $e) { $error = $e->getMessage(); } } $content .= " <div class='login-box'> <div class='panel panel-default'> <div class='panel-heading'> <h3 class='panel-title'><span class='lock-icon'></span><strong>Member Log-in</strong></h3> </div> <div class='panel-body'> <form role='form' action='./' method='post'> <div class='message-error'>$error</div> <div class='form-group'> <label for='user'>Username</label> <input type='text' name='user' id='user' class='form-control' placeholder='Username' /> </div> <div class='form-group'> <label for='pass'>Password</label> <input type='password' name='pass' id='pass' class='form-control' placeholder='Password' /> </div> <button type='submit' class='btn btn-sm btn-primary'>Login</button> </form> </div> </div> </div> "; Should I replace the code $session->redirect($pages->get("template=home")->url); // redirect to home after user login With echo "<script>history.go(-1);</script>"; ?
  14. Some page required certain role to access, and will redirect to a user log-in page I found this post, it handle the redirection manually, which could allow to store page id to session variable or redirect url with paramater. https://processwire.com/talk/topic/6387-redirect-to-previous-page/ However, I config the page redirect in template access tab, which I put log-in page id where a page redirection. Any clue to store a page with this method ?
  15. Here is a sample page tree and my site is a multi language website with default English and two other languages let say japanese and korean language path suffix of each are / english /jpn japanese /kor korean Home +-----about +-----product +-----contact +-----members-area +-----login (1001) +-----logout (1002) members-area is restricted for users with registered role. In access tab of members-area template, page will redirect to 1001 page id (login form) for guest After user log in, it will redirect back to home My problem is if I am at other two langauges to login, it will redirect to default English home. I suppose redirect back to japanese home or korean home For instance, when access members area in japanese , http://mydomain.com/jpn/members-area it will redirect to login page http://mydomain.com/jpn/login After user logged in, pw redirect to (default English home) instead of http://mydomain.com/jpn (japanses Home) This is my login.php template <?php $content = ""; if ($user->isLoggedin()) { $session->redirect($pages->get("template=home")->url); } if ($input->post->user && $input->post->pass) { $username = $sanitizer->username($input->post->user); $password = $input->post->pass; try { if ($session->login($username, $password)) { $session->redirect($pages->get("template=home")->url); // redirect to home after user login } else { $error = "Wrong username or password. Login failed."; } } catch (Exception $e) { $error = $e->getMessage(); } } $content .= " <div class='login-box'> <div class='panel panel-default'> <div class='panel-heading'> <h3 class='panel-title'><span class='lock-icon'></span><strong>Member Log-in</strong></h3> </div> <div class='panel-body'> <form role='form' action='./' method='post'> <div class='message-error'>$error</div> <div class='form-group'> <label for='user'>Username</label> <input type='text' name='user' id='user' class='form-control' placeholder='Username' /> </div> <div class='form-group'> <label for='pass'>Password</label> <input type='password' name='pass' id='pass' class='form-control' placeholder='Password' /> </div> <button type='submit' class='btn btn-sm btn-primary'>Login</button> </form> </div> </div> </div> ";
  16. $t = $templates->get("dashboard"); $t->flags = Template::flagSystemOverride; $t->flags = 0; Not working.....template's system flag is still checked ps I just put these few line of codes on home.php template and executed on home page
  17. A template checked with System flag, it cannot be viewable at the front-end. How could I disable system flag for a custom template ? I tried following code, but it didn't work $t = $templates->get("dashboard"); $t->set("flagSystem", 0); $t->save(); The system flag of dashboard template is still checked.
  18. Let say Home +---about +---contact +---services +---member +---page1 +---page2 +---page3 member is using member template page1,2,3 are using basic-page template basic-page template can be viewed by guest user member template can be viewed by user which is with role of registered Are page1,2,3 inheritance the access role permission from member ? In other words, guest user cannot able to access page1,2,3
  19. Before I got your suggested answer, I tested with $u->template = "my-user-parent"; and it work. I also tested with yours. it work too.
  20. Follw up with my previous post https://processwire.com/talk/topic/12782-regarding-multiple-templates-or-parents-for-users/ For default installation, api to create a new user is something like that $u = new User(); $u->of(false); $u->name = "adrian"; $u->email = "adrian@example.com"; $u->pass = "123456"; $u->addRole("registered"); $u->save(); $u->of(true); With multiple template or parent , how to setup a user object to use which template and parent, before executing save() method ?
  21. I followed the steps of creating multiple template/parents for users I got an error on Step 4 while creating a new page with new template created in step 3. When I hitted save button, an error occur. Error: Call to a member function getInputfield() on a non-object (line 630 of /var/www/html/pw-test/wire/modules/Process/ProcessPageAdd/ProcessPageAdd.module) This error only occur when selecting the new created template. template (basic-page)from installation profile (basic profile) has no such an issue Edit: I'm sorry for my carelessness. I did something wrong on step 3 which producing the above error. Anyway, multiple template and parent setup for users is working now.
×
×
  • Create New...