A Blue Star

Archive for June, 2008

Insert new post in to wordpress from php

Posted on June 17th, 2008 by Steven Smethurst

This code snippet should let you add a new post to your wordpress database 2.5.1 require_once(‘wp-config.php’); // create post object class wm_mypost {     var $post_title;     var $post_content;     var $post_status;    /* publish, private */     var $post_author;    /* author user id (optional) */     var $post_name;      /* slug (optional) */     var $post_type;      /* ’page’ or ’post’ (optional, defaults to ’post’) */     var $comment_status; /* open or closed for commenting (optional) */     var $post_category ;  } // initialize post object $wm_mypost = new wm_mypost(); $wm_mypost->post_title    = "Title2 ". date( ’r' ); $wm_mypost->post_content  = "content3"; $wm_mypost->post_status   = ’publish’;  $wm_mypost->post_author   = 1; // Catagorys $post_category = split("," , "one"); foreach($post_category as $key=>$val) {     $post_category[$key] = get_cat_ID($val); } $wm_mypost->post_category =  $post_category ;  // Optional; uncomment as needed // $wm_mypost->post_type = ’page’; // $wm_mypost->comment_status = ’closed’; // feed object to wp_insert_post $post_ID = wp_insert_post($wm_mypost); echo date( ’r' ) . "\n"; echo "post_ID:". $post_ID . "\n"; 

How to make a CMinMaxAvg class

Posted on June 6th, 2008 by Steven Smethurst

I got asked how to create a simple averaging class. If you where feeling smart you could enhance this class in to a template class for a object that has the =,+,>,< operator. But I’m feeling lazy today. class CMinMaxAvg { private : int m_count; int m_total; int m_min; int m_max; public: CMinMaxAvg() { m_count [...]

How to install PHPBB 3.0.1

Posted on June 5th, 2008 by Steven Smethurst

This tutorial will walk you thou the steps to install PHPBB3 on your system. Intro PHPBB3 has become one of the more popular bulletin board system (AKA, BBS, or forums) available. It is used for all types of websites, from corporate websites, online stores, online hobby groups, ect.  One of the main selling points for [...]