126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Google's Highly Open Participation Program tries to get young students into Open Source and Joomla! specifically. Everyone is welcome, there are not limits. You can be a coder, documenter, tester, translator to help out. Jump in and start helping!
User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Post by depresz » Thu Dec 13, 2007 3:55 pm

Hello again.
I selected another task yesterday... This time I would like to help by creating new plugin. I looked out and I think that this task should be easy  8)
Create a Joomla! v 1.5 Plugin to update Twitter status with article title
when published

Describe the task.

Twitter is a microblogging service, many times used from a Mobile device
that friends, family, and co–workers use to stay connected with quick,
frequent 140 character phrases.

Create a Joomla! plugin to:

    * Define Twitter name and password, logon to twitter;
    * Post the first 140 characters of the title of an article, when published.

Resources:

    * Twitter

  # Home - http://www.twitter.com/
  # API - http://groups.google.com/group/twitter- ... umentation

    * Examples

  # WordPress Twitter Updater - http://blog.victoriac.net/blog/twitter-updater
Google Task

Task Claimed: Dec 12 Task Due: Dec 26
[me=AmyStephen]added project information.[/me]
Last edited by AmyStephen on Fri Dec 28, 2007 1:11 am, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article

Post by depresz » Sat Dec 15, 2007 10:37 am

I appropriate all my free time for Joomla! project. I finished my task, and what can I say? It's so addictive! I wouldn't say it before. Would be perfect if someone would like to check out results of my work. In my opionion everything should be fine.

I have also created quite simple documentation. It's available on http://www.depresz.piotrkow.net.pl/Twit ... in_doc.pdf

Folks, I love Joomla!  :laugh:


I have just edited file: delete "multilanguage" in xml file (doesn't work when plugin disabled)
You do not have the required permissions to view the files attached to this post.
Last edited by depresz on Sat Dec 15, 2007 5:29 pm, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article ti

Post by AmyStephen » Sat Dec 15, 2007 10:54 pm

depresz wrote: Folks, I love Joomla!  :laugh:
8)

Image

[me=AmyStephen]is so happy!  :-*[/me]

This is a great social networking tool, with it you can now connect a Joomla! website with a HUGE stream of possible readers. It is getting to be the equivalent to a ping with blogging. Thanks for picking this task.

Great documentation!

Suggestions:
- Add section / category selection criteria.
- It would be REALLY cool if you could associate this with a Joomla! User. That way, a blogger would twitter to his/her own account in a group blog situation.
- It would be really, REALLY cool if you could shoot a URL to Twitter, too - or link the title, if possible, so that readers could click it and be transported to the article.
- Twitter converts URLs to Tiny URLs. If you can sent a linked title, you could shorten the title for the length of a tiny url and send both. This would be VERY valuable to be able to drive hits to your site from Twitter.

Great work!
Amy :)

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article t

Post by depresz » Sun Dec 16, 2007 8:12 am

Great Amy!

I designate myself list of tasks to do:

TASK 1 - URL IN TWITTER (article title [max. length] + tiny url to article)
I am still thinking about URL's to Joomla! articles in Twitter, but in my level of knowlegde it's impossible. When the article is adding, there is no parameters that symbolize number of article, so I can't create URL ;( I think that this is not predictable. I can't do it, but i will not give up. I'll try to do something if you give me some clue. Inside my hearth I know that I can do it xD (edited: I have scent: JTableContent, but how to use it??  :'(). on the assumption that Joomla! creates ID number by last_used_number+1 (in my case it will 115), I found solution (I think so):

Code: Select all

$db =& JFactory::getDBO();
$query = "SELECT id FROM #__content ORDER BY id DESC LIMIT 1 ";
$db->setQuery( $query );
$rows = $db->loadObjectList();

