Jump to content

tires

Members
  • Posts

    203
  • Joined

  • Last visited

Profile Information

  • Location
    Germany

Recent Profile Visitors

2,294 profile views

tires's Achievements

Sr. Member

Sr. Member (5/6)

43

Reputation

  1. Now I run into another problem. I would like to use the redirect in a website where i use the login/register module. According to my devtools in firefox the initially URL (https://mysite.com/article/name-of-my-article/) is redirected to the frontend login form (https://mysite.com/) with a 301. I have no idea how to write the hook to grab the URL and set the cookie. In this hook i don't work: $this->addHookBefore('ProcessLogin::buildLoginForm', function(HookEvent $event) ...
  2. As i mentioned before i didn't get any result in my hook if i try it with segments. Or is there something wrong?
  3. You are absolutely right! But the GET variable is not absolutely necessary if i understand it right. Is there any way to get the last part of the URL via segments instead of this wild explode('/' ... Or can i not use segments in this context?
  4. Many thanks to all of you! I thought it would be useful to use the processwire functions (i.e. segments) and I did not want to change the url. Because if someone kicks on the link in the mail and is already logged in the url would have to be changed again ... from the url with get to the regular one.
  5. Many thanks to both of you! I solved it this way and put the following hooks in my site/ready.php ... First hook to grab the URL: $this->addHookBefore('ProcessLogin::buildLoginForm', function(HookEvent $event) { // --- Split URL --- // $actual_link = explode('/',(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); // --- Putting the last i.e. fifth part of the URL in a session cookie "weiterleiter" --- // $this->wire('session')->set('weiterleiter', $actual_link[5]); }); Second hook to redirect after login: $this->addHookAfter('Session::loginSuccess', null, function($event) { // --- Get session cookie "weiterleiter" and write it in $weiter --- // $weiter = $this->wire('session')->get('weiterleiter'); // --- If the $weiter is not empty add the path and write it in $url --- // if(!empty($weiter)) $url = "artikel/".$weiter; // --- Redirect to the URL --- // $this->wire('session')->redirect($url); // --- Delete the session-Cookie ---// $this->wire('session')->remove('weiterleiter'); }); That works for me! Is there a smarter way to do this? Or a smarter way to get the url by segments?
  6. To allow the user to check the box, I need to give the role permission to view and edit the field. I also apparently need to give the role page editing permission ...
  7. Thank you! While trying to implement your solution I found an even easier way. I restricted the access in the field settings to specific roles. This works pretty well!
  8. HI! I would like to show some fields (checkboxes) in the user profile depending on the role of the user. I.e. If the user has the role "checker 1" the first check box i shown when he is editing his profile. If the user has the role "checker 2" the second check box i shown in his profile. BTW. I am using the LoginRegister module for users to edit they profile if this makes a difference.
  9. It would be a pity if the module was not continued! I'm afraid I can't contribute in any helpful way. Unfortunately i lack the skills ...
  10. By visiting the hash URL to checking the mail manually i get the following error message: Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /mydomain/mysite/site/modules/ProcessEmailToPage/flourishlib/fMailbox.php on line 505 How can i avoid this?
  11. Ok, i find it out: If i add "$config->pagefileSecure = true;" to my site/config.php all files are secure immediately! I does't have to do any further steps to secure old files.
  12. After a few month walk by i just want to ask again: Is there a way to change existing files into secure files? If i understand this right after i add the $config->pagefileSecure = true to my config file all files from now on are secure ... but not the old ones, right?
  13. Check this: in the .htaccess the "RewriteBase" ... should be "/" in site/config.php the $config->httpHosts entries ... is the url entered correctly in site/config.php set the $config->debug to "true" to get further error messages
  14. Thanks! Do you have any idea how to avoid a GET var and just work with the normal URL? And where to grab this URL so i could redirect after login? Do i need another hook for this purpose? This test hook doesn't output a segment at all: $this->addHookBefore('ProcessLogin::buildLoginForm', function(HookEvent $event) { $segment = $this->wire('input')->urlSegment1(); echo "This is my" . $segment; });
  15. Hi! I made a little intranet with processwire. If there is a new article a mail containing the URL (https://mysite.com/article/name-of-my-article/) is sended to each user. If the user klicks on the url and he is not already logged in he is now redirected to the login page (in this case a frontend login with Login/Register module). After login he is redirected to the start page but not to the URL from the mail. What is the most simple way to get a proper redirect to the expected URL? Do i have to work with a cookie? Where do i have to write and read this cookie? Thanks!
×
×
  • Create New...