| | |||||||
| Technology & Technical Skills Computer skills, hardware, software, internet topics, gadgets, programming |
|
Welcome to the Personal Development for Smart People Forums, the place for lively, intelligent discussion of all personal growth issues -- physical, mental, financial, social, emotional, spiritual, and more. You're currently viewing as a guest, which gives you limited read-only access. By joining our free community, you'll be able to post your own messages, access many members-only features, see the new messages posted since your last visit, and of course remove this header message. Registration is fast, simple, and free, so please join today. If you arrived here from a search engine, you may want to explore the main site first, which includes hundreds of deep and insightful articles on a variety of personal development topics. |
| | Thread Tools | Display Modes |
| |||
|
As far as I can tell creating a new topic in SMF modifies the following tables in the SMF database: smf_boards smf_log_activity smf_log_boards smf_log_search_subjects smf_log_topics smf_messages smf_settings smf_topics Doublechecking this.. |
| |||
|
BTW - I've been wanting to improve my php mysql skills for a while, so don't worry about me spending some time on this. Helps me out to know this stuff better.
|
| |||
|
TBH - I really don't know much about this stuff either, but I'll try to help out anyway I can
__________________ Lightning Shock - My Website Wordpress Mountain - Wordpress Resources and Community |
| |||
|
It looks like a new topic in SMF modifes the following cells in these tables. smf_boards > numTopics > +1 smf_boards > numPosts > +1 smf_log_activity > topics > +1 smf_log_activity > posts > +1 smf_log_boards > ID_MSG > +1 smf_log_search_subjects > word > new row for each word of the new thread smf_log_search_subjects > ID_TOPIC > +1 smf_log_topics > ID_TOPIC > +1 smf_log_topics > ID_MSG > +1 smf_messages > ALMOST EVERY CELL MODIFIED smf_settings > totalTopics > +1 smf_settings > totalMessages > +1 smf_topics > ID_TOPIC > +1 smf_topics > ID_BOARD > +1 smf_topics > ID_FIRST_MSG > +1 smf_topics > ID_LAST_MSG > +1 So, basically we need to create a php file that can does the same thing (recreates these actions) |
| |||
|
I should say that I manually created all the boards and sub-boards for my forums, it might be easier this way when configuring the posts-to-threads part of the database. (Unless you think it would be easier to just program it all together, including the boards.)
__________________ Lightning Shock - My Website Wordpress Mountain - Wordpress Resources and Community Last edited by jamestl2; 08-17-2007 at 05:26 AM. |
| |||
|
I went through the tutorial here and created a plugin that e-mails me when I publish a new wordpress post, using the publish_post hook we talked about. Here is the code. Code:
<?php
/*
Plugin Name: Email Friends
Plugin URL: http://stevepavlina.com/forums
Description: This plugin will e-mail Dan at his yahoo account when a new post is published.
Author: Dan Linehan
Version: 1
Author URL: http://bestconsultingever.com
*/
function email_friends($post_ID) {
$friends = 'puredemo@yahoo.com';
mail($friends,"Dan's blog updated",'I just put something on my blog: ~http://blog.example.com');
return $post_ID;
}
add_action('publish_post','email_friends');
?> Working on a function that will post to SMF instead of emailing. |
| |||
| |
| |||
|
Here's a really good discussion on wordpress and SMF integration. SMF & WordPress Of course jjgallow is all over it, lol. |
| |||
|
I don't see any SMF hooks for creating a new thread or a new post, which is pretty crucial to what we want to do. I asked Orstio, the lead developer over there about it, Quote:
|
| |||
|
Wow... here is a thread with exactly what we've been discussing. Create a new SMF topic from an external application |
| |||
|
Is that PHP file you wrote an SMF plugin or WP plugin? Also, Good Links I'll check them out PS: I've tried contacting jjgallow over at WP forums, but still no response (Don't know where he is)
__________________ Lightning Shock - My Website Wordpress Mountain - Wordpress Resources and Community |
| |||
|
Its a WP plugin, try it out, super easy to make.. It looks like someone already did a plugin that does exactly what we want with SMF, but the download site is down. Its called SMF commenter. I bumped the thread and emailed the plugin maker, so hopefully we'll hear back from him by later today. It looks like he is still active on the forums. |
| |||
|
I tried uploading your file, but WP is not reading it as a plugin, here is the process I took: Copied the php text into a notepad file and saved it as a php file. Then FTP'd the file to cpanel, and tried to access it through the WP dashboard.
__________________ Lightning Shock - My Website Wordpress Mountain - Wordpress Resources and Community |
| |||
| Quote:
Usually you FTP a file directly into your webspace - not to cpanel. Is the php file in your plugins folder? ie. wp-content/plugins/friend_email.php? |
| |||
| Quote:
Quote:
__________________ Lightning Shock - My Website Wordpress Mountain - Wordpress Resources and Community |
| |||
|
Nevermind, got it working (saved it wrong)
__________________ Lightning Shock - My Website Wordpress Mountain - Wordpress Resources and Community |
| |||
|
Let me know how much progress you make on the new plugin, and if there is anything else I can do to help
__________________ Lightning Shock - My Website Wordpress Mountain - Wordpress Resources and Community |
| |||
|
I received the code today for SMF commenter but its not working for me. I'm revising it, but this may take a few days, as I have some other projects to work on over the weekend. James, I'm posting the code so you can take a look at it over the weekend as well. wp_smf_commenter.php Code: <?php
/*
Plugin Name: SMF Commenter
Plugin URI:
Description: When a new Wordpress post is published the post is duplicated in the forums and a link is added to the word press post.
Author: twistedsymphony
Version: .4
Author URI: http://web-nine.com/
*/
/* Copyright 2007 twistedsymphony (email : twistedsymphony@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2.1 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
I offer no warranties and no support for this plugin. Maybe it's mean but I
have better things to do. I wrote this plugin because there was no good solution
to integrating WP and SMF. I only offer this plugin because I know there are
many others interested in this integration which is the only reason I'm
releasing it at all. I made it for my own devices but if someone else can use
this as is without my help then great. I've tried to comment as much of this
as possible because if you ask me for help I probably wont have time to respond.
*/
/*******************************************************
INSTALLATION INSTRUCTIONS
1.
*******************************************************/
if (!defined('SMF'))
define('SMF', 1);
include_once('/homepages/13/d174540341/htdocs/nintendo/forums/Sources/Subs-Post.php');
//returns the SMF topic id from the postmeta table if an SMF ID has been set for the specified post
function get_smf_id($wp_id){
global $wpdb;
//check the post meta table for smf_id tags and return the value if one exists
@$smf_id = $wpdb->get_var("SELECT meta_value FROM $wpdb->postmeta WHERE post_id=$wp_id and meta_key='smf_id'");
//return the SMF topic id
return $smf_id;
}
//if SMF topic ID exists and is valid then add a link to the end of the WP post. else do nothing
function add_smf_link($content = '') {
Global $id; //get the WP id of the current post.
$wpsmfc = get_option('wpsmfc'); //get the user options
$smf_id = get_smf_id($id); //get the smf id
//check if the SMF ID was returned or invalid
If ((is_numeric($smf_id)) && ($smf_id != 0)){
//add the link text to the end of the content
$content .= "<p><a href=".$wpsmfc['wpsmfc_url']."/index.php?topic=".$smf_id.">".$wpsmfc['wpsmfc_wptxt']."</a></p>";
}
//return the content
return $content;
}
//checks if there is an SMF topic id associated with a published post, if not it creates a new topic and associates the ids
function create_smf_topic($id){
global $wpdb; //needed to use the WP database
$wpsmfc = get_option('wpsmfc'); //get the user options
$smf_id = get_smf_id($id); //get the SMF ID from the database
//checks if the id exists
If (is_null($smf_id)){
//generates the url (which includes necessary data) to the topic creation script
$url = get_option('home').'/wp-content/plugins/wp_smf_commenter/smf_create_topic.php?wp_id='.$id.'&smf_board='.$wpsmfc['wpsmfc_bid'].'&smf_user='.$wpsmfc['wpsmfc_mid'].'<xt='.$wpsmfc['wpsmfc_smtxt'];
//fires off the url... there are 4 ways to do this and none of them seem to work right.
//wp_redirect($url);
//header("Location: $url");
echo '<head><meta HTTP-EQUIV="REFRESH" content="0; url='.$url.'"></head>';
//header("Refresh: 0;url=$url");
//echo '<script type="text/javascript">window.open(\''.$url.'\')</script>';
//fopen ($url, "rb");
}
}
//this function filters the comment number on the news page to reflect the number of comments in SMF
function smf_comment_count(){
global $id, $wpdb;
$smf_id = get_smf_id($id); //get the smf id
if (is_null($smf_id)){//check that an SMF ID was returned
$smf_count = 0;
}else{
@$smf_count = $wpdb->get_var("SELECT COUNT(*) FROM smf_messages WHERE ID_TOPIC = $smf_id"); //get the post count from the SMF tables
$smf_count -=1; //subtract 1 to account for the first post created by WP.
}
return $smf_count;
}
//Calls the wp_smf_pollster_options.php page and adds it to the admin options when requested by the action below
function wpsmfc_add_options_page(){
add_options_page('SMF Commenter Options', 'SMF Commenter', 'manage_options', 'wp_smf_commenter/wp_smf_commenter_options.php');
}
//creats an SMF topic and relates the WP post id to the SMF topic id in a meta tag (if they do not already exist) whenever a post is published
add_action('publish_post', 'create_smf_topic');
// fires off the "add_smf_link" function whenever post content is dispalyed in Wordpress
add_filter('the_content', 'add_smf_link');
// sets the # of comments to the actual number of comments in the forum
add_filter('get_comments_number', 'smf_comment_count');
//calls the function to create the options page whenever it is requested.
add_action('admin_head', 'wpsmfc_add_options_page');
?> wp_smf_commenter_options.php Code: <?php
/*
Author: twistedsymphony
Author URI: http://web-nine.com/
Description: Options for WP SMF Commenter
*/
//grabs the plugin data from the base plugin page for Commenter
load_plugin_textdomain('wpsmfc',$path = 'wp-content/plugins/wp_smf_commenter');
// Commenter's URI when viewed from the admin panel
$location = get_option('siteurl') . '/wp-admin/options-general.php?page=wp_smf_commenter/wp_smf_commenter_options.php';
//This creates the starting options if none exist
$wpsmfc_new=array(
"wpsmfc_mid" => 1,
"wpsmfc_bid" => 1,
"wpsmfc_wptxt" => "Discuss this topic in our forums.",
"wpsmfc_smtxt" => "View this topic on the news page.",
"wpsmfc_url" => $location.'/fourms'
);
add_option('wpsmfc', $wpsmfc_new);
//grabs the form sumbit data and updates the options
if ('process' == $_POST['stage']){
$wpsmfc=array(
"wpsmfc_mid" => $_POST['wpsmfc_mid'],
"wpsmfc_bid" => $_POST['wpsmfc_bid'],
"wpsmfc_wptxt" => $_POST['wpsmfc_wptxt'],
"wpsmfc_smtxt" => $_POST['wpsmfc_smtxt'],
"wpsmfc_url" => $_POST['wpsmfc_url']
);
update_option('wpsmfc', $wpsmfc);
}
//places the option in a useable variable for display back on the form
$wpsmfc = get_option('wpsmfc');
//the rest of this is the html form that makes up the Commenter options page... soo many options!
?><div class="wrap">
<h2><?php _e('SMF Commenter Options', 'wpsmfc') ?></h2>
<form name="form1" method="post" action="<?php echo $location ?>&updated=true">
<input type="hidden" name="stage" value="process" />
<p><input name="wpsmfc_mid" type="text" id="wpsmfc_mid" value="<?php echo $wpsmfc['wpsmfc_mid']; ?>" size="5" />
This is the Member ID of the SMF member you would like to appear as the one creating the WP posts in SMF (needs to be an admin for html support)</p>
<p><input name="wpsmfc_bid" type="text" id="wpsmfc_bid" value="<?php echo $wpsmfc['wpsmfc_bid']; ?>" size="5" />
This is the Board ID of the SMF board you would like the SMF topics to appear in.</p>
<p><input name="wpsmfc_wptxt" type="text" id="wpsmfc_wptxt" value="<?php echo $wpsmfc['wpsmfc_wptxt']; ?>" size="40" />
This is the text that will appear at the bottom of every WP post to link to SMF.</p>
<p><input name="wpsmfc_smtxt" type="text" id="wpsmfc_smtxt" value="<?php echo $wpsmfc['wpsmfc_smtxt']; ?>" size="40" />
This is the text that will appear at the bottom of every SMF topic to link back to WP.</p>
<p><input name="wpsmfc_url" type="text" id="wpsmfc_url" value="<?php echo $wpsmfc['wpsmfc_url']; ?>" size="40" />
This is the base URL of your SMF forum as it appears in the browser (exclude "/index.php" and everything after it).</p>
<p class="submit">
<input type="submit" name="Submit" value="<?php _e('Update Options', 'wpsmfc') ?> »" />
</p>
</form>
</div> |
| |||
|
Is this all the code needed? Or is there more for the plugin?
__________________ Lightning Shock - My Website Wordpress Mountain - Wordpress Resources and Community |
| |||
|
I get these errors *above* the dashboard when I deactivate the plugin: Code: Warning: main() [function.main]: open_basedir restriction in effect. File(/homepages/13/d174540341/htdocs/nintendo/forums/Sources/Subs-Post.php) is not within the allowed path(s): (/home/mspqlbpr:/usr/lib/php:/usr/local/sqmail:/usr/local/lib/php:/tmp) in /home/mspqlbpr/public_html/wp-content/plugins/wp_smf_commenter/wp_smf_commenter.php on line 42 Warning: main(/homepages/13/d174540341/htdocs/nintendo/forums/Sources/Subs-Post.php) [function.main]: failed to open stream: Operation not permitted in /home/mspqlbpr/public_html/wp-content/plugins/wp_smf_commenter/wp_smf_commenter.php on line 42 Warning: main() [function.include]: Failed opening '/homepages/13/d174540341/htdocs/nintendo/forums/Sources/Subs-Post.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mspqlbpr/public_html/wp-content/plugins/wp_smf_commenter/wp_smf_commenter.php on line 42
__________________ Lightning Shock - My Website Wordpress Mountain - Wordpress Resources and Community |
| |||
|
Scratch those errors, I fixed that problem and I can activate the plugin and everything in the dashboard looks fine. Now only if I could configure everything else, because nothing else is showing up... There are also some changes I would like, which I don't think would be to hard: Be able to tell which post goes into which board. Also I didn't want the thread to display the whole post from wp, just something like "Discuss this post in this thread here..." And maybe since some of my posts were not written by me, so maybe it could publish threads in there name.
__________________ Lightning Shock - My Website Wordpress Mountain - Wordpress Resources and Community Last edited by jamestl2; 08-19-2007 at 09:20 AM. |
| |||
|
I also wanted to know how the comment system would work, because SMF registers everyone with the blog, with the forums. But what about the people that don't register who leave comments? How are their comments posted in the forums? Also, how would those other options I mentioned be configured? Do you have plans (through the database or code, or something) to implement those features? Or are they too out of reach?
__________________ Lightning Shock - My Website Wordpress Mountain - Wordpress Resources and Community |
| |||
|
James, Sorry about the wait! I am doing two other websites this week, then flying to Ohio to be the best man in a buddy's wedding Sunday. I won't be able to work on the script any more until Tuesday or so. Are you making any headway with it? |
| |||
|
No problem Although I've been trying to figure it out, but its still not working, am I suppose to change everything highlighted in blue? Also, still not sure about the "advanced features" I'd like to implement, wouldn't know how to go about creating them.
__________________ Lightning Shock - My Website Wordpress Mountain - Wordpress Resources and Community Last edited by jamestl2; 08-21-2007 at 07:57 PM. |
| |||
|
I'l be around through the week, just not for long periods. What is it doing now when you publish a new wordpress post? |
| |||
|
The Plugin doesn't seem to affect anything. I tried publishing a new post but no link at the bottom, and nothing in the forums. The only thing it seemed to do was disable the comments for new posts, and not able to "read" comments on existing posts.
__________________ Lightning Shock - My Website Wordpress Mountain - Wordpress Resources and Community |
| Bookmarks |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Wordpress Related Posts Plugin | Cassie | Technology & Technical Skills | 1 | 08-14-2009 06:24 PM |
| Earn Passive Income While Web Surfing (Blog) | Steve Pavlina | Steve Pavlina | 80 | 05-11-2007 02:13 PM |
| Value of these Forums | impaul99 | Intention-Manifestation | 25 | 12-19-2006 03:07 PM |
All times are GMT. The time now is 07:33 PM.






