Jump to content

asbjorn

Members
  • Posts

    179
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by asbjorn

  1. $articles = $pages->find("template=article, fieldAuthors=$page"); foreach ($articles as $article) { // something like echo $article->title; } You could also skip a few lines of code if you put the extra fieldAuthors=$page in your selector. Then your pages->find only returns pages where the current page's author is present in fieldAuthors.
  2. I found a solution. At least the solution still works after some testing: Logging in, typing tfa, logging out, closing browser. The solution was to hook the redirect after ProcessLogin::afterLogin. $this->addHookAfter('ProcessLogin::afterLogin', null, function($event) { if($this->wire('user')) $this->wire('session')->redirect("/"); });
  3. I think I got a step closer. I have a few lines of code in a ready.php file to redirect the user to the front end after login. When I removed these lines, the browser login session at my ProcessWire page remembered me the next time, and did not ask for the two factor authentication code. There are the lines of code. I'm not sure about the first part being relevant, but they are part of ready.php anyway. $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->name == 'avdeling') { $event->return = $event->pages->get("id=$event->user")->editor_unit; } }); $this->addHookAfter('Session::loginSuccess', null, function($event) { if($this->wire('user')) $this->wire('session')->redirect("/"); }); Does anyone know why these lines of code would make the login ask for the TFA code every time?
  4. if ($page->parent->template->name == "tags") { $field_name = "tag"; I guess this could work for what you are describing, on the child template (i.e. tag_and_category.php template). Just remove the space after parent->, and you might be good to go. ?
  5. To find the template for the page you are currently at ($page), you can use the information with $page->template. Then you can use a if/else statement to set a variable that would be the field name. if ($page->template->name == "tag") { $field_name = "tag"; } elseif ($page->template->name == "category") { $field_name = "category"; } $items = $pages->find("template=project, $field_name=$page"); It might be other ways as well, but this should be good enough.
  6. If I get specific questions about WordPress, WordPress plugins and/or other services, I will (sometimes, not always) ask the client (or client to be), something like: I understand that you have the need for [general tool description, i.e. SEO editing tools ]. What part(s) of [specific tool name, i.e. Yoast SEO] do you find most useful, and would like to use? Maybe a custom solution would fit your needs better, and save you time on a daily basis. Also, we could look at what could be done automatically when it comes to [short tool description, i.e. SEO] if we look at a custom solution.
  7. If I understand you correctly, you want every individual project page to list all other project pages that has the same tag? If yes, then the following code could work: $items = $pages->find("template=project, tags=$page"); Just to expand further on that: In your code line, if your code would work, would return something like a random project page's child pages of any template that is tagged with $page (current page). But then, ->children is supposed to be used with $page, not $pages.
  8. Five years after I started translating, I have completed all translations for the core / core modules. Hurrah! From now on, translations for upcoming versions of ProcessWire will be tagged as releases with the ProcessWire version name at Releases – processwire-norwegian-language-pack-nb-no – GitHub.
  9. As mentioned in the topic Tfa module not remembering me, I have som issues with getting Tfa codes to be remembered on a website on a subdomain. I have about $70 (US Dollars) to solve this issue. Please PM me or answer this thread. Here are all my previous posts from the linked topic above. On what the issue is and what I know.
  10. Google Tag Manager is useful to track form events. It is how I have tracked visitors use of forms earlier. In addition to the method @MoritzLost suggest, there are ways to track this in the Google Tag Manager admin based on IDs and classes.
  11. The Norwegian language pack has been split into two repositories: One for ProcessWire core translations (default-wire). Same repository as before A new for ProcessWire free and pro modules (default-site): New repository here.
  12. I'd like to see the feature that is available for fields at example.com/processwire/setup/field/tags/ for templates as well as.
  13. Could there be some issues with cookies or sessions? Or settings that one would have to set for a subdomain login to work properly, so that the 2FA code is remembered after a browser restart?
  14. I think I have a relevant clue on how to solve this. It seems that the authenticate code is remembered on my "www.domain.com" page. But the problem I posted on, was on "subdomain.domain.com". So I think it is because of the subdomain. I have not yet found a way to check this out and test my theory.
  15. I have ProcessWire 3.0.165 installed, TfaTotp 0.0.4 and TfaEmail 0.0.2. And I have the problem that the system is not remembering the login. It keeps asking for both login and tfa code at every restart of my browser. Also other users of my website is reporting the same. I am at a loss where to begin debugging this issue. I have tried multiple browsers. Also deactivating all options in ProcessLogin for Do not allow user to skip code entry when any of these properties change does not help. The settings are for remember me for 90 days. Any one had the same experience?
  16. It seems to be an issue with the RSS feed for the ProcessWire blog at https://processwire.com/blog/rss/ , which has not been updated since the 3.0.154 / 3.0.155 post in late April.
  17. Thank you @huseyin, I got it working with the suggested Ajax Search module and some minor tweaking with inspiration from your site and ProcessWire.com. In the end I decided not to use the live search anyway. But I got to try it out, and it could be useful for future clients.
  18. I have a few clients that I work for as a freelancer besides my full time job. So I cannot compare to 500. But I have a preferred shared hosting provider that I use and recommend, based on a few arguments such as it having a great pricing model, being stable and my knowledge of it. Although I have clients with different shared hosting providers if they want that. I think cost matters for both my business and my clients. If I should run a server, learn enough about server security and stability beside web development, the cost for my clients would be more than they would be willing to pay today. If I had more clients, maybe it would be otherwise. I mostly handle support inquiries between my client and their shared hosting provider as well.
  19. I have a website with multiple content types that I want to be accessible through search. I really like the live search on processwire.com, that sorts content types while typing. I tried to find the code to recreate this, with no luck. Does anyone know if this is jquery, specific jquery plugins, json/xml cached files, and what kind of PHP code is used? Any tip that point me in the right direction would be much apperciated. The search result listing seems fairly easy to create with sorting through parameters.
  20. I guess you're right, @zoeck. It was worth a try.
  21. I was looking at this plugin today, and I have the same question as @mn-martin three years ago: Is it still maintained @Jonathan Dart?
  22. Thanks for the cheat sheet, @szabesz. And you're code is great inspiration @Pixrael. Here's my code, @elabx, or parts of it. This is the code that gives me correct output. _main.php <?php namespace ProcessWire; ?> <!doctype html> … template stuff <footer pw-id=footer> … more template stuff </footer> </body> </html> some-page-template.php, the relevant code at the bottom: <?php namespace ProcessWire; ?> … template stuff <?php echo "<script data-pw-append=footer src=\"" . $config->urls->templates . "theme/js/showmore.min.js\"></script>"; echo "<script data-pw-append=footer type=\"application/ld+json\">" . json_encode($schema_review) . "</script>"; ?> But if I edit the last part, to <script pw-append=footer… instead of data-pw-append, it will output the scripts before <!doctype html>. That is what I don't get. Reading about the two variations being similar in usage.
  23. @huseyin I think it is worth the change for me. I used a method where i included head.php, header.php and foot.php on each template. Now I have it all in _main.php. That alone was a step for me in the right direction. Also, I have moved a lot of code around. My site has grown over time, so it was a lot of if statements in head.php e.g.: if ($page->template == "basic-page") { … Now I solve it with regions in _main.php and each template file. Still getting to know Markup Regions though.
  24. I am trying Markup Regions for the first time on a site these days. And I have read Markup Regions Front-End Docs at ProcessWire.com. There is says that "pw-" and "data-pw-" is doing the same thing. Although I get different output when I try both in the same situation. E.g. when I am trying to append a <script>-tag, I need to add data-pw-append=footer. With just pw-append, it will output the script above <doctype> and <html>. Also, I need to use data-pw-append inside a php function, with pw-append the same as above happens. Other places, I cannot recall exactly where, the opposite happens. Where I have to use pw-append instead of data-pw-append. (Or pw-id instead of data-pw-id). Is this normal behavior? Is there any more documentation on usage I have missed perhaps?
  25. I solved this with a work around. I checked if a page was modified in the last hour. If it was modified, I did not run the function. If it was not modified in the last hour, I run the function. That way, I could set the LazyCron to fire "every30Seconds".
×
×
  • Create New...