Search

Hey, everyone!

It's been a long while since I've done anything Symphony-related, especially with S2, but I've found a good amount of free time to play catch up.

This extension is, more or less, a crash-course in teaching myself the ins and outs of S2. With the help of Rowan's email filter extension, I was able to reverse engineer my way into creating my very own extension, sans documentation.

To summarize, the Twitter Notifier will allow you to add multiple Twitter accounts that monitor specified content sections for your Symphony site. Whenever you post new content in a section that is being monitored by a Twitter account, the extension will send a tweet to said account containing an optional blurb and direct link to the content.

Due to the flexible nature of Symphony and the fact that content will be arranged differently from user to user, the direct link to your site will need to be manually specified. Assuming that you're using a unique identifier for your content, this extension allows you to specify an xpath expression to search for it.

That's pretty much all it does. The neat thing is, you can have the same account monitor different sections separately. For instance, send a tweet stating you just added a new blog post and then send another tweet whenever you upload a picture to an image gallery.

Naturally, Twitter's limitations still apply, so you'll have to be creative when providing a blurb. For the URL's, I might implement a URL shortening service like SnipUrl or something similar to save some space.

140 characters ain't a whole lot.

This extension is fully functional, but currently has no interface implemented. So, unfortunately, I can't provide any screenshots. The good news is this extension will be completed within the next day or so.

If you have any questions in the mean time, don't hesitate to ask. I'll update this post as I go.

Oh, and just for the heck of it: http://www.twitter.com/wilhelm

Cheers!

Sound good wilhelm. I'm always a big fan of integrating with other services.

Thanks, Alistair. I figured it'd be a great way to get my feet wet with S2 development. Quite a bit easier than I thought. I love the use of the observer (delegates) pattern even thought it's been there since the start.

Great job, guys!

Nice. I like being able to push to services from my site rather than having to pull them in.

Alright, I actually managed to find the time to finish this thing up.

Installation is pretty straight-forward, just read the included readme.txt. I didn't include a custom blurb like I mentioned above, but that can be easily changed from within the 'extension.driver.php' file. Everything is documented, for the most part, so poking around the extension should be simple enough.

I added a URL-shortening service (http://is.gd), so you shouldn't run over your Tweet limit.

I'll be posting a detailed walkthrough some time tomorrow on my site and link to it from here. Until then, here's the link to the package:

Twitter Notifier 1.000

Suggestions and critiques are always welcome.

Enjoy!

P.S. - There are a few things that still need to be added. Like the ability to edit your added accounts. Right now, you'll have to either delete an account you want to edit and add it again or modify it directly from within the database.

Hi wilhelm, just to let you know, your using a CURLOPT_POST call to the is.gd API when you should be using a CURLOPT_URL call.

The following setup works for me from line 203:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://is.gd/api.php?longurl={$url_to_shorten}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$link_to_entry = curl_exec($ch);
curl_close($ch);

Great addition though, cheers.

  • Eoghan

Funny. I'll fix it ASAP.

Ta!

  • W

Does this extension still work and is it available for download anywhere?
I need to send tweets from a news sections of my department’s website at university and this extension seems to do the trick.

i spoke to wilhelm and he posted his stuff on git but he’s not 100% sure if it still works with the current build.

looks like it doesn’t work, not surprised since this was last worked on almost a year ago.

I really don’t know how to use git and was trying to commit my changes to what i think is my branch, but have not been able to successfully.

can someone help me out here by either explaining how to do this or by committing this change in the extension.driver.php file for this extension:

from

public function addToNavigation(&$context)
{
    $context['navigation'][300]['children'][] = array
    (
        'link' => '/extension/twitternotifier/accounts/',
        'name' => 'Twitter'
    );

    return true;
}

to

public function fetchNavigation() {
    return array(
        array(
            'location'  => 'System',
            'name'  => 'Twitter',
            'link'  => '/accounts/'
        )
    );
}

around line 148.

thanks

getting this error when trying to create a new post:

2010/02/06 13:56:42 > WARNING: 2 - Invalid argument supplied for foreach() in file /home/site/extensions/twitternotifier/extension.driver.php on line 313
2010/02/06 13:56:42 > WARNING: 2 - Missing argument 4 for fieldTextarea::appendFormattedElement(), called in /home/site/extensions/twitternotifier/extension.driver.php on line 323 and defined in file /home/site/symphony/lib/toolkit/fields/field.textarea.php on line 158
2010/02/06 13:57:07 > WARNING: 512 - MySQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND f.id IN ('98') LIMIT 1' at line 4 in query "SELECT f.`id` AS `field_id`
                FROM `sym_fields` AS `f` 
                LEFT JOIN `sym_sections` AS `s` ON f.parent_section = s.id
                WHERE `s`.id =  AND f.id IN ('98') LIMIT 1" in file 

it also seems like accounts are not editable once they have been created

Hey, peeps. Yeah, I’m not surprised that this thing no longer works. It was my first attempt at writing an extension for S2 and I never really finished it. This would explain why you can’t edit Twitter accounts at the moment.

If anything it’s a good starting point for someone else to pick up where I left off. :)

yup, trying to =) i’m not too well versed in this part of symphony myself.

Be happy to take a look soon if no one else beats me to it…

any one working on this? it seems useful I want to have sms notifications and twitter can do that for me.

Has anyone already extended this extension to work with ping or posterous so a (few first lines) of new entry can be autoposted to several social sites at once?
I’d add tumblr to the list, but unfortunately they only autopost to facebook and twitter, although…does anybody uses anything else these days?…..

Any news on this? Does it work with 2.2, or is there something similar out there?

Seems like a great idea to have a social media notifier...

This extension was deprecated a long time ago and since then the source code has been lost to the ether.

I had a chat with Wilhelm about reviving this, but he had lost the code.

I began work on a new Twitter Notifier, but since then my requirement vanished so the code is part finished on github. I've left it in the symphonists organization, so it's there for anyone to fork and complete, my only request is that the source remain under the current location.

I have Wilhelm's code! I attach it to this post.

Attachments:
twitternotifier.zip

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details