Home Forums Requests Edit Vehicle Information Bug

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by  BePro Software Team 4 years, 8 months ago.

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

    morgan
    Participant

    I’ve noticed that when using the BePro Vehicles Addon, the <select> fields don’t appear to be working correctly.

    It seems as though every time the first non-placeholder option is selected (<option value="0">), the value isn’t properly saved into the bepro_listings_vehicle database. I first noticed that, when editing the fields by way of the form found in the BuddyPress profile page, any vehicle dropdown field I changed to the first option would not update in the BePro_Listings_Vehicles database. Any that were changed to the second+ option updated correctly.

    I thought this might be due to modifications I made to the plugin, but I’ve just tested it on a fresh install of Be_Pro, Be_Pro_Vehicles, BePro_Authors, and Buddypress on a different theme and was able to replicate the issue. What’s more, on this new install I was unable to get these fields to save correctly upon listing creation (as opposed to editing the listing) and I know I have been able to get these fields to work previously.

    For the record, this appears to only affect the BePro_Listings_Vehicles database, not the BePro_Listings_Vehicle_Types database, as I was able to change the Status field to each different value succesfully.

    I think this might have something to do with the array reference key starting at 0 and the database interpreting that 0 as a null or empty value. This is just a theory, as I’ve been coding all day and wasn’t about to jump into this new challenge with half an hour left to work. I leave the issue in your capable hands.

    Even if you don’t update the plugin right away, I would love to know a fix for this issue ASAP, as my site focuses on vehicle listings.

    Thanks,

    Morgan

    #2730

    Hi Morgan,

    Our team is investigating this issue and will update this post with an answer asap

    Regards
    ___
    BePro Software Team

    #2741

    morgan
    Participant

    Figured it out today, the problem lies in the PHP empty() function evaluating 0 as false.

    Every time the post data contained an argument of 0, update_vehicle_listing() would view it as empty and save the empty string into the database rather than the 0. Made a few modifications to use!isset()instead ofempty() and everything seems to be working correctly.

    • This reply was modified 4 years, 8 months ago by  morgan.
    • This reply was modified 4 years, 8 months ago by  morgan.
    • This reply was modified 4 years, 8 months ago by  morgan.
    #2764

    Hi,

    Thanks for sharing the fix. We will implement it into the next release of the addon

    Regards
    ___
    BePro Software Team

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.