Link twitter user names

Creating and modifying plugins.
Post Reply
User avatar
Cowboy
Regular
Posts: 29
Joined: Wed Jul 15, 2009 8:07 pm
Location: Bottrop
Contact:

Link twitter user names

Post by Cowboy » Fri Aug 21, 2009 2:42 pm

Hello,

I found a WP plugin that automatically links twitter user names like @name in blog posts and/or comments to the user's twitter profile at twitter.com/name. Is something like that possible in s9y? The twitter plugin is not able to do this.

A second thing is link a commenter's name with his twitter profile, if it can be found via email address. I saw this in another blog, with an option box to switch linking to twitter on or off. The link was realized by a twitter icon behind the name. How can this be done in s9y?
Keep it Country,
Markus
Cowboy of Bottrop

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Link twitter user names

Post by garvinhicking » Mon Aug 24, 2009 9:47 am

Hi!

I believe you could easily do that with the "Regular Expressions" event plugin (serendipity_event_regexpmarkup). You can store a file "twitter.php" inside the plugins/serendipity_event_regexpmarkup/ directory that should look like:

Code: Select all

<?php
$regexpArray = array(
    'SearchArray' => array("/@([\w]+)/i"),
    'ReplaceArray'=> array('<a href="http://www.twitter.com/\1">\1</a>')
);


(I've now also committed that file to the plugin, should be available shortly in spartacus)

A second thing is link a commenter's name with his twitter profile, if it can be found via email address. I saw this in another blog, with an option box to switch linking to twitter on or off. The link was realized by a twitter icon behind the name. How can this be done in s9y?


Is that really done by email address? I think it would then require a Twitter API lookup, that could be harder to implement... Maybe we can push Grisha on this? ;)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
Cowboy
Regular
Posts: 29
Joined: Wed Jul 15, 2009 8:07 pm
Location: Bottrop
Contact:

Re: Link twitter user names

Post by Cowboy » Mon Aug 24, 2009 2:42 pm

Hey, thanks! I'll try it with that plugin, it looks simple.

For the second question: The text box label was about "Email-Adresse zum Twitter-Profil verlinken" ("Link email address to twitter profile") The blog where I found this is styled with a new theme, in which that feature isn't implemented anymore.
Keep it Country,
Markus
Cowboy of Bottrop

User avatar
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Re: Link twitter user names

Post by blog.brockha.us » Wed Sep 02, 2009 8:05 pm

hmm.. I have to look, if I can manipulate this link. Seems to be a nice idea, to link the name with a twitter acc. If this is possible for a plugin, the microblogging plugin seems to be the right place for it. :)

I will have a look into that.
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/

stm999999999
Regular
Posts: 1517
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: Link twitter user names

Post by stm999999999 » Mon Sep 07, 2009 8:15 pm

garvinhicking wrote:You can store a file "twitter.php" inside the plugins/serendipity_event_regexpmarkup/ directory that should look like:

(I've now also committed that file to the plugin, should be available shortly in spartacus)


hm, this new regex interferes with a private plugin of mine (serendipity_event_email_bot_OBFUSCATOR) witch makes mail-adresses clickable and have the possibility to obfuscate them with various methods. (in the moment I cannot publish it, because I am unsure about the licence).

But what this post is about:

in the moment I have deleted the twitter.php, but the next plugin-update it will be there again.

Would it be a good idea to have a option in the egexpmarkup-plugin to enable/disable the xxx.php-Files in the plugin directory?
Ciao, Stephan

Post Reply