echo $rows[0]->id;
To last ID number (115)i will add 1 and i'll get predictive ID article number (116) and finally address to site ;).
I worked with shotest address as possible and find out that minimal arguments in address are id, Itemid, and option. Every char is important in Twitter case.
Is ONE big problem. When plugin sends address, Twitter server can not create short address to article because receive only part of addres! http://SERVER/index.php?option=com_content&id=116&Itemid=50. Typical request to Twitter.com look: status=TEXT, but when inside the TEXT will exist & char, Twitter recognize that as end of status parameter and think that rest of text is other parameter. Al least I can add address to Main Site (index.php). I would like to solve that but i don't know how? I thought that i can solve this by using & but as can you see, here also exists &.


TASK 2
I am open for Joomla User. Where exactly would you like to see this? (where start to build)
I am still don't know how to start. Help Amy :'(


TASK 3
About categories: Do you mean that articles from selected groups can be post into Twitter? These groups can be choose inside configuration of plugin? At start i thoutht that i will use some listbox and user will mark, which section want to enable plugin. I had even code (get list of sections form database). Suddenly, I can not use it because implementation of code is not available on .xml level. I have just putted text field. You can enter name of sections which you want to add to Twitter. It's al little bit disscomfortable because you have to remember about comma among name of section.


Task 1: Added Title + link to Main site (not article site). I think that this task is done
Task 2: Task open
Task 3: I think done, I can't do any more / technical restriction

And something else... http://extensions.joomla.org/component/ ... Itemid,35/. Hello Joomla! Extensions  8)
Last edited by depresz on Sun Dec 16, 2007 5:36 pm, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article ti

Post by AmyStephen » Sun Dec 16, 2007 5:33 pm

Caution: You might want to verify that a) the article has a state = 1 (published); b) the publish date is current (not after today) and c) that it is a public message (access = 0), before sending to twitter.

TASK 1 - URL IN TWITTER

Joomla!'s URL

I talked to Ian about this task and asked him his advice on determining a good Joomla! URL for an article, as it is created.

He suggests continuing to obtain the article ID, as you have indicated with that query.

Then, include the ContentHelperRoute class into your plugin

Code: Select all

require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
And pass that ID you found into the ContentHelperRoute class for JRoute to obtain the URL.

Code: Select all

JRoute::_( ContentHelperRoute::getArticleRoute( $articleid ) )
Getting a good URL is, of course, really important - so - spend a little time verifying this (I will help, as well.)

Sending a URL to Twitter

Next, I recommend using that URL to generate a tiny url.

You really don't want to waste precious space on a parametrized URL Plus, if Twitter is not handling special characters changing amperstands into & wastes more space...

What about figuring out the tiny url, yourself, and sending it?

Option 1: Create and lookup tiny url with PHP

Option 2: Stammy Script: RSS to Twitter using PHP - the article shows how to use CURL to access the tiny url API and create a shortened URL. In this case, it's a cron job and an RSS feed, but you can easily adapt it your purposes to build a tiny url in realtime. The gmail authentication plugin (plugins/authentication/gmail.php) uses CURL. So, between those two resources, you should be able to get a tiny url to pass on to Twitter.

Sending the URL *is* worthwhile. Driving clicks back to the website is the big benefit to hooking a website up to a SN, like Twitter.

TASK 2 - JOOMLA! USER

If you really want to do this, it would be HUGELY powerful in a multi-user blogging environment. Kevin Devine has a UserMeta System Plugin that is drop dead easy to use. You could suggest people use his plugin - or another method of extending JUser parameters - to add a TwitterURL parameter. Then, users could specify their Twitter URL in their profile.

Your plugin would could add a parameter indicating whether or not these extended user parameters will be used. If the parameter is set to Yes, your code would lookup the TwitterURL for the article author and send the title to that location, instead of the default Plugin location.

This would be HUGE. Consider it please.

TASK 3 - JOOMLA! SECTIONS AND CATEGORIES

Just add a category and section text box that would limit tweets to those selections (comma separated list). There are many examples of this in the core. Menu items - modules, etc.

Twitter Fan Site

Might want to add your JED link to Twitter Fan Wiki

HTH,
Amy :)


Edit - while I was researching - I see you made some changes to your post. So, I'll wait for you to consider some of this and respond to your next post.
Last edited by AmyStephen on Sun Dec 16, 2007 5:35 pm, edited 1 time in total.

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Post by depresz » Sun Dec 16, 2007 5:42 pm

