GradDev
Members-
Posts
16 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
GradDev's Achievements
Jr. Member (3/6)
3
Reputation
-
Thank you @Jan Romero for your reply! I installed Tracy Debugger, checked how to use the console to get the SQL like in the link you have shared and following are the results. I am not able to understand the details in the query yet, but it surely is different for both the users. When run in with Admin user: I ran this in the console of Tracy: d($pages->getPageFinder()->find(new Selectors("report_meta_details.report_type.title=Global"), array('returnQuery' => true))->getQuery()); And this was the result: (please note that there are many many similar lines where I have entered dots) SELECT pages.id,pages.parent_id,pages.templates_id FROM `pages` JOIN field_report_meta_details AS field_report_meta_details ON field_report_meta_details.pages_id=pages.id AND ((((field_report_meta_details.data=25488) ) OR ((field_report_meta_details.data=25507) ) OR ((field_report_meta_details.data=25526) ) OR ((field_report_meta_details.data=25545) ) OR ((field_report_meta_details.data=25564) ) OR ((field_report_meta_details.data=25583) ) . . . OR ((field_report_meta_details.data=38127) ) )) WHERE (pages.status<:i0X) GROUP BY pages.id And for the Guest User: I entered this: d($pages->getPageFinder()->find(new Selectors("check_access=0,report_meta_details.report_type.title=Global"), array('returnQuery' => true))->getQuery()); And this is the result: SELECT pages.id,pages.parent_id,pages.templates_id FROM `pages` JOIN field_report_meta_details AS field_report_meta_details ON field_report_meta_details.pages_id=pages.id AND ((((field_report_meta_details.data=0) ) )) WHERE (pages.status<:i0X) GROUP BY pages.id Following is run in Tracy console without "check_access=0" with Guest user: d($pages->getPageFinder()->find(new Selectors("report_meta_details.report_type.title=Global"), array('returnQuery' => true))->getQuery()); And this is the result: SELECT pages.id,pages.parent_id,pages.templates_id FROM `pages` JOIN field_report_meta_details AS field_report_meta_details ON field_report_meta_details.pages_id=pages.id AND ((((field_report_meta_details.data=0) ) )) LEFT JOIN pages_access ON (pages_access.pages_id=pages.id AND pages_access.templates_id IN(2,133,3)) WHERE (pages.status<:i0X) AND pages.templates_id NOT IN(2,133,3) AND pages_access.pages_id IS NULL GROUP BY pages.id
-
Thank you for the response @elabx But, check_access=0 does not work. I have tried it already. It still returns an empty array. That's what was more confusing for me! ? (I should have added it in the question. My mistake.) And yes, it is the same with find() and the parent selector. ----- @Jan Romero yes, you are right! I do use the selectors in a key-value pair for more clarity in code ?
-
Hello, I have the following selector and output which works when I am logged in as an admin and as a guest as well. $pages->get("name=reports")->children()->each("report_meta_details.report_type.title") //Output //Array ( [0] => Global [1] => Global [2] => Global [3] => Global [4] => Global ) Now, The following selector returns different results for Admin and Guest: $pages->get("name=reports")->children("report_meta_details.report_type.title=Global")->each("report_meta_details.report_type.title"); //Output for Admin //Array ( [0] => Global [1] => Global [2] => Global [3] => Global [4] => Global ) //Output for Guest //Array ( ) Here, the field "report_meta_details" is a FieldsetPage, the field "report_type" is a page reference (to children of a page called report-type). Now, the first once runs for both the users; and both the users have the access to the templates, as the titles are returned correctly in the first selector. But the second one, the selector is using something that the users have access to but still does not show the results to the Guest. Any reasons why this is the case? All help is appreciated. Thanks! EDIT: I have tried the check_access=0 selector as well. But no effect.
-
Hello! I am building a searching mechanism where the search key will be compared to three different fields in heirarchy and the matching search results will be saved to a PageArray. Like below $pageData = new PageArray(); $pageData->append($page->children('field_1*=' . $search_key )); $pageData->append($page->children('field_2*=' . $search_key )); $pageData->append($page->children('field_3*=' . $search_key )); $pageData = $pageData->unique(); What I need, is the results of the first query to show up first, then the second and then the third. But the resulted PageArray looks something like the below when printed: ProcessWire\PageArray Object ( [count] => 11 [items] => Array ( [Page:6] => Array ( [id] => 25468 [name] => forage-grass [parent] => /reports/ [template] => report_detailed_page [title] => 3D Forage Grass ) [Page:7] => Array ( [id] => 29724 [name] => 3d-laser-scanners [parent] => /reports/ [template] => report_detailed_page [title] => 3D Laser Scanners) [Page:0] => Array ( [id] => 34700 [name] => 3d-art [parent] => /reports/ [template] => report_detailed_page [title] => 3D art) [Page:8] => Array ( [id] => 34711 [name] => 3d-paint [parent] => /reports/ [template] => report_detailed_page [title] => 3D Paint) [Page:1] => Array ( [id] => 34734 [name] => 3d-mapping-and-modelling [parent] => /reports/ [template] => report_detailed_page [title] => 3D Mapping and Modelling) [Page:2] => Array ( [id] => 34746 [name] => 3d-secure-pay [parent] => /reports/ [template] => report_detailed_page [title] => 3D Secure Pay) [Page:3] => Array ( [id] => 35930 [name] => 3d-food-printing [parent] => /reports/ [template] => report_detailed_page [title] => 3D Food Printing ) [Page:4] => Array ( [id] => 37142 [name] => 3d-mapping-and-modelling [parent] => /reports/ [template] => report_detailed_page [title] => 3D Mapping and Modelling) [Page:5] => Array ( [id] => 37154 [name] => 3d-secure-pay-authentication [parent] => /reports/ [template] => report_detailed_page [title] => 3D Secure Pay Authentication) ) [selectors] => ) As you can see, the pages are sorted according to their IDs. While the keys in the array show the actual order in which they were added to the PageArray. I tried to use the sort() method but could not get it to work. I want to print these according to the order they were added to the PageArray. Please help me understanding what might be wrong or what I should be doing! Thank you!
-
How do I use filters to search a string with Double Quotes?
GradDev replied to GradDev's topic in General Support
Right. I used that one but did not work. I corrected the question. But now that I dig a little further, it does not seem to be the issue with double quote escaping. It seems to be the issue with the colon (:) character being surrounded by double quotes. Now, I am trying something like following: $pages->find("textarea_simple*=:\"value1\"") And it returns the pages. But this does not: $pages->find("textarea_simple*=\":\"value1\""); Do I need to escape the colon character as well? But simply escaping it with \: does not work. -
Hello, I have a Processwire website (www.example.com) I want to have a wordpress/woocommerce section of the website at (www.example.com/marketplace/) Is there any way this can be done? Apart from this, I am planning to have a universal login system for both the systems. The logins will be verifies inside of PW and an API will be used to transfer login data to wordpress. Now, in this scenario, how the user sessions can be managed and continued? Is cookies a viable/secure option?
-
@Jan Romero Thanks! The positioning of output formatting was the issue. The code just needs to be- $page_to_change->of(false); $page_to_change = $pages->get("name=xyz"); $page_to_change->resume->deleteAll(); //OR //$page_to_change->resume->delete($page_to_change->resume); $page_to_change->save(); This will make $page_to_change->resume be a Pagefiles array rather than just an object; thus both the deleteAll() and delete($Pagefile) functions work on it now.
-
I have a file field named "resume". I want to delete the file saved in it using the API. The field is limited to only 1 upload of file and the return type is set to "Automatic" which means it will return a single object if a file is available. Now there are two options that I have tried- delete() and deleteAll(). $page_to_change = $pages->get("name=xyz"); $page_to_change->resume->deleteAll(); //OR //$page_to_change->resume->delete($page_to_change->resume); $page_to_change->of(false); $page_to_change->save(); Both of these give an error like- Error: Exception: Method Pagefile::deleteAll does not exist or is not callable in this context(...) I understand that this error is because these two functions work on a wirearray rather than on a file object. But how do I delete a single file?
-
How to convert a codeigniter website to a PW website?
GradDev replied to GradDev's topic in General Support
Thank you all for the inputs. Really appreciate it. I will be learning the basic structure of CodeIgniter for now. In the next four days, once I get the FTP handed over, I will go ahead and decide how to go ahead with this. If needed, I will come back to this thread for support and then also to update how I went ahead with it so it might help someone in the future. -
How to convert a codeigniter website to a PW website?
GradDev replied to GradDev's topic in General Support
Thank you for the quick reply! Okay, so let me make this clear that the website is not live yet. And just has been freshly developed. It is hosted on a server and I will be given the login credentials for the FTP and Database. The client had some issues with the prior developer so they left the project incomplete AFAIK. Hence, not much content to migrate. Maximum of 100 entries might have been done. More entries will be done after I complete the redesign. The templates will be needed are as follows- Movies list page, Individual movie page, books list page, individual book page, events list page, individual event page, home, about us, contact etc. I think many of these designs will already be ready in the project. I just need to know where I can find them and modify them. Even if I get the directory with the HTML/CSS design files, that would be great. -
Hello, My client has come to me with a website that has been developed in CodeIgniter by someone else and wants me take over it for some design changes. The website is basically a directory listing of various of books, movies, events etc. related to a specific topic. So this is heavily database driven. I know basic PHP, and have been using ProcessWire for a while now (though not yet an expert at the APIs). I have no knowledge of how CodeIgniter works. What I will be needed to do is to change the design of some elements a bit, and add a couple of fields of information in the database. My questions are- How do I convert this website into a PW website? How long will it take just for the conversion? Do I need to learn CodeIgniter for it?
-
'failed to open stream: Permission denied' warning
GradDev replied to GradDev's topic in General Support
Okay, I solved it. File ownership was the problem. executed this in a php file- echo get_current_user(); //Acer echo exec('whoami'); //admin Got different outputs for both. The script is run as admin; I thought the folder owner should be admin too. So I went to the online SSH (I'm using google cloud as server), used `sudo su` to change user to root and then ran this command- chown -R Acer /home/admin/web/mywebserver.example.com/public_html/site chown -R admin /home/admin/web/mywebserver.example.com/public_html/site ls -l /home/admin/web/mywebserver.example.com/public_html/site The output was- total 16 drwxrwxr-x 7 admin Acer 4096 Mar 1 18:35 assets -rw-r--r-- 1 admin Acer 2616 Mar 1 21:33 config.php drwxr-xr-x 7 admin Acer 4096 Mar 1 18:17 modules drwxrwxr-x 7 admin Acer 4096 Mar 1 18:18 templates And the warnings were gone. I still don't completely comprehend all the technical details at play here, so I should be careful. I would like to know if I have made any mistakes or have left some loopholes in these settings that might be problematic later? Thanks! P.S.- I'm loving PW and especially the community. You guys are awesome! -
'failed to open stream: Permission denied' warning
GradDev replied to GradDev's topic in General Support
Hey Christophe, thanks for the reply. I emptied all the folders inside site/assets/cache/ folder. Now the server is showing this error instead- Error: Exception: Unable to create directory /home/admin/web/mywebserver.example.com/public_html/site/templates/ (in /home/admin/web/mywebserver.example.com/public_html/wire/core/FileCompiler.php line 228) I even tried changing the ownership of these files in SSH using the 'chown' command. nothing worked,