Featured Content Gallery | WordPress Plugin | iePlexus

Getting it to work in Wordpress MU

New releases, ideas for the future, and known issues

Getting it to work in Wordpress MU

PostBy flash on Wed Apr 15, 2009 5:01 pm

I have FCG working in Wordpress MU. It took a few changes to the options.php file to change how the options are handled in the database but it was pretty straight forward.

**EDIT** just to be clear, this plugin works in Wordpress MU as a standard plugin - it does not work as a wordpress mu plugin, but at least you can install it now

I have included the entire options.php file here for your reference. Copy the contents below into the "options.php" file and then replace the one on your server with the new one.

Code: Select all
<?php
$location = $options_page; // Form Action URI
/****************************************************
** changed the way the options are created on the database. **
*****************************************************/
if (isset($_POST['updateOptions'])) {
   if (get_option('gallery-width') || get_option('gallery-width') == '')
      update_option('gallery-width',$_POST['gallery-width']);
   else
      add_option('gallery-width',$_post['gallery-width']);
   if (get_option('gallery-height') || get_option('gallery-height') == '')
      update_option('gallery-height',$_POST['gallery-height']);
   else
      add_option('gallery-height',$_post['gallery-height']);
   if (get_option('gallery-info') || get_option('gallery-info') == '')
      update_option('gallery-info',$_POST['gallery-info']);
   else
      add_option('gallery-info',$_post['gallery-info']);
   if (get_option('gallery-items') || get_option('gallery-items') == '')
      update_option('gallery-items',$_POST['gallery-items']);
   else
      add_option('gallery-items',$_post['gallery-items']);
   if (get_option('gallery-border-color') || get_option('gallery-border-color') == '')
      update_option('gallery-border-color',$_POST['gallery-border-color']);
   else
      add_option('gallery-border-color',$_post['gallery-border-color']);
   if (get_option('gallery-bg-color') || get_option('gallery-bg-color') == '')
      update_option('gallery-bg-color',$_POST['gallery-bg-color']);
   else
      add_option('gallery-bg-color',$_post['gallery-bg-color']);
   if (get_option('gallery-text-color') || get_option('gallery-text-color') == '')
      update_option('gallery-text-color',$_POST['gallery-text-color']);
   else
      add_option('gallery-text-color',$_post['gallery-text-color']);
   if (get_option('gallery-use-featured-content') || get_option('gallery-use-featured-content') == '')
      update_option('gallery-use-featured-content',$_POST['gallery-use-featured-content']);
   else
      add_option('gallery-use-featured-content',$_post['gallery-use-featured-content']);
   if (get_option('gallery-use-thumb-image') || get_option('gallery-use-thumb-image') == '')
      update_option('gallery-use-thumb-image',$_POST['gallery-use-thumb-image']);
   else
      add_option('gallery-use-thumb-image',$_post['gallery-use-thumb-image']);
   if (get_option('gallery-way') || get_option('gallery-way') == '')
      update_option('gallery-way',$_POST['gallery-way']);
   else
      add_option('gallery-way',$_post['gallery-way']);
   if (get_option('gallery-items-pages') || get_option('gallery-items-pages') == '')
      update_option('gallery-items-pages',$_POST['gallery-items-pages']);
   else
      add_option('gallery-items-pages',$_post['gallery-items-pages']);
   if (get_option('gallery-category') || get_option('gallery-category') == '')
      update_option('gallery-category',$_POST['gallery-category']);
   else
      add_option('gallery-category',$_post['gallery-category']);
   if (get_option('gallery-fcg-button') || get_option('gallery-fcg-button') == '')
      update_option('gallery-fcg-button',$_POST['gallery-fcg-button']);
   else
      add_option('gallery-fcg-button',$_post['gallery-fcg-button']);
      if (get_option('gallery-fade-duration') || get_option('gallery-fade-duration') == '')
      update_option('gallery-fade-duration',$_POST['gallery-fade-duration']);
   else
      add_option('gallery-fade-duration',$_post['gallery-fade-duration']);
   if (get_option('gallery-delay') || get_option('gallery-delay') == '')
      update_option('gallery-delay',$_POST['gallery-delay']);
   else
      add_option('gallery-delay',$_post['gallery-delay']);
   if (get_option('gallery-randomize-pages') || get_option('gallery-randomize-pages') == '')
      update_option('gallery-randomize-pages',$_POST['gallery-randomize-pages']);
   else
      add_option('gallery-randomize-pages',$_post['gallery-randomize-pages']);
   if (get_option('gallery-rss-word-quantity') || get_option('gallery-rss-word-quantity') == '')
      update_option('gallery-rss-word-quantity',$_POST['gallery-rss-word-quantity']);
   else
      add_option('gallery-rss-word-quantity',$_post['gallery-rss-word-quantity']);
   if (get_option('gallery-default-transaction') || get_option('gallery-default-transaction') == '')
      update_option('gallery-default-transaction',$_POST['gallery-default-transaction']);
   else
      add_option('gallery-default-transaction',$_post['gallery-default-transaction']);
}?>
<div class="wrap">
   <h2>Featured Content Gallery Configuration</h2>
   <p>Use the options below to select the content for your gallery, to style your gallery, and to configure the gallery slides and transitions.<br />
    Visit the <a href="http://www.featuredcontentgallery.com">Featured Content Gallery Plugin</a> website for more information.</p>
        <form method="post" action="<?php echo $location?>"> <?php //changed this to $location and removed the nonce form stuff ?>
      <fieldset name="general_options" class="options">
        <div style="padding-top: 15px"></div>
        <u><strong>Featured Content Gallery Code</strong></u> - If not already included, add this code to your template file where you want the Featured Content Gallery to be displayed:<br />
        <blockquote>&lt;&#63;php include &#40;ABSPATH &#46; '/wp-content/plugins/featured-content-gallery/gallery.php'&#41;&#59; &#63;&#62;</blockquote>
        <div style="padding-top: 10px"></div>
        <?php  $galleryoldway = (get_option('gallery-way') == 'old' || get_option('gallery-way') == '') ? "checked" : "";
                 $gallerynewway = get_option('gallery-way') == 'new' ? "checked" : "";
        ?>
        <u><strong>Featured Content Selection</strong></u> - Select either a blog category or individual post/page IDs for your featured content:<br />
        <div style="padding-top: 5px"></div>
        <table width="690" border="0" cellpadding="0" cellspacing="7">
        <tr>
       <td width="330">
        <input type="radio" name="gallery-way" id="gallery-way" size="25" value="old"  <?php print $galleryoldway; ?>>
                 Select here to use category selection
        </td>
        <td width="360">
        <input type="radio" name="gallery-way" id="gallery-way" size="25" value="new"  <?php print $gallerynewway; ?>>
                 Select here to use individual post or page IDs
        </td>
      </tr>
         <tr>
       <td>
        Category Name:<br />
                    <input name="gallery-category" id="gallery-category" size="25" value="<?php echo get_option('gallery-category'); ?>"></input>
        </td>
       <td>
        Post or Page IDs <span class="style1">(comma separated no spaces)</span>:<br />
                    <input name="gallery-items-pages" id="gallery-items-pages" size="25" value="<?php echo get_option('gallery-items-pages'); ?>"></input>
        </td>
         </tr>
         <tr>
        <td>
        Number of Items to Display:<br />
                 <input name="gallery-items" id="gallery-items" size="25" value="<?php echo get_option('gallery-items'); ?>"></input>
        </td>
        <td>
        <?php $checked3 = get_option('gallery-randomize-pages') ? "checked" : ""; ?>
                    <input type="checkbox" name="gallery-randomize-pages" id="gallery-randomize-pages" <?php print $checked3 ?>>
        Check here to randomize post/page ID display
        </td>
         </tr>
      </table>
        <div style="padding-top: 10px"></div>
        <u><strong>Gallery Style</strong></u> - Choose your gallery size and colors:<br />
        <div style="padding-top: 10px"></div>
        <table width="690" border="0" cellpadding="0" cellspacing="7">
        <tr>
       <td width="330">
        Gallery Width in Pixels:<br />
        <input name="gallery-width" id="gallery-width" size="25" value="<?php echo get_option('gallery-width'); ?>"></input>
        </td>
        <td width="360">
        Gallery Border Color (#hex or color name):<br />
        <input name="gallery-border-color" id="gallery-border-color" size="25" value="<?php echo get_option('gallery-border-color'); ?>"></input>
        </td>
      </tr>
         <tr>
       <td>
        Gallery Height in Pixels:<br />
        <input name="gallery-height" id="gallery-height" size="25" value="<?php echo get_option('gallery-height'); ?>"></input>
        </td>
       <td>
        Gallery Background Color (#hex or color name):<br />
        <input name="gallery-bg-color" id="gallery-bg-color" size="25" value="<?php echo get_option('gallery-bg-color'); ?>"></input>   
        </td>
         </tr>
         <tr>
        <td>
        Text Overlay Height in Pixels:<br />
        <input name="gallery-info" id="gallery-info" size="25" value="<?php echo get_option('gallery-info'); ?>"></input>
        </td>
        <td>
        Gallery Text Color (#hex or color name):<br />
        <input name="gallery-text-color" id="gallery-text-color" size="25" value="<?php echo get_option('gallery-text-color'); ?>"></input>
        </td>
         </tr>
      </table>
        <div style="padding-top: 10px"></div>
        <u><strong>Slide Transition Times and Other Options</strong></u> - Choose your slide and fade duration, carousel button name and text overlay word quantity:<br />
        <div style="padding-top: 10px"></div>
        <table width="690" border="0" cellpadding="0" cellspacing="10">
        <tr>
       <td width="330">
        Slide Display Duration (milliseconds):<br />
        <input name="gallery-delay" id="gallery-delay" size="25" value="<?php echo get_option('gallery-delay'); ?>"></input><br />
        (Default: 9000 milliseconds / 9 seconds)
        </td>
        <td width="360">
        Carousel Button Name:<br />
        <input name="gallery-fcg-button" id="gallery-fcg-button" size="25" value="<?php echo get_option('gallery-fcg-button'); ?>"></input><br />
        (Default: "Featured Content")
        </td>
      </tr>
         <tr>
       <td>
        Slide Fade Duration (milliseconds):<br />
        <input name="gallery-fade-duration" id="gallery-fade-duration" size="25" value="<?php echo get_option('gallery-fade-duration'); ?>"></input><br />
        (Default: 500 milliseconds / .5 seconds)
        </td>
       <td>
        Number of Words in Text Overlay:<br />
        <input name="gallery-rss-word-quantity" id="gallery-rss-word-quantity" size="25" value="<?php echo get_option('gallery-rss-word-quantity'); ?>"></input><br />
        (Default: 100 words)
        </td>
         </tr>
      </table>
        <div style="padding-top: 10px"></div>
        <u><strong>Slide Transition Type</strong></u> - Choose your slide transition effect:<br />
        <div style="padding-top: 10px"></div>
        <?php  $galleryfade = (get_option('gallery-default-transaction') == 'fade' || get_option('gallery-default-transaction') == '') ? "checked" : "";
              $galleryfadeslideleft = get_option('gallery-default-transaction') == 'fadeslideleft' ? "checked" : "";
              $gallerycontinuoushorizontal = get_option('gallery-default-transaction') == 'continuoushorizontal' ? "checked" : ""; 
              $gallerycontinuousvertical = get_option('gallery-default-transaction') == 'continuousvertical' ? "checked" : "";
        ?>
        <table width="500" border="0" cellpadding="0" cellspacing="10">
        <tr>
       <td width="250">
        <input type="radio" name="gallery-default-transaction" id="gallery-default-transaction" size="25" value="fade"  <?php print $galleryfade; ?>> Simple Fade
        </td>
        <td width="250">
      <input type="radio" name="gallery-default-transaction" id="gallery-default-transaction" size="25" value="fadeslideleft"  <?php print $galleryfadeslideleft; ?>> Slide Left with Fade
        </td>
      </tr>
         <tr>
       <td>
      <input type="radio" name="gallery-default-transaction" id="gallery-default-transaction" size="25" value="continuoushorizontal"  <?php print $gallerycontinuoushorizontal; ?>> Continuous Horizontal
        </td>
       <td>
      <input type="radio" name="gallery-default-transaction" id="gallery-default-transaction" size="25" value="continuousvertical"  <?php print $gallerycontinuousvertical; ?>> Continuous Vertical
        </td>
         </tr>
      </table>
        <div style="padding-top: 10px"></div>
        <u><strong>Required Custom Fields</strong></u>
        <div style="padding-top: 5px"></div>
        For each post or page you want to display in your gallery, regardless of your selections above, you <strong>must</strong> include a custom field. For the main gallery image, use the key <strong>articleimg</strong> and the full url of your image in the value. You <strong>must</strong> have at least two (2) items featured for the gallery to work.
        <div style="padding-top: 10px"></div>
        <u><strong>Advanced Custom Fields</strong></u>
        <div style="padding-top: 5px"></div>
      <?php $checked1 = get_option('gallery-use-featured-content') ? "checked" : ""; ?>
        <input type="checkbox" name="gallery-use-featured-content" id="gallery-use-featured-content" <?php print $checked1 ?>>
        Check here if you want to use custom text under the post/page title.<br />
        Key: <strong>featuredtext</strong> - Insert custom text in the value. HTML is allowed.
        <div style="padding-top: 10px"></div>
        <?php $checked2 = get_option('gallery-use-thumb-image') ? "checked" : ""; ?>
        <input type="checkbox" name="gallery-use-thumb-image" id="gallery-use-thumb-image" <?php print $checked2 ?>>
        Check here if you want to use a custom thumbnail image in your gallery.<br />
        Key: <strong>thumbnailimg</strong> - Insert the url of the image in the value.
        <div style="padding-top: 5px"></div>
      You can also add alt text to your gallery images with a custom field.<br />
        Key: <strong>alttext</strong> - Insert the alt text in the value.
        <div style="padding-top: 15px"></div>
        For more information, please visit the <a href="http://www.featuredcontentgallery.com/install-setup">Featured Content Gallery Install & Setup</a> page.

      </fieldset>
      <p class="submit"><input type="submit" name="updateOptions" value="<?php _e('Update Options') //changed the name of the submit button to updateOptions?>" /></p>
        <p><em>Featured Content Gallery WordPress Plugin v3.2.0 by <a href="http://www.ieplexus.com">iePlexus</a></em></p>
   </form>     
</div>


Hope this helps somebody out

Flash
flash
 
Posts: 1
Joined: Wed Apr 15, 2009 4:56 pm

Re: Getting it to work in Wordpress MU

Thank you for using the Featured Content Gallery Forum
 

Re: Getting it to work in Wordpress MU

PostBy archetype on Wed May 27, 2009 4:11 pm

Cool! I have been searching and searching for this. So this will work on 2.7.1 MU? Thanks again for posting.

Will
archetype
 
Posts: 3
Joined: Mon May 18, 2009 1:05 pm

Re: Getting it to work in Wordpress MU

PostBy WPLJ on Thu Jun 11, 2009 1:44 pm

MAJOR thanks flash! Exactly what I needed. Thank you for posting this
WPLJ
 
Posts: 3
Joined: Thu Jun 11, 2009 1:43 pm

Re: Getting it to work in Wordpress MU

PostBy sho on Wed Jul 01, 2009 3:04 pm

thank you so much this was very helpful. now if i could just figure out how to pull the custom fields from the blogs to the main blog.
sho
 
Posts: 1
Joined: Tue Jun 30, 2009 7:54 pm

Re: Getting it to work in Wordpress MU

PostBy dmcdmc on Tue Aug 25, 2009 7:54 am

Hey. I had the same problem with FCG version 3.2 and Wordpress MU 2.8.4a and this fix worked.

However, the featuredtext does not appear at the bottom of the gallery. Is anyone else having this problem?
dmcdmc
 
Posts: 4
Joined: Mon Aug 24, 2009 8:27 am

Re: Getting it to work in Wordpress MU

PostBy aaroncampbell on Tue Sep 29, 2009 2:01 pm

The correct fix is for the plugin to register it's settings. If it doesn't, it will stop working in one of the upcoming versions of WP (not sure if it's planned for 2.9 or 3.0, but it's definitely coming). If anyone knows who I should tell to get this code added to FCG, let me know. Here is the correct way to fix it:
In options.php, find this code:
Code: Select all
<?php wp_nonce_field('update-options'); ?>

Replace it with this:
Code: Select all
<?php
      /**
       * @todo Use only settings_fields() once this supports only 2.7+
       */
      if ( function_exists('settings_fields') ) {
         settings_fields( 'gallery_settings' );
      } else {
         wp_nonce_field('update-options');
?>
         <input type="hidden" name="action" value="update" />
         <input type="hidden" name="page_options" value="gallery-width,gallery-height,gallery-info,gallery-items,gallery-border-color,gallery-bg-color,gallery-text-color,gallery-use-featured-content,gallery-use-thumb-image,gallery-way,gallery-items-pages,gallery-category,gallery-fcg-button,gallery-fade-duration,gallery-delay,gallery-randomize-pages,gallery-rss-word-quantity,gallery-default-transaction" />
<?php
      }
?>

The conditional will mean that this can still work on WP 2.6 and older. If you have 2.7+, you can just use the "settings_fields( 'gallery_settings' );" part of all that.

Then, in content-gallery.php you need to add this code to the end (before the closing PHP tag):
Code: Select all
function register_gallery_options() {
   register_setting( 'gallery_settings', 'gallery-width' );
   register_setting( 'gallery_settings', 'gallery-height' );
   register_setting( 'gallery_settings', 'gallery-info' );
   register_setting( 'gallery_settings', 'gallery-items' );
   register_setting( 'gallery_settings', 'gallery-border-color' );
   register_setting( 'gallery_settings', 'gallery-bg-color' );
   register_setting( 'gallery_settings', 'gallery-text-color' );
   register_setting( 'gallery_settings', 'gallery-use-featured-content' );
   register_setting( 'gallery_settings', 'gallery-use-thumb-image' );
   register_setting( 'gallery_settings', 'gallery-way' );
   register_setting( 'gallery_settings', 'gallery-items-pages' );
   register_setting( 'gallery_settings', 'gallery-category' );
   register_setting( 'gallery_settings', 'gallery-fcg-button' );
   register_setting( 'gallery_settings', 'gallery-fade-duration' );
   register_setting( 'gallery_settings', 'gallery-delay' );
   register_setting( 'gallery_settings', 'gallery-randomize-pages' );
   register_setting( 'gallery_settings', 'gallery-rss-word-quantity' );
   register_setting( 'gallery_settings', 'gallery-default-transaction' );
}

add_filter( 'admin_init', 'register_gallery_options');


If you do this, the plugin will work on WPMU, still work on standard WordPress, and be ready to survive future versions of WordPress.
aaroncampbell
 
Posts: 2
Joined: Sat Aug 15, 2009 9:58 am

Re: Getting it to work in Wordpress MU

PostBy questus5 on Sun Oct 25, 2009 4:51 pm

Hi I picked up this thread as I also have issues with FCG in wordpress mu. I followed the later part of this thread in fixing the options page but when i create content aqnd posted it I get a black screen and what is a seemingly indefinate load period for the assests. I tested this in exactly the same way on a regular wordpress blog and it worked fine.

the website is http://questusfive.com

In explorer it does throw an error in the javascript referencing the below but i am not sure if this is relevant. I only installed the version of MU yesterday so I am assuming this is the latest version. the one I am running is v2.8.4a. I am using the studio press allure template that I have customised.

Any help on getting this fixed would be greatly appreciated.

----------------------------------------
Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 1.0.3705; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Mon, 26 Oct 2009 00:44:57 UTC

Message: 'this.galleryData.0.image' is null or not an object
Line: 327
Char: 4
Code: 0
URI: http://questusfive.com/wp-content/plugi ... ery.js.php

Message: Object doesn't support this property or method
Line: 1
Char: 1
Code: 0
URI: http://questusfive.com/
questus5
 
Posts: 11
Joined: Sun Oct 25, 2009 4:41 pm

Re: Getting it to work in Wordpress MU

PostBy questus5 on Sun Oct 25, 2009 5:24 pm

P.S i did try turning off all other plugins in case of a javascript conflict but this didnt do anything either.
questus5
 
Posts: 11
Joined: Sun Oct 25, 2009 4:41 pm

Re: Getting it to work in Wordpress MU

PostBy admin on Mon Oct 26, 2009 7:24 am

give me the fcg options page screenshot
Yelena Khamidullina
Web Applications Developer, iePlexus

1. Check settings to exclude fcg-YOU conflict
2. Try to turn off all your plugins at once to exclude fcg-other plugin conflict
3. Try default theme to exclude fcg-theme conflict
4. Post in this forum to involve me in your troubleshooting. URL is required
User avatar
admin
Site Admin
 
Posts: 4735
Joined: Fri Jan 16, 2009 9:29 am
Location: Seattle, WA

Re: Getting it to work in Wordpress MU

PostBy questus5 on Mon Oct 26, 2009 12:09 pm

Please see enclosed screen capture. Sorry for the quality had to get it down to a size i could import.
Attachments
fcg.sc.jpg
fcg.sc.jpg (141.6 KiB) Viewed 7165 times
questus5
 
Posts: 11
Joined: Sun Oct 25, 2009 4:41 pm

Next

Return to Development, Improvement, and Conflicts

Who is online

Users browsing this forum: No registered users and 0 guests