Thank you so much for important information.
I'm impressed!

So, to the work... it won't be workless night... ;D


I'll here update status of work...
22:10 16/12/2007 - PROGRESS 30% local time: Finally, after many hours, plugin create title + shorted url to Twitter.com (shorting before upload to Twitter.com; self script)
06:57 18/12/2007 - PROGRESS 55%: Today I'm gonna to continue creating code which will compare name of entried sections in configuration with selected options. It looks very simple but in practice it's quite complicated. From Twitter module, when I update status, I give only ID of sections and categories. But user detailed NAME, not id numbers. That's why I had to open db and read id,title of section. Then finally plugin has opoprtunity to compare selected optiona with saved by user in config. This same plan I have to apply to categories. I think it will take me about 2,5 hour.
Later, today, I'm going to do something with JUser! Yes! I'll do it ;)
Oooops... thime to school ;D
22:10 18/12/2007 - PROGRESS 100% local time: YOU can don't believe but... done!

PROGRESS OF TWITTER STATUS: 100%
it's ready
Last edited by depresz on Tue Dec 18, 2007 9:09 pm, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article ti

Post by AmyStephen » Tue Dec 18, 2007 4:29 am

depresz wrote: I'll here update status of work...
22:10 16/12/2007 local time: Finall, after many hours, plugin create title + shorted url to Twitter.com (shorting before upload to Twitter.com; self script)
Excellent! Can't wait to see this! This will be one of the best Twitter extensions around.

Amy :)

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article t

Post by depresz » Tue Dec 18, 2007 4:36 pm

As you can see (look previous post) I did most important sections. Now I would like to create support with JUser. I have to ask you about something accroding to:
Your plugin would could add a parameter indicating whether or not these extended user parameters will be used. If the parameter is set to Yes, your code would lookup the TwitterURL for the article author and send the title to that location, instead of the default Plugin location.
Every user (intrinsically administrator) has to have login and password boxes in JUser parameters, right?

I have added from me option: Only for published (not every article is published so i thouht that is helpful option)

I attached plugin to test... You know, it's very development build so you can affect some... things  :P
You do not have the required permissions to view the files attached to this post.
Last edited by depresz on Tue Dec 18, 2007 9:10 pm, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Post by depresz » Tue Dec 18, 2007 9:21 pm

Hi!
Amy, mission complete! I've just done last part of... of everything! I'm very sleepy. All my work took ~30h. I'm very tired. I conclusion: I did 300% of normal work  ;D Look at task: simple status at start, advance plugin in the end. Thank you Amy for suggestions, rly thx because I learnt a lot of things (you rock!).
One thing left: someone have to check my plugin  :P

If task of Twitter module is not claimed, I would like to claim this. I'm experienced with Twitter tech.

Now I'm gonna to fall asleep xD

Cheerz!

Of course I'll update documentation.
I worked on Nightly Build, because in normal RC3 it didn't work (Personal Twitter)
You do not have the required permissions to view the files attached to this post.
Last edited by depresz on Tue Dec 18, 2007 9:27 pm, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article ti

Post by AmyStephen » Tue Dec 18, 2007 9:30 pm

depresz -

I've told a couple of people that I feel guilty because I really did challenge you. I've looked around at a lot of extensions for various open source CMSs - and explored the Twitter ones. This will be the very best around. I can tell you are a talented developer because you dig very, very deep. This will be good for you.

While you sleep, I'll Twitter. I'll try to be quiet so I don't wake you.

You have done very good work and should feel proud!
Amy :)

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Post by depresz » Wed Dec 19, 2007 5:16 pm

:P I don't know what to say :laugh:, thx
I have just updated doc. I was trying to make grammar as best as possible (still learning English)
http://www.depresz.piotrkow.net.pl/Twit ... oc_1.1.pdf

Now Task is fully completed.
I'm waiting for comments.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Post by depresz » Thu Dec 20, 2007 5:54 am

And what do you think Amy about Twitter Status?

I have tommorow free day so I would like to start another task.

