• I am having compatibility issues between NGG and other WP plugins: “SFC – Like” and “SFC – Share” which are part of the Simple Facebook Connect plugin. Whenever I activate either of these SFC plugins the NGG fails to display galleries.

    Without the SFC plugins activated, the HTML code is as follows:

    <!-- main START -->
    		<div id="main">
    	<div class="post">
    		<h3 class="title">Photos</h3>
    		<div class="content">
    			<p>Gallery Desc</p>  <div class="ngg-galleryoverview" id="ngg-gallery-5-86">
    	<!-- Slideshow link -->

    But once I activate either plugin, the NGG plugin fails to generate the gallery:

    <!-- main START -->
    		<div id="main">
    	<div class="post">
    		<h3 class="title">Photos</h3>
    		<div class="content">
    			<p>Gallery Desc</p>			<div class="fixed"></div>
    		</div>
    		<div class="meta">

    As you can see, the entire DIV which should contain the images is omitted.
    I have found a topic in SFC support which is almost identical to my issue and several months old. I have also contacted the SFC dev, however he says this is an issue with NGG.

    Any help would be greatly appreciated..

Viewing 15 replies - 1 through 15 (of 31 total)
  • why should this a error of NGG, can you please post a reason for that ?

    Thread Starter ViperBe

    (@viperbe)

    I don’t know.. that is what I was told by the FCB developer when I asked him about this issue. I am trying to use both plugins, I don’t know much about their workings, or WP internals for that matter. If I knew why it wasn’t working or what was causing it I’m sure I would be so much closer to actually finding a fix…

    edit: I should note that if I modify the SFC plugin to skip the apply_filters() call, NGG shows the gallery properly.. however as stated in that topic, doing that breaks FCB.

    Maybe he can give us a hint what could be the fault of NGG, I will then fix it

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    The error with NGG is two fold.

    First, NGG needs to allow whatever it is hooking to the_content filter to be run more than once on the page. SFC applies the content filter to the content in order to allow it to process shortcodes and things of that nature, so it can see the final and completed content of the post. It needs to do this to get images and other stuff of that nature.

    Secondly, NGG needs to also load the shortcode handling code on the back-end of the site. The publish plugin tries to process the shortcodes as well, so that it can do much the same thing.

    Basically, NGG is trying to be far too smart. If some other plugin needs the content of a post to do something, then it’s going to use a the_content call, or a get_the_content call followed by apply_filters of the_content. Any plugin that uses the content filters to modify the post content should allow this to work a) at all times and b) more than once per post.

    Otto,

    since 1.6.X I’m loading all shortcode & other lib’s always ( http://code.google.com/p/nextgen-gallery/source/detail?r=750 ). The “smart” idea was to reduce the memory footprint, but I didn’t remind that other plugin do there stuff in the back end.

    About the_content filter : I’m using add_shortcode(), the filter is just used one time (to convert old shortcodes), so I’m not sure what is wrong with my code at this point and what I should change…

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    I haven’t used or looked at the code for NGG, so I can’t tell you what is specifically wrong, but there is a possible way to debug.

    Take a theme. Make it call the_content() twice in a row. Does the gallery display twice on the page? If not, why not?

    Had the same issue:
    calling the_content twice breaks the NGG navigation of [album] etc.

    If i have an album, containing some galleries, containing the images,
    the top-level view of the album is showing good. But if the reader navigates a level down to a gallery rendering gets confused:
    Tracing NGG’s filter output shows, that on the first call NGG delivers correct output, on the second call, NGG somehow thinks, the user navigated to another depth or whatever of the nested almbum/gallery.

    My workaround was to patch SFC not calling the_content in the page header, thus not be able to correctly find a thumbnail for a NGG page.

    imo, It is NOT the abovementioned shortcode filter of NGG, it has something to do with the state of album/gallery navigation.

    The scenario is described here: http://wordpress.org/support/topic/plugin-nextgen-gallery-album-tag-renders-empty-when-the_content-filter-is-applied-twice?replies=1#post-1821654

    @otto
    I’m using add_shortcode which replace the placeholder with the gallery content. You can call the_content(); as often you want, it will always show the gallery as as long as the function add_shortcode() will be executed. Same for the WordPress core gallery shortcode…

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    @alex: Yes, except that for some reason, it doesn’t.

    It’s not a matter of your add_shortcode or even your filter on the_content, it’s a matter of how those functions actually behave and what they do. Like briarddixie pointed out above, it doesn’t behave the same on subsequent calls to the gallery display code.

    A shortcode function or a filter should return the same thing every time, given the same content/input. Somehow, it’s maintaining some kind of other state so that continued calls don’t return the same thing.

    Please let us go back to the main issues you reported :

    a) you can call the_content more than one time, It will show a gallery
    b) the shortcode handling code will now be loaded in the backend ( since 1.6.0)

    briarddixie reported something complete different, the handling of album links when the_content is called more times, as I used here a special permalink structure I need to look into it, but it will not prevent the showing of a gallery.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Okay, so what exactly is the problem then? Why is it *not* showing the gallery when my plugin applies the_content filter?

    In the head, I do this:

    the_post();
    rewind_posts();
    $content = get_the_content();
    $content = apply_filters('the_content', $content);

    The first line gets the post early and populate the $post variables and such.

    The second line rewinds the query, so that the main Loop will have the ability to get the post properly.

    The third line gets the content, unprocessed.

    The fourth line applies the_content filter to it, which processes shortcodes and everything else. This is done so that I can get the complete content of the post, as it will be displayed.

    When you do that, NGG fails to display the gallery in the main post body. If you comment out the final line, then NGG displays the gallery.

    Why is NGG not displaying the gallery? That’s the question.

    How can I reproduce this behavior ?

    Setup SFC Like & Share button (Setting : Before AND After the content of your post). My gallery still appear.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Alex: Like I said, I don’t use NGG. I’m just reporting what several of my users have told me.

    Thread Starter ViperBe

    (@viperbe)

    I had NGG setup already.
    When I installed FCB and activated the “SFC – Like Button” plugin, galleries stopped working. They still show, but when clicking on one to open, they fail and load an empty page (showing post context, but not the gallery itself). I have it set to manual, but it’s the same behaviour as when using “before and after the content of your post”.

    If you need any more info regarding my setup I will try to provide it..

    @viperbe Which shortcode do you use ? Are you use a album or gallery shortcode ?

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘[Plugin: NextGEN Gallery] Compatibility issues with other plugins (FCB)’ is closed to new replies.