Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jaspersone

    (@jaspersone)

    @simon, it’s actually two plugins that I am currently writing now called ‘events’ and ‘post highlights’. For the life of me, I could not figure out what was going wrong at first. I had not made any updates to WordPress or PageLines at the time and happen chance discovered the issue a day after I pushed the code to my testing server.

    Needless to say, while testing I also made the same assumption that I could safely use whatever var names I wanted (since sections are class based). After pulling out my hair for half a day and not discovering the cause of the symptoms, I was finally able to get some help from the PageLines support staff. The problem was resolved simply by prefixing my var names with something unique.

    Post mortem, I did a quick diff view and noted the only change between the working and broken files was the unique var names. Switching from the old to new code caused the problem to disappear. Reverting back to the old code caused the problem to reappear. I didn’t run any other conclusive tests yet.

    I have been programming in other languages for a while now, but this is my first dive into PHP, so correct me if I’m wrong, but it seems like variable name collision might be causing the issue.

    Thread Starter jaspersone

    (@jaspersone)

    I discovered the underlying problem. When using pagelines, the $opt_array in the custom plugin section.php file does not have its own unique namespace. Therefor if keys in the array collide with var names that WordPress uses, in my particular case, it was the variable ‘categories’, then the conflict will cause WordPress to behave unpredictablely.

    In addition, function section_template() requires its option value names to be unique as well. After adjusting those two things, I no longer have the issue and categories are saving as expected.

Viewing 2 replies - 1 through 2 (of 2 total)