Cheers
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

kdevine
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 200
Joined: Thu Mar 02, 2006 8:38 pm
Location: Baltimore, MD

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article ti

Post by kdevine » Thu Dec 20, 2007 2:47 pm

I unfortunately am not a Twitter user so the full impact of this plugin is lost on me but I know Twitter is becoming more popular so I am sure this plugin will be very welcome by the community.

Since I am not familiar with Twitter I will just offer a brief critique of the code.

Frist the nitpicky stuff...
Please be consistent with your indentations. Some of your code and the set up xml file are a little difficult to follow. Also, spaces between variable names and values really help readability. If you could go through your plugin and do some clean up I know other developers looking at your code would appreciated it. Also, please consider using tags in your Doc Comments and using the standard format. Again this is just to help out other developers and prep your code for documentation.

/**
* @copyright 
* @license
*/

Please consider using single quotes instead of double quotes on strings to boost performance.

Last thing I noticed is that there is no plugin parameter to allow the user to choose whether or not to use the Twitter user.xml set up file for User parameters. If the user has their own custom parameters then installing this component will override them. This plugin should have a parameter for turning on the Twitter User parameters and in my opinion it should default to off.

Also, maybe add a parameter so the user can choose whether to include private content in this.

I can't test this since I don't have Twitter but I'm not sure your logic for selecting the article is correct. If the task is save or apply, and the other conditions met, then the last article ID from the table is pulled. However, if the task is apply then the last ID in the table may not have been the article that was just edited. How are you ensuring that the article you are sending to Twitter is the article just edited?

Other than those things the plugin looks good to me. Amy is certainly impressed so you should be proud.

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Post by depresz » Thu Dec 20, 2007 4:44 pm

Thank you so much kdevine for sugestions!

I have just edited code (improved: spaces, simple quote, @author, etc). I have also added parameter in plugin config that allow or disallow plugin manage the profile details (It's most important thing that I was finding)...
I ignored apply button: Plugin will work only when save button will be pressed. I decided to cancel supporting apply button because function works only once, with first press of apply button; each next time will be ignored because Joomla! allocate ID to article. When ID is empty, plugin can update Twitter status (when edit ID is not empty).
I have found one BIG bug: When user submit new article from front-end, status is not updates.
In front-end is diffrent interpretation of save variable. Worest is that that save button is managed by JavaScript, that I hate xD. I can't check does user add new article because I don't have clarity action OnButtonPress.
I'm fixing this.
Last edited by depresz on Thu Dec 20, 2007 4:51 pm, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Post by depresz » Thu Dec 20, 2007 7:30 pm

done, done, done

I'd like to again thanks kdevine 8) . I improved all functions that were responsible for front-end. I fix my glance on address of article because they were small but visible bugs.

Documentation: http://www.depresz.piotrkow.net.pl/Twit ... oc_1.1.pdf
Plugin: as attachment to this post

Twitter Status should now work in right way
I have nothing to do...
Can I upload this on Google?
You do not have the required permissions to view the files attached to this post.
Last edited by depresz on Fri Dec 21, 2007 8:01 am, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
Roman Blanty
Joomla! Explorer
Joomla! Explorer
Posts: 372
Joined: Thu Aug 25, 2005 5:32 pm
Location: Internet
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article ti

Post by Roman Blanty » Sat Dec 22, 2007 2:43 pm

I've tested the plugin. Installation is simple. Plugin works with no errors. And furthermore is very well documented. I guess that this work meets all demands you could have from a plugin!
Great work.
Proud Polish Joomla! Team Member > http://www.joomla.pl
Hardcore Translator ;)
Joomla! Translation Coordination Team
Jobs in IT: http://www.workita.com

User avatar
mcsmom
Joomla! Exemplar
Joomla! Exemplar
Posts: 7897
Joined: Thu Aug 18, 2005 8:43 pm
Location: New York
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article ti

Post by mcsmom » Sun Dec 23, 2007 9:30 am

Please put the instructions for using the plugin in the description field of your xml file. Use enabled rather than published since that is the word used in the user interface.

