Fieldtype, Module

Archived
Forum
(read-only)

CE Tweet

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Causing Effect

     

Errors displaying if no Tweet has been added

Support (Resolved)

Terralemon
Terralemon

If I use the code “{article_tweets type=“oembed”}{html}{/article_tweets}” the tweet(s) are correctly displayed but as soon as I don’t add any tweets I get an error.
Using: EE2.10.2, PHP5.5, ce_tweet 1.3.8
When selecting the ce_tweet field (underneath add-ons) I get a PHP error (Array to string conversion for form_helper.php)
Please help out.

Causing Effect - Aaron Waldon
# 1
Developer
Causing Effect - Aaron Waldon

Hi Terralemon!

I think you are saying there are two separate issues here, so let’s address those.

Issue 1: The Field Variables

If I use the code “{article_tweets type=“oembed”}{html}{/article_tweets}” the tweet(s) are correctly displayed but as soon as I don’t add any tweets I get an error.

What is the error that you receive here?

I am unable to replicate this. I have tried using the fieldtype with and without tweets, and with and without the oembed tag. I get no errors at all. If the tweet is empty, there is simply no output. I’m testing with CE Tweet 1.3.8, EE2.10.2, and PHP 5.6.10.

If you just put the CE Tweet code by itself in a template do you get the error? If not, then the problem likely lies somewhere else. Here’s what I’m using to test:

{!-- I'm including the script tag here, but Devot:ee keeps stripping it out , so just pretend --}

{!-- this entry has two tweets --}
{exp:channel:entries channel="ce_tweet_example" url_title="ce-tweet-example" dynamic="off"}
{software_tweet type="oembed"}{html}{/software_tweet}
{/exp:channel:entries}

{!-- this entry has no tweets --}
{exp:channel:entries channel="ce_tweet_example" url_title="ce-tweet-example-2" dynamic="off"}
{software_tweet type="oembed"}{html}{/software_tweet}
{/exp:channel:entries} 

The tweets from the first tag show up, and no tweets show up for the second entry, as expected.

Issue 2: The CE Tweet FieldType Global Settings

When selecting the ce_tweet field (underneath add-ons) I get a PHP error (Array to string conversion for form_helper.php)

That’s just a notice, not an error, but let’s take care of it. I think the CodeIgniter method used for the settings used to accept an array (which makes more sense, imho), and now they changed it to a string. We can just change this line of ft.ce_tweet.php from this:

$form .= form_input'results_per_page'$results_per_page, array( 'id' => 'ce_tweet_results_per_page' ) ) . '<br><br>'

to this:

$form .= form_input'results_per_page'$results_per_page ) . '<br><br>'

Does making that change get rid of the notice?

Terralemon
# 2
Terralemon

1. I know now what happens. It works (your code and my code as well as they don’t differ). I have added the following code underneath {exp:channel:entries…: “{if no_results}{redirect=“404”}{/if} and your add-on gives a ‘no_result’ apparently as I get redirected to the 404.
2. Thanks. I got rid of the error message.

Causing Effect - Aaron Waldon
# 3
Developer
Causing Effect - Aaron Waldon

Excellent. Glad everything worked out. :)