Porting Custom made forum to wordpress BuddyPress
-
Hi
I am porting custom made forum to buddypress.
Here is my code in an external file inside wordpress install directory more
`
// Include wordpress main index file,we get access to “all wp-function(not tested)” in our external file.
require($_SERVER.”/more/index.php”);
define(‘WP_USE_THEMES’, false); // Do not show themes
header(“HTTP/1.1 200 OK”); //Sometimes error occurs,so to fix we set headersecho ‘Testing buddypress function…
‘;
$defaults = array(
‘topic_title’ => ‘When did your baby smile for the first time ?’,
‘topic_slug’ => ”,
‘topic_text’ => ”,
‘topic_poster’ => 1706, // accepts ids
‘topic_poster_name’ => ‘Will James ‘, // accept names
‘topic_last_poster’ => 1706, // accepts ids
‘topic_last_poster_name’ => ”, // accept names
‘topic_start_time’ => bp_core_current_time(),
‘topic_time’ => bp_core_current_time(),
‘topic_open’ => 1,
‘topic_tags’ => false, // accepts array or comma delim
‘forum_id’ => 2 // accepts ids or slugs
);$ret_value = bp_forums_new_topic($defaults);
echo ‘This is what we got from this function—->’.$ret_value.’
‘; // This output nothing
echo ‘This is wordpress mysql last insert id—>’.$wpdb->insert_id; //This only output 0(zero)
`
I want the topic insert id so i can feed answers for the topic. The function buddypress function “bp_forums_new_topic ” works perfect.Can you figure out a way as how to get the topic last id or am i missing something out ?
- The topic ‘Porting Custom made forum to wordpress BuddyPress’ is closed to new replies.