Support » Plugins » WordPress PunBB integration

  • Alright, so I found a post which allowed me to do SOME post integration wordpress->punbb where if I posted something on wordpress it would then post it on to the forums.

    This is the code I’m using for the posting part

    function punbb_publish_post($id)
        global $wpdb;
        $wppost = $wpdb->get_row("SELECT ID, post_date, post_title, post_content FROM ".$wpdb->posts." WHERE ID = ".$id." LIMIT 1");
        /* Check if edited or new */
        $wppost_check = $wpdb->get_row("SELECT id, topic_id FROM ".PUNPREFIX."posts WHERE user = 'Neteyes' AND posted = ".strtotime($wppost->post_date));
        $wpdb->query("UPDATE ".PUNPREFIX."topics SET subject = '".$wppost->post_title."' WHERE id = ".$wppost_check->topic_id);
        $wpdb->query("UPDATE ".PUNPREFIX."posts SET message = '".$wppost->post_content."' WHERE id = ".$wppost_check->id);
        /*If New */
        else {
        $wpdb->query("INSERT INTO ".PUNPREFIX."topics (user, subject, posted, last_post, last_poster, forum_id) VALUES(
        $topic_id = $wpdb->insert_id;
        $wpdb->query("INSERT INTO ".PUNPREFIX."posts (user, user_id, message, posted, topic_id, poster_ip) VALUES(
        $post_id = $wpdb->insert_id;
        $wpdb->query("UPDATE ".PUNPREFIX."topics SET last_post_id = ".$post_id.", first_post_id = ".$post_id." WHERE id = ".$topic_id);
        $wpdb->query("UPDATE ".PUNPREFIX."forums SET last_post = ".strtotime($wppost->post_date).", last_post_id = ".$post_id.", last_poster = 'Neteyes' WHERE id = 1");
        $punbb_postnumber = $wpdb->get_row("SELECT num_posts, username FROM ".PUNPREFIX."users WHERE username = 'Neteyes' LIMIT 1");
        $wpdb->query("UPDATE ".PUNPREFIX."users SET num_posts = ".$punbb_postnumber->num_posts."+1 WHERE username = 'Neteyes'");
        /* Puts a Link to the forum topic in the post */
        $wp_add = "<p>Diskutiere <a href=\"/\" title=\"Link zum Topic im Forum\">hier. -></a></p>";
        $wp_content = $wppost->post_content.$wp_add;

    The thing is it’s not giving me any errors but it’s not posting anything on the forums either.

    I added the

    do_action('punbb_publish_post', $id, $post);


    do_action(‘edit_post’, $post_id, $post);
    do_action(‘save_post’, $post_id, $post);
    do_action(‘wp_insert_post’, $post_id, $post);

    again, I’m not sure if the variables there are totally correct but it’s not giving me any errors.

    The file I’m editing is wp-includes/post.php
    I also have these rows at the top of the post.php

    define('PUNPATH', '../punbb'); // path to punbb folder
      define('FORUM_ROOT', '../punbb'); // path to punbb folder
    define('PUNPREFIX', 'pun_'); // punBB table prefix

    This script is also from PunBB 1.3 so it’s probably somewhat outdated.
    I can probably tell you what the problem is, the $user_id variables and the $id and $post_id, the thing is, I think these variables are supposed to come from the punbb functions (i just got the script off a forum) but when I call the function by

    require FORUM_ROOT.'include/common.php';

    I’m getting alot of errors in the form of

    Warning: require(../punbb/include/common.php) [function.require]: failed to open stream: No such file or directory in /storage/content/48/134348/projekt.*********.se/public_html/wp-includes/post.php on line 22`

    Warning: require(../punbb/include/common.php) [function.require]: failed to open stream: No such file or directory in /storage/content/48/134348/projekt.*********.se/public_html/wp-includes/post.php on line 22

    Fatal error: require() [function.require]: Failed opening required '../punbb/include/common.php' (include_path='.:/usr/lib64/php') in /storage/content/48/134348/projekt.******.se/public_html/wp-includes/post.php on line 22</blockquote>

    But there definately is a ../punbb/include/common.php file.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘WordPress PunBB integration’ is closed to new replies.