How to make upload logo for dealer as a required field?

ClassiBase classifieds script Forums General help How to make upload logo for dealer as a required field?

This topic contains 3 replies, has 2 voices, and was last updated by  Elite Tan 3 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1092 Reply

    Elite Tan
    Participant

    dear Support, in the logincontroller php I saw
    there is web, info rule for dealer and we can use the “|required” to make it a required field, web and info is text, but for logo which is file type the “|required” doesn’t work when i use rule “logo” as |required, please advice what code to use to make the logo as a required field to work? meaning
    newly register dealer must upload a logo, to hear from you soon, Thanks 🙂

    #1095 Reply

    ClassiBase
    Keymaster

    This requires advanced PHP knowledge. Change /sys/app/controllers/LoginController.php file, after line 321

    Add new if statement like following.

    if(!strlen($user->logo))
    {
    // image not uploaded
    $this->validation()->set_error(__('Error uploading logo. Please select logo to upload.'));
    return $user;
    }

    Again changes made to core files will be deleted on script update.

    #1101 Reply

    Elite Tan
    Participant

    dear Support, I’ve added above code, after I’ve selected a logo to upload, and click on check box to agree, it display below error, appreciate you can help and advice what’s wrong?
    ———–
    Error accured while creating your account. Please try again later.
    ———–

    if($dealer)
    {
    // set user as dealer
    $user->level = User::PERMISSION_DEALER;

    // check if can auto approve dealer
    if(Config::option(‘account_dealer_auto_approve_reg
    istration’))
    {
    // set user as dealer
    $user->enabled = 1;
    }
    else
    {
    // set user as pending to be approved as
    dealer
    $user->enabled = 0;
    }

    // upload image if set
    if(User::uploadLogo($user, ‘logo’) === false)
    {
    // if error on uploading logo
    return $user;
    }
    if(!strlen($user->logo)){
    // image not uploaded
    $this->validation()->set_error(__(‘Error up
    loading
    logo. Please select logo to upload.’));
    return $user;

    }
    }
    else

    #1104 Reply

    Elite Tan
    Participant

    please ignore above Support, I just added above code again in the original install logincontroller file and it great work! Thanks alot once again 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: How to make upload logo for dealer as a required field?
Your information: