Forums | Mahara Community

Developers /
Embedding twitter via textbox?


Gordon McLeod's profile picture
Posts: 197

18 December 2013, 22:50

Hi,

I know it used to be possible to embed Twitter feeds in textboxes before they changed the api. Twitter now produces an embed code for timelines/hashtages/etcs, but I've tried adding that as html in a textbox - it displays as a link rather than as an embed of tweets on the page. I'm wondering if anyone has a solution to display the new twitter timelines that doesn't involve installing non-core plugins?

I'm not averse to using plugins but have to jump through hoops to get anything changed. If anyone can advise on whether there is a way to do this that doesn't involve changing code or installing that would be a great help.

Thanks, Gordon.

Tobias Zeuch's profile picture
Posts: 111

19 December 2013, 1:43

H Gordon,

can't you include it in an /external media/ block (if you add it to the allowed iframe sources)? If not, do you have an example of a link/embed-code that you would like to display?

Tobias

Gordon McLeod's profile picture
Posts: 197

19 December 2013, 2:54

Hi Tobias,

Here's an example of the embed code - for #Mahara hashtag. The code produced by Twitter doesn't generate as an iframe - though I tried wrapping it in an iframe just in case (you then get a blank box).

I thought the code might get filtered so I've changed < to [ at the start of the class and script code lines.

Regards, Gordon.

[a class="twitter-timeline"  href="https://twitter.com/search?q=%23Mahara"  data-widget-id="392643624308985856">Tweets about "#Mahara"</a>
    [script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

Tobias Zeuch's profile picture
Posts: 111

19 December 2013, 4:48

Hi Gordon,

Ok, I see what the problem is. The twitter-timelines are nearly pure javascript. The html-part is just the link and usually the twitter-javascript code would replace that with the timeline. But the javascript-code is blocked by mahara, both in the iframe-block and in the html-block (and also in the html-code mode for text-boxes). 

I don't see any way to get the twitter-hashtag search into mahara without hacking into the code (to not filter out the twitter-javaScript-file or include the javascript-file directly) or installing a plugin that loads the twitter api itself. 

Twitter once offered their timelines (or hash-tag searches) as rss-feeds but that feature is disabled with the new api. 

Sorry, that I couldn't help you. 

Tobias

anonymous profile picture
Account deleted
Posts: 1

01 December 2014, 22:34

It takes some time but this actually works.  You need to get the RSS from twitter and just use the external RSS block. 

Don Presant's profile picture
Posts: 255

02 December 2014, 2:35

The only current way I've found to get a Twitter RSS feed is to use a service called TwitRSS.me to get the syntax. I just tested again OK for my handle, but when I tried your handle Gordon, it broke...so mileage may vary.

It's a personal project site asking for donations.

Gordon McLeod's profile picture
Posts: 197

02 December 2014, 3:41

Hi Don,

I've just tried the TwitRSS.me option with a couple of twitter handles (including mine) and they displayed, though symbols (quotes, &, etc) came through as ascii. It displays that way on the RSS site so isn't a Mahara issue - it's just displaying what the feed pushes out. It's better than no feeds, though doesn't let you pull in hashtags (which I really wanted), just @name.

Thanks, Gordon.

7 results