<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>scriptygoddess &#187; WordPress scripts</title>
	<atom:link href="http://www.scriptygoddess.com/archives/category/wordpress/wordpress-scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptygoddess.com</link>
	<description></description>
	<lastBuildDate>Thu, 08 Dec 2011 18:23:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Simulate Breadcrumb Navigation with Hierarchical Custom Taxonomies</title>
		<link>http://www.scriptygoddess.com/archives/2010/11/19/simulate-breadcrumb-navigation-with-hierarchical-custom-taxonomies/</link>
		<comments>http://www.scriptygoddess.com/archives/2010/11/19/simulate-breadcrumb-navigation-with-hierarchical-custom-taxonomies/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 01:05:08 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress scripts]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1652</guid>
		<description><![CDATA[Code is below with comments to explain what&#039;s going on. This code would go on your taxonomy.php page&#8230; &#60;?php //get current term info $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); //store curent term's id as first in the array $breadcrumbarray[] = $term-&#62;term_id; //transfer the term info object so we don't mess [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Code is below with comments to explain what&#039;s going on. This code would go on your taxonomy.php page&#8230;<br />
<code>&lt;?php<br />
 //get current term info<br />
 $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );<br />
 //store curent term's id as first in the array<br />
 $breadcrumbarray[] = $term-&gt;term_id;<br />
 //transfer the term info object so we don't mess it up<br />
 $tempterm = $term;<br />
 //backward crawl terms...<br />
 //if the current term in the crawl has a parent - get it's parent's id...<br />
 while ($tempterm-&gt;parent != 0) {<br />
 $tempterm = get_term_by('id',$tempterm-&gt;parent,get_query_var( 'taxonomy' ));<br />
 // and store it in the array<br />
 $breadcrumbarray[] .= $tempterm-&gt;term_id;<br />
 }<br />
 //now reverse order the array so it goes from parent to child...<br />
 $breadcrumbarray = array_reverse($breadcrumbarray);<br />
//now we'll loop through our array to display each item in the parent to child order and with links...<br />
 $isfirst = true;<br />
 foreach($breadcrumbarray as $termid) {<br />
 if (!$isfirst) echo " » ";<br />
 $isfirst = false;<br />
 // get all the info again for the current term id in the array<br />
 $terminfo = get_term_by('id',$termid,get_query_var( 'taxonomy' ));<br />
 //show links for all terms except the current one..<br />
 if ($terminfo-&gt;term_id != $term-&gt;term_id) {<br />
 //get the URL for that terms's page<br />
 $url = get_term_link( $terminfo-&gt;name, get_query_var( 'taxonomy' ) );<br />
 echo '&lt;a href="'.$url.'"&gt;'.$terminfo-&gt;name.'&lt;/a&gt;';<br />
 } else {<br />
 echo $terminfo-&gt;name;<br />
 }<br />
 }<br />
 ?&gt;<br />
</code><br />
I couldn&#039;t see an easier (or built in) way to do this&#8230; if there is, do let me know. Seems like it&#039;s a simple thing that shouldn&#039;t require so much code&#8230;</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2010/11/19/simulate-breadcrumb-navigation-with-hierarchical-custom-taxonomies/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Put comments on a separate page (in wordpress)</title>
		<link>http://www.scriptygoddess.com/archives/2008/11/08/put-comments-on-a-separate-page-in-wordpress/</link>
		<comments>http://www.scriptygoddess.com/archives/2008/11/08/put-comments-on-a-separate-page-in-wordpress/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 05:24:50 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[WordPress scripts]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1543</guid>
		<description><![CDATA[I&#039;ve had a few clients ask for this, and I saw some requests to do this on the forums, but no one ever that I found came up with a solution. Here&#039;s the scenario, you have your blog posts, and maybe they&#039;re long, and rather than make the page *even longer* by dumping the comments [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I&#039;ve had a few clients ask for this, and I saw some requests to do this on the forums, but no one ever that I found came up with a solution. Here&#039;s the scenario, you have your blog posts, and maybe they&#039;re long, and rather than make the page *even longer* by dumping the comments on the same page at the bottom, you want a special, separate page for the comments for each post.</p>
<p>Now the trick I&#039;ve done to accomplish this, I will warn you worked in the scenario it was designed in &#8211; (I had &#034;permalinks&#034; turned on. I&#039;m not sure how this would work, if at all, if they weren&#039;t turned on, or if the permalink configuration was different) I&#039;m sure there are probably other setups where this would not work. So, that&#039;s my disclaimer.</p>
<p>Basically what we&#039;re going to do is use the query string to determine whether or not to display comments or the post on the page. It&#039;s not terribly &#034;pretty&#034; &#8211; and maybe a htaccess expert can tell us how to accomplish the same task by adding a line or two in there to keep the URLs &#034;pretty&#034; &#8211; but in the meantime, I&#039;m just happy to have it work at all!</p>
<p>So first &#8211; surround anything you would want only on the POST version of the page with this:<br />
<strong>*UPDATED TO ADD:</strong> This problem/question has come up a number of times.  These changes will probably go on your single.php template file (because thats the page that normally dispalys the comments.) If for some reason you don&#039;t have a single.php file, then your &#034;single-post view&#034; is probably being derived from the default single.php template file (in the default theme directory) &#8211; so it&#039;s probably safe to grab a copy of that one and make your changes to it, and then upload it to your theme&#039;s directory)</p>
<p><code>&lt;?php if (!isset($_GET['show']))  { ?&gt;<br />
POST PAGE ONLY STUFF GOES HERE...<br />
&lt;?php } ?&gt;</code></p>
<p><strong>*ALSO UPDATED TO ADD</strong>:The code above should be WITHIN the <a href="http://codex.wordpress.org/The_Loop">&#034;WP LOOP&#034;</a>.</p>
<p>Inside there you will want to create a link that will bring the user to the &#034;comment page&#034; for the post. You do that like this:</p>
<p><code>&lt;a href="?show=comments"&gt;Click here to view/write comments&lt;/a&gt;</code></p>
<p>Then you wrap your call to the comments template like so:</p>
<p><code>&lt;?php if (isset($_GET['show']) &#038;&#038; $_GET['show'] == "comments")  { ?&gt;<br />
&lt;?php comments_template(); ?&gt;<br />
&lt;?php } ?&gt;</code></p>
<p><strong>*UPDATED TO ADD:</strong> Take a look at where the comments_template() line normally goes on the default theme, if you&#039;re using a custom theme. You want to make sure you really only put that around the comments_template() line&#8230; not large sections of your single.php template file&#8230;</p>
<p>Now, ON your comments template page (comments.php), you will need to modify the comments form so that after a comment gets submitted, you end up back on the comment version of the page. To do that you need to grab the current URL of the page you&#039;re looking at &#8211; and put it into a hidden field (named &#034;redirect_to&#034;) in the comment form. To get PHP to pull in the full URL, I grabbed this function from <a href="http://webcheatsheet.com">webcheatsheet.com</a>:</p>
<p><code>function curPageURL() {<br />
 $pageURL = 'http';<br />
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}<br />
 $pageURL .= "://";<br />
 if ($_SERVER["SERVER_PORT"] != "80") {<br />
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];<br />
 } else {<br />
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];<br />
 }<br />
 return $pageURL;<br />
}</code></p>
<p><strike>To make that available throughout, I created a &#034;plugin&#034; file, and just threw that function into it. (obviously have to activate the plugin before you can start using that function in your theme). (There&#039;s probably another way to &#034;add a function&#034; like that, but this worked for me)</strike> If you don&#039;t already have one, create a &#034;functions.php&#034; file for your theme and add that function in there (surrounded by &lt;?php and ?&gt; tags obviously)</p>
<p>So then before the &lt;/form&gt; of the comment form I added this:</p>
<p><code>&lt;?php if (function_exists('curPageURL')) { ?&gt;<br />
&lt;input type="hidden" name="redirect_to" value="&lt;?php echo curPageURL() ?&gt;" /&gt;<br />
&lt;?php } ?&gt;</code></p>
<p>That&#039;s it. Hope that helps someone else. <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Updated:</strong><br />
<a href="/downloads/scriptygoddess_comments_sep_page.zip">Here are the modifications applied to the default wordpress theme</a>. I&#039;ve made comments to the changes I added in so you can see what I did and then apply it as appropriate to your own theme. In the zip are JUST the files I modified &#8211; not the whole wordpress default theme &#8211; so single.php, index.php, functions.php and comments.php.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2008/11/08/put-comments-on-a-separate-page-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>Forget User Info</title>
		<link>http://www.scriptygoddess.com/archives/2004/06/29/forget-user-info/</link>
		<comments>http://www.scriptygoddess.com/archives/2004/06/29/forget-user-info/#comments</comments>
		<pubDate>Wed, 30 Jun 2004 01:04:38 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress my-hacks additions]]></category>
		<category><![CDATA[WordPress scripts]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/06/29/forget-user-info/</guid>
		<description><![CDATA[Guest authored by<br />
Mark Jaquith - <a href="http://www.txfx.net/">txfx.net</a>
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>When someone leaves a comment on a WordPress blog, a cookie is saved to their computer with the name, e-mail, and URI that they entered.  This is quite handy for most people, but it may bother those who use public or shared computers.  WordPress does not by default have a way for commenters to specify that they don&#039;t want their info saved to a cookie, so here&#039;s a way to do that.</p>
<p>Warning: This is not just a plugin.  You are going to add a few lines to a core WordPress file.  Just so you know.<br />
<span id="more-1293"></span><br />
2 files need to be modified: <b>wp-comments.php</b> (to put in the checkbox for &#034;don&#039;t remember my info&#034; and the &#034;delete my cookie&#034; link), and <b>wp-comments-post.php</b> (to ensure that the cookie isn&#039;t saved if the user requests that it not be), and you need to install a plugin to handle manual &#034;delete my cookie&#034; requests. (Just a side note, and this applies to anytime you need to modify an existing page, you should make backups of the wp-comments.php, and wp-comments-post.php page before you make your changes)</p>
<p><b>Step 1</b></p>
<p>Open up <b>wp-comments-post.php</b> and find these lines (89, 90 and 91):<br />
<h3>setcookie(&#039;comment_author_&#039; . $cookiehash, $author, time() + 30000000, COOKIEPATH);<br />
setcookie(&#039;comment_author_email_&#039; . $cookiehash, $email, time() + 30000000, COOKIEPATH);<br />
setcookie(&#039;comment_author_url_&#039; . $cookiehash, $url, time() + 30000000, COOKIEPATH);</h3>
<p>Change those lines to the following:</p>
<h3>if($_POST['forget_cookie'] == &#039;forget&#039;){<br />
setcookie(&#039;comment_author_&#039; . $cookiehash, &#034;, time()-60000, COOKIEPATH);<br />
setcookie(&#039;comment_author_email_&#039; . $cookiehash, &#034;, time()-60000, COOKIEPATH);<br />
setcookie(&#039;comment_author_url_&#039; . $cookiehash, &#034;, time()-60000, COOKIEPATH);<br />
} else {<br />
setcookie(&#039;comment_author_&#039; . $cookiehash, $author, time() + 30000000, COOKIEPATH);<br />
setcookie(&#039;comment_author_email_&#039; . $cookiehash, $email, time() + 30000000, COOKIEPATH);<br />
setcookie(&#039;comment_author_url_&#039; . $cookiehash, $url, time() + 30000000, COOKIEPATH);<br />
}</h3>
<p>Save <b>wp-comments-post.php</b> and upload the new version.</p>
<p><b>Step 2</b></p>
<p>Add the following code to your <a href="http://wiki.wordpress.org/my-hacks.php">my-hacks.php</a>.</p>
<h3>/*<br />
Code Reference Name: Forget User Info<br />
URI: http://www.scriptygoddess.com/archives/2004/06/29/forget-user-info/<br />
Description: Deletes the comment cookie when ?forget_user_info=1 is passed to the URL<br />
Version: 1.0<br />
Author: Mark Jaquith<br />
Author URI: http://www.txfx.net/<br />
*/<br />
if($_GET['forget_user_info']) { // User has manually requested that their cookie be deleted.<br />
setcookie(&#039;comment_author_&#039; . $cookiehash, &#034;, time()-60000, COOKIEPATH); setcookie(&#039;comment_author_email_&#039; . $cookiehash, &#034;, time()-60000, COOKIEPATH); setcookie(&#039;comment_author_url_&#039; . $cookiehash, &#034;, time()-60000, COOKIEPATH);<br />
unset($comment_author, $comment_author_email, $comment_author_url);<br />
header(&#039;Expires: Mon, 26 Jul 1997 05:00:00 GMT&#039;);<br />
header(&#039;Last-Modified: &#039; . gmdate(&#039;D, d M Y H:i:s&#039;) . &#039; GMT&#039;);<br />
header(&#039;Cache-Control: no-cache, must-revalidate&#039;);<br />
header(&#039;Pragma: no-cache&#039;);<br />
$location = $_SERVER["HTTP_REFERER"];<br />
if ($is_IIS) {<br />
header(&#034;Refresh: 0;url=$location&#034;);<br />
} else {<br />
header(&#034;Location: $location&#034;);<br />
}<br />
}</h3>
<p><b>Step 3</b></p>
<p>Open up <b>wp-comments.php</b>.</p>
<p>Add this line, somewhere in the form section:<br />
(You should also probably give the input a tabindex, and reorder any other input tabindexes that follow, so that your users don&#039;t become human pinballs when they press TAB to go to the next form element.)</p>
<h3>&lt;p&gt;<br />
&lt;input type=&#034;checkbox&#034; name=&#034;forget_cookie&#034; id=&#034;forget_cookie&#034; value=&#034;forget&#034; /&gt;<br />
&lt;label for=&#034;forget_cookie&#034;&gt;Do not save my info&lt;/label&gt;<br />
&lt;/p&gt;</h3>
<p>Add this line where you think it would be appropriate:</p>
<h3>&lt;?php if (strlen($comment_author) != 0 || strlen($comment_author_email) != 0 || strlen($comment_author_url) != 0) { echo &#039;&lt;p&gt;Your info has been saved, but you may &lt;a href=&#034;&#039; . $_SERVER['REQUEST_URI'] . &#039;?forget_user_info=1&#034;&gt;delete your cookie&lt;/a&gt; if you wish.&lt;/p&gt;&#039;; } ?&gt;</h3>
<p>Save your changes to <b>wp-comments.php</b>, upload the new version, and you&#039;re done!</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2004/06/29/forget-user-info/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Comment Highlighting (based on author)</title>
		<link>http://www.scriptygoddess.com/archives/2004/06/21/comment-highlighting-based-on-author/</link>
		<comments>http://www.scriptygoddess.com/archives/2004/06/21/comment-highlighting-based-on-author/#comments</comments>
		<pubDate>Tue, 22 Jun 2004 02:22:27 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress scripts]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/06/21/comment-highlighting-based-on-author/</guid>
		<description><![CDATA[Monty asked about comment highlighting based on author. Even though this isn&#039;t a plugin, I thought this could work similar to the way I was doing comment highlighting Again, after your comment loop: &#60;?php foreach ($comments as $comment) { ?&#62; Add the following (with edits as neccessary) : &#60;?php $isByAuthor = false; if($comment-&#62;comment_author_email == &#039;YOUR-EMAIL&#039;) [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.riteshsapra.com/wp">Monty</a> <a href="http://www.scriptygoddess.com/archives/2004/06/07/question-for-mt-to-wp-converts-or-those-thinking-about-it/#comment-11754">asked</a> about comment highlighting based on author.</p>
<p>Even though this isn&#039;t a plugin, I thought this could work similar to the way I was doing <a href="http://www.scriptygoddess.com/archives/2004/06/04/comment-hilighting/">comment highlighting</a><br />
<span id="more-1282"></span><br />
Again, after your comment loop:<br />
<h3>&lt;?php foreach ($comments as $comment) { ?&gt;</h3>
<p>Add the following (with edits as neccessary) :</p>
<h3>&lt;?php<br />
$isByAuthor = false;<br />
if($comment-&gt;comment_author_email == &#039;YOUR-EMAIL&#039;) {<br />
$isByAuthor = true;<br />
}<br />
?&gt;</h3>
<p>Then before your comment text begins (with <em>&lt;?php comment_text() ?&gt;</em>) add this:</p>
<h3>&lt;?php if($isByAuthor ) { echo &#039;&lt;div class=&#034;authorcomment&#034;&gt;&#039;;} ?&gt;</h3>
<p>To close the DIV tag &#8211; BEFORE the ending LI tag for the comment add this</p>
<h3>&lt;?php if($isByAuthor ) { echo &#039;&lt;/div&gt;&#039;;} ?&gt;</h3>
<p>Then add a style &#034;authorcomment&#034; to your style sheet. Style however you like.</p>
<p>Then as long as you use that email when you comment &#8211; the comment will be highlighted.</p>
<p><strong>See alternate (simplified) variations in the comments</strong></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2004/06/21/comment-highlighting-based-on-author/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>Comment Hilighting</title>
		<link>http://www.scriptygoddess.com/archives/2004/06/04/comment-hilighting/</link>
		<comments>http://www.scriptygoddess.com/archives/2004/06/04/comment-hilighting/#comments</comments>
		<pubDate>Fri, 04 Jun 2004 19:52:11 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress scripts]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/06/04/comment-hilighting/</guid>
		<description><![CDATA[One of the things I wanted to do was be able to highlight certain posts that were particularly important. Probably not useful on all types of blogs &#8211; but on this one, where some comments with links, or suggestions, or alternate methods of doing something, may go unnoticed in a busy, highly commented post, I [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>One of the things I wanted to do was be able to highlight certain posts that were particularly important. Probably not useful on all types of blogs &#8211; but on this one, where some comments with links, or suggestions, or alternate methods of doing something, may go unnoticed in a busy, highly commented post, I wanted to be able to point to a few and make sure people saw them&#8230;</p>
<p>I had actually originally asked MooKitty for a plugin/hack that would do it:<br />
<a href="http://mookitty.co.uk/devblog/archives/2004/06/04/kittens-hilite-comments/">Here is her script.</a></p>
<p>I think her solution is very well-done. It means updates to the interface so you can easily see which post was noted as &#034;important&#034;, etc. However, after having lived through a few MT upgrades, I&#039;ve been trying to avoid editing any core WordPress code, so that I don&#039;t have to start worrying about a dozen hacks I could lose when I upgrade my CMS.</p>
<p>Here&#039;s my solution. It may not be as elegant, but it gets the job done. <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<span id="more-1277"></span><br />
On your wp-comments.php file, after this line of code:<br />
<h3>&lt;?php foreach ($comments as $comment) { ?&gt;</h3>
<p>Add the following:</p>
<h3>&lt;?php<br />
$isImportant = false;<br />
if (stristr($comment-&gt;comment_content, &#034;&lt;!&#8211;important&#8211;&gt;&#034;)) {<br />
$isImportant = true;<br />
} ?&gt;</h3>
<p>Then before your comment text begins (with <i>&lt;?php comment_text() ?&gt;</i>) add this:</p>
<h3>&lt;?php if($isImportant) { echo &#039;&lt;div class=&#034;importantcomment&#034;&gt;&#039;;} ?&gt;</h3>
<p>To close the DIV tag &#8211; BEFORE the ending LI tag for the comment add this</p>
<h3>&lt;?php if($isImportant) { echo &#039;&lt;/div&gt;&#039;;} ?&gt;</h3>
<p>Then add a style &#034;importantcomment&#034; to your style sheet. Style however you like.</p>
<p>When you want to mark a comment as &#034;important&#034; simply edit it and in the very beginning of the comment add this:</p>
<h3>&lt;!&#8211;important&#8211;&gt;</h3>
<p>The kind of neat thing is, I can see an easy hack/addition to this where you could have &#034;levels&#034; of importance &#8211; with each level having a different style.</p>
<p>The drawbacks of my idea vs. MooKitty&#039;s is that with mine, techincally anyone can add the &#034;important&#034; text to their comment, and make theirs stand out. (You would just need to edit it to remove the important notation &#8211; if you wanted to). As well, without looking at your blog, or clicking edit on each comment, there&#039;s no easy way to tell from the comment listing pages which comments have been marked as important &#8211; like you can with hers.</p>
<p>So, pick your poison, I guess. But wanted to show you both options.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2004/06/04/comment-hilighting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Number of users currently online (part II)</title>
		<link>http://www.scriptygoddess.com/archives/2004/03/27/number-of-users-currently-online-part-ii/</link>
		<comments>http://www.scriptygoddess.com/archives/2004/03/27/number-of-users-currently-online-part-ii/#comments</comments>
		<pubDate>Sat, 27 Mar 2004 04:00:49 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[MT scripts]]></category>
		<category><![CDATA[WordPress scripts]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/03/27/number-of-users-currently-online-part-ii/</guid>
		<description><![CDATA[I&#039;ve been looking around for &#034;users currently online&#034; type scripts. So, tonight, I hacked together two great scripts. The first comes from Spoono &#8211; this script uses php and mySQL to keep track of how many users are on your site. Then tonight I saw Lynda&#039;s script &#8211; which uses php, a flat file and [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I&#039;ve been <a href="http://www.scriptygoddess.com/archives/004895.php">looking around</a> for &#034;users currently online&#034; type scripts. So, tonight, I hacked together two great scripts. The first comes from <a href="http://www.spoono.com/php/tutorials/tutorial.php?id=16">Spoono</a> &#8211; this script uses php and mySQL to keep track of how many users are on your site. Then tonight I saw <a href="http://www.soveryposh.com/blog/2004/03/online_users.php">Lynda&#039;s script</a> &#8211; which uses php, a flat file and makes use of MT&#039;s cookies to actually display WHO is on your site (they would have had to leave a comment on the site to show up in this list)</p>
<p>So I combined the two&#8230;<br />
<span id="more-658"></span><br />
(<b>IMPORTANT NOTE:</b> I&#039;m still working out the kinks with this script. If you use this and have issues &#8211; please email me (scripty aT scriptygoddess dOt nEt) &#8211; don&#039;t leave a comment&#8230; that way the comments section doesn&#039;t get out of hand&#8230; I&#039;d prefer to keep the comments section reversed for either modifications/alternate hacks or additional suggestions)</p>
<p>Here is the modified &#034;create table&#034; script</p>
<p><code>CREATE TABLE useronline (<br />
timestamp int(15) DEFAULT '0' NOT NULL,<br />
ip varchar(40) NOT NULL,<br />
file varchar(100) NOT NULL,<br />
userName varchar(50) NOT NULL,<br />
userURL varchar(100) NOT NULL,<br />
PRIMARY KEY (timestamp),<br />
KEY ip (ip),<br />
KEY file (file)<br />
);</code></p>
<p>The way the <a href="http://www.spoono.com/php/tutorials/tutorial.php?id=16">Spoono&#039;s original script</a> worked was that it would (I believe) only tell you how many users were on a <i>particular page</i> &#8211; but the way my script below works is that it shows users on the entire site&#8230;</p>
<p>On Lynda&#039;s site, she pointed out that you need to modify the &#034;rememberme&#034; and &#034;forgetme&#034; javascript functions. <a href="http://www.soveryposh.com/x/blog/online_users/">See her site for the details.</a></p>
<p>Now here&#039;s the updated script. (I made this a seperate file and put it on my site as an include where I wanted to the &#034;users on site&#034; to display)</p>
<p><code>&lt;?php<br />
//fill in some basic info<br />
$dbsvr= "localhost";<br />
$dbusrnam = "your-database-username";<br />
$dbpswrd = "your-database-password";<br />
$database = "your-database-name";<br />
$timeoutseconds = 300;<br />
$mt_name = isset($_COOKIE['mtcmtauth']) ? ($_COOKIE['mtcmtauth']) : "";<br />
$mt_url = isset($_COOKIE['mtcmthome']) ? ($_COOKIE['mtcmthome']) : "";<br />
$mt_ip = getenv("HTTP_X_FORWARDED_FOR") ? getenv("HTTP_X_FORWARDED_FOR") : getenv("REMOTE_ADDR");<br />
// If someone doesn't want their name to appear on the list, enter their<br />
// urls below, separated by a comma.  Example:<br />
// $blocked_urls = "http://www.domain1.com, http://www.domain2.com";<br />
$blocked_urls = "";<br />
// If user is in blocked report above, make them anonymous and then add to file<br />
if ($blocked_urls !="") {<br />
$blocked = explode(",", $blocked_urls);<br />
for ($i=0; $i &lt; count($blocked); $i++) {<br />
if (trim($blocked[$i]) == $mt_url) {<br />
$mt_name = "";<br />
$mt_url = "";<br />
}<br />
}<br />
}<br />
//get the time<br />
$timestamp = time();<br />
$timeout = $timestamp-$timeoutseconds;<br />
//connect to database<br />
mysql_connect($dbsvr, $dbusrnam, $dbpswrd);<br />
//insert the values<br />
$insert = mysql_db_query($database, "INSERT INTO useronline VALUES<br />
('$timestamp','$mt_ip ','','$mt_name','$mt_url');");<br />
if(!($insert)) {<br />
print "Useronline Insert Failed &gt; ";<br />
}<br />
//delete values when they leave<br />
$delete = mysql_db_query($database, "DELETE FROM useronline WHERE timestamp &lt; $timeout");<br />
if(!($delete)) {<br />
print "Useronline Delete Failed &gt; ";<br />
}<br />
//grab the results<br />
$result = mysql_db_query($database, "SELECT DISTINCT ip, userName, userURL FROM useronline");<br />
if(!($result)) {<br />
print "Useronline Select Error &gt; ";<br />
}<br />
//number of rows = the number of people online<br />
$user = mysql_num_rows($result);<br />
$display = "";<br />
$annon = 0;<br />
mysql_close();<br />
for ($i = 0; $i &lt; $user; $i++) {<br />
$row= mysql_fetch_array($result);<br />
if ($row["userName"] != "" &#038;&#038; $row["userURL"] != "") {<br />
//make sure url has "http://" in it<br />
$isHttpUrl = strpos($row["userURL"], "http://");<br />
if ($isHttpUrl === false) {<br />
    $row["userURL"] = "http://".$row["userURL"];<br />
}<br />
$display .= "&lt;a href=&#92;"".$row['userURL']."&#92;"&gt;".$row["userName"] ."&lt;/a&gt;&lt;br /&gt;";<br />
} else if ($row["userName"] != "") {<br />
$display .= $row["userName"] ."&lt;br /&gt;";<br />
} else {<br />
$annon++;<br />
}<br />
}<br />
if ($display != "") {<br />
echo $display;<br />
}<br />
if ($annon != "") {<br />
echo $annon;<br />
if ($annon &lt;= 1) {<br />
echo " user";<br />
} else {<br />
echo " users";<br />
}<br />
}<br />
?&gt;</code></p>
<p><b>To use this script with wordpress, change these two lines in the script above:</b></p>
<p><code>$mt_name = isset($_COOKIE['mtcmtauth']) ? ($_COOKIE['mtcmtauth']) : "";<br />
$mt_url = isset($_COOKIE['mtcmthome']) ? ($_COOKIE['mtcmthome']) : "";</code></p>
<p>To this:</p>
<p><code>$mt_name = (isset($_COOKIE['comment_author_'.$cookiehash])) ? trim($_COOKIE['comment_author_'.$cookiehash]) : '';<br />
$mt_url = (isset($_COOKIE['comment_author_url_'.$cookiehash])) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : '';</code></p>
<p>(yes, I know the variables still say &#034;mt&#034; in them &#8211; if that really confuses you, just do a find and replace and change them.</p>
<p>If you have MOVED OVER from MT to WP &#8211; and still want to capture the names of people who may or may not have left a comment on your wordpress blog yet (so they don&#039;t have cookies from wp comments &#8211; but probably still have MT cookies), change those lines to this instead:</p>
<p><code>$mt_name = (isset($_COOKIE['comment_author_'.$cookiehash])) ? trim($_COOKIE['comment_author_'.$cookiehash]) : '';<br />
if ($mt_name == '') {<br />
	$mt_name = isset($_COOKIE['mtcmtauth']) ? ($_COOKIE['mtcmtauth']) : "";<br />
}<br />
$mt_url = (isset($_COOKIE['comment_author_url_'.$cookiehash])) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : '';<br />
if ($mt_url == '') {<br />
	$mt_url = isset($_COOKIE['mtcmthome']) ? ($_COOKIE['mtcmthome']) : "";<br />
}</code></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2004/03/27/number-of-users-currently-online-part-ii/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

