WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
[resolved] Conflict with Contact Form 7? (57 posts)

  1. jcmilton
    Member
    Posted 2 years ago #

    I just updated (automatically) to Contact Form 7 version 3.2 and I'm using the latest NextGEN version of 1.9.3. After updating Contact Form 7 to 3.2 now all of a sudden I cannot upload images using NextGEN Gallery.

    When I try to upload I get this error:

    ERROR: sample-image.jpg:
    Fatal Error: Call to undefined function wpcf7_add_tag_generator() in /home/xxxx/public_html/wp-content/plugins/contact-form-7/modules/text.php on line 152

    The end result is that no images are uploaded. But if I disable the Contact Form 7 plugin, the NextGEN Gallery upload works again. So there is a conflict in there somewhere with the latest version of Contact Form 7.

    Is this happening to anyone else?

    Any help would be appreciated!

    Thanks!

    http://wordpress.org/extend/plugins/nextgen-gallery/

  2. MidnightCarnival
    Member
    Posted 2 years ago #

    Same Problem here

    would be appreciated as well

  3. jcmilton
    Member
    Posted 2 years ago #

    Apparently there is a development version to try. I haven't tried it yet though.

    http://wordpress.org/support/topic/plugin-contact-form-7-call-to-undefined-function-wpcf7_add_tag_generator-error?replies=2

  4. jcmilton
    Member
    Posted 2 years ago #

    Well I tried the development version of Contact Form 7 but it generated an error message on my WP Admin Page. I'm trying to find how I can revert back to the previous version that worked with NextGEN.

  5. passimal
    Member
    Posted 2 years ago #

    I v tried to downgrader contact form 7 foudn here : http://wordpress.org/extend/plugins/contact-form-7/developers/
    but it s the same ...
    I cannot use Nextgen Gallery ...

  6. jdkrause
    Member
    Posted 2 years ago #

    I had the same problem with Contact Form 7 V3.2, I had to revert back to the previous version which worked fine with NGG. I re-downloaded CF7 V3.1.2 here -- http://downloads.wordpress.org/plugin/contact-form-7.2.4.6.zip

  7. jcmilton
    Member
    Posted 2 years ago #

    I downloaded and reinstalled Contact Form 7 version 3.1.2 (the previous working version) from here:
    http://wordpress.org/extend/plugins/contact-form-7/developers/

    Now NGG gallery uploads work fine again.

  8. Kung Fu Designs
    Member
    Posted 2 years ago #

    This looks like a similar issue that I'm having(same error message).

    http://wordpress.org/support/topic/plugin-nextgen-gallery-fatal-error-using-flash-uploader?replies=1

    I do not have the plugin you mentioned, however...

    Any help?

  9. jcmilton
    Member
    Posted 2 years ago #

    Sorry. My error messages were caused by the plugin "Contact Form 7." If you're getting the same error messages but you don't have that plugin, then try to think about when it first started happening and if you had recently installed or updated a particular plugin.

  10. lucaweb
    Member
    Posted 2 years ago #

    Me too i have the same Issue!!

  11. Jon Edwards
    Member
    Posted 2 years ago #

    Thanks JCMilton.

    I installed the last development version of Contact Form 7 (3.1.2) and I have it all working again.

    There's a definite conflict between those two plugins - would be great if the two developers would try resolve the issue, as these as two of the most popular plugins for WordPress.

  12. B_Dark
    Member
    Posted 2 years ago #

    same problem here,I installed the last development version of Contact Form 7 (3.1.2) and I have it all working again.

  13. mslocum
    Member
    Posted 2 years ago #

    It looks to me that it is a bug in NextGen that is becoming evident with the new Contact Form update.

    ***Start (short) Technical reason (from what I can figure out)***
    The nextgen file admin/upload.php does a require of ngg-config.php which includes the WordPress wp-load.php. This loads WordPress and all plugins. Then later down in NGG's upload.php file it loads the WordPress admin bootstrap wp-admin/admin.php. This is a problem since WP already loaded as a non-admin, and good plugin programmers only load files that are needed by non-admin WP. Now hooks like admin-init are getting called and functions are getting called that aren't loaded.
    ***End Technical reason***

    My fix:
    Change the last line in NextGen's ngg-config.php file from
    require_once( WP_LOAD_PATH . 'wp-load.php');
    to:
    require_once( WP_LOAD_PATH . 'wp-admin/admin.php');

    Disclaimer: I'm not a NextGen or Contact Form 7 developer. From searching through their code it looks like the ngg-config.php file is always loaded for admin uses. This means that the above fix should not break anything. I can't guarantee this, but it is working so far for me.

  14. Takayuki Miyoshi
    Member
    Posted 2 years ago #

    mslocum, I totally agree with you. There seems to be many plugins including famous ones like NGG which load wp-load.php and wp-admin/admin.php. IMO it's not a good practice as it can cause many many conflicts with other plugins, not only with Contact Form 7. Even if it's necessary for them, they shouldn't load wp-load.php before wp-admin/admin.php.

  15. Decimus
    Member
    Posted 2 years ago #

    SOLVED
    Thanks mslocum. Really appreciate you posting the fix.

    For the last few days I've been trying to find the answer.

    Did as you suggested and from within the plugin editor, edited:
    nextgen-gallery/ngg-config.php

    // let's load WordPress
    // removed by PEB http://wordpress.org/support/topic/plugin-nextgen-gallery-conflict-with-contact-form-7#post-2874491
    // require_once( WP_LOAD_PATH . 'wp-load.php');
    require_once( WP_LOAD_PATH . 'wp-admin/admin.php');

    WORKED.

    Many thanks

    Peter

  16. digitalcanopy
    Member
    Posted 2 years ago #

    Thanks mslocum. Hopefully the NextGen Gallery dev will remedy their next release.

  17. NicoR
    Member
    Posted 2 years ago #

    same problem

  18. passimal
    Member
    Posted 2 years ago #

    hello,
    I ve tried to modify the ngg-config.php but it doesn 't work ...
    When I want to create , modify or upload img the menu dont appeared ...

    http://portfolio.bealcost.com/wp-admin/admin.php?page=nggallery-add-gallery/

    I m waiting for solution , thanks a lot ...

  19. mslocum
    Member
    Posted 2 years ago #

    passimal, Sounds like a different problem. Maybe start a new thread. This one is for the upload but when using Contact Form 7.

  20. passimal
    Member
    Posted 2 years ago #

    Hello I dont think so ...
    I put the original theme ( twenty eleven)
    I disable plugin contat form 7
    I upload WP 3.2.2
    And the same ... so I dont know ....

  21. a_johnson
    Member
    Posted 2 years ago #

    mslocum- it does break something. You wrote:

    'Change the last line in NextGen's ngg-config.php file from
    require_once( WP_LOAD_PATH . 'wp-load.php');
    to:
    require_once( WP_LOAD_PATH . 'wp-admin/admin.php');

    Disclaimer: I'm not a NextGen or Contact Form 7 developer. From searching through their code it looks like the ngg-config.php file is always loaded for admin uses. This means that the above fix should not break anything. I can't guarantee this, but it is working so far for me.'

    I tried this on a site I'm developing. Although it fixed the admin upload, it breaks the author upload. I am using the capability manager. If "NextGEN Manage others gallery" is unchecked, no galleries are able to be accessed, even that users. If it is checked, then that user can manage ALL galleries.

  22. mslocum
    Member
    Posted 2 years ago #

    a_johnson,
    I tried re-creating your problem, but it all seemed to work as expected for me.

    What I tried:

    • Have user with role Author
    • Set NextGEN roles 'Add gallery/Upload images' and 'Manage gallery' to Author
    • Assign a gallery to the author user
    • My author user can upload and manage the gallery that they own as expected.

    Am I missing something?

    When I set 'Manage others gallery' to Author I am able to upload to any gallery.

    You said you are using the 'capability manager.' Do you mean the built-in page admin.php?page=nggallery-roles or are you using a plugin?

  23. a_johnson
    Member
    Posted 2 years ago #

    I'm using the Capability Manager plugin. THe NGG roles are currently set to author. This did work previously and the only change was the 'require_once( WP_LOAD_PATH . 'wp-admin/admin.php');' fix.

    See screen shots~ http://templatesagogo.com/NGG-roles.png and http://templatesagogo.com/NGG-capability-mrg.png

  24. a_johnson
    Member
    Posted 2 years ago #

    I forgot to add that it looks like Contact form 7 is in conflict with other plugins too. Maybe the solution is to work some magic there as opposed to NGG? As others have said, these are two of the most popular plugins for WP. I use them on almost all the sites I write.

  25. mslocum
    Member
    Posted 2 years ago #

    I'm still having trouble duplicating the problem, but I probably don't have everything setup the same way. From my experience doing custom capabilities, once you set them they are stored in the database. I haven't looked into this plugin, but I'm guessing you can disable it and it keeps all the roles. Because it doesn't play an active role, it just sets them when you hit save.

    If you notice nextgen-gallery/admin/upload.php lines 38 and 41, this seems problematic to me. We already did the admin bootstrap by changing the ngg-config.php, then the uploader is unsetting the user, then calling the admin bootstrap again. The author even admits, "don't ask me why". It looks to me like the whole uploader for NextGEN needs to be refactored. This is actually why I put in the disclaimer. It looks like NextGEN's uploader is a bunch of hacks.

    I'm personally not a huge Contact Form 7 fan, but I use it anyway. But from a developer's perspective, it looks they are loading files properly. They have dozens of php files, but they are only loading the ones that are needed. Look at contact-form-7/settings.php line 11. This is a very good thing. It improves website performance and reduces server memory usage. If there are other plugins that don't load the WordPress bootstrap properly then shame on them. They either need to learn how to program or stop being lazy. I'm struggling not to rant more. :)

    Sorry, I couldn't help figure out any more with your capabilities problem. Anyone else having this problem with capabilities?

  26. irri
    Member
    Posted 2 years ago #

    Hi there.
    Same trouble here. Can't upload new images.

    But even after reinstalling the latest version of the plugin of Contact form 7 I keep getting the same error.

    I used the latest version from June 2.
    It's conflicting my nextgen gallery plugin and I can't upload new images. I am quite relieved that the gallery itself is still working though.

    I don't understand why the latest plugin worked for others.
    Any ideas? :S

    The error:
    http://i27.photobucket.com/albums/c191/irrimiriam/ScreenShot2012-06-12at091835.png

    Kind Regards

  27. a_johnson
    Member
    Posted 2 years ago #

    I'll probably just remove Contact Form 7 and use another plugin. I'll restore NGG to the original code for now. I actually need CF7 more than I need NGG but NGG has features that other galleries don't have.

  28. a_johnson
    Member
    Posted 2 years ago #

    It looks like something else changed re: Capabilities. Authors are not allowed to edit their own galleries or add photos even with the permissions set properly. So the issue is probably unrelated to the code change.

  29. hoven002
    Member
    Posted 2 years ago #

    Thanks mslocum, I experienced the same problems after an update of the contact form. Your solution resolved it!

    Cheers,
    Kenneth

  30. Josh.biz
    Member
    Posted 2 years ago #

    Thanks mslocum. Your simple solution worked for me. No side effects noticed yet. I hope one of the plug-ins causing the issue is soon updated (sounds like it should be NextGen). This is going to a be a very common issue for many users.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.