WordPress.org

Ready to get started?Download WordPress

Forums

Participants Database
[resolved] images to files (16 posts)

  1. lozbo
    Member
    Posted 2 years ago #

    Hi,

    I know that for security reasons it is only possible to upload images, but if we wanted it to tweak it, should it be easy to change it to files? Like doc, docx, pdf, etc.

    If so, could you shed some light regarding how to achieve it?

    Thanks!

    http://wordpress.org/extend/plugins/participants-database/

  2. lozbo
    Member
    Posted 2 years ago #

    I found this line of code in the participants-database.php

    self::$allowed_extensions = array( 'jpg','jpeg','gif','png' );

    Will just changing this line do the trick, or should I dig somewhere else?

    Thanks a lot in advance for this plugin!

  3. lozbo
    Member
    Posted 2 years ago #

    I tried editing that and some other lines, and now I'm getting it to "accept" the entry, but looks like the file is not being saved, but the rest of the info does..

  4. xnau
    Member
    Plugin Author

    Posted 2 years ago #

    lozbo,

    You will need to change the allowed MIME types in participants-database.php line 1931. Go to php.net to get the correct constants to use.

    Also, make sure that image uploads are working first...that way you know that your basic setup is good.

  5. lozbo
    Member
    Posted 2 years ago #

    Thanks! I had already commented out that filetype check and the form was being sent and the thank you message appeared, yet seemed like no file was attached.

    Image uploads are working fine, I will continue to review.

    I think I will also need to tweak some other files, like the list participants section both in the admin and the public one (which btw I can't seem to show, with the [pdb_record] in a page and the record form settings pointing to that page..)

  6. rayfellers
    Member
    Posted 2 years ago #

    I've been searching for something like this that could be used as an input form for product data rather than for people. I've looked at cforms II, but your plugin looks good also.

    Do you think it will work for my application?

    Thanks for your reply and for the plugin.

  7. xnau
    Member
    Plugin Author

    Posted 2 years ago #

    rayfellers,

    You know it's possible, but if you don't need "public" user input, you may want to look into using custom post types for that. There are several plugins that will help you set up your custom post type.

  8. rayfellers
    Member
    Posted 2 years ago #

    Thanks for your answer. I'll look into custom post plugins.

  9. lozbo
    Member
    Posted 2 years ago #

    I think I got it. I had to edit one more line in participants-database.php, which in the latest update is line 871:

    $return = empty( $value ) ? '' : '<p>Download file</p>';

    Instead of showing an <img> tag with its src atribute pointing to the image uri, I switched it to a link tag with its href pointing to that same image uri.

    Then I did something similar in FormElement.class.php (within the classes folder):

    $this->_addline( '<p class="uploaded-image" id="image_'.$this->name.'">value.'">Download File</p>' );

    I couldn't find the right mime types in line 1931 (in the latest update is line 2045)that "check the type of file to make sure it is an image file", so I just commented it out.

    So I think this kinda solves it, I will continue to make tests and check but just in case, Xnau, is there anything I'm missing?

    I need also help regarding languages, but for that topic I opened a new thread:

    http://wordpress.org/support/topic/plugin-participants-database-switching-languages?replies=1

    Thanks in advance!

  10. lozbo
    Member
    Posted 2 years ago #

    The forum ate my code, or rather rendered it as html (as expected) but I think it can still be understood from my comments and context, or in case of any doubts I can send over the files or a .txt with the relevant code..

  11. xnau
    Member
    Plugin Author

    Posted 2 years ago #

    lozbo,

    Yes, looks pretty good, although you'll find out when you test it if there are other issues...I haven't tried to do this. Commenting out the MIME type test was necessary, so that was good.

    For me, I would say, you've made it so you can't also upload images--but maybe you don't ever need to do that.

  12. lozbo
    Member
    Posted 2 years ago #

    Well then I will set this topic to "resolved".

    For this particular project I don't need images, but perhaps in future versions of the plugin there will be an option to select whether you want images or files :P

  13. kamu_lhr
    Member
    Posted 2 years ago #

    lozbo

    please share the code what you put in the line 871 and the FormElemet.class

    $this->_addline( '<p class="uploaded-image" id="image_'.$this->name.'">value.'">Download File</p>' );

    deamveawer says this syntax is wrong and I cannot click the Download File as a link!

    please advise

  14. lozbo
    Member
    Posted 2 years ago #

    Hi Kamu_lhr,

    I don't know if the code will be pasted correctly as it may be parsed by the forum:

    $this->_addline( '<p class="uploaded-image" id="image_'.$this->name.'"><a href="'.$this->value.'">Download File</a></p>' );

    I don't know if dreamweaver is always right about the syntax, but if you continue to experience errores send me your email and I'll send you the line of code in a text file.

    Hope it works!

  15. lozbo
    Member
    Posted 2 years ago #

    I know what's missing! In my first post, the one where you got the code in the first place, I didn't use the "code" tag, so the forum turned the anchor tag into an actual link for display in this page. But I think it's right now!

  16. lozbo
    Member
    Posted 2 years ago #

    Also worth noting! I "stayed" in the 1.3.5 version, and current latest is 1.3.7, so the lines might have changed (the line number at least), so check the changelog, or just modify the right ones on the newer version (or if you do like me: avoid updating, which of course is not advisable).

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic