Forums » SEPHP Help and Tips

New Profile Question field

    • 7 posts
    October 26, 2020 8:30 AM EDT

    Hello guys. I'm starting a new project and as part of the user registration, I require the user to ble able to upload certain images. The problem is I'm new to SocualEngine and PHP in general (I code, just my experience with PHP is somwehat limited) so I'm wondering if anybody from the community could point me in the right direction :). Thanks a lot in advance for your support.

    • Moderator
    • 5025 posts
    October 26, 2020 8:47 AM EDT

    Hi Yasmany! Welcome aboard :) 


    Can you let us know more about what you want to achieve? 

    • 7 posts
    October 26, 2020 9:32 AM EDT

    Sure...I need a certain type of user to provide some picture as a proof of some document types. Now, I think I can use the profile questions section because in there I can filter by profile type. Also, If I create a profile question of type "File", then I can reuse that logic and in that way I can replicate more "File" profile questions for the same profile or add another questions to other profile types. Now, I've done some things like modifying the application\modules\Fields\settings\fields.php to add this:

    'legalAccreditation' => array(
          'base' => 'file',
          'label' => 'Legal accreditation',
          'category' => 'specific',
          'helper' => 'fieldLegalAccreditation',
          'multi' => false,
    Then in the folder application\modules\Fields\Form\Element I added the LegalAccreditation file:
     * @category   Application_Core
     * @package    Fields
     * @copyright  Copyright 2020 MedallPro
     * @license
     * @author     Yasmany Alfonso
    class Fields_Form_Element_LegalAccreditation extends Engine_Form_Element_File
    But from there on, I'm having some interrogants: 
    1. Is this the correct approach? 
    2. How could I easily add a file preview? Is is possible/correct to add a ViewScript decorator in order to add the required html/js functionality for the file preview (I'm thinking in a small preview rectange, and when you click it, you can view the full sized image as a popup or something like that).
    3. This is something I completely ignore: How those new files are sent to the server in the form? Is this accomplished automatically?
    4. When the user is editing the profile, can I use the $this->getValue() function to retrieve the url of the associated image?
    Again, thanks a lot for your support.

    This post was edited by Yasmany at October 26, 2020 9:33 AM EDT
    • Moderator
    • 5025 posts
    October 26, 2020 10:03 AM EDT

    You should make a plugin instead of modifying core as that voids support and can break upgrades. I do not know how to make what you are trying to make but first, try to make it as a plugin.

    • Moderator
    • 5025 posts
    October 26, 2020 10:04 AM EDT

    I believe there may be some third party plugins that already do this. 

    • 7 posts
    October 26, 2020 10:08 AM EDT

    Is it possible for you to point me to some of them??

    • Moderator
    • 5025 posts
    October 26, 2020 10:12 AM EDT

    I'm not sure which of them at our store here would do that. The search I did there found this one but there could be more.

    • 7 posts
    October 26, 2020 10:45 AM EDT

    This one: looks promising because it has other features I needed to code as well. Thanks a lot :)

    • 7 posts
    October 26, 2020 12:16 PM EDT

    Do we have any way of contacting the creators of the plugin here: . I triend in the website, but so far, I've had no answed :(

    This post was edited by Yasmany at October 26, 2020 12:45 PM EDT
    • Moderator
    • 5025 posts
    October 26, 2020 4:05 PM EDT

    Yes, each plugin has a link to contact the developer. You sent two tickets to us instead of the developer. Contact them at this link