Posts by mmelling

    Byron - thanks so much for your help - apologies for being slow responding.


    Not sure I understand your suggestion about adding attribute="timestamp" to the form input.


    This is what I've done:



    It seems too simplistic!! I didn't expect to be able to save the new filename as easily as $details['name'] = $filename;


    Please shout if you can suggest any improvements. I've a bit more testing to do but it seems to be working.

    I'm using a Perch Form with a series of up to 9 image upload fields. I'd like to add a timestamp to every filename of the uploaded images (currently Perch adds a timestamp only if a file with the same name already exists). The amended filename needs to be applied to the image file and saved in the form response.


    I'm assuming I need a custom app (I'm calling it ipltd_filename) to do this. This app should just rename the files and then redispatch to mbk_forms (to handle reCAPTCHA), which in turn redispatches to perch_forms.


    In my form template, the form will post to the new app and include the file upload fields:



    I'm stuck on how to build a form handler in a custom app. I think the app's runtime.php should be something like:



    Can anyone point me in the right direction? Or show any examples of handling files in a form handler?

    Do you need to use tags? If not, why not just test for whether the user is logged in. In your page template:


    if (!perch_member_logged_in()) {

    echo "<p>You need to log in to view this material. Please log in using the form below.</p>";

    perch_members_login_form();


    } else {

    // user IS logged in so display some content

    ...

    }

    I seem to remember having similar issues a while ago. File upload checking relies on PHP Fileinfo. That may not be enabled on your live server. If you're using hosting on cPanel, Check in PHP Extensions that fileinfo is enabled. This would fit with the behaviour being different on the live and local servers. See:
    https://docs.grabaperch.com/perch/configuration/security/


    This might not be the fix in your case, but perhaps worth checking.

    Yes! I've just spotted 1 record (out of over 400) which has no first name or last name. I've removed that record from the csv file and repeated the import - everything is now working fine!


    Thanks so much for your help.

    Hi Clive,

    Thanks for an astoundingly quick response on Good Friday!! Unfortunately, there isn't an "_id" column in the perch3_members table of the database. There is a memberID, which I've populated - along with all the other columns in that table. The database table looks OK.

    I've got a Runway site with Perch Members. I've imported members direct into the database from Excel. Everything appears to be working OK. But when on the "Listing members" page in Perch admin and clicking column headings to sort the list of members, I'm getting this notice displayed above the list of members (this is in my local development site where I display all errors etc):


    Notice: Undefined index: _id in C:\wamp\www\pixel\cms\addons\apps\perch_members\modes\members.list.post.php on line 121


    And in debug (in both development and live sites):

    Array

    (

    [type] => 8

    [message] => Undefined index: _id

    [file] => C:\wamp\www\pixel\cms\addons\apps\perch_members\modes\members.list.post.php

    [line] => 121

    )


    The error is not displayed when sorting by members' email addresses; it only happens when sorting by the "Joined" date or by "Status". Despite the error, the sorting still works correctly.


    This wasn't happening before I imported members from Excel - sorting wasn't producing the error then. So I'm pretty sure it's a problem with how I've imported the data not an issue with Runway or the Perch Members app. I've made no changes to Perch core or Perch Members files.


    I'd be really grateful if someone could point me in the right direction to resolve this in case it affects something else in the future that I haven't tested yet.


    Diagnostics:


    Summary information


    Perch Runway: 3.1.7, PHP: 7.2.0, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $, with PDO

    Server OS: WINNT, apache2handler

    Installed apps: content (3.1.7), assets (3.1.7), categories (3.1.7), perch_forms (1.12), perch_members (1.6.4), mbk_forms (1.0), pipit (0.6.1), pipit_members (1.3.0)

    App runtimes: <?php $apps_list = [ 'perch_forms', 'mbk_forms', 'perch_members', 'pipit', 'pipit_members', ]; ?>

    PERCH_LOGINPATH: /cms

    PERCH_PATH: C:\wamp\www\pixel\cms

    PERCH_CORE: C:\wamp\www\pixel\cms\core

    PERCH_RESFILEPATH: C:\wamp\www\pixel\cms\resources

    Image manipulation: GD

    PHP limits: Max upload 128M, Max POST 128M, Memory: 1024M, Total max file upload: 128M

    F1: 3b606135b33e6a102526838f4152a807

    Resource folder writeable: Yes

    HTTP_HOST: pixel.local

    DOCUMENT_ROOT: C:/wamp/www/pixel

    REQUEST_URI: /cms/core/settings/diagnostics/

    SCRIPT_NAME: /cms/core/settings/diagnostics/index.php

    I've been installing the Perch reCAPTCHA app on some recent Perch sites - thanks to Ryan for his work on this!


    I have a lot of older Perch sites that might also benefit from this app. What are the minimum versions of Perch and Perch Forms required to run it?


    Specifically, I have a number of sites using the last version in the Perch 2 series ie Perch 2.8.34 with Perch Forms 1.8.3 (the last version for Perch 2). Would Perch reCAPTCHA run in those sites?


    Thanks.

    I have a form posting to Perch forms that includes a file upload input, allowing users of the website to upload photos. Filenames of uploaded files are not sanitised - punctuation symbols like brackets and ampersands are accepted and so are spaces in the filenames.


    Is that working correctly? The only operation affecting filenames appears to be the addition of a timestamp if a file has the same name as an existing file in the same directory.


    I'm curious because files uploaded using the Perch admin are subject to much more stringent sanitisation.


    The template is in the templates/content directory (not templates/forms). Template code (abbreviated):


    Code
    1. ...
    2. <perch:form id="cbd_form" method="post" app="perch_forms" action="#success">
    3. ...
    4. <div>
    5. <perch:label for="cb_image_import1">Photo 1 (.jpg or .png)</perch:label>
    6. <perch:error for="cb_image_import1" type="filetype"> <div class="error">The file must be an image eg .jpg, .png.</div></perch:error>
    7. <perch:error for="cb_image_import1" type="fileupload"> <div class="error">Sorry but we couldn't upload that file - the file may be too large. Please email the images to us separately, clearly identifying which building they relate to.</div></perch:error>
    8. <perch:input id="cb_image_import1" type="image" label="Photo 1">
    9. </div>
    10. ...



    Diagnostics:


    Perch Runway: 3.1.5, PHP: 7.3.11, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $, with PDO

    Server OS: WINNT, apache2handler

    Installed apps: content (3.1.5), assets (3.1.5), categories (3.1.5), perch_forms (1.12)

    App runtimes: <?php $apps_list = [ 'perch_forms', ]; ?>

    PERCH_LOGINPATH: /cms

    PERCH_PATH: C:\wamp\www\XXXX\cms

    PERCH_CORE: C:\wamp\www\XXXX\cms\core

    PERCH_RESFILEPATH: C:\wamp\www\XXXX\resources

    Image manipulation: GD

    PHP limits: Max upload 256M, Max POST 256M, Memory: 256M, Total max file upload: 256M

    F1: 3b606135b33e6a102526838f4152a807

    Resource folder writeable: Yes

    HTTP_HOST: XXXX.local

    DOCUMENT_ROOT: C:/wamp/www/XXXX

    REQUEST_URI: /cms/core/settings/diagnostics/

    SCRIPT_NAME: /cms/core/settings/diagnostics/index.php

    I know this issue has been mentioned before going back years but I don't believe it has been resolved. I develop in a WAMP environment locally then upload to the live LAMP site. If regions containing forms have been saved locally, the path to the form template contains backslashes, which causes problems on the live site.


    This is not just an issue when first launching a site. When maintaining and updating sites, I often add new content first to the local site eg to test new content templates. Often I'll re-publish all pages to check all new templates are working correctly and then import the database to the live site. Every time, I need to either manually amend the form template paths in the database or save every form again on the live site.


    Two different instances where the path to the form template is stored:

    - perch3_content_regions: backslashes stop the form working

    - perch3_forms: backslashes block selection of "Email address field" for the autoreponse


    Is there any chance you could have another look to see if this can be resolved in the Forms app?


    Here's the live site diagnostics:


    I resolved this so I'm posting here in case it helps anyone else.


    In the database:

    perch2_user_privileges table has 5 items relating to categories including:

    privID: 27

    privKey: categories.manage


    perch2_menu_items table has this row relating to categories:

    itemTitle: Categories

    privID: 22


    Note the menu item was using an incorrect privID for managing categories.


    So, in the perch2_menu_items table, I edited the privID so it matched the "categories.manage" privID

    itemTitle: Categories

    privID: 27


    And then the Organise ... Categories menu item was displayed for the editor role.

    I've given the Editor role all the rights over Categories (create, delete, manage, create category sets, delete category sets).


    But when the editor logs in, they don't see the "Categories" item under Organise in the sidebar menu.


    Diagnostics:


    Perch: 3.1.4, PHP: 7.2.0, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $, with PDO

    Server OS: WINNT, apache2handler

    Installed apps: content (3.1.4), assets (3.1.4), categories (3.1.4), perch_forms (1.11), perch_members (1.6.4), perch_mailchimp (3.1)

    App runtimes: <?php $apps_list = [ 'perch_forms', 'perch_members', 'perch_mailchimp', ]; ?>

    PERCH_LOGINPATH: /cms

    PERCH_PATH: C:\wamp\www\cruse\cms

    PERCH_CORE: C:\wamp\www\cruse\cms\core

    PERCH_RESFILEPATH: C:\wamp\www\cruse\cms\resources

    Image manipulation: GD

    PHP limits: Max upload 64M, Max POST 50M, Memory: 1024M, Total max file upload: 50M

    F1: 3b606135b33e6a102526838f4152a807

    Resource folder writeable: Yes

    HTTP_HOST: cruse.local

    DOCUMENT_ROOT: C:/wamp/www/cruse

    REQUEST_URI: /cms/core/settings/diagnostics/

    SCRIPT_NAME: /cms/core/settings/diagnostics/index.php