Jump to content

DV-JF

Members
  • Content Count

    138
  • Joined

  • Last visited

Community Reputation

32 Excellent

About DV-JF

  • Rank
    Sr. Member

Recent Profile Visitors

3,906 profile views
  1. Push... No, ideas? @ryan may I asked you, if you could have a look on this thread and give me a little hint 🙂? Many greets!
  2. When I do bd(wire('languages')->getLanguage()); in my module, I get an error: Session: Method Languages::getLanguage does not exist or is not callable in this context
  3. Hi @Dzung it depends on how much you want to build on your own or how many conditions you want to have preset. There are many ways how a blog system could be build up. Just search the forum to get an idea. Perhaps this might be a good starting point for you: Many greets...
  4. @bernhard Thank you for creating the issue in repo.
  5. Hi, I've had the same problem. Have a look here, this helped me out: https://github.com/ryancramerdesign/LoginRegister/pull/4/commits/e678f0d87abf9c8e43028f3636aaedb5ee43359e Many greets!
  6. Hi, maybe I've found a bug, but there's a behavior I can't explain: I'm trying to hook into Pages::saveReady with following code example: https://processwire-recipes.com/recipes/extending-page-save-process/ <?php /** * Hook the saving of pages to add own processes. * * ProcessWire 2.x * Copyright (C) 2014 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://processwire.com * */ class HookAfterPagesSave extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'HookAfterPageSave', 'version' => 1, 'summary' => 'Hook the saving of pages to add own processes.', 'singular' => true, // Limit the module to a single instance 'autoload' => true, // Load the module with every call to ProcessWire ); } public function init() { // init() is called when the module is loaded. // saveReady is a hook after processing the previous changes of the page, // but just before those changes are saved to the database. // It's called for each page that's being saved, no matter if it's in // the backend or in your templates via the api. $this->addHookAfter('Pages::saveReady', $this, 'afterSaveReady'); } In the afterSaveReady() function I'm trying to get the language property of the user who saved that page, but instead of returning the correct user language the default language is always returned. <? public function afterSaveReady($event) { $userLanguage = $this->user->language; bd($userLanguage); $this->message("User Language: ".$userLanguage); }; Here's the output and a test with the console of TracyDebugger Any ideas? Should I open a ticket here: https://github.com/processwire/processwire-issues/issues ? Many greets!
  7. Which tab is initially activated depends on the chosen user language. See \wire\modules\LanguageSupport\LanguageTabs.module line 69: // determine the index of the tab for the user's language $activeTab = 0; foreach($this->languages as $index => $lang) { if($lang->id == $language->id) $activeTab = $index; }
  8. Hey girls and guys, I'll want to open this thread in order to discuss a main problem I've run into with following setup: I'm maintaining a site where different URLs are directed to the same folder. In site/ready.php the $user->language is set based on the $config->httpHost <?php /* Set language based on the domain and user is not logged in */ /* Slovenian */ if( $config->httpHost == "www.domain.si" || $config->httpHost == "domain.si" || $config->httpHost == "domain.si.local") { if (!($user->isSuperuser())) $user->language = $languages->get('si'); } /* German */ elseif( $config->httpHost == "www.domain.at" || $config->httpHost == "domain.at" || $config->httpHost == "domain.at.local" || $config->httpHost == "domain.ch" || $config->httpHost == "www.domain.ch" || $config->httpHost == "domain.de" || $config->httpHost == "www.domain.de") { if (!($user->isSuperuser())) $user->language = $languages->get('default'); } /* Croatian */ elseif( $config->httpHost == "www.domain.hr" || $config->httpHost == "domain.hr" || $config->httpHost == "domain.hr.local") { if (!($user->isSuperuser())) $user->language = $languages->get('hr'); } /* English */ elseif( $config->httpHost == "www.domain.eu" || $config->httpHost == "domain.eu" || $config->httpHost == "domain.eu.local") { if (!($user->isSuperuser())) $user->language = $languages->get('en'); } /* Italian */ elseif( $config->httpHost == "www.domain.it" || $config->httpHost == "domain.it" || $config->httpHost == "domain.it.local") { if (!($user->isSuperuser())) $user->language = $languages->get('it'); } The homepage (id=1) has following settings: As you can see German (Deutsch) is set as default language. Everything is working nice and fine and I'm really happy with this kind of setup but now there are some new requirements, which causes me quite a headache : I've to add some pages only in one or two languages (they should not be present in German) I've to create some editor roles that are allowed to only edit (can be done with https://processwire.com/docs/user-access/permissions/#multi-language-page-edit-permissions) & add pages to their specific language. What I've found out so far: The default language can't be disabled and must always be present (though this would be in my eyes the easiest solution) Creating my own "language select field" - example here: won't work in this case because I've to rely on the native languages in order to setup the right permissions for editors. There seems to be some solutionsbut I think these won't match for me because I've to think about handling editors and permissions, too. After searching and searching, scratching my head and searching and searching again, the only possibility that comes to my mind is to add another language for German and assign this language to the specific URL's instead of the default language. The advantages with this solution for me: I could activate or deactivate any language on any page Editors which are allowed to add pages can get the permission page-edit-lang-default without affecting the German pages. The disadvantages: All multi-language-fields will have an empty tab for the default language - this may irritate editors a lot Seems to me like a lot of work to do because I've to copy the language field nearly for 1000 pages/repeaters (maybe I'll find an SQL query) My questions: How would you handle this task? Could my setup be optimized in a completely different way? If I go for my solution (adding another language for German) would it be possible to hide the language tab for default language in any way? If some points aren't clear enough please don't hesitate to ask. Many greets...
  9. Hi, I'm using this kind of setup (https://processwire.com/blog/posts/language-access-control-and-more-special-permissions/#language-page-edit-permissions) in order to control the page edit permissions. Now I'm wondering if it's possible to hide the "none-ediable" language-tabs instead of striking them through. Many greets...
  10. Hi, I've found this topic due a hint from @Robin S here: One question is open to me: I'm wondering if it's possible to "manually create" an error in order to test if the code is running fine and everything works as expected? Could someone please give me a hint how to force the LoginRegister module to throw an error. Many greets!
  11. @Robin S Thank you for your advice, somehow I've missed that topic during my research! I'll post other questions there. Many greets.
  12. Hi all... after looking into the I've recognized some errors caused by this module. Error: Exception: Login not attempted due to overflow. Please wait at least 5 seconds before attempting another login. (in /***/public_html/wire/modules/Session/SessionLoginThrottle/SessionLoginThrottle.module line 150) Error: Exception: Login not attempted due to overflow. Please wait at least 20 seconds before attempting another login. (in /***/public_html/wire/modules/Session/SessionLoginThrottle/SessionLoginThrottle.module line 150) Error: Exception: This request was aborted because it appears to be forged. (in /***/public_html/wire/core/SessionCSRF.php line 191) Is there a way to output these errors in a user friendly way, without throwing an "Internal Server Error" on the Frontpage (see attached video)? Many greets! IMG_3955.MOV
  13. I'd run into the same issue. Everything worked well, but then I've added a PageReferenceField to the user template. Since then I can't complete the register process. Unable to complete confirmation, please re-register and try again @Dadswell96 Did you find a workround? Many greets!
  14. Did you managed this task ? I'm trying nearly the same thing - would be nice to get some hints.
×
×
  • Create New...