They just have to enable it, right? And fill in the parameters?
So we must fix our vision not merely on the negative expulsion of war, but upon the positive affirmation of peace. MLK 1964.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Post by depresz » Sun Dec 23, 2007 1:03 pm

I've squared parameters box, added "instruction" in desc box and updated doc
http://www.depresz.piotrkow.net.pl/Twit ... oc_1.1.pdf
You do not have the required permissions to view the files attached to this post.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article ti

Post by AmyStephen » Sun Dec 23, 2007 8:09 pm

depresz -

These tests were on my Internet accessible webserver: Apache/2.2.3 (Win32) PHP/5.2.4

+++

Sections and Categories
When sections and categories are offered as parameters in modules or plugins, typically, that is done by entering the number (key) of the section or category - rather than the title.

I cannot "blank out" the sections or categories. Typically, leaving it blank means "all" (rather than an asterisk, which is not a common practice.)

Article Manager:

When I go to the article manager page, in the backend Administrator, I get these errors:
Notice: Undefined offset: 1 in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 78

Notice: Trying to get property of non-object in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 78

Notice: Undefined offset: 1 in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 79

Notice: Trying to get property of non-object in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 79

Notice: Undefined variable: sekcja_table in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 83

Notice: Undefined variable: kategoria_table in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 143

When I edit a specific article I get these errors:

Notice: Undefined offset: 1 in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 78

Notice: Trying to get property of non-object in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 78

Notice: Undefined variable: sekcja_table in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 83

Notice: Undefined variable: kategoria_table in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 143
++++

Post to Twitter and URL

SEF URLs off

The post to Twitter worked, but the tiny url did not. It was http://tiny url.com
test to twitter sef urls OFF http://tiny url.com/
SEF URLs on

Same as above, the post to Twitter worked, but not the tiny url.
test to twitter sef urls ON http://tiny url.com/
http://twitter.com/AmyStephen


Per user Twitter

I absolutely love the ability to use this plugin by User. That really supports a great SNing/group/community environment.

In your user guide, I recommend you give some instruction to where to get the UserMeta System Plugin and how to add the three data elements your plugin requires. (It will save you lots of trouble to go ahead and include those instructions; this is a new function and not many know how to use it.)

I did not retest this capability, yet.

I'll look for your post. I'll also try on my localhost and let you know how that goes.

Amy :)

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article ti

Post by AmyStephen » Sun Dec 23, 2007 8:41 pm

I did not get the same error messages on my localhost environment as I did, above. But, the post to Twitter did not work, either.  :P

System info: Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.3

Would it make sense to offer a parameter that allows sending or without the URL?

Any ideas on what you would like me to try?

Sorry for the "not so good" news!

Amy :)

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Post by depresz » Sun Dec 23, 2007 9:14 pm

Hi!
I'm fixing all those errors...
I have just repaired Sections, Categories... insted Text, will be ID. Also blank instead *. It was easy because I just had to remove code ;P

Now there is no option to enable/disable URL, but this is nice thing  :laugh:

Fixed:
Notice: Undefined offset: 1 in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 78

Notice: Trying to get property of non-object in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 78

Notice: Undefined offset: 1 in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 79

Notice: Trying to get property of non-object in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 79

Notice: Undefined variable: sekcja_table in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 83

Notice: Undefined variable: kategoria_table in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 143
My plugin include user.xml but I think that is bad idea.

Amy thanks for all... I have a lot of work


Half-repaired in attach.
please check

Cheers!
You do not have the required permissions to view the files attached to this post.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article ti

Post by AmyStephen » Sun Dec 23, 2007 11:42 pm

The text now reads ID of selected sections and ID of selected categories, but it still defaults in the XML to News and *.

Also, as I was reviewing the twitter.xml file, I noticed you have not implemented the language strings into your Plugin Editor.  I made a post that I have been sharing that might help. Compared to what you have done, this is child's play. ;)

When I go into the backend Article Manager and the editor I still get these errors (I get some of these when saving an article):
Notice: Undefined offset: 1 in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 78

Notice: Trying to get property of non-object in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 78

