<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>WordPress DK Forum Topic: Lidt hjælp fra en venlig sjæl..søges</title>
		<link>http://wp-danmark.dk/forum/topic/lidt-hj%c3%a6lp-fra-en-venlig-sj%c3%a6ls%c3%b8ges</link>
		<description>WordPress DK Forum Topic: Lidt hjælp fra en venlig sjæl..søges</description>
		<language>da-DK</language>
		<pubDate>Wed, 26 Aug 2026 05:40:03 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Søg]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://wp-danmark.dk/forum/search.php</link>
		</textInput>
		<atom:link href="http://wp-danmark.dk/forum/rss/topic/lidt-hj%c3%a6lp-fra-en-venlig-sj%c3%a6ls%c3%b8ges" rel="self" type="application/rss+xml" />

		<item>
			<title>Thomas om "Lidt hjælp fra en venlig sjæl..søges"</title>
			<link>http://wp-danmark.dk/forum/topic/lidt-hj%c3%a6lp-fra-en-venlig-sj%c3%a6ls%c3%b8ges#post-45819</link>
			<pubDate>ons, 20 mar 2013 22:42:33 +0000</pubDate>
			<dc:creator>Thomas</dc:creator>
			<guid isPermaLink="false">45819@http://wp-danmark.dk/forum/</guid>
			<description>&#60;p&#62;Hej Finnj og Jesper&#60;/p&#62;
