Extension talk:WordPress Comments

Questions

 * 1) Can users create new topics in Extension:WordPress Comments? - Currently No --Supertick 22:26, 9 May 2008 (UTC)
 * 2) Is there any extension for mediawiki 1.7 which allows me to put the entire wordpress in a framed window? Odessaukrain 04:48, 30 March 2008 (UTC)
 * you might want to try using iframes - there is an iframe extension somewhere - however there are a variety of not so nice things with iframes inappropriate scrollbars,etc... --Supertick 22:29, 9 May 2008 (UTC)

the extensions does not work for me
i installed wordpress on the same database as mediawiki and i tried to get the comment page into the mediawiki wiki page after i put the link:

comments
 wp_post_title=xavi wp_url=http://www.guitarpedia.co.il/wordpress 

and after that all the page changes is design and things getting ugly and i get thta messege in the bottom: could not find wordpress article with a title like [Wiki Extension WordPress Comments%] and in the top: Warning: mysql_numrows: supplied argument is not a valid MySQL result resource in /home/.bagging/gigantesco/mediawiki/extensions/WordpressComments.php on line 40

thnks for your help

You need to publish a post from wordpress called xavi first --Supertick 22:28, 9 May 2008 (UTC)

of course i opened that post. i use the 1.12 version of mediawiki.
 * Check what database prefix you used. The default for the database is "wp_" which is what is used in the code for the WordpressComments.php but if you used a different prefix when you were installing the wordpress database then you'll get the, "could not find wordpress article with a title like [Wiki Extension WordPress Comments%]" error.  To fix go into the WordpressComments.php code and change the default "wp_" to whatever you used for your code. -- 121.103.174.184 07:02, 6 February 2010 (UTC)

I need to configure the Data Base settings?
in the installation process, i never asked to supply the DB name, user or password. so i cant understand how its suppose to find the articels?

i say it becuase the extension wont work for me as i alreasy said i'd published a post in the wordpress and tried to reffer to it through the wiki page and suddenly the whole page become weird and the design is not correctly and i got two messeges. one on the top of the page which says: Warning: mysql_numrows: supplied argument is not a valid MySQL result resource in /home/.bagging/gigantesco/mediawiki/extensions/WordpressComments.php on line 40

and the second, that appers at the wikipage that i created: could not find wordpress article with a title like [%]

heres the link to the wiki page please check it out and here's link to the wordpress page: thank u a lot!--Goan 19:18, 11 May 2008 (UTC)
 * Looks like you missed a step when installing wordpress. As shown on the wordpress install page you have to do the following steps:
 * Step 3: Rename the wp-config-sample.php file to wp-config.php.
 * Open wp-config.php in your favorite text editor and fill in your database details as explained in Editing wp-config.php to generate and use your secret key password.

Similar Problem
I'm getting a similar error... I did install both WordPress and the wiki on the same database
 * See above sounds like you missed the step

One of the Solution
mysql_numrows should be written as mysql_num_rows

How to add numbered comments?
I would like to add the comment number next to the person leaving the message. Does anybody know how to accomplish this?

Commentaire 2
Et prima post Osdroenam quam, ut dictum est, ab hac descriptione discrevimus, Commagena, nunc Euphratensis, clementer adsurgit, Hierapoli, vetere Nino et Samosata civitatibus amplis inlustris.

Haec et huius modi quaedam innumerabilia ultrix facinorum impiorum bonorumque praemiatrix aliquotiens operatur Adrastia atque utinam semper quam vocabulo duplici etiam Nemesim appellamus: ius quoddam sublime numinis efficacis, humanarum mentium opinione lunari circulo superpositum, vel ut definiunt alii, substantialis tutela generali potentia partilibus praesidens fatis, quam theologi veteres fingentes Iustitiae filiam ex abdita quadam aeternitate tradunt omnia despectare terrena.

Alii nullo quaerente vultus severitate adsimulata patrimonia sua in inmensum extollunt, cultorum ut puta feracium multiplicantes annuos fructus, quae a primo ad ultimum solem se abunde iactitant possidere, ignorantes profecto maiores suos, per quos ita magnitudo Romana porrigitur, non divitiis eluxisse sed per bella saevissima, nec opibus nec victu nec indumentorum vilitate gregariis militibus discrepantes opposita cuncta superasse virtute.

Et hanc quidem praeter oppida multa duae civitates exornant Seleucia opus Seleuci regis, et Claudiopolis quam deduxit coloniam Claudius Caesar. Isaura enim antehac nimium potens, olim subversa ut rebellatrix interneciva aegre vestigia claritudinis pristinae monstrat admodum pauca.

Adolescebat autem obstinatum propositum erga haec et similia multa scrutanda, stimulos admovente regina, quae abrupte mariti fortunas trudebat in exitium praeceps, cum eum potius lenitate feminea ad veritatis humanitatisque viam reducere utilia suadendo deberet, ut in Gordianorum actibus factitasse Maximini truculenti illius imperatoris rettulimus coniugem.

Downloads crashed
I want to download this extension and I can't do it, URLs are crashed.

Somebody send me the file
I want it so bad, but the URL does not work. Can somebody send one to me? My email: shiyewuxian@gmail.com

Thanks

Revised version
I've been using this extension for over a year. The links to Greg's original code and instructions have disappeared, and I have been unable to contact Greg, so I have updated this page to point to my slightly modified version of Greg's code. I'd really appreciate any testing or comments that people may like to do. Since my hacks are not really tested outside of my own site I will change the code status from stable back to beta. If anyone has an untouched version of the 0.9.0 code I'd be interested to see it and happy to host it.

QuantumTiger 07:55, 17 December 2010 (UTC)


 * Hey Glad to see this extension updated! I have used the original wordpress comments extension on my wiki for about 2 years. Seeing your new version I was wondering if upgrading to the new version might break anything from version 0.9.0 ? Also one thing I would like to see for future version is nested comments available in the wordpress comments. Also another thing holding me back from upgrading is "Also note that moving/renaming a page will break the link to any existing comments." I have to weight whether if that is worth it because pages often get moved on my wiki. Wouldn't using the unique mediaiwiki page id resolve this issue? (I guess there's 3 questions here - 1.) will upgrade from 0.9.0 work 2.) possible to add nested comments 3.) how about using unique mediawiki page id to avoid "moving / renaming pages breaks link to existing comments") ? --222.236.170.103 11:36, 10 January 2011 (UTC)


 * Thanks for the untouched 0.9.0 code. Most helpful! 1) Theoretically an upgrade to 0.10.0 should work although it will not buy you much, unless you make use of the 'one wordpress thread for all comments' functionality - which would require you to make database changes to all existing comments. Be aware that 0.10.0 remains untested except in my installation 2) I have never used WP nested comments, so no idea. 3) Using ID instead of name is almost certainly possible. To be honest I should have done this from the outset, but was struggling to find my way round mediawiki documentation at that point!


 * Now I have the untouched 0.9.0 I will host that as well as my hack. I can also review my hack a bit more closely to make it more generic. I'll try and implement the IDs thing. No promises on anything else yet. And may take a while to get around to it!


 * QuantumTiger 17:28, 10 January 2011 (UTC)

Also untouched version of 0.9.0

setHook ( "wp:comments", 'get_wordpress_comments' ) ; }