Notice: Undefined offset: 1 in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 79

Notice: Trying to get property of non-object in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 79

Notice: Undefined variable: kategoria_table in D:\VirtualWebsites\JoomlaPlace\JoomlaGHOP\plugins\system\twitter.php on line 143
The post still took place but only with the http://tiny url.com/ URL.

These are all probably just things not yet fixed, but I thought I would report it, anyway.

I'll hold my questions on the user.xml.

Thanks!
Amy :)

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Post by depresz » Mon Dec 24, 2007 10:26 am

Problems:
#1.Article Manager
#2.Post to Twitter and URL
#3.Per user Twitter
#4.Internationalization of plugin



I think that notification of #1.Article Manager and problems of #2.Post to Twitter and URL have this same origin. I tested my plugin on Joomla 1.5 RC3 and SVN from 12/17/07. I didn't saw anything like that what did you quote. I have only one logical fault of errors: Windows! Yeah! That's not a joke ;) tiny url works fine; function of tiny url uses common code, using by many programmers. On my machine: Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6.2 Server all is well. Roman Blanty and mcsmom didn't have problems (at least didn't write thay had trouble with something). I really believe this is blame of Windows.
Windows paths sux: D:\VirtualWebsites\JoomlaPlace\Jo....

look at code:
    //Create full path of article
    $address = 'http://'.$SERVER.$SUB_DIR.$path;
When Tiny encounter on http://D:\... I don't know what Twitter is thinking about it... On webserver everything SHOULD be fine. In my case full path to example article is http://192.168.1.112/Joomla-1.5RC4/inde ... icle&id=44. Address like from Internet. http://twitter.com/verytesty
   language/en-GB/en-GB.plg_twitter.ini





[/quote]

I didn't attached zip because I don't want to introduce dither.
Last edited by depresz on Mon Dec 24, 2007 11:35 am, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article ti

Post by AmyStephen » Mon Dec 24, 2007 3:35 pm

Depresz -

You mentioned RC3 - have you tested with RC4, as well? Very important to do so, especially with the amount of router changes introduced. I could be wrong, but, I don't believe mcsmom tested your plugin, her comments were more related to your content.

I know that Michal did an install and a quick post and that it worked as I can see the tweet out there. The URL generated was good and directed me back to his site.

These are Joomla!'s minimum system requirements. It's a tall standard but it's a large, diverse community. Building Joomla! extensions is not easy. There is a mighty narrow path of PHP that must be walked in order to function on the types of websites that are required. Yesterday, the delicious JSON task had to be modified due to a PHP directive the developer uses that is not required (or preferred) on Joomla! sites.

If you want access to my server (administrator and front end), that can be provided. Let me know and I will PM you the credentials. Do not be discouraged. This is not easy work, in general, and what you are doing is not "high school" level work. This is professional grade development; I know of no other Twitter extension that attempts to perform this feat. You will resolve it.

Amy :)

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Post by depresz » Mon Dec 24, 2007 7:42 pm

I tested my plugin on RC4 release. And... no problem.
I would be really grateful if you'll provide me your server.
Don't worry... I had moments of resignation but I don't wanna give up  ;)
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article ti

Post by AmyStephen » Wed Dec 26, 2007 5:46 am

Nice Tomasz!  8)

Image
I wonder why Joomla! gives you the parameterized URL?

Later down the road, if you continue working with this (and I hope you do), you might want to explore that. I don't know if it's even possible to get the SEF URL from Joomla! after creating a new article. But, technically, this is not the right value. It's so early into the new Joomla! router logic and what (and when) a URL is needed. This will likely evolve.

Tomorrow, I will look at the User Configuration and also want to see what problems you are having with Internationalization.

Great work; good sign to see you hanging in there.
Amy :)

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Post by depresz » Wed Dec 26, 2007 9:12 am

Hi!
Later down the road, if you continue working with this (and I hope you do), you might want to explore that. I don't know if it's even possible to get the SEF URL from Joomla! after creating a new article. But, technically, this is not the right value. It's so early into the new Joomla! router logic and what (and when) a URL is needed. This will likely evolve.
Yeah, this is not great solution but in this step (progress of work) it's adequate. There is no specially problems with that but I'll fix it in the future.

