[wp-hackers] Changes from 2.x.x to 3.x.x
mailapera
mailapera at gmail.com
Thu Jan 20 15:35:51 UTC 2011
Hi,
I know this may seem a topic coming late, but I have an issue after
upgrading from 2.9.2 to 3.0.4 I cannot figure out.
So I was wondering if you could help me out replying to this question.
Are queries or prefixes handled differently in 3.x?
I have this function that works in conjunction with NGG, but the issue
here is not the plugin (tested). So it might be some parameter that
changed with 3.x
I bumped my head on wordpress.org searching for any note on this, but
could not find anything. Any hint is greatly appreciated! Below is the
function.
function mrt_thr_addgall()
{
//echo "hi";
if(!current_user_can('level_10'))
{
global $wpdb, $current_user,$wp_query;
$url = get_option('siteurl');
$mrt_postID = $wp_query->post->ID;
$mrt_post = get_post($mrt_postID);
$mrt_curr_title = $mrt_post->post_title;
$mrt_content = $mrt_post->post_content;
$mrt_userID = $current_user->id;
$nggallery = $wpdb->prefix . 'ngg_gallery';
$gall_path = "wp-content/gallery/";
$mrt_temp = ABSPATH . "wp-content/gallery/";
$mrt_status = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE
post_author=$mrt_userID AND post_status <> 'auto-draft' AND
post_status <> 'trash' AND post_type <> 'revision' AND mrt_flag != '1'
");
if ( is_array($mrt_status) )
{
foreach($mrt_status as $index)
{
add_post_meta($index->ID, "gallerypopup", "", false);
add_post_meta($index->ID, "galleryflash", "", false);
add_post_meta($index->ID, "firstthumb", "", false);
$mrt_title = $index->post_title;
$mrt_ID = $index->ID;
$mrt_thr_title = str_replace(" ","-",$mrt_title);
$mrt_path = $mrt_temp . $mrt_thr_title;
$mrt_gall_path = $gall_path . $mrt_thr_title;
if ( !file_exists($mrt_path))
{
mkdir($mrt_path);
chmod($mrt_path, 0777);
}
$wpdb->query($wpdb->prepare("INSERT INTO ".$nggallery."(name,
path, title, author) VALUES(%s, %s, %s, %d)", $mrt_title,
$mrt_gall_path, $mrt_thr_title, $mrt_userID ) );
$mrt_gallID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery
WHERE name='".$mrt_title."'");
$wpdb->query("UPDATE $wpdb->posts SET mrt_gallID=$mrt_gallID
WHERE post_title='".$mrt_title."'");
$wpdb->query("UPDATE $wpdb->postmeta SET
meta_value='[slideshow=".$mrt_gallID."]' WHERE meta_key='galleryflash'
AND post_id=$index->ID");
$wpdb->query("UPDATE $wpdb->postmeta SET
meta_value='[gallery=".$mrt_gallID."]' WHERE meta_key='gallerypopup'
AND post_id=$index->ID");
$wpdb->query("UPDATE $wpdb->posts SET mrt_flag=1 WHERE ID=$index->ID");
/*else if($index->post_status == 'pending' && $index->post_type == 'post')
{
$redir_value = $url."/wp-admin/edit.php?page=thrifty/functions.php";
header("Location: $redir_value");
}*/
}
}
}
}
More information about the wp-hackers
mailing list