&#60;p&#62;@Finnj: Jeg er bange for din kode gør mig forvirret. Jeg er ikke kode mand.&#60;/p&#62;
&#60;p&#62;@Finnj+Jesper: Hvis ikke wp_die hvad skal man så bruge, den overstående kode er den man finder alle steder på nettet.&#60;/p&#62;
&#60;p&#62;Jeg behøver ingen fleksibilitet. Jeg skal blot have sådan at ingen autors kan indsend indlæg til gennem kig under 350 ord. &#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
function atLeast($content){&#60;br /&#62;
global $post;&#60;br /&#62;
$minword = 100; //set this to the minimum number of words&#60;br /&#62;
$content = $post-&#38;gt;post_content;&#60;br /&#62;
if (str_word_count($content) &#38;lt; $minword &#124;&#124; current_user_can( 'manage_options' ) )&#60;br /&#62;
wp_die( __('Error: Your article is below the minimum word count.') );&#60;br /&#62;
}&#60;br /&#62;
add_action('publish_post', 'atLeast');function atLeast($content){&#60;br /&#62;
global $post;&#60;br /&#62;
$minword = 350; //set this to the minimum number of words&#60;br /&#62;
$content = $post-&#38;gt;post_content;&#60;br /&#62;
if (str_word_count($content) &#38;lt; $minword &#38;amp;&#38;amp; current_user_can( 'author' ) )&#60;br /&#62;
wp_die( __('Error: Your article is below the minimum word count.') );&#60;br /&#62;
}&#60;br /&#62;
add_action('publish_post', 'atLeast');&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Det skulle altså virke, men hvad skal man så bruge i stedet for wp_die??&#60;/p&#62;
&#60;p&#62;Thomas --&#38;gt;der er godt træt af at skrive &#34;din artikel er under 350 ord&#34;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Jesper Jarlskov om "Lidt hjælp fra en venlig sjæl..søges"</title>
			<link>http://wp-danmark.dk/forum/topic/lidt-hj%c3%a6lp-fra-en-venlig-sj%c3%a6ls%c3%b8ges#post-45773</link>
			<pubDate>ons, 20 mar 2013 01:11:38 +0000</pubDate>
			<dc:creator>Jesper Jarlskov</dc:creator>
			<guid isPermaLink="false">45773@http://wp-danmark.dk/forum/</guid>
			<description>&#60;p&#62;if (str_word_count($content) &#38;lt; $minword &#124;&#124; current_user_can( 'manage_options' ) )&#60;br /&#62;
bør gælde for alle, bortset fra admins, du er altså ikke afhængig af at dine brugere har en bestemt rolle.&#60;br /&#62;
Mht. die er jeg enig med finn, pas på med den. die stopper afviklingen af dit script for at vise en fejl, og du risikerer at alt indtastet data går tabt. Der er selvfølgelig tale om &#38;lt; 100 karakterer, så det er ikke MEGET data, men det kan stadig være virkelig irriterende.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Finnj om "Lidt hjælp fra en venlig sjæl..søges"</title>
			<link>http://wp-danmark.dk/forum/topic/lidt-hj%c3%a6lp-fra-en-venlig-sj%c3%a6ls%c3%b8ges#post-45770</link>
			<pubDate>tirs, 19 mar 2013 23:14:01 +0000</pubDate>
			<dc:creator>Finnj</dc:creator>
			<guid isPermaLink="false">45770@http://wp-danmark.dk/forum/</guid>
			<description>&#60;p&#62;kan se at mine &#60;code&#62;print_r('[hr]')&#60;/code&#62; bliver til html, det må du lige rette når du paster, hvor [ selvfølgelig skal være &#38;lt;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Finnj om "Lidt hjælp fra en venlig sjæl..søges"</title>
			<link>http://wp-danmark.dk/forum/topic/lidt-hj%c3%a6lp-fra-en-venlig-sj%c3%a6ls%c3%b8ges#post-45769</link>
			<pubDate>tirs, 19 mar 2013 23:11:12 +0000</pubDate>
			<dc:creator>Finnj</dc:creator>
			<guid isPermaLink="false">45769@http://wp-danmark.dk/forum/</guid>
			<description>&#60;p&#62;Herunder lidt input.&#60;/p&#62;
&#60;p&#62;Jeg ville være forsigtig med at bruge die(), herunder en funktion som i hvertfald virker hos mig. Du kan have problemer med $content og $post, det er mere sikkert hvis du sender $post med i funktions kaldet, og der også tager min words med, så er det lidt mere fleksibelt. Funktionen returnerer også antallet af ord.&#60;br /&#62;
&#60;code&#62;&#60;br /&#62;
function atLeast($tmp_post, $tmp_min_words)&#60;br /&#62;
		{&#60;br /&#62;
		$tmp_min_words = (int) $tmp_min_words; // check that it is an integer&#60;br /&#62;
		// Check is post is set&#60;br /&#62;
		if ( ((!isset($tmp_post)) &#124;&#124; (str_word_count($tmp_post-&#38;gt;post_content) &#38;lt; $tmp_min_words)) &#38;amp;&#38;amp; current_user_can( 'author' ) )&#60;br /&#62;
			{&#60;br /&#62;
			wp_die( __('Error: Your article is below the minimum word count of').' '.$tmp_min_words.__(' words!') );&#60;br /&#62;
			}&#60;br /&#62;
		return str_word_count($tmp_post-&#38;gt;post_content);&#60;br /&#62;
		}&#60;/p&#62;
&#60;p&#62;	//below for testing:&#60;br /&#62;
	if (current_user_can( 'author' ))&#60;br /&#62;
		$tmp_author = 'Yes';&#60;br /&#62;
	else&#60;br /&#62;
		$tmp_author = 'No';&#60;/p&#62;
&#60;p&#62;	print_r('User is author : '.$tmp_author);&#60;br /&#62;
	print_r('&#60;hr /&#62;');&#60;br /&#62;
	$tmp_post_id = 531; // post ID to test with&#60;br /&#62;
	$tmp_post = get_post($tmp_post_id);&#60;br /&#62;
	print_r('Number of words: '.atLeast($tmp_post, 100));&#60;br /&#62;
	print_r('&#60;hr /&#62;');&#60;br /&#62;
&#60;/code&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Thomas om "Lidt hjælp fra en venlig sjæl..søges"</title>
			<link>http://wp-danmark.dk/forum/topic/lidt-hj%c3%a6lp-fra-en-venlig-sj%c3%a6ls%c3%b8ges#post-45766</link>
			<pubDate>tirs, 19 mar 2013 21:47:18 +0000</pubDate>
			<dc:creator>Thomas</dc:creator>
			<guid isPermaLink="false">45766@http://wp-danmark.dk/forum/</guid>
			<description>&#60;p&#62;Hej Jesper og Finnj&#60;/p&#62;
&#60;p&#62;Det er KUN authors det skal gælde for. Har prøvet:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;function atLeast($content){&#60;br /&#62;
global $post;&#60;br /&#62;
$minword = 100; //set this to the minimum number of words&#60;br /&#62;
$content = $post-&#38;gt;post_content;&#60;br /&#62;
if (str_word_count($content) &#38;lt; $minword &#38;amp;&#38;amp; current_user_can( 'author' ) )&#60;br /&#62;
wp_die( __('Error: Your article is below the minimum word count.') );&#60;br /&#62;
}&#60;br /&#62;
add_action('publish_post', 'atLeast');&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;og det virker ikke.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Finnj om "Lidt hjælp fra en venlig sjæl..søges"</title>
			<link>http://wp-danmark.dk/forum/topic/lidt-hj%c3%a6lp-fra-en-venlig-sj%c3%a6ls%c3%b8ges#post-45754</link>
			<pubDate>tirs, 19 mar 2013 17:48:48 +0000</pubDate>
			<dc:creator>Finnj</dc:creator>
			<guid isPermaLink="false">45754@http://wp-danmark.dk/forum/</guid>
			<description>&#60;p&#62;&#60;code&#62;&#60;br /&#62;
if (str_word_count($content) &#38;lt; $minword &#124;&#124; current_user_can( 'manage_options' ) )&#60;br /&#62;
&#60;/code&#62;&#60;br /&#62;
Hvis det er author det skal gælde for&#60;br /&#62;
&#60;code&#62;&#60;br /&#62;
if (str_word_count($content) &#38;lt; $minword &#38;amp;&#38;amp; current_user_can( 'author' ) )&#60;br /&#62;
&#60;/code&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Jesper Jarlskov om "Lidt hjælp fra en venlig sjæl..søges"</title>
			<link>http://wp-danmark.dk/forum/topic/lidt-hj%c3%a6lp-fra-en-venlig-sj%c3%a6ls%c3%b8ges#post-45705</link>
			<pubDate>tirs, 19 mar 2013 00:18:16 +0000</pubDate>
			<dc:creator>Jesper Jarlskov</dc:creator>
			<guid isPermaLink="false">45705@http://wp-danmark.dk/forum/</guid>
			<description>&#60;p&#62;Prøv at ændre&#60;br /&#62;
&#60;code&#62;if (str_word_count($content) &#38;lt; $minword)&#60;/code&#62;&#60;br /&#62;
til&#60;br /&#62;
&#60;code&#62;&#60;br /&#62;
if (str_word_count($content) &#38;lt; $minword &#124;&#124; current_user_can( 'manage_options' ) )&#60;br /&#62;
&#60;/code&#62;&#60;br /&#62;
Jeg tror det burde kunne klare det.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Thomas om "Lidt hjælp fra en venlig sjæl..søges"</title>
			<link>http://wp-danmark.dk/forum/topic/lidt-hj%c3%a6lp-fra-en-venlig-sj%c3%a6ls%c3%b8ges#post-45689</link>
			<pubDate>man, 18 mar 2013 18:32:35 +0000</pubDate>
			<dc:creator>Thomas</dc:creator>
			<guid isPermaLink="false">45689@http://wp-danmark.dk/forum/</guid>
			<description>&#60;p&#62;Hej&#60;br /&#62;
Jeg vil gerne havde sat et mininum antal ord på udgivede indlæg og har i den forbindelse fundet denne stump kode:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;function atLeast($content){&#60;br /&#62;
global $post;&#60;br /&#62;
$minword = 100; //set this to the minimum number of words&#60;br /&#62;
$content = $post-&#38;gt;post_content;&#60;br /&#62;
if (str_word_count($content) &#38;lt; $minword)&#60;br /&#62;
wp_die( __('Error: Your article is below the minimum word count.') );&#60;br /&#62;
}&#60;br /&#62;
add_action('publish_post', 'atLeast');&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Men hvordan får jeg den fixet til gælde for authors og ikke for admins??
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
