faster is better than slow | Download Swift
+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 16 of 16

Thread: SWIFT on a WordPRess MU install

  1. #11


    Ok, then I didn't need to comment out those globals, I didn't think so
    but what the heck is step 4?

    4. And remove in that same forms the 3 old hidden fields like nonce that are no longer needed
    That was the only nonce fields I could find?

    I didn't comment them out the first time, and my error was a little different, it said are you sure you want to do that? on a blank screen. (I'm paraphrasing, I don't remember what it said verbatem)

    So I figured I left some old code that needed taken out.

    ?

    Where do I have add_action('switch_theme', 'delete_stuff');

    OOHH,,

    No, I didn't add that, I was just showing you where in the functions I added your snippet, which I included your comment.
    It's all there, look again.
    Last edited by green; 03-02-2010 at 03:17 AM. Reason: mispellings galore <-LOL

  2. #12


    If you google around you will read that the following 3 hidden fields are no longer needed and basically in newer versions are even required to not use:

    <input type="hidden" name="action" value="update" />
    <input type="hidden" name="page_options" value="<?php echo $options_list;?>" />
    and the wp_none field

    Life now becomes much easier with WordPress handling this for you

  3. #13


    Its not that hard actually: in the new WP releases (which will soon merge with the WordPress MU code) :

    1) you need to register all variables that you want to put in the options (we did that even in 2 groups)
    2) remove the 3 old hidden fields and replace with the settings_fields which do the same and more

    simple.

  4. #14


    omg

    I'm hitting a wall on the design options page

    The options page works great, but on the design page I'm pulling my hair out.

    What am I missing? can you post the whole design-options.php file? I need to see what you're talking about to "get it"

    I understand the array of options, but I'm not understanding whats wrong with the form and why I keep getting the , "Are you sure you want to do this? Try again message...


    *Update*

    Well the options page did work, now it doesn't, but I didn't change anything... :/ ????

    Where is the "wp_none field" I have searched multiple files, and I can't find that anywhere in them, are you making a typo?
    I re-downloaded a fresh copy of swift 5.19 and I can't find it....

    It's unsuall for me to have this much trouble, and those links you sent, I saw a lot of talk about opening a security hole by putting legacy WP code back in, and alot of people advised against it.
    Last edited by green; 03-04-2010 at 07:57 PM. Reason: UPDATE

  5. #15


    ok here is my functions.php:

    PHP Code:
    <?php
    // Directory constants
    define('INCLUDES'TEMPLATEPATH '/includes');
    define('ADMIN'TEMPLATEPATH '/admin');
    define('WIDGETS'TEMPLATEPATH '/widgets');
    define('FUNCTIONS'TEMPLATEPATH '/functions');
    define('LAYOUTS'TEMPLATEPATH '/layouts');

    // the 
    $wud wp_upload_dir();
    define('U_DIR'$wud['basedir']);

    // U_URL is used like : U_URL.'/swift_custom' so I wonder
    // why that line is not in the define??? Anyway...
    if (isset($blog_id) && $blog_id 0) {
        
    define('U_URL'get_bloginfo('template_url') . '/includes');
        
    define('UU_URL'$wud['baseurl']);
    } else {
        
    define('U_URL'$wud['baseurl']);
    }


    require_once (
    INCLUDES '/sidebar-init.php'); // Initializes the sidebars
    require_once (INCLUDES '/navigation.php');
    require_once (
    INCLUDES '/thumb.php');
    require_once (
    INCLUDES '/wp-pagenavi.php');

    require_once (
    ADMIN'/admin-core.php');
    require_once (
    ADMIN'/admin-header.php');
    require_once (
    ADMIN'/swift-options-init.php');
    require_once (
    ADMIN'/swift-design-options-init.php');
    require_once (
    ADMIN'/pageorder.php');
    require_once (
    ADMIN'/categoryorder.php');
    require_once (
    ADMIN'/create-styles.php');

    require_once (
    FUNCTIONS'/custom-functions.php');

    require_once (
    LAYOUTS'/blog-loop.php');
    require_once (
    LAYOUTS'/mag-loop.php');

    require_once (
    WIDGETS '/widget-functions.php');
    require_once (
    WIDGETS '/widgets.php'); 

    add_action('widgets_init'create_function('''return register_widget("swiftTabs");'));
    add_action('widgets_init'create_function('''return register_widget("swiftPopularPosts");')); 
    add_action('widgets_init'create_function('''return register_widget("swiftAdsWidget");')); 
    add_action('widgets_init'create_function('''return register_widget("SubscribeBox");')); 
    add_action('widgets_init'create_function('''return register_widget("HomePageOnlyText");')); 
     

    add_action('update_option''create_style_sheet');
    add_action('update_option''resetSwiftOptions');


    add_action('admin_head''first_run_options');



    add_action('switch_theme''delete_stuff');

    // EDL: Added Register Settings
    add_action('admin_init''register_swift_settings');
    function 
    register_swift_settings() {
        global 
    $swift_options$swift_design_options;
        foreach (
    $swift_options as $value) {
            if(
    $value['id']!=NULL) {
                
    register_setting('swift_settings_group'$value['id']);
            }
        }    
        foreach (
    $swift_design_options as $value) {
            if(
    $value['id']!=NULL) {
                
    register_setting('swift_settings_group_design'$value['id']);
            }
        }    
    }

    // EDL: Date Thing

    $dateformat get_option('date_format');$timeformat get_option('time_format');

    function 
    fv_date_diff($d1$d2){
            if (
    $d1 $d2){
                
    $temp $d2;
                
    $d2 $d1;
                
    $d1 $temp;
              } else {
                
    $temp $d1//temp can be used for day count if required
              
    }
              
    $d1 date_parse(date("Y-m-d H:i:s",$d1));
              
    $d2 date_parse(date("Y-m-d H:i:s",$d2));
              
    //seconds
              
    if ($d1['second'] >= $d2['second']){
                
    $diff['second'] = $d1['second'] - $d2['second'];
              } else {
                
    $d1['minute']--;
                
    $diff['second'] = 60-$d2['second']+$d1['second'];
              }
              
    //minutes
              
    if ($d1['minute'] >= $d2['minute']){
                
    $diff['minute'] = $d1['minute'] - $d2['minute'];
              } else {
                
    $d1['hour']--;
                
    $diff['minute'] = 60-$d2['minute']+$d1['minute'];
              }
              
    //hours
              
    if ($d1['hour'] >= $d2['hour']){
                
    $diff['hour'] = $d1['hour'] - $d2['hour'];
              } else {
                
    $d1['day']--;
                
    $diff['hour'] = 24-$d2['hour']+$d1['hour'];
              }
              
    //days
              
    if ($d1['day'] >= $d2['day']){
                
    $diff['day'] = $d1['day'] - $d2['day'];
              } else {
                
    $d1['month']--;
                
    $diff['day'] = date("t",$temp)-$d2['day']+$d1['day'];
              }
              
    //months
              
    if ($d1['month'] >= $d2['month']){
                
    $diff['month'] = $d1['month'] - $d2['month'];
              } else {
                
    $d1['year']--;
                
    $diff['month'] = 12-$d2['month']+$d1['month'];
              }
              
    //years
              
    $diff['year'] = $d1['year'] - $d2['year'];
              return 
    $diff;
        }



    ?>
    And my /admin/swift/design-options.php:

    PHP Code:
    <?php require_once('admin-header.php');?>
    <?php admin_header
    ();?>
    <div class="tabs">
      <ul class="tabmenu hidden">
          <li><a href="#Layout">Layout Options</a></li>
          <li><a href="#Fonts">Fonts</a></li>
        <li><a href="#colors">Colors</a></li> 
        <li><a href="#bgImages">Background Images</a></li>
        <li><a href="#Rounded-Corners">Rounded Corners</a></li>
        <li><a href="#Custom-CSS">Custom CSS</a></li> 
          
      </ul>
     
    <form method="post"  action="options.php">
    <?php settings_fields('swift_settings_group_design'); 
    global 
    $themename$shortname2$swift_design_options;
    $options_list='';
    foreach (
    $swift_design_options as $value
    {
        if(
    $value['id']!=NULL)$options_list.=$value['id'].',';
        switch ( 
    $value['type'] ) 
        {
            case 
    "open":
    ?>
    <div class="open"> 

    <?php break; case "close"?>
    </div>

    <?php break; case "clear"?>
    <div class="clear"></div>

    <?php break; case "tab-title"?>    
        <div id="<?php echo $value['name']; ?>">
        <h2><?php echo $value['name']; ?></h2>
        
    <?php break; case "heading"?>    
        <div id="sub-heading">
        <h3><?php echo $value['name']; ?></h3>

    <?php break; case "sub-heading"?>        
    <div class="sub-heading"><h4><?php echo $value['name']; ?></h4></div>

    <?php break; case 'text'?>
    <div  class="text">
    <input name="<?php echo $value['id']; ?>" class="color" id="<?php echo stripslashes(get_option$value['id'] )); ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_option$value['id'] ) != "") { echo stripslashes(get_option$value['id'] )); } else { echo stripslashes($value['std']); } ?>" />
    <span class="title"><?php echo $value['name']; ?></span> 
    <div class="clear"></div>
    </div>

    <?php break; case 'regulartext'?>
    <div  class="text">
    <span class="title"><?php echo $value['name']; ?></span>
    <input class="width" name="<?php echo $value['id']; ?>" id="<?php echo stripslashes(get_option$value['id'] )); ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_option$value['id'] ) != "") { echo stripslashes(get_option$value['id'] )); } else { echo stripslashes($value['std']); } ?>" />
    <span class="desc"><?php echo $value['desc']; ?></span>
    </div>


    <?php break; case 'textarea'?>
    <div class="textarea clearfix">
    <span class="title"><?php echo $value['name']; ?></span>
    <textarea name="<?php echo $value['id']; ?>"type="<?php echo $value['type']; ?>" cols="" rows=""><?php if ( get_settings$value['id'] ) != "") { echo stripslashes(get_settings$value['id'] )); } else { echo $value['std']; } ?></textarea>
    <span class="desc"><?php echo $value['desc']; ?></span>
    <br />
    </div>

    <?php break; case "checkbox"?>
    <div class="checkbox">
    <?php if(get_option($value['id'])=="true"){ $checked "checked=\"checked\""; }else{ $checked "";} 
    ?>

    <input type="checkbox" class="cb" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked?> />
    <span class="title"><?php echo $value['name']; ?></span>
    <span class="desc">(<?php echo $value['desc']; ?>)</span>
    </div>

    <?php break; case 'ordering'
     
    swift_mypageorder();
     
    swift_mycategoryorder();
    ?>

    <?php break; case 'radio'?>
    <div class="radio text">
    <span class="title"><?php echo $value['name']; ?></span>
    <?php foreach ($value['options'] as $option) { ?>
    <label>
    <input type="radio" name="<?php echo $value['id']; ?>" value="<?php echo $option?><?php if ( get_settings$value['id'] ) == $option){ echo 'checked';} ?>/><?php echo $option?>

    </label>
    <?php ?>
    </div>

    <?php break; case 'select'?>
    <div class="select text">
    <span class="title"><?php echo $value['name']; ?></span>
    <select class="width" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">
    <?php foreach ($value['options'] as $option) { ?>
        <option <?php 
        
    if ( get_settings$value['id'] ) == $option) {  echo ' selected'; }?> >
        <?php echo $option?>
        </option>
        <?php ?>
    </select>
    <span class="description"><?php echo $value['desc']; ?></span>
    </div>


    <?php break; case 'hidden'?>

    <input name="<?php echo $value['id']; ?>" id="<?php echo stripslashes(get_option$value['id'] )); ?>" type="hidden" value="<?php echo rand()?>" />

    <?php 
    }
    }
    ?>  
    <input type="hidden" name="colour-options" value="update" />
    <p class="submit">
    <input type="submit" class="button-primary alignright" value="<?php _e('Save Changes'?>" />
    <input type="submit" name="design-reset" class="button-primary alignleft" value="Reset" id="reset" /> 
    <div class="clear"></div>
    </p> 
    </div>
    </form>

    </div><!-- /swift-wrapper-->

  6. #16


    Ok Thank you soo much! Well showing me everything did the trick I guess, but not like you'd expect! It was as simple as you said, however, I was using Google Chrome to test, and the cache was not "Really" Clearing. Seeing it in full just gave me the confidence that I had it correct the first time, and not go in so many directions.

    I had to exit the browser completely before it started working. No Ctrl-F5 or deleting the cache was going to work. Google Chrome must use a memory cache too, they why it was working for a bit and then quit on it's own I guess.

    Much praise to Edelwater for the Great research and guide. We need to get together to talk about some customizations you were asking about now don't we? I owe ya one!

    *Shout to Satish* I'd incorporate this in the next update for WPMU users out there too, this code is also a tad smaller, and may even be "Swifter"

+ Reply to Thread

Similar Threads

  1. Wordpress Hacked And Swift Infected
    By rexharris in forum Support
    Replies: 1
    Last Post: 06-20-2013, 01:11 PM
  2. Can not choose Swift Theme in Wordpress Admin
    By veteran in forum Bug report and suggestions.
    Replies: 1
    Last Post: 01-13-2012, 11:25 AM
  3. Sharing not working for me Swift 5.54 and Wordpress 3.1
    By shiva in forum Bug report and suggestions.
    Replies: 1
    Last Post: 03-10-2011, 01:35 AM
  4. Wordpress Install Error
    By xlcr in forum Bug report and suggestions.
    Replies: 5
    Last Post: 12-01-2010, 12:56 AM
  5. WordPress 3.0-beta1 & Swift 5.25 bug
    By Wisefaq in forum Bug report and suggestions.
    Replies: 1
    Last Post: 05-05-2010, 09:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts