Forum

Thread tagged as: Problem, Error, Twitter

Twitter Not Displaying on Site Home Page

Hello, I'm conducting work on a Perch website for a client who has utilized the product for a year to this point. Unfortunately, Perch itself is new to me, so I'm constantly looking for answers in the forums and documentation to fill in gaps in my knowledge. However, I am at a point where I cannot come up with additional ideas to troubleshoot the issue I'm confronted with due to the circumstances by which I operate the site's support from a remote location, and only have access to a few folders through a drive accessed by WebDAV.

The site had been running an old version of Perch, and the company requested that I install twitter support for them. By reading the documentation for that however, I discovered that the version of Perch was too early to run the Perch 2 version of Twitter. With that in mind, and discovering that they had sufficient MySQL and PHP version in the Diagnostic panel, I suggested they upgrade to Perch 3 so that we could roll out the Perch_twitter app. That took some doing, but I thought I had upgraded them properly as they are back to the status-quo with the new UI at this point.

However, in installing Perch_Twitter there were complications, in that the system spat out a sequence of errors for an employee at their office who was supposed to manage the website in-house when they went to complete the last few steps of the Twitter installation process barring the 'add to webpage' part. Their description of the problem was that it displayed out multiple lines of error code when they selected 'Get Tweets', but that it somehow managed to retrieve the tweets afterwards.

Notice: Trying to get property of non-object in C:\inetpub\dev\admin\addons\apps\perch_twitter\PerchTwitter.class.php on line 163

I had chalked this up to the database having issues with the newly installed Twitter app. But since the tweets 'appeared' to be populated, I presumed everything was fine and carried on with the installation instructions. It wasn't until things did not operate properly in the last step of adding the tweets to the webpage that I became curious and opened the PerchTwitter.class.php to see what line 163 was.

    public function get_tweet_html($tweet)
    {
        $API = new PerchAPI(1.0, 'perch_twitter');
        $HTTP = $API->get('HTTPClient');
        $response = $HTTP->get('https://publish.twitter.com/oembed?omit_script=true&url=https://twitter.com/Interior/status/'.$tweet->id_str);
        $item = PerchUtil::json_safe_decode($response);
        if (!isset($item->error)) {
            return $item->html;
        }

        return -1;

The line in question turned out to be the 'return $item->html;'.

Which may have become relevant when I went to add the twitter section to a selected web page within a div using:

<?php
    perch_twitter_get_latest();
    perch_twitter_widget_js();
?>

Which only injected: <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> into the webpage at this point. So now I'm curious if there was some tie-up with regards to getting the html for the tweets in question and all the entries for them are entirely blank. The reason why I'm 'guessing' at this point, is that while the website administration page is accessible to me, and the FTP folders hosted for the website, I do not have direct access to the database upon which it was installed and must ask our client to look into the database themselves, so my hypothesis is based purely on the details I can glean from the code and the resulting lack of content displayed.

My basic diagnostic has the following, if it helps debug what is going on. If additional information is required, I will provide the full diagnostic:

Perch: 3.0.11, PHP: 5.6.20, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: WINNT, cgi-fcgi
Installed apps: content (3.0.11), assets (3.0.11), categories (3.0.11), perch_blog (5.6.1), perch_twitter (4.0)
App runtimes: <?php $apps_list = [ 'perch_blog', 'perch_twitter', ];
PERCH_LOGINPATH: /admin
PERCH_PATH: C:\inetpub\dev\admin
PERCH_CORE: C:\inetpub\dev\admin\core
PERCH_RESFILEPATH: C:\inetpub\dev\admin\resources
Image manipulation: GD
PHP limits: Max upload 10M, Max POST 10M, Memory: 128M, Total max file upload: 10M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
REQUEST_URI: /admin/core/settings/diagnostics/
DOCUMENT_ROOT: C:\inetpub\dev
HTTP_HOST: www.website.ca

What should I, or the person managing my client's twitter account be doing to get these tweets to display on the page? Is it possible they forgot to select an option in setting up the Twitter options for their account? Or should I be contacting the person managing the database to verify that the database table's column for tweet html is entirely blank? Thanks in advance for any advice that you can give me.

D Budgell

D Budgell 0 points

  • 3 years ago

I am going to get the database administrator at the client's office to look into the perch2_twitter table to verify that the database column is empty. If anyone has any other suggestions of ideas I should pursue to resolve my issue with integrating the Twitter app in this website, please let me know. I do not know enough about the internal functionality of the Perch_Twitter app to understand why it would not be able to retrieve the html-wrapped tweets, but would be able to acquire the raw text of those tweets.

Any ideas at all would be appreciated.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are those tweets protected?

Drew McLellan said:

Are those tweets protected?

No, I just checked the twitter account of my clients, and they have 90 tweets, and no notification of their account being set to 'protected' when accessing anonymously.. Would there be another reason why the perch2_twitter_tweets table's column tweetHTML in the database would be set to NULL while tweetText was retrieved properly?

The fact that it retrieved something, rather than nothing, suggests that the OAuth process went correctly, but the fact that it is omitting that critical component leaves me baffled. Is there some other information I should acquire to try to diagnose this problem before doing something as a shot in the dark, like dropping the contents of perch2_twitter tables out of the database and trying to get the app reinstalled?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you give an example tweet ID?

Go watch the tutorial videos.

Drew McLellan said:

Can you give an example tweet ID?

Hey Drew, sorry it took me so long to get back to you. Holidays and all.

I'm unsure if you mean 'id' as in the numerical tag that twitter uses in its urls to bring up particular tweets in a timeline, or something separate within the perch_twitter database tables.

One of the tweets we pulled in seems to be referred to as "941370057946304512" on Twitter. Does that sound like the sort of number you would be looking for? I am also looking into the database to see if there might be a different number you might be looking for. I will let you know when I have some more information from the on-site database in case the ID in the system is significantly different.

Thanks for your help Drew, I was not expecting the installation of this twitter application to be quite this complicated.

EDIT: I checked the database, and that ID I previously provided is listed under the 'tweetTwitterID' column.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, that's what I'm after.

Drew McLellan said:

Yes, that's what I'm after.

Let me know if that tells you something useful, or if you think I should just go through the process of trying to reinstall perch_twitter on my client's system.

Hey Drew,

Haven't heard back with regards to this issue so I'm going to go through the process of having my client uninstall the database component of the perch_twitter app so that we can attempt to reinstall it again. If you have any particular details that you would suggest I look into before or after this process please let me know. I am still unsure of what I should be on the lookout for to solve my client's issue.

Drew McLellan

Drew McLellan 2638 points
Perch Support

That tweet is embedding fine for me here, so short of further information I'm not sure what to suggest.

Drew McLellan said:

That tweet is embedding fine for me here, so short of further information I'm not sure what to suggest.

I'll get you the complete diagnostic file. And I'll hold off on the re-installation for a little while longer. I just hope this gives you sufficient information to help diagnose this issue.


Perch: 3.0.11 Production mode: Production (100) Installed apps: content (3.0.11), assets (3.0.11), categories (3.0.11), perch_blog (5.6.1), perch_twitter (4.0) DB driver: PDO DB tables: perch2_blog_authors (3), perch2_blog_comments (0), perch2_blog_index (1096), perch2_blog_posts (31), perch2_blog_posts_to_tags (0), perch2_blog_sections (1), perch2_blog_tags (0), perch2_blog_webmention_queue (0), perch2_blogs (1), perch2_categories (9), perch2_category_counts (4), perch2_category_sets (1), perch2_content_index (2749), perch2_content_items (504), perch2_content_regions (98), perch2_menu_items (10), perch2_navigation (0), perch2_navigation_pages (1), perch2_page_templates (4), perch2_pages (115), perch2_resource_log (643), perch2_resource_tags (0), perch2_resources (771), perch2_resources_to_tags (0), perch2_settings (27), perch2_twitter_scheduled_tweets (0), perch2_twitter_settings (1), perch2_twitter_tweets (40), perch2_user_passwords (4), perch2_user_privileges (40), perch2_user_role_privileges (45), perch2_user_roles (3), perch2_users (6) Users: 6 App runtimes: <?php $apps_list = [ 'perch_blog', 'perch_twitter', ]; Scheduled tasks for perch_blog: delete_spam_comments (1440 mins), publish_posts (1 mins), process_webmentions (1 mins) Scheduled tasks for perch_twitter: post_tweets (1 mins) Editor plug-ins: H1: 64bd8a60c4aacdd6a8302f9fcd84be9b L1: bcdd44651a1b54bedbc420d7b8e781c5 F1: 3b606135b33e6a102526838f4152a807 headerColour: #00809c content_singlePageEdit: 1 helpURL: siteURL: / hideBranding: 1 content_collapseList: 1 lang: en-gb update_2.8.29: done latest_version: on_sale_version: perch_blog_update: 5.6 perch_blog_post_url: /News/post.php?s={postSlug} headerScheme: dark dashboard: 1 perch_blog_site_name: perch_blog_slug_format: %Y-%m-%d-{postTitle} perch_blog_akismet_key: perch_blog_max_spam_days: 1 hide_pwd_reset: 0 content_hideNonEditableRegions: 1 content_frontend_edit: 1 perch_blog_comment_notify: 0 logoPath: /admin/resources/logo.png update_3.0.11: done perch_twitter_update: 4.0 PERCH_DEVELOPMENT: 10 PERCH_STAGING: 50 PERCH_PRODUCTION: 100 PERCH_DB_USERNAME: username PERCH_DB_SERVER: localhost PERCH_DB_DATABASE: websitedb PERCH_DB_PREFIX: perch2_ PERCH_TZ: America/St_Johns PERCH_EMAIL_FROM: website.cms@gmail.com PERCH_EMAIL_FROM_NAME: WEBSITE PERCH_LOGINPATH: /admin PERCH_PATH: C:\inetpub\dev\admin PERCH_CORE: C:\inetpub\dev\admin\core PERCH_RESFILEPATH: C:\inetpub\dev\admin\resources PERCH_RESPATH: /admin/resources PERCH_HTML5: 1 PERCH_EMAIL_METHOD: smtp PERCH_EMAIL_HOST: smtp.gmail.com PERCH_EMAIL_AUTH: 1 PERCH_EMAIL_SECURE: ssl PERCH_EMAIL_PORT: 465 PERCH_EMAIL_USERNAME: website.cms@gmail.com PERCH_RUNWAY: PERCH_ERROR_MODE: DIE PERCH_DATE_LONG: %d %B %Y PERCH_DATE_SHORT: %d %b %Y PERCH_TIME_SHORT: %H:%M PERCH_TIME_LONG: %H:%M:%S PERCH_RUNWAY_ROUTED: PERCH_STRONG_PASSWORDS: PERCH_ASSET_VERSION: f704e7442d11292c99b5 PERCH_DEBUG: PERCH_PREVIEW_ARG: preview PERCH_TEMPLATE_PATH: C:\inetpub\dev\admin\templates PERCH_TEMPLATE_FILTERS: PERCH_DEFAULT_DOC: index.php PERCH_DEFAULT_EXT: .php PERCH_PRODUCTION_MODE: 100 PERCH_XHTML_MARKUP: PERCH_RWD: 1 PERCH_HTML_ENTITIES: PERCH_SSL: PERCH_STRIPSLASHES: PERCH_PROGRESSIVE_FLUSH: 1 PERCH_PARANOID: PERCH_FORCE_SECURE_COOKIES: PERCH_DEFAULT_BUCKET: default PERCH_TRANSLATION_ASSIST: PERCH_PASSWORD_MIN_LENGTH: 6 PERCH_MAX_FAILED_LOGINS: 10 PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR PERCH_VERIFY_UPLOADS: PERCH_PRIV_ASSIST: PERCH_CUSTOM_EDITOR_CONFIGS: PERCH_ENABLE_EXIF: 1 PERCH_AUTH_PLUGIN: PERCH_DB_CHARSET: utf8 PERCH_DB_PORT: PERCH_DB_SOCKET: PERCH_APPS_EDITOR_PLUGIN: markitup PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown Hosting settings PHP: 5.6.20 Zend: 2.6.0 OS: WINNT SAPI: cgi-fcgi Safe mode: not detected MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $ MySQL server: 5.5.45 Free disk space: 1.77 TB Extensions: Core, bcmath, calendar, ctype, date, ereg, filter, ftp, hash, iconv, json, mcrypt, SPL, odbc, pcre, Reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, openssl, SimpleXML, wddx, xml, xmlreader, xmlwriter, cgi-fcgi, mysql, mysqli, mbstring, gd, gettext, curl, exif, xmlrpc, Phar, soap, pdo_mysql, pdo_sqlite, imap, tidy, pdo_sqlsrv, sqlsrv, mhash GD: Yes ImageMagick: No PHP max upload size: 10M PHP max form post size: 10M PHP memory limit: 128M Total max uploadable file size: 10M Resource folder writeable: Yes Session timeout: 24 minutes Native JSON: Yes Filter functions: Yes Transliteration functions: No PROCESSOR_ARCHITEW6432: AMD64 _FCGI_X_PIPE_: \\.\pipe\IISFCGI-13f721de-f5f1-4de4-9a85-0d7803562ec7 PHP_FCGI_MAX_REQUESTS: 10000 PHPRC: C:\Program Files (x86)\PHP\v5.6 ALLUSERSPROFILE: C:\ProgramData APPDATA: C:\Windows\system32\config\systemprofile\AppData\Roaming APP_POOL_CONFIG: C:\inetpub\temp\apppools\dev\dev.config APP_POOL_ID: dev CommonProgramFiles: C:\Program Files (x86)\Common Files CommonProgramFiles(x86): C:\Program Files (x86)\Common Files CommonProgramW6432: C:\Program Files\Common Files COMPUTERNAME: WEBSITESERVER ComSpec: C:\Windows\system32\cmd.exe FP_NO_HOST_CHECK: NO LOCALAPPDATA: C:\Windows\system32\config\systemprofile\AppData\Local NUMBER_OF_PROCESSORS: 8 OS: Windows_NT Path: C:\Program Files (x86)\PHP\v5.6;C:\Windows\system32\inetsrv;C:\Program Files (x86)\PHP\v5.5;C:\Windows\system32\inetsrv;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;;C:\Program Files\MySQL\MySQL Server 5.5\bin; PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC PROCESSOR_ARCHITECTURE: x86 PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 63 Stepping 2, GenuineIntel PROCESSOR_LEVEL: 6 PROCESSOR_REVISION: 3f02 ProgramData: C:\ProgramData ProgramFiles: C:\Program Files (x86) ProgramFiles(x86): C:\Program Files (x86) ProgramW6432: C:\Program Files PSModulePath: C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ PUBLIC: C:\Users\Public SystemDrive: C: SystemRoot: C:\Windows TEMP: C:\Windows\TEMP TMP: C:\Windows\TEMP USERDOMAIN: WEBSITEWEB USERNAME: WEBSITESERVER$ USERPROFILE: C:\Windows\system32\config\systemprofile WebAddIns: C:\Program Files\Windows Server\Bin\WebApps\RemoteAccess\Addins windir: C:\Windows ORIG_PATH_INFO: /admin/core/settings/diagnostics/index.php URL: /admin/core/settings/diagnostics/index.php SERVER_SOFTWARE: Microsoft-IIS/8.5 SERVER_PROTOCOL: HTTP/1.1 SERVER_PORT: 80 SERVER_NAME: www.website.ca SCRIPT_NAME: /admin/core/settings/diagnostics/index.php SCRIPT_FILENAME: C:\inetpub\dev\admin\core\settings\diagnostics\index.php REQUEST_URI: /admin/core/settings/diagnostics/?extended REQUEST_METHOD: GET REMOTE_PORT: 57602 REMOTE_HOST: -Redact- REMOTE_ADDR: -Redact- QUERY_STRING: extended PATH_TRANSLATED: C:\inetpub\dev\admin\core\settings\diagnostics\index.php LOCAL_ADDR: 192.168.1.3 INSTANCE_META_PATH: /LM/W3SVC/4 INSTANCE_NAME: DEV INSTANCE_ID: 4 HTTPS: off GATEWAY_INTERFACE: CGI/1.1 DOCUMENT_ROOT: C:\inetpub\dev APPL_PHYSICAL_PATH: C:\inetpub\dev\ APPL_MD_PATH: /LM/W3SVC/4/ROOT HTTP_UPGRADE_INSECURE_REQUESTS: 1 HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 HTTP_REFERER: https://www.website.ca/admin/core/settings/diagnostics/ HTTP_HOST: www.website.ca HTTP_COOKIE: cmsa=1; __utmz=202572048.1512674885.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmc=202572048; PHPSESSID=kila6ko6un9m50rqeheok56k70; __utma=202572048.581302519.1512674885.1514991698.1515433186.19 HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.9 HTTP_ACCEPT_ENCODING: gzip, deflate HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 HTTP_CONNECTION: keep-alive FCGI_ROLE: RESPONDER PHP_SELF: /admin/core/settings/diagnostics/index.php REQUEST_TIME_FLOAT: 1515510516.5477 REQUEST_TIME: 1515510516
Drew McLellan

Drew McLellan 2638 points
Perch Support

That doesn't really reveal too much more, to be honest. Is your development server on Windows too? I'm wondering if that's a factor.

It is on a Windows server. It has been that way for almost a year now and we haven't had major complications until trying to install the perch_twitter app to embed a feed into it.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't know what to suggest, unfortunately.

That is unfortunate. If you have any possible additional ideas of things that I should check or inquire after please let me know.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Did you try removing the tables and letting it reinstall? Would only take about 30 seconds to do.

Do you mean just perch_twitter2 ? Or some other tables in addition to that?

Which tables should I ask the database admin to truncate/drop? Or better, whether I should truncate the contents or drop the tables entirely?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have a table called perch_twitter2 ?

If so, that's not come from us.

I may be paraphrasing. As I said previously, I do not have the database in front of me due to my remote support role. I think I meant perch2_twitter, now that I look around for that information.

I've been thinking more on the steps involved in creating this twitter app. One of which involved setting a 'callback url', I was curious if you might know Drew, what would happen if the callback URL was set incorrectly, or not at all? Would it refuse to communicate with the perch Twitter app, or would it not send html encoded tweets like I've been seeing here?

I know, it's a bit of a shot in the dark, but there are only a few possible points where data was entered, and now I'm wondering if something might have been incorrectly configured during the twitter dev/OAuth process. It's still probably wisest to do a drop and reinstall at this point, but the more I think about the steps, that is the only point I am unsure about.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I think this would probably quite quick to troubleshoot and fix if you could sit down in front of it.