Jump to content

theoretic

Members
  • Posts

    85
  • Joined

  • Last visited

Recent Profile Visitors

2,077 profile views

theoretic's Achievements

Full Member

Full Member (4/6)

37

Reputation

  1. @Jan Romero, You're super cool! That extra slash in form action value resolves the problem. Thanks a lot!
  2. Hi friends! And thanks for Processwire! I've got a strange PW behavior which i cannot explain. Maybe i'm missing something. I have a form with method=post and action=action_page (different from page where the form resides). I'm trying to use post vars in the action_page's template. Both $_POST and $input->post() are empty. Deeper analysis shows that PW performs a http 301 redirect to action_page after the form is submitted, so all post vars are no longer available. How can i prevent PW from doing so? Did some simple tests to find the reason, i'm 95% sure that the redirect is triggered by PW. Thanks in advance for any advice!
  3. Hi everybody! And thanks for Processwire! I like PW hooks and use them in almost all of my projects. But it appears i'm missing some functionality. Some pseudocode to explain my wishlist: //somewhere in site/ready.php addHookClass('Page(template=my_template)::my_data', function($event) { ... } //somewhere in site/templates/my_template.php var_dump($page->my_data); //should output a multilevel array or nested objects $page->my_data->set('some_var',$some_value); //doesn't write to database $page->my_data->save(); //$page->save('my_data') is not applicable here because my_data is not a regular PW data field In fact i'm trying to create a solution for manipulating per-user settings (how to display some data on some pages etc.) but this approach may appear to be useful in different cases. Any suggestions are welcome!
  4. Just to clarify the situation. It appears that i've run into Firefox memory issues. I have many Firefox tabs and windows opened at the same time, and sometimes it may lead to strange effects concerning sessions and cookies. So it's not a Processwire-related issue. Hope this will be useful for someone.
  5. Hi guys! And thanks for Processwire! I got a strange issue concerning user system behavior. Maybe it's a bug in Processwire, maybe i'm missing something. I'm developing a site having 2 different user templates: the native user template and member template. The alternative user template setup has been done according to official tutorial. What's working fine: "Regular" users can log in and log out as intended Member users also can log in and log out as intended using $session->forceLogin($memberUser) and $session->logout() "Regular" users (all having superuser permissions) can access admin pages and use them Member users have their own set of permissions, they cannot access admin pages What's buggy: Both $session->forceLogin($memberUser) and $session->logout() have no effect on "regular" user sessions. Logging in/logging out regular users have no effect on member user sessions. Member users can only access their own personal pages with member template, trying to access other member pages gives 404. The only project-specific thing which could potentially lead to this behavior is the empty password field for any member user. They always log in using $session->forceLogin() and credentials obtained from external API. Tried to assign a password for one of member users; that user could log in/log out using admin page but the above-described bugs were still the same for him. Have no idea how to fix this, will appreciate any help. Thanks in advance! P.S. I'm using Processwire 3.0.201 in both dev (Windows) and test (Linux) environments.
  6. Thanks @matjasp! It's exactly what i've missed.
  7. Hi friends! And thanks for Processwire! I've found a... hmm, not a bug but rather missing feature. Let's imagine we have a field of type Page Reference. Due to some reasons (e.g. for having possibility to create new pages directly from inputfield) we assigned a Parent page to Selectable pages settings of our inputfield. Later we decide that we n o longer need that Parent page setting. And - voila! - there's no possibility to unset it. In fact, this impossibility may lead to errors like "A page does not have necessary parent" which may appear while populating our inputfield programmatically. At the moment, the only way to fix this is to edit the database manually and to delete the parent settings from 'data' column. Hope this will be fixed in later versions of Processwire. Thanks again!
  8. @Pixrael, good question! I thought that PW database uses InnoDB by default but it was wrong. Did an InnoDB migration without changing any code, the concurrent tests are experiencing the same troubles as before with MyISAM, but now there will be more space for experiments. Thanks!
  9. Hi friends! Many thanks for the brilliant Processwire! I have an interesting question concerning concurrent requests. I'm working on a PW-driven API which should pass some tests required by my client, including a so-called concurrent request test. The test harness generates a certain number of unique http requests and "fires" them in almost no time (they're received by webserver with time difference of the order of milliseconds). However far from real life use cases, this test is absolutely required by my client. Experiencing such a high (however short) load, PW reveals some weaknesses mainly concerning database interaction. Almost all concurrent requests should update a PW-driven numeric data field (in fact a database table). Concurrent requests try to increment/decrement its value, and after that a final check of the field value is performed. In most cases the final check fails. In-depth study shows that PW may receive new requests before the current request is processed, and this may lead to wrong final value. I tried some possible solutions: Wrapping field-changing operations in a database transaction. No success. Using mysql table lock. In my case this also didn't give a versatile result. Writing a lock mechanism denying any operation with data field until the previous request(s) are ended. Not versatile enough again. Organizing request queue. Maybe the best possible solution, but didn't try it yet. So what are your ideas in this case? Any possible approach is welcome 😉
  10. Hello everybody! And thanks for Processwire! I have an interesting task which i couldn't resolve in the way i'd like. Hope someone will give a good advice 😉 So let's suppose we have pages with template called 'event'. We need an easy way to check whether a user can participate in this or that event. In such cases i'd like to write a hook of this kind: //somewhere in site/ready.php $wire->addHookProperty('User::canParticipateIn', function($event) { //deciding whether user can participate or not $event->return = $result; }); //somewhere in a template file if( $user->canParticipateIn ){ //displaying a form etc. } This generally works with simpler tasks. But in this particular case we need to pass an argument to our newly created hook function. This argument will be an event page instance. So our possible hook should change to something like pseudocode below: //somewhere in site/ready.php $wire->addHookProperty('User::canParticipateIn', function($event) use ($page) { //deciding whether user can participate or not $event->return = $result; }); //somewhere in a template file if( $user->canParticipateIn($eventPage) ){ //displaying a form etc. } Unfortunately this doesn't work. Processwire gives an error: So is there any way to pass an argument to a hook in this case? Thanks in advance for any possible answer!
  11. I think that due to almost-impossibility to change Processwire default language it's not necessary to explicitly name the language from which the text will be translated. It's enough to change all "Translate from English" phrases to just "Translate".
  12. Hello Robert! Thanks for a perfect module! I've made some changes to it (e.g. possibility to set the source language in module settings), how can i collaborate with You?
  13. Hi all! As of end of May 2021 the situation has changed. PagePermissions.module included in Processwire 3.0.178 (and maybe in some of previous versions) has been updated, and @Jan Romero's patch is no longer actual. However you may need to manually create a new permission called user-view-all and apply it to guest role and maybe some other roles. After that guest users will have possibility to browse custom user profile pages.
  14. @Jan Romero, thanks a lot! Your patch resolves the problem. I think it deserves Ryan's attention and should be added to Processwire core.
  15. Hi there! And thanks for Processwire! I've got an interesting case concerning access to current user page. It appears that PW somehow limits access to the frontend page of current user. I'm speaking about a specific PW configuration. We have two kind of users: 'regular' users with native user template and member users with specific member template and specific members parent page (by the way, it's so cool that PW allows to use custom user templates and custom parent for certain user pages!). So a member with name Joe has a page with member template and url like /members/joe . The members template has some access limitations: only member users can see pages with member template. It works like a charm in most situations. For example, user Bill (who has member template and is logged in) can browse a page with url /members/ann which also is a member page with member template. And now, meet the glitch! The above-mentioned Bill cannot get to his own page /members/bill ! PW generates 404 page instead. I see no reason for this behavior. From my point of view any member should have access to any member page in this situation. What am i doing wrong? Any advice is welcome!
×
×
  • Create New...