Why Twitter didn't display full address?
This is very complicated problem and I can't clear up what was wrong  :laugh:. First, was problem with encoding to the UTF-8, you know %26, etc... Plugin didn't send full path:

Code: Select all

http://192.168.1.112/Joomla-1.5RC4/index.php?option=com_content&view=article&id=47
only like that:

Code: Select all

http://192.168.1.112/Joomla-1.5RC4/index.php?option=com_content
When I resolved this I could send to Twitter server full path (not compressed by tiny url). Next problem was bound with tiny url script. On your server it didn't work! To this day I don't know why. Version of script was a little... old. I discovered that tiny url.com provide API:

Code: Select all

http://tiny url.com/api-create.php?url=
When you GET url param, you'll receive shorten URL.
Old function was too complicated... I think there was problem in preg_match function. Before I discovered API to tiny, i tried to use:

Code: Select all

$handle=fopen("http://tiny url.com/api-create.php?url=".$address, "r");
echo fread($handle, 32);
fclose($handle);
There is another LOL because on my server and server of my ISP everything went OK. Of course your server was diffrent  :laugh:. Function did't execute. I think you have enabled some restriction...
Later I looked out and I noticed that first bug wasn't bound with tiny url script so I decided to cancel using %26 because in new tiny url script address was incorrect.

I had a lot of fun (and work) with improving...
I checked everything twice on my and your server.
Now everything works fine!

Left only one problem. Internationalization. But I think that with your help I will do it quick.
I tried to put translation string into second file called en-GN.plg_twitter_categories.ini but without result.
In this (simpliest problem) I haven't clue what to do (what is wrong).
I have problem with descripion of parameters in xml file (I can't see translated string)

Cheers!

Edit 10:29 am local time: Added attachment
Edit 12:34 am local time: Language improvement (but doesn't work in parameter (description) yet)
Edit 12:48 am local time: Documentation updated: http://www.depresz.piotrkow.net.pl/Twit ... oc_1.1.pdf. I'm gonna create polish version of this doc
Edit 2:37 pm local time: Polish version of doc available: http://www.depresz.piotrkow.net.pl/Twit ... 1.1_pl.pdf
Edit 7:42 pm local time: JoomlaCode profil created! http://joomlacode.org/gf/project/twitter_status/
You do not have the required permissions to view the files attached to this post.
Last edited by depresz on Wed Dec 26, 2007 6:42 pm, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Post by depresz » Thu Dec 27, 2007 8:03 am

Great news!
Plugin done. I did localization. There was problem with file name convention: en-GB_plg_system_twitter.ini instead en-GB_plg_twitter.ini   :laugh: I have uploaded plugin to JoomlaCode.
Please check  8)

I've installed/reinstaller/uninstalled... and there was only warning with pl-PL language. Everything OK
Latest version on your server Amy

http://joomlacode.org/gf/project/twitter_status/frs/
Cheers!
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article ti

Post by AmyStephen » Fri Dec 28, 2007 1:10 am

Wonderful work! Really fabulous work! Please consider adding it to the Joomla! Extensions Directory as I think it will get some nice response. Also, go ahead and post it to your Google Task page. This task is complete and goes well beyond what we had originally dreamed of.

You are very talented and a real joy to work with.

Thank you for your contributions to the Joomla! community,
Amy :)

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 126 - Create a Joomla! v 1.5 Plugin to update Twitter status with article title

Post by depresz » Fri Dec 28, 2007 7:54 am

Hi,

I'm very happy and glad that I could participate in this Task.

Issue 126 on Google has been updated. http://code.google.com/p/google-highly- ... ail?id=126
Extensions Directory also updated. http://extensions.joomla.org/component/ ... Itemid,35/

Now, I'll take one day off before next task (I probably know what task I'll select... I fell in love in #125  :-*).

Thanks
Last edited by depresz on Fri Dec 28, 2007 9:28 am, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP


Locked

Return to “Google's Highly Open Participation Contest”