-
Posts
741 -
Joined
-
Last visited
-
Days Won
12
Posts posted by psy
-
-
Another thing I love about PW is the friendly, supportive forum. I certainly don't want to be accused of trolling the guy. He put his opinion out there based on his experiences, as is his right. Should he venture here though, I'd be more than happy to help him with his PW site
-
6
-
-
-
"You can't fix 'stupid'" is an old saying. Sure PW is not for everyone and as the guy said, "Great for developers (I assume), pretty bad for everyone else". What got up my nose was he presents himself as a web developer/designer/guru and his own site is technically bad. Done well, PW is great for everyone. I suspect where he got lost was "assuming" that PW was a load the app, apply a FE theme, bung in a few plugins, squeeze your content to fit the theme and away you go.
The thing I love most about PW is the exact opposite. I have complete freedom to build my sites, backend, frontend & user-friendliness
-
7
-
-
After looking at his site, my guess is "You can't fix 'stupid'"
-
3
-
1
-
-
4 hours ago, wbmnfktr said:
if($page->template = "mediaSeries") {
Shouldn't that statement have a == ?
-
9 hours ago, dragan said:
That's exactly where (the often overlooked) Pro field "Functional Fields" shines. It does exactly what you are looking for.
I usually do a combination of both - separate 'Business Info' page that stores stuff like logo versions, etc and a functional field that stores common text phrases. All editable by admin on that page and (I believe as don't use it), editable for multi-lang sites. Even go so far sometimes to make the page a link in the admin main menu, with or without a custom module
-
Hi @3fingers, thank you.
As mentioned, it's not an out-of-the-box solution. Read the Dropbox API doco. Maybe:
- Dropbox app/yourclientfolder/subfolder-by-pw-user ? Or,
- List files in the Dropbox folder as checkbox options in the client's private page admin area- tick for each needed by user? Or,
- As you mentioned, copy/paste links in a repeater on the client's page
There are lots of options. Think of these API's as toolboxes that allow you to create the scenario that suits your client's requirements.
-
2
-
Definitely NOT an out-of-the-box solution to your specific requirement but there is this module which may be a good starting point:
It acts as a wrapper for the Dropbox API, giving you access to Dropbox features such as uploading to folder(s), user access, etc in conjunction with @benbyf's https://github.com/benbyford/InputfieldDropbox
-
1
-
-
After your error message, try $this->exit() which halts all further processing, including the save function.
-
Solved! Thanks @Zeka
Solution:
<?php // in my auto-loaded custom module public function init() { $this->addHookAfter('ProcessPageView::pageNotFound', $this, "unpublishedProfile"); } public function unpublishedProfile (HookEvent $event) { $page = $event->arguments(0); if ($page->isUnpublished() && $page->template == 'profile') $this->wire('session')->redirect($this->wire('pages')->get(1312)->url); }
-
2
-
-
Thanks @Zeka, think you're onto something there. I searched but could not find
-
For pages with a particular template, I would like them to display/redirect to a different page from the normal http404 page when status is unpublished. Can't figure out what to hook and where. Un-working code is:
<?php // in my auto-loaded custom module public function init() { // this hook doesn't catch... returns the normal http404 page for unpublished template=profile pages $this->addHookBefore('Page("template=profile")::loaded', $this, "unpublishedProfile"); } public function unpublishedProfile (HookEvent $event) { $page = $event->arguments(0); if ($page->isUnpublished()) $this->wire('session')->redirect($this->wire('pages')->get(1312)->url); }
Also tried to hook After page loaded with same result, ie default Page Not Found shown.
Help & suggestions to fix much appreciated.
Cheers
psy -
Rather than use the problematic PW front-end image uploads, I went for uppy and with @Robin S' amazing help, got it working. Tus/Uppy has a nice drag-n-drop user interface, overcomes file size limits, allows for resumable uploads + more.
In Robin's example, he saves the images to a new page. In my case, I prepended the page id and an underscore to the filename in the Uppy js code. Then, in the uppy server page code, identify the required page by exploding the filename on the underscore.
Maybe time to get a new horse?
-
2
-
-
Great addition to FB, thanks @BitPoet
Small problem when using FB40a with PW3.0.145 to remember form entries in a cookie. On revisiting the form displays the number of rows I've added but they're empty of data.
-
Lots of PW goodness in this one too: https://processwire-recipes.com/
-
1
-
-
Thanks again @teppo. I tried a few things with my limited knowledge of Apache including changing root dir privileges to 777 (scary I know!) for testing purposes to see if the error message was correct. Didn't change anything so switched the root dir privileges back to PW preferred settings.
Obviously something is amiss and fairly certain it's not that SeoMaestro cannot create the file. I even saved a dummy sitemap.xml file (updated module prefs to same file name) in the root dir and still no luck. I've used this module before with success on other sites with earlier PW versions.
Problem reared its head with PW1.0.142+. Wondering if maybe latest .htaccess or other is affecting things? @Wanze?
-
Hi @teppo, yes had field named 'seo' of FieldtypeSeoMaestro assigned to a number of templates and publicly viewable pages
-
On 11/1/2019 at 7:33 AM, titanium said:
Somebody mentioned that earlier in this thread, but no solution was proposed (the error went away automagically in that case).
Problem didn't go away for me. It still exists and no solution found. Turned off sitemap.xml generation to lose the error message. Still hoping for a fix
-
Thanks @dragan will give it a try.
Another idea I had was to use FormBuilder for the login form - again hackish.
Really wish PW had a solid Login/Register module...
-
2
-
-
Nice ? home page nav was a bit confusing for me, eg when clicking on 'About', it scrolled to your About section but the menu disappeared. There was no obvious way to get back to the top of the page. When I scrolled up, the menu had disappeared. Using iMAC with wide screen. Going into phone mode in Chrome dev tools made it a bit easier... Otherwise, well done you!
-
1
-
-
I want to have both a login form and a registration form on the same page. After much tweaking in CSS & Hooks, I managed to get @ryan's LoginRegister module to display as required. All goes well until it doesn't, ie if there is an error in the form submission.
Each form has the wrapper ID hardcoded to "LoginRegister". Problem is when both forms are on the same page, both forms get the error messages and the Login form turns into a Register form. See attached before-and-after images and my code is in the 'spoiler'.
Spoiler<?php namespace ProcessWire; // the message doesnt work but the goose user who tried to login with both client and admin roles is auto-logged out $message = ''; if ($input->get('logout')==1 && $input->get('g')==1 ) { $message = "You have been auto-logged out as the account you logged in with has both Client and Admin privileges which would completely screw up the application!"; } if($user->isLoggedin() && !$input->get('profile') && !$input->get('logout')) { // you take over and render your own output or redirect elsewhere $session->redirect('/dashboard/'); } else { $wire->addHookBefore('Inputfield::render', function ($event) { $inputfield = $event->object; if ($inputfield instanceof InputfieldTextarea) { // textarea input $inputfield->addClass('form-control'); $inputfield->columnWidth = 100; } else if ($inputfield instanceof InputfieldText) { // includes most single-line text types $inputfield->addClass('form-control'); $inputfield->columnWidth = 100; } else if ($inputfield instanceof InputfieldSubmit) { // submit button $inputfield->addClass('button button-rounded'); } if ($inputfield->required) { $inputfield->addClass('required'); $inputfield->attr('required','required'); } }); $loginRegister = $modules->get('LoginRegister'); $loginRegister->set('renderStyles', false); $loginRegister->set('renderScripts', true); if ($input->get('register')|| $input->get('register_confirm')) { $loginRegister->set('features', array('login', 'register', 'profile', 'forgot','login-email')); } else { $loginRegister->set('features', array('login', 'profile', 'forgot','login-email')); } $loginForm = $loginRegister->execute(); $loginRegister->set('features', array('login', 'register', 'profile', 'forgot','login-email')); $input->get->register = 1; $registerForm = $loginRegister->execute(); $input->get->register = 0; } ?> <region id="regHeadCSS"> <link type="text/css" href="/wire/templates-admin/styles/font-awesome/css/font-awesome.min.css?v=30e" rel="stylesheet"> <?php foreach(wire('config')->styles as $file) : ?> <link rel='stylesheet' type='text/css' href='<?=$file?>' /> <?php endforeach;?> </region> <region id="regContent"> <!-- Content ============================================= --> <section id="content"> <div class="content-wrap"> <div class="container clearfix"> <div class="col_one_third nobottommargin"> <div class="well well-lg nobottommargin"> <?=$message?> <?php if (!$input->get('register') && !$input->get('register_confirm')) : ?> <?php try { echo $loginForm; } catch (WireException $e) { echo "Too many failed login attempts.<br>" . $e->getMessage(); } ?> <?php endif;?> </div> </div> <div class="col_two_third col_last nobottommargin"> <?=$page->body?> <?php // needed to avoid server 500 error when user tries to login too many times in the other form try { echo $registerForm; } catch (WireException $e) { echo "Too many failed login attempts.<br>" . $e->getMessage(); } ?> </div> </div> </div> </section><!-- #content end --> </region><!--regContent-->
Help to fix much appreciated
-
Thanks @teppo realised I'd posted in the wrong forum and didn't know how to change it
-
1
-
-
1. I'm getting the following error on a number of sites running PW3.0.142+
Failed to generate the XML sitemap
Even though the API should have write access to the site root (unless something has changed in .htaccess?). I know others have raised this issue but I cannot figure it out.
2. The module default values do not parse PW vars while per page SeoMaestro fields do, eg in the field default Meta section:

literally displays {title} in the browser tab. However if on a page seo override I uncheck the Inherit default value checkbox and enter:

on page output, it correctly parses headline (1st priority) or page title (2nd priority) text in the browser tab.
Help to fix both issues much appreciated.
-
All good. Did you know about:
$page->images->firstand
$page->images->lastI often use $pages->images->last when client uploads images and wants the last one to display. To get really specific, you can call the image within a Pageimages array by calling the image by its index. Pageimages derives from WireArray which allows you to call an item by its index https://processwire.com/api/ref/wire-array/eq/
-
1
-


CKEditor as a Formbuilder Front End Field
in Module/Plugin Development
Posted
@prestoav I needed something similar however I did not want to give the front end users all the features available in the PW CKEditor menu. It was more difficult for me to reduce the feature set than start afresh for the front end and I chose TinyMCE over CKEditor.
In the form, I created a textarea field with no textformatters and a limit of 5000 characters. In my template:
And the end result on the front end:
Data is saved correctly in the DB and all good.
PS: If anyone tries to add in a sneaky <script>, it throws 403 Forbidden error