Twitter App not displaying Tweets

  • Ok, so looking into things (and not sure why I am doubting myself but it's been a long frustrating road), it seems I am correct in the fact that JSON is complied in my PHP installation. Infact, I would have done pretty well (or be using a very old version) to have not had.


    I've looked at PerchTwitter.class.php (line 162 - 166), some more:


    Code
    1. if (!isset($item->error)) {
    2. return $item->html;
    3. }
    4. return -1;

    and have come to some form of conclusion. Firstly, I'm not 100% sure how, within the scheme of this file, the process ever gets past the return -1 item to process anything else in the file. Just doesn't quite makes sense to me.


    Removing the above code from the file does allow me to now return and display the tweets without error, just in raw html format.


    As such, changing the tweet.html template to:


    Code
    1. <perch:twitter id="tweetHTML" encode="false" />

    allows the tweets to be rendered in html.


    This now returns the latest 3 tweets, although the formatting is not what I expected, with no options for retweets, follow etc, but I guess I can build a custom template for this.

    Before anyone says it, I do not like editing CORE code, but this fix worked for me. It's not the answer, there is definitely something not quite right with the PerchTwitter.class.php script, but with client pressures and demands, I will try and take a look at this asap and see if I can figure it out, or what infact the offending lines of code are doing.


    Not sure if, when Perch 4 is delivered, a new Twitter App will also be updated, or it will work, but I really wanted to keep using the Twitter App, rather than looking at alternative solutions.


    I love Perch and it's frustrating but these things happen. Surely cannot be the only one who has encountered this problem and hopefully this workaround, albeit I'm sure, temporary will help a few people out.

  • Yep, as expected (but thought I might be going mad and doubting myself), it is there, listed under Extensions:

    Quote

    Extensions: Core, bcmath, calendar, ctype, date, filter, hash, iconv, json, mcrypt, SPL, pcre, Reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, bz2, SimpleXML, xml, wddx, xmlreader, xmlwriter, apache2handler, openssl, curl, fileinfo, gd, gettext, mbstring, exif, mysqli, pdo_mysql, pdo_sqlite, Phar, ftp, Zend OPcache

    There must be something failing the function, as, once it is in the !isset element as mentioned above, I just cannot see how it escapes the return -1; item, to then process further.


    Obviously it must work for some people as surely everybody would be on this forum complaining that the Perch Twitter App doesn't work ?


    Thanks for all your responses and a big thank you to your mention about adding /perch/addons/apps/perch_twitter/settings/ to the callback url. This should really be added to the documentation as I've had this issue for ages (never got past the setup and as such gave up on the Twitter App completely for a while).

    Would have done it again, but client is adamant about having Twitter feed on the site and why not, should be fairly simple. Might have to look at other widgets, but at least I've got the Perch App working now, just not an elegant solution, or, inline with Perch. Hate hacking code.