thanks so much.
before next update, actually, I was trying to track code. now I temporarily resolved problem. I list issues I found for your reference here. the main problem here are 2 files: sf-links.php and sf-support.php
in sf-links.php
line#104:$content = $wpdb->get_row(”SELECT post_content, post_title, post_author, post_status FROM “.$wpdb->prefix.”posts WHERE ID = “.$postid.”;”);
line#112:
$post_title = $wpdb->escape($content->post_title);
line#114-118:
$slug = sf_create_topic_slug($post_title);
$sql = “INSERT INTO “.SFTOPICS.” (topic_name, topic_slug, topic_date, forum_id, user_id, blog_post_id) VALUES ('”.$post_title.”', '”.$slug.”', now(), “.$_POST['sfforum'].”, “.$content->post_author.”, “.$postid.”);”;
$wpdb->query($sql);
check above code, it tried to retrieve post_title from wpdb, convert to topic slug. then insert to table “sfposts”.
it caused problem if blog title contrains all chinese character. after check wordpress db, I found it uses post_name for slug. so I just changed code as below:
line#104:(select one more field 'post_name' from wpdb)$content = $wpdb->get_row(”SELECT
post_content, post_title, post_author, post_status, post_name FROM
“.$wpdb->prefix.”posts WHERE ID = “.$postid.”;”);
line#112:(not touch)
$post_title = $wpdb->escape($content->post_title);
line#114-118:(use blog-post slug to create forum-topic slug)
$slug = sf_create_topic_slug($content->post_name);
$sql = “INSERT INTO “.SFTOPICS.” (topic_name, topic_slug, topic_date,
forum_id, user_id, blog_post_id) VALUES ('”.$post_title.”',
'”.$slug.”', now(), “.$_POST['sfforum'].”,
“.$content->post_author.”, “.$postid.”);”;
$wpdb->query($sql);
—————————————–
the next issue is function 'sf_create_topic_slug' in sf-support.php.
suppose, even the slug name was converted from chinese character above and return empty str,
sf_create_topic_slug should deal with it. but in current version, it does not.
line#1165-1166:
$title = sf_create_slug($title);
if(empty($title)) return '';
in above code, if $title is empty then return empty str? I changed code for temp solution.
line#1165-1166:
$title = sf_create_slug($title);
if(empty($title)) $title = 'unknow_topic';
it assigned $title as 'unknow_topic' and not return, going next code segment to attach incremental surffix, like unknow_topic-1, unknow_topic-2 (in case already had 'unknow_topic' there)
hope in next update. it can use topic-id instead.
the other minor issue:
1. while edit blog-post, the “create link” select list can not display correct forum name. checked sf-links.php, found code like,
line#34
$forumid = $islink->meta_value;
it can not get correct forumid on my php5, I changed it as
line#34
$keys = explode('@', $islink->meta_value);
$forumid = $keys[0];
it works.
2. in sf-links.php
line#14:
add_action('save_post', 'sf_save_blog_link');
actually, it does nothing, especially when I tried to link my old blog post to forum. so I just change it as
line#14:
add_action('save_post', 'sf_publish_blog_link');
use publish action hook instead
hope above info would be helpful.