eGullet

Condition: link in post content

Recommended Posts

I'm trying to create a rule whose condition is that the post content contains a link. I tried just setting it up to search the content for the string "http", but it never triggers. So then I tried writing a custom PHP script to do what I want, but there is a bug in it that I can't isolate -- I get no error message, the page load just crashes. Can anyone either help me figure out why the first method doesn't work, or figure out what's wrong with this PHP set up as a truth value test, "Value is TRUE"?

//<?php

return stripos($content->$content,'http') !== FALSE;

 

Share this post


Link to post
Share on other sites
return stripos($content->$content(),'http') !== FALSE;

or try

$search = 'http';
$search_title = stripos($content->title, $search);
$search_content = stripos($content->content(), $search);

if ($search_title !== FALSE || $search_content !== FALSE ) {
      
      	$found = 1;
      
	}

if (count($found) > 0) {
  
  	return TRUE;
  
}
  
return FALSE;

 

  • Like 1

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.