-
Posts
253 -
Joined
-
Last visited
Everything posted by prestoav
-
Hi there, I'm hoping someone can help here. I've just moved a new site from my development server account over (where the site was working fine for the client to edit content pre-launch) to the client's final hosting account and the live site is all fine. However, while most edits can be done without an issue, image uploads in admin cannot. I know this has been an issue before but, having trawled the posts about it and suggested esolutions I still can't resolve it on their host. PW Version: 3.0.123 PHP version: 7.3.20 max_execution_time 160 max_upload_size 256M GD Library is enabled Looking at the console data it looks like the AJAX request from the image upload is getting a 403 error which is suggesting a permissions issue? First we get this on console: ?id=1169&s=1&c=1:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0 Then, the AJAX request: https://*******/admin/page/edit/?&id=1169&InputfieldFileAjax=1 Gets a 403 according to Chrome Dev Tools > Network XHR. Also, the response is empty. Can anyone point me in the direction of the directory that deals with this and what the permission should be to allow it or indeed any other fix / area to investigate? Thanks so much for your help.
-
OK, I think I found a way in, that is to read the DB more directly for the possible values. I noticed from the original thread about the FieldTypeSelect module @ryan mentioned it stored the options as non-relational values. So, with a bit or trial and error I managed to get the values out. Note that they are stored as a single text string with options separated by the "\n" that comes from the admin input field (I'm guessing). So to get an array of the values for the Select filed called 'listing_types' you can do this: // First let's get an array of the possible values $field = $fields->get('listing_type'); $lts = explode("\n", $field->data["select_options"]); // Now lets show them foreach ($lts as $lt) { echo $lt . "<br />"; } Note also that, as Ryan points out, if the select values in the field have been changed at any time then there may be pages with this field set to values that no longer appear in the array above. You could, I supposed, look at all the set values for pages and build an array that way but this solution works for me. I hope this is helpful.
-
OK, I think I have an idea why might this me an issue. The field uses the older 'FieldTypeSelect' field type rather than 'FieldTypeSelectOptions'. Maybe the getOptions() method is not available for the 'FeildTypeSelect' type? Is there a way to migrate from one to another would anyone know? In admin for this field it's not possible to change the type to Select Options but I can create a new field of type 'Select Options'. Or does anyone know the method for the 'FieldTypeSelect' type to retrieve the options? Thank you!
-
Hi everyone, PW v 3.0.165 I have a select field called 'listing_type' with three options. I'm trying get all values for the select to show on a page. First I have this in the template that grabs the field: // Get Listing Types $field = $fields->get('listing_type'); $fieldtype = $field->getFieldtype(); echo "Field title: " . $field->name . " Fieldtype: " . $fieldtype . "<br />"; This seems to work and I get "Field title: listing_type Fieldtype: FieldtypeSelect" on the page exactly as I'd expect. However, as soon as I add the getOptions line to get the field like this: $field = $fields->get('listing_type'); $fieldtype = $field->getFieldtype(); echo "Field title: " . $field->name . " Fieldtype: " . $fieldtype . "<br />"; $listTypes = $field->type->getOptions($field); I get this error: Error: Exception: Method FieldtypeSelect::getOptions does not exist or is not callable in this context (in wire/core/Wire.php line 544) Looking the exception report this seems to be the issue: Wire->__call('getOptions', Array) Anyone have any ideas why I'm getting this error? Thanks in advance.
-
Date Field with Older Dates Selectable (>10 years ago)
prestoav replied to prestoav's topic in General Support
Perfect! Thank you. I can't believe I missed that! -
Hi all! I'm building a historical page of past events for a client using a repeating field per event and including a Datetime field to input of the date. However, the earliest year that is presented is 2010 (i.e. ten years prior to today). Some of the events the page needs to show have earlier dates than that (starting 2000). Does anyone know a way to change the default choice for this field type? I can't see anything in the field settings. Thank you in advance!
-
CKEditor - Justify Preinstalled on Textarea Fields
prestoav replied to prestoav's topic in Wishlist & Roadmap
Sorry for the late reply, that works a treat!!! Do you know if there is a similar way to set the tools as default as I couldn't see that in AOS? For example I'd like these tools as default in the editor bar: Format, Styles, -, Bold, Italic, -, Superscript, Subscript, RemoveFormat JustifyLeft, JustifyCenter, JustifyRight, JustifyBlock- 11 replies
-
- 1
-
Hi all and thanks for the great work on PW! One thing I find I have to do on any new site is add the Justify plugin to textarea fields as it is such a widely required feature for text headings in content. ANy chance this could be added to the core an automatically be installed on new textarea fields using CKEditor? Thank you!
- 11 replies
-
CKEditor as a Formbuilder Front End Field
prestoav replied to prestoav's topic in Module/Plugin Development
Hi PSY! Thanks for this. Really helpful! I ended up getting it working once I found the missing PWlink plugin and have disabled some formatting tools too!!! -
CKEditor as a Formbuilder Front End Field
prestoav replied to prestoav's topic in Module/Plugin Development
Thanks again dragan. Console was a good call as it looks to be an issue with a missing pwlink plugin. Reloaded that then disabled it and all is working! Thanks for your help! -
CKEditor as a Formbuilder Front End Field
prestoav replied to prestoav's topic in Module/Plugin Development
Hi dragan, perfect, thank you! I knew it would be there somewhere.. Only one issue now, I see a space on the front end where the editor window will go but no styling on the CKEditor window? I've tried using Embed method C and D but, although I see a text area box, there's no CKEditor styling or tools. Here's the code from the page using Embed method D (Custom Embed)... <div class='Inputfield Inputfield_body InputfieldCKEditor' id='wrap_Inputfield_body'> <label class='InputfieldHeader' for='Inputfield_body'>Body text</label> <div class='InputfieldContent '> <textarea id="Inputfield_body" class="InputfieldCKEditorNormal InputfieldMaxWidth" name="body" rows="5" data-configName="InputfieldCKEditor_body"></textarea> <script> ProcessWire.config.InputfieldCKEditor.editors.Inputfield_body = 'InputfieldCKEditor_body'; config.InputfieldCKEditor.editors.Inputfield_body = 'InputfieldCKEditor_body'; </script> </div> </div> I'm getting the styles in the <head> too: <link type='text/css' href='/idreamav/site/modules/FormBuilder/FormBuilder.css' rel='stylesheet' /> <link type='text/css' href='/idreamav/site/modules/FormBuilder/frameworks/basic/main.css' rel='stylesheet' /> <link type='text/css' href='/idreamav/wire/modules/Inputfield/InputfieldPage/InputfieldPage.css?v=107-1577984776' rel='stylesheet' /> <link type='text/css' href='/idreamav/wire/modules/Inputfield/InputfieldCheckbox.css?v=105-1577984776' rel='stylesheet' /> <link type='text/css' href='/idreamav/wire/modules/Inputfield/InputfieldCKEditor/InputfieldCKEditor.css?v=161-1577984776' rel='stylesheet' /> <link type='text/css' href='/idreamav/site/modules/FormBuilder/InputfieldFormBuilderFile.css?v=1-1571064721' rel='stylesheet' /> <link type='text/css' href='/idreamav/site/modules/FormBuilder/themes/basic/jquery-ui.css' rel='stylesheet' /> And scripts in the footer (or should these be in the <head> too)? <script type='text/javascript'>var _pwfb={config:{"InputfieldCKEditor":{"language":"en","timestamp":"2015030801.162","plugins":{"sourcedialog":"\/idreamav\/wire\/modules\/Inputfield\/InputfieldCKEditor\/plugins\/sourcedialog\/plugin.js"},"editors":[]},"InputfieldCKEditor_body":{"baseHref":"\/idreamav\/","contentsCss":"\/idreamav\/wire\/modules\/Inputfield\/InputfieldCKEditor\/contents.css","extraPlugins":"pwimage,pwlink,sourcedialog","removePlugins":"image,magicline","toolbar":[["Format","Styles","-","Bold","Italic","-","RemoveFormat"],["NumberedList","BulletedList","-","Blockquote"],["PWLink","Unlink","Anchor"],["PWImage","Table","HorizontalRule","SpecialChar"],["PasteText","PasteFromWord"],["Scayt","-","Sourcedialog"]],"format_tags":"p;h1;h2;h3;h4;h5;h6;pre;address","language":"en","entities":false,"uploadUrl":"","pwUploadField":"","pwAssetPageID":0,"height":"10em","stylesSet":"mystyles:\/idreamav\/wire\/modules\/Inputfield\/InputfieldCKEditor\/mystyles.js","customConfig":"\/idreamav\/site\/modules\/InputfieldCKEditor\/config-body.js?nc=1567498470"},"debug":false,"urls":{"root":"\/idreamav\/"}}};if(typeof ProcessWire=='undefined'){ProcessWire=_pwfb;}else{for(var _pwfbkey in _pwfb.config) ProcessWire.config[_pwfbkey]=_pwfb.config[_pwfbkey];}if(typeof config=='undefined') var config=ProcessWire.config;_pwfb=null;</script> <script type='text/javascript' src='/idreamav/wire/modules/Inputfield/InputfieldPage/InputfieldPage.min.js?v=107-1577984776'></script> <script type='text/javascript' src='/idreamav/wire/modules/Inputfield/InputfieldCKEditor/ckeditor-4.12.1/ckeditor.js'></script> <script type='text/javascript' src='/idreamav/wire/modules/Jquery/JqueryUI/JqueryUI.js?v=1577984776'></script> <script type='text/javascript' src='/idreamav/wire/modules/Jquery/JqueryUI/modal.min.js?v=1577984776'></script> <script type='text/javascript' src='/idreamav/wire/modules/Inputfield/InputfieldCKEditor/InputfieldCKEditor.min.js?v=161-1577984776'></script> <script type='text/javascript' src='/idreamav/wire/templates-admin/scripts/inputfields.js'></script> <script type='text/javascript' src='/idreamav/site/modules/FormBuilder/form-builder.js'></script> -
Hi folks. I'm building a Formbuilder form to create new advert pages in a marketplace. Formbuilder is ideal for this. I need to add a description field that allows text to be added with line breaks etc. so showing a CKEditor field would be ideal (i.e. exactly like the field I'm typing into right now)!. Does anyone know if it's possible to add a CKEditor field to the front end presentation fo a Formbuilder field, maybe via a module or such? Many thanks!
-
Thank you! That worked perfectly. I new I was missing something! Just for completeness here's my resulting code for now: // Prepare and output body text (cleans <p> tags with inside) $bodyCopy = preg_replace('/<p>\x{00A0}<\/p>/u', '', $page->body); echo $bodyCopy;
-
Images In Repeaters Not Uploading for Editors
prestoav replied to prestoav's topic in General Support
Sorry for the late reply Robin. We are going to try the PW update. I'll keep you posted! -
Hi MoritzLost, Firstly, thanks for taking the time to respond. I'll give that a try and see what happens for new adverts. Sadly I have over 400 adverts already in place, many with this issue, so I'll still need to find a template edit that solves the problem for adverts already in place.
-
Hi all, This is driving me a little nuts so I hope someone has an idea what I'm doing wrong! I have a marketplace site built on PW where users upload their own ads including a text description ($page->body) that is a CKEditor Textarea field. I may change this to a straight Textarea field in future but for now CKEditor is needed. As expected many users paste in from Word and, because of this, we end up with a lot of <p> elements with just an inside. I'd like to remove these (and empty <p> elements too) for formatting on the front end. While I use the 'Remove empty paragraph tags' filter on the filter that won't remove those with an . So, I've added this to the template to do that job: $bodyCopy = $page->body; $bodyCopy = str_replace( "<p> </p>", "", $bodyCopy); echo $bodyCopy; This outputs the contents of the body field fine but refuses to get rid of the <p> </p>'s. In addition, since the source within View Source shows them all as "<p> </p>" i.e. with a rendered space character, I have tried replacing that string too but to no avail. They show as "<p> </p>" in the source editor in admin for that page > field by the way. To investigate further I tried setting the initial variable in the template as actual text like this: $bodyCopy = "<p>Real Text</p><p> </p><p>More real text.</p>"; $bodyCopy = str_replace( "<p> </p>", "", $bodyCopy); echo $bodyCopy; And this works just fine. So it looks like something is happening when I assign the bodyCopy variable to the the field output that's stopping the str_replace working. Any ideas gratefully received!!!
-
Hi all, This is for an existing site with a new page template and new repeaters - PW v 3.0.42 For the new template there are a couple of repeater fields with image fields as child fields. The super user can upload images to the image fields within the repeaters but any other uses (e.g. editors) can't. The image appears to upload then disappears. This is true for all the repeaters in this page template. I remember from some time ago that permissions needed to be setup explicitly (rather than inherited) for these fields so I have set edit permissions explicitly for the page template, repeater and repeater sub-fields but still the editors can't upload images. Any ideas / thoughts gratefully received!
-
Front End Editing Restricted To Page Creator?
prestoav replied to prestoav's topic in General Support
Thanks Jens, I'll give that a go now! ?- 2 replies
-
- front end edit
- user
-
(and 1 more)
Tagged with:
-
Hi there, I have a marketplace site that used the older Fredi module for front end editing so advertisers can create and edit their adverts (in the form of pages). After upgrading to v3.0 of Processwire I'd like to change the editing method for users to the new, core front end editing methods. However, it seems that with this method any editor can edit any page (subject to template restrictions for their user role). Using Fredi I checked the user and created user were equal before displaying edit buttons (clunky but it worked). Is there any stock way to restrict front end editing to the creator of the page so that my advertisers can only edit their own ads or should I test for user as before? Thanks in advance as always ?
- 2 replies
-
- front end edit
- user
-
(and 1 more)
Tagged with:
-
Hi all, I've had a request from a client (that I built a multi language PW site for) to change the text colours in the language tabs when they are not completed. Essentially they were having difficulty detecting which languages had content and which didn't when scanning the page in admin. Now I know this means changing Admin template files which I hate doing but the client was insistent. Looking through I found this in the module CSS and changed the colour for empty content to red thus: wire/modules/LanguageSupport/LanguageTabs.css - line 61 .langTabEmpty a { opacity: 0.7; font-weight: normal !important; color: #ff0000 !important; /* I changed the colour here */ } Now we get this when editing, the red indicating no translated text has been added: I think is a better UX. However, when adding alt text to images in an image field the same CSS colour change doesn't apply. Looking at the CSS the .langTabEmpty class isn't added to these tabs on the image field. Could this be considered as an improvement at next module upgrade time please? Thanks as always!
-
A little more info, it's a PW issue by the looks of it. If I use the same file upload field as an independent field on a page template it uploads and saves fine. As soon as the field is within a repeater then it stops working. I've seen this issue with image uploads and to fix that I've gone into the system template for the repeater and set the access specifically for certain users rather than inheriting access. I've tried that here but it still doesn't work.
-
Hi again, thanks for the suggestion and it looks like Mod_Security is turned off so unlikely to be an issue.
-
Hi Tom, thanks. I'll check that next.
-
Just another additional piece of info, I don't get any JS errors in console during the upload or page save ? Nothing in PW logs either. PW version is 3.0.42
-
Thanks again BitPoet. Sadly this isn't the issue. The site is on a VPS (the only site on there) with 50GB available and unlimited disk space allocation for this domain. Current stats show only 22% id disk space in use. Also, image uploads within repeaters work fine.