-
Posts
1,360 -
Joined
-
Last visited
-
Days Won
49
Everything posted by flydev
-
Sorry for the short answer, i am on mobile. Shouldn't be : $repeaterDay->save('film_times'); ?
-
A fast answer, suggestion. From there : https://dev.mysql.com/doc/refman/5.6/en/charset-charsets.html mysql> SHOW CHARACTER SET; +----------+-----------------------------+---------------------+--------+ | Charset | Description | Default collation | Maxlen | +----------+-----------------------------+---------------------+--------+ | latin1 | cp1252 West European | latin1_swedish_ci | 1 | | utf8 | UTF-8 Unicode | utf8_general_ci | 3 | | utf8mb4 | UTF-8 Unicode | utf8mb4_general_ci | 4 | +----------+-----------------------------+---------------------+--------+ My bet is that you might have a 4-byte characters in a keyword which is actually triggering the error where MySQL utf-8 character set only supports 3-byte characters. My recommendation is to convert your database to the utf8mb4_general_ci collation. PS: Backup, Backup, Backup Edit: Blog post found on ProcessWire: https://processwire.com/blog/posts/pw-3.0.15/#utf8mb4-considerations Good luck ?
-
When we submit the login form of your admin page, the response is a 404 error code. Also your attempt to visit the reset.php failed, you might have an issue with the .htaccess file. You could try the following : backup everything create a file - disable-procache.php - on the root web dir (along the index.php file) with this code: <?php namespace ProcessWire; require_once('./index.php'); // get the module $pc = $modules->get('ProCache'); // turn off procache $pc->cacheOn = false; visit the page at http://yourwebsite.com/disable-procache.php replace the .htaccess file with this https://github.com/processwire/processwire/blob/master/htaccess.txt (do not forget to rename it to .htaccess) try to login - result ?
-
That's good to know about MAMP Pro, thanks ! About PureVPN, if you feel concerned by privacy things, check this website for a short - bad/sad - review about PureVPN : https://restoreprivacy.com/purevpn-review/
-
shortcut to adding admin page in menus?
flydev replied to benbyf's topic in Module/Plugin Development
For modules, what @dragan said. Also in getModuleInfo(), you can add : 'page' => array( 'name' => 'mymodulepage', 'parent' => 'setup', 'title' => 'MyModulePage' ), And how do you do that ? The reason is because the page added require a ProcessModule to be defined. -
Remove items from one array to another without deleting pages
flydev replied to Tom.'s topic in General Support
I don't fully understand the issue, there is an example of buidling a PageArray, inserting pages, looking for a given page (item), removing it from the PageArray : // example $allpagesarray = new PageArray(); // loop to get all Page tree object and insert them in the PageArray for this example foreach($pages->get(1)->children as $p) { $allpagesarray->add($p); if(count($p->children)) { foreach ($p->children as $cp) { $allpagesarray->add($cp); } } } echo "count allpagesarray: {$allpagesarray->count}<br>"; // new PageArray containing some Page object $productpages = new PageArray(); foreach ($pages->get('/products/')->children as $prod) { $productpages->add($prod); } $firstprod = $productpages->first; // the Page object we are looking for in $allpagesarray if($allpagesarray->has($firstprod)) { echo "page found (id:$firstprod->id), removing it from PageArray<br>"; $allpagesarray->remove($firstprod); if($allpagesarray->not($firstprod)) echo "page (id:{$firstprod->id}) removed<br>"; } // check if the Page still exist after removing it from the PageArray if($allpagesarray->not($firstprod)) { echo "page not found (looking for id: {$firstprod->id})<br>"; } else { echo "page still found (id:{$firstprod->id})<br>"; } echo "count allpagesarray: {$allpagesarray->count}<br>"; -
Create a hook in ready.php that can also be used in a template file
flydev replied to a-ok's topic in General Support
Yes, to be more precise, as it look like you want to access this array from a template, you will want to set this array as a property to the right page id or template context. Check : wire()->addHookProperty(...); https://processwire.com/api/ref/wire/add-hook-property/ -
Create a hook in ready.php that can also be used in a template file
flydev replied to a-ok's topic in General Support
Hi, I think we could say that ready.php is one of the file where we can define hooks to alter templates. It could also be a module. So yes, it's possible and it's the way to go and it depend only on the context you put your hook on. -
Sorry @MarcoPLY I didn't saw your last ping! This is the correct way to call the hook, put it in ready.php as you did then, go to Modules > Refresh if you still can't see the hook. Code : wire()->addHookAfter('Pages::saved', function(HookEvent $event) { // Get the object the event occurred on, if needed $pages = $event->object; // Get values of arguments sent to hook (if needed) $page = $event->arguments(0); // your code: $page = $event->arguments[0]; bd($page); // tracy debug: User page object if ($page->template == "user") { $mc = wire('modules')->get("SubscribeToMailchimp"); $email = wire('user')->email; $subscriber = [ 'FNAME' => wire('user')->pad_firstname, ]; $mc->subscribe($email, $subscriber); bd($mc); // tracy debug: MailChimp object } });
-
Correct, try to compare your hook-code and the one on the documentation: https://processwire.com/api/ref/pages/saved/ hints: function, HookEvent, $pages, $event, object; ? besthintever: tracy
-
Ok this is the issue. Your problem is a known bug in SOAP extension and you should update the version running on your server to at least PHP 7.1.14 (known to me where the bug was fixed and its working). So just to be clear, PHP 7.0 branch contain the bug. To fix it, update the server PHP version. And FYI, a good habit is to develop with the same environment to avoid those head scratching moment ? - https://bugs.php.net/bug.php?id=70469 Submitted: 2015-09-10 13:50 UTC Modified: 2017-11-22 22:14 UTC https://github.com/php/php-src/pull/2899
-
Hi, Are you on ProcessWire 3 ? If yes then write at the top of the check_code.php the following code : <?php namespace ProcessWire; What's the error(s) ? - Assuming the problem is calling this file, modify your call(s) to this file like that : <!-- example for form action --> <form method="post" action="<?= $config->urls->templates; ?>download/check_code.php"> [...] </form> <!-- example for redirect --> <?php $session->redirect($config->urls->templates . 'download/check_code.php');
-
Whats the PHP version on XAMP and server? (Cant reproduce the error, working fine here)
-
By default, SOAP trigger error with his custom php error handler. To catch exceptions, add array('exceptions'=> true) as an argument : try { $client = new \SoapClient('faulty url goes here', array('exceptions'=> true)); } catch (\SoapFault $e) { echo 'wrong'; }
-
Hi @quickjeff It should work out of the box. Just put the code after the LoginRegister execute() function call, done. Nope, no reason ?
-
You are safe to skip this warning while you are sure you don't have a script that need to run longer than the limit (e.g. a custom cron job which in this case will fail silently). If you don't have lot of modules or your site's size isn't that "big" then you are again safe to ignore it. A small note about this specific warning coming from the FileCompiler.php to try to find out the culprit (imho, in your case, it come from a module) : Read on https://processwire.com/blog/posts/processwire-3.0.14-updates-file-compiler-fields-and-more/#file-compiler-updates Call to set_time_limit() in ProcessWire 3 : https://github.com/processwire/processwire/search?q=set_time_limit&type=Code
-
It depend on your needs, check : [...] const statusInit = 2; // system and modules are initializing const statusReady = 4; // system and $page are ready [...] E.g: in init.php, $page is not accessible (called too early) in ready.php, $page is accessible. Summarily said, new API variables are set (populated) before your prepended file to be consumed in your templates. If you want to access the $general variable as is from a template, you will have to set it in ready.php because here you can know the template/page context. Check those four examples.. Let's say we want to debug $general from our home.php template using Tracy with bd($general); #1 - Set new API var in init.php : (both call return null because we try to access the API var from a template, but still here the template context is unknown) $general is null $wire->general is null #2 - Set the new API var in ready.php : $general is populated $wire->general is populated #3 - Set the new API var in _init.php : $general is null $wire->general is populated #4 - Set the new API var in home.php : (same result as _init.php) $general is null $wire->general is populated Hopefully this will make thing clearer for you though an expert could explain deeper the thing.
- 1 reply
-
- 6
-
Another idea depending the number of data you got (anyway, not really a criteria here), you could also use RockFinder by @bernhard and custom queries using MySQL EXTRACT function with subquery. # pseudo-query SELECT pages.id FROM ( sub_query ) WHERE EXTRACT(MONTH FROM DATE( subquery_here ) ); https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_extract
-
Benefit of modules over a plain class?
flydev replied to suntrop's topic in Module/Plugin Development
Bump. Answer needed @LostKobrakai in before to put this damn refactoring thing on the tasks list ? -
That's a good question! When I developed this module I didn't had FormBuilder in hand. Now that I have a copy of this module, I will try to see if it works out of the box tomorrow. Stay tuned !
-
Hi and sorry guys for the late answer, I will take a look tomorrow and will try to answer you both!
-
Look like there is still a problem with your .htaccess or as @kongondo said, a language issue. Is your website a multi-language one ? What happen if you activate the .htaccess directive RewriteBase / ? # ----------------------------------------------------------------------------------------------- # 11. OPTIONAL: Set a rewrite base if rewrites aren't working properly on your server. # And if your site directory starts with a "~" you will most likely have to use this. # ----------------------------------------------------------------------------------------------- RewriteBase / # RewriteBase /pw/ # RewriteBase /~user/
-
I would go with a custom module to give ability to your administrators to insert/remove/update the potentials users which ares stored in the pages tree. If the people pages list is very large, it is not a problem, you will end up with a paginated pages tree, and you will have the ability to find easily those users (pages) from the search case or even the Pages > Find menu. You can also write a small Process module to manage those pages with a datatable, rockgrid or whatever you would like to use. - Reading @kongondo's answer after writing I see that he already explained the idea. Check this thread. Simply build a template for "people" and import them as a pages. This make things a lot easier. Just build your Process module to manage those pages. You can have a working prototype at the end of the day with all the information found on this forum.
-
You need to enable php short tag in the php.ini file or add php to any tag < ? then clear the cache.
-
Hola, si quieres ayuda, tienes que saber que en este foro se habla ingles ? Intenta lo que sigue. ----------------------------- First install the module TracyDebugger. Then in the root folder of the website, create a file trash.php and write the following code inside this file : <?php namespace ProcessWire; include_once('./index.php'); set_error_handler(function($severity, $message, $file, $line) { if (error_reporting() & $severity) { throw new \ErrorException($message, 0, $severity, $file, $line); } }); wire('pages')->emptyTrash(); then navigate to http://yourwebsite.com/trash.php and check the logs.