function get_wordpress_comments($data) {

$param = array; $info = explode("\n", $data); if(is_array($info)){ foreach($info as $lin){ $line = explode("=",$lin, 2); if(count($line)==2){ $param[trim($line[0])] = trim($line[1]); }		}	}	$wp_post_title = (isset($param["wp_post_title"]))? $param["wp_post_title"] : ""; // TODO - default to page name $wp_url = (isset($param["wp_url"]))? $param["wp_url"] : "";

global $wgParser; global $wgDBserver; global $wgDBname; global $wgDBuser; global $wgDBpassword; global $wgPageName;

$wgParser->disableCache;

mysql_connect($wgDBserver,$wgDBuser,$wgDBpassword) or die("Unable toconnect to database" . mysql_error); @mysql_select_db("$wgDBname") or die("Unable to select database $wgDBname");

$sql = " SELECT * FROM wp_posts WHERE post_title LIKE '$wp_post_title%' AND post_status = 'publish'  "; $result = mysql_query($sql); $number = mysql_numrows($result); $wp_post_ID = 0; $ret = "";

if ($number < 1) {		#$ret .= "no records found"; -- TODO Configurable $ret .= "could not find wordpress article with a title like [".$wp_post_title."%]" ; } else if ($number == 1){ $wp_post_ID = mysql_result($result, 0,"ID"); $sql = " SELECT * FROM wp_comments INNER JOIN wp_posts ON comment_post_ID = ID WHERE ID = $wp_post_ID AND comment_approved = '1'  ORDER BY comment_date "; $result = mysql_query($sql); $number = mysql_numrows($result); $i = 0; $ret = ""; #$ret .= "[".$sql ."]"; #$ret .= "[".$wp_post_ID ."]";

if ($number < 1) {			#$ret .= "no records found"; -- TODO Configurable }		else {			$ret .= ""; while ($number > $i) {				$ret .= ""; $ret .= "	 ". mysql_result($result,$i,"comment_author") ." Says:"; $ret .= "				"; $ret .= "	". date("M d Y g:i a", strtotime(mysql_result($result,$i,"comment_date"))) ." "; $ret .= "	 ". mysql_result($result,$i,"comment_content"). " ";				$ret .= ""; $i++; }			$ret .= "";

}

$reply_form = true; if ($reply_form) {			$ret .= get_wordpress_reply_form($wp_post_ID, $wp_url); }

} else { $ret .= "more than one wordpress post match"; $ret .= "sql [".$sql."]"; }

return $ret; }

function get_wordpress_reply_form ($wp_post_ID, $wp_url) {

if ($wp_post_ID > 0) {		$ret = ""; $ret .= "Leave a Comment "; $ret .= ""; $ret .= " "; $ret .= " Name (required) "; $ret .= " <input type=\"text\" name=\"email\" id=\"email\" value=\"\" size=\"22\" tabindex=\"2\" />"; $ret .= "<label for=\"email\"> Mail (will not be published) (required) "; $ret .= " <input type=\"text\" name=\"url\" id=\"url\" value=\"\" size=\"22\" tabindex=\"3\" />"; $ret .= "<label for=\"url\"> Website "; $ret .= " <textarea name=\"comment\" id=\"comment\" cols=\"100%\" rows=\"10\" tabindex=\"4\"> "; $ret .= " <input name=\"submit\" type=\"submit\" id=\"submit\" tabindex=\"5\" value=\"Submit Comment\" />"; $ret .= "<input type=\"hidden\" name=\"comment_post_ID\" value=\"$wp_post_ID\" />"; $ret .= " "; $ret .= " "; $ret .= "	 "; $ret .= " "; $ret .= "<div id=\"footer\">"; $ret .= "	 "; $ret .= "		GizmoGarden is proudly powered by"; $ret .= "		<a href=\"http://wordpress.org/\">WordPress</a>"; $ret .= ""; $ret .= "		<a href=\"http://blog.gizmogarden.com/?feed=rss2\">Entries (RSS)</a>"; $ret .= "		and <a href=\"http://blog.gizmogarden.com/?feed=comments-rss2\">Comments (RSS)</a>."; $ret .= "	 "; $ret .= " "; $ret .= " "; }	return $ret; }

?>

Comments load at the Top of the page
Under page tools I clicked on 'edit' and added the code:  wp_post_title=Wiki comments wp_url=http://wiki.com/wordpress </wp:comments> However, the comment section loads before the page and comes up in the top left hand corner of the page. Although it seems to work and I can post comments if I am quick enough before the rest of the page loads, how do I get it to come up in the main body of the page and work as it should?