Project

General

Profile

Actions

Feature #85

closed

Twitter List Page

Added by Matt Gold over 14 years ago. Updated over 10 years ago.

Status:
Resolved
Priority name:
Low
Assignee:
Dominic Giglio
Category name:
WordPress (misc)
Target version:
Start date:
2009-12-02
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

Let's build a list of members on twitter through the @cunycommons account (or use this list http://twitter.com/#/list/mkgold/cuny) and build a page like this: http://www.journalism.cuny.edu/twitter-lists/


Files

18.png (142 KB) 18.png Dominic Giglio, 2012-08-06 03:02 AM
twitter.doc (36 KB) twitter.doc Sarah Morgano, 2012-08-07 12:59 AM
twitter_sm_9.4.12.doc (34.5 KB) twitter_sm_9.4.12.doc Sarah Morgano, 2012-09-04 12:17 PM
Screen Shot 2013-08-21 at 8.50.53 PM.png (39.6 KB) Screen Shot 2013-08-21 at 8.50.53 PM.png Chris Stein, 2013-08-21 08:55 PM
Actions #1

Updated by Boone Gorges over 13 years ago

  • Target version set to Future release

That jschool page appears to be broken. Would like some more detail on how this might be implemented. Ie is it populated by your Twitter list, do people have to apply to be on the list, etc.

Actions #2

Updated by Boone Gorges almost 12 years ago

  • Assignee changed from Matt Gold to Dominic Giglio

Reassigning to Dom. Matt, if you're still interested in doing this, you should have a conversation with Dom about how it would be done.

Actions #3

Updated by Matt Gold almost 12 years ago

Just added the rest of the team to this as watchers. All, please feel free to chime in.

This ticket has a few goals:

1. Find a way to represent/visualize our community on twitter;
2. Enable people to find other members of our community on twitter and connect to them;
3. See what people are talking about.

The SOJ page above now appears to be non-working, so it's not a great model. Here is another one to consider; happy to look at others - http://twitter.ncsu.edu/index.php

Just FYI, our Commons account already has a list of community members that could be used on this potential page - https://twitter.com/#!/cunycommons/cuny

Like the NC State page, we may just want to present a list of recent tweets from people on our list. That would certainly be better than nothing. What would be cooler, but more involved, would be actually tying twitter accounts to CAC profiles in some way, so that people could, say, both follow someone on twitter and friend them on the CAC through this page.

Actions #4

Updated by Michael Smith almost 12 years ago

How would we choose from the list? If they are Commons members? Can we scrape the profiles on the Commons for Twitter handles too?

This topic brings to mind the idea that it would be cool if groups could have social network profiles. BikeCUNY is a group that has a Twitter account and I can imagine them synching certain activity to their Twitter feed. There would be issues to consider, such as users being able to opt in or out from this.

Syncing friending with following would be interesting. I would think that you'd possibly manage this through the social network sites both users have declared in common. When you friend someone (or join a group that has social network accounts) you would be presented with the option to follow the person or group in shared networks. I do worry though that this might come across to users as a bit invasive, or an undesired pressure.

I don't know what the technical lift would be for this, but I think it's interesting.

Actions #5

Updated by Matt Gold almost 12 years ago

This topic brings to mind the idea that it would be cool if groups could have social network profiles.

That's a fantastic idea, Michael. Can you create a separate ticket that lays out a vision for what you're imagining here? Many thanks.

Actions #6

Updated by Michael Smith almost 12 years ago

Feature request for 'Social Network Profiles in BP Groups' started here: http://redmine.gc.cuny.edu/issues/1996

Actions #7

Updated by Chris Stein over 11 years ago

http://twitter.ncsu.edu/
http://www.troy.edu/twitter/
http://socialmedia.duke.edu/
http://www.ucdavis.edu/social-media/twitter.html
http://www2.binghamton.edu/social-media/

listing a few social media sites here for some schools. Matt, I wasn't sure which direction you were looking at. Are any of these close to what you were thinking?

Michael, sounds interesting. Will check out the feature request you created.

Actions #8

Updated by Matt Gold over 11 years ago

NC State comes the closest to what I'm thinking about -- less a social media directory than a representation of our Commons community as it exists on twitter. So, something that displays the latest tweets from our community (as defined through a list, perhaps) would be great. I do like the design of NC State's page a lot.

Actions #9

Updated by Sarah Morgano over 11 years ago

Here are a couple more sites that I came across:

http://socialmedia.asu.edu/
http://isenet.ning.com/page/twitter-feed-of-isenets

I noticed that many Twitter/social media pages simply serve as directories, and I prefer what Matt suggested about having it be a feed from the community. I like how NC State also features a hashtag search, though I'm not sure which hashtags beyond #cuny and #cunyevents we would want to feature. It looks like NC State offers their code for free, but would we be able to tweak it as we see fit?

What I like about the ISENET site was that it included a message about how to opt-in to have member's tweets be included. We already have a list of CUNY twitterers, but I'm not sure if they would all feel comfortable to have their tweets included in the feed. Perhaps we could reach out to folks who we know are on the Commons and Twitter and ask their permission? It would be easy enough to pull out group twitter handles from the https://twitter.com/#!/cunycommons/cuny list, but it would be great to have members in there as well. Perhaps our @cunycommons/cuny list folks wouldn't care if they were included in the feed, but I'm not sure. What do others think?

Actions #10

Updated by Matt Gold over 11 years ago

Hi Sarah --

I think we might want to think about whether we should feature CUNY twitterers generally (ie., the members of your CUNY list) or only members of the Commons who are also on twitter. We could try to do both through different pages in the way that the ASU site does -- start off showing Commons members by default, but then have a link where people can see the larger CUNY community, too.

Actions #11

Updated by Michael Smith over 11 years ago

We might be able to pull off this page in a blog with some Twitter plugins. I can try to play around with it.

Actions #12

Updated by Chris Stein over 11 years ago

I looked quickly at the ones we had Michael and didn't see any that let you put in multiple twitter accounts for one spot. We may have to take something like one of those and modify it so that it can accept multiple accounts.

Also if we show a list of tweets by Commons members, which sounds like a good idea, it might be nice to make something custom so that we could include a link to their profile on the Commons.

Normally I'd think that an opt in would be the way to go on this. However that will mean that we will have a limited number of feeds to start and that we will have to do some more programming to allow people to opt in (or like with the ISENET allow people to send someone an email to opt in).

In the end I think that an automated system where people could click somethings in their profile to show their tweets in their profile, in this sitewide page (or both) would be a nice option. If we go that route we might also start thinking about other social media to include. LinkedIn information for example might be something some people would want on their profile page.

Actions #13

Updated by Michael Smith over 11 years ago

Thanks for looking into the plugins, I'm hoping to find one that works with a Twitter list. That way we could manage the curated list via Twitter and feed to the site. Though that would not allow for a 'hands-free' opt-in or opt-out process.

I'm a little on the fence about opt-in, these are public feeds we're talking about. Could we add all the Commons members to the feed list and then send out a notification asking members to let us know if they'd like to opt-out? This would make for a more robust start to the page.

Actions #14

Updated by Matt Gold over 11 years ago

Though I'm generally a fan of opt-in, in this case I agree with Michael that opt-out is the way to go given the public nature of the feeds. I do like Chris's idea of possibly connecting twitter posts to Commons profiles.

Actions #15

Updated by Michael Smith over 11 years ago

I played around with the existing Twitter plugins on the Commons, but I couldn't find one that would allow us to flexible embed Twitter lists and and Twitter search streams. But I think I've found one that could work for our purposes -

Garee's Twitter stream is a plugin that uses a customizable shortcode for embedding Twitter streams really easily pretty much anywhere. http://wordpress.org/extend/plugins/garees-twitter-stream

Here's an example where I've embedded the Commons current current list on my site:

https://twitter.com/#!/cunycommons/cuny

displayed here:

http://www.michaelbransonsmith.net/blog/twitter-stream/

Actions #16

Updated by Matt Gold over 11 years ago

Thanks, Michael. That twitter plugin looks promising, though we might have to hack it to get some advanced functionality, such as possibly connecting tweets/twitter accounts to Commons accounts. But I agree that this is a good start and that it does a very nice job on visual presentation -- many thanks.

Actions #17

Updated by Michael Smith over 11 years ago

What do you think about moving forward with the Commons Twitter page first, and then adding other features as we move toward widgetizing profiles. If we clear the Garee plugin for the next release (assuming dev feels good about it), we could build the page immediately after. I was thinking we could display a Twitter list of Commons members as well as a search result for 'cunycommons.'

- Michael

Actions #18

Updated by Matt Gold over 11 years ago

I'm on board with that plan, Michael. Can you create a separate ticket for the new plugin request?

Actions #19

Updated by Michael Smith over 11 years ago

All set with the new ticket:

http://redmine.gc.cuny.edu/issues/2010

Actions #20

Updated by Dominic Giglio over 11 years ago

To all my fellow Commoners (well the ones watching this issue at least),

I've been monitoring this discussion and really like all the great ideas. I've created a single WordPress template page that includes all the PHP/HTML/CSS/JS needed to implement as much of the functionality discussed here as I could. I tried to use the NC State page as a rough guide since it seems that most of you liked that design, but I styled it to fit our current theme. I've attached a screenshot to give you all an idea of what it looks like.

Boone, the page/code is still a little rough but you shouldn't have any problems getting it loaded up. Just create a page in the admin and set it's template to "Twitter Stream", then visiting [YOUR_DEV_URL]/twitter (or whatever you name the page in your env) should load up all the different feeds. There isn't much optimization right now, and by that I mean Twitter API query optimization, but it should give everyone enough to talk about as a first revision. Could you get it up on cdev for everyone to poke and prod please?

There is one issue that everyone needs to be aware of. In an attempt to skip OAuth (Boone you know what I'm talking about) I am using only Twitter's publicly available API endpoints. The drawback/tradeoff to this is that the feeds are "rate limited." Twitter allows only 150 requests per hour before blocking access. I don't think this would be an issue in production (although I don't have our traffic stats in front of me), but if everyone starts hitting the cdev page at once there's a chance we'll hit the limit. Just wanted everyone to be aware.

Boone (again), I have no problem splitting the file up into separate template / css / js files, I just wanted to keep it contained at first so there were fewer files to worry about (and I avoid our main css file like the plague! LOL). Would you please take a look at web inspector (or firebug) in your env? I'm doing something wrong, it seems to be loading the code that belongs in <head> all over the page.

Here's the topic branch: https://github.com/castiron/cac/commits/twitter-page

I hope everyone likes my vision for this feature. Please let me know what you think I've done wrong as well as right.

Actions #21

Updated by Boone Gorges over 11 years ago

Thanks, Dom. Looks cool.

Everyone - Page is available here: http://cdev.gc.cuny.edu/twitter/ You may have to click one of the menu items to get the first set to load; ignore this bug for the moment.

Dom - Yeah, we can talk about optimization at some later point. For the Twitter data, I'd suggest doing the API calls server side, so that we can stash the results in a transient; your JS would then make requests against the Commons, rather than directly against Twitter. I don't care too much how we organize styles, etc.

Actions #22

Updated by Sarah Morgano over 11 years ago

This is great, thanks for your work Dom! The only strange thing I noticed was that the links/hashtags/usernames are not currently clickable.

Actions #23

Updated by Dominic Giglio over 11 years ago

Matt, I will start looking into re-coding as a half server side / half client side implementation.

Sarah, linking inside the tweets is not as easy as it sounds. :-)

I wanted to get the page up before really diving in and creating the functionality everyone expects when looking at a tweet (i.e. clickable links and hashtags). That info comes from twitter inside the json response but in a different location. So the code needs to examine each tweet (or status update as twitter referees to them) to determine if hashtags and links are embedded and then take action to turn them into hyperlinks when appropriate.

Actions #25

Updated by Dominic Giglio over 11 years ago

Awesome!! I love that it's only 22 lines of code!!

I will use this in the next version of the page, which will follow Matt's recommendation and implement server side API calls and client side JS that queries our server.

Actions #26

Updated by Boone Gorges over 11 years ago

Matt's recommendation and implement server side API calls and client side JS that queries our server.

That was me. I'm not sure how much Matt knows about performance issues regarding transient caches and server- vs client-side API calls :)

Actions #27

Updated by Dominic Giglio over 11 years ago

HAHA!! That's just too funny. I was impressed by his knowledge of server side WordPress versus client side Javascript!!! :-)

Actions #28

Updated by Matt Gold over 11 years ago

I totally know all that stuff - just didn't feel like sayin it.

Actions #29

Updated by Chris Stein over 11 years ago

Dom, thanks for stepping in and doing the work, it looks great. I think with the links in there it will be great. Boone, I noticed your code only did hashtags and mentions. I'm assuming we'll add in a check for urls as well. Luckily they're all the same format so it shouldn't be too hard (I found this page when I wondered how hard it would be to change less well formed links, http://www.codinghorror.com/blog/2008/10/the-problem-with-urls.html).
Server-side caching sounds like a great idea too.

After that I think the only thing left is to figure out the names for the different categories of tweets on the right. I think the @cunycommons links are fine. For Community Tweets I think it's less clear. "Community Tweets" box name might be changed to CUNY Tweets. People won't know what the CUNY List Tweets is. Members should be made clear that it is members of the Twitter list and not the Commons; similar for subscribers.

Do we want to look into adding Tweets from Commons members this round? Perhaps that would be a third box "Commons Members' Tweets?"
If we do I agree with the general consensus that we override our implulse to opt-in and since Twitter is public and the member put it in their profile then we are within our rights to use it. I'm assuming that it will be too complicated to add in the opt-out option since that requires more work.

Perhaps we can tie the opt-out into the new privacy settings in some future version and only add tweets from people who have made their Twitter id public in their profile?

Finally, do we think there is a need to explain what the Twitter jargon ( @, #, mentioon, tweet ) means?

Actions #30

Updated by Sarah Morgano over 11 years ago

Do we want to look into adding Tweets from Commons members this round?

If it's a manual thing, I'll volunteer. I can work off of the CUNY list. If it's something that can be extracted from the site with some awesome code that's way beyond my knowledge, even better.

Finally, do we think there is a need to explain what the Twitter jargon ( @, #, mentioon, tweet ) means?

I think it'd be nice to provide some information about Twitter and perhaps link to some resources. I'll work on copy for this page.

Actions #31

Updated by Dominic Giglio over 11 years ago

Sarah,

My advice would be to look at the NC State page again. They'e got some nice simple copy that we can use. I was planning on adding something similar to their's once I got some feedback on my current design.

Actions #32

Updated by Sarah Morgano over 11 years ago

Feel free to tweak as you see fit.

Best,
Sarah

Actions #33

Updated by Matt Gold over 11 years ago

Just taking a look at the twitter page for the first time. Fantastic work, Dom! And thanks to the rest of the team for tweaks and suggestions. Great work.

Actions #34

Updated by Dominic Giglio over 11 years ago

Thanks Matt, all the feedback here made the design a lot easier.

Actions #35

Updated by Sarah Morgano over 11 years ago

I've created a list for members of the CUNY Academic Commons: https://twitter.com/#!/cunycommons/cunycommons. It currently has 70 members. I made sure to pick out twitter handles that are listed on the person's profile page.

Actions #36

Updated by Matt Gold over 11 years ago

Wow -- that took some intensive work, Sarah -- thank you. What was your process? I wonder whether there is a way for Boone to export a list of all accounts in the database that don't have the twitter field set to null as a way to check to make sure we got everyone. Boone, what do you think?

Actions #37

Updated by Sarah Morgano over 11 years ago

Hi Matt,

It didn't take me too long, but I didn't go through every page in the member section. I added folks who I knew were both on Twitter and the Commons (and checked their profiles to make sure they had the twitter icon) then I just browsed through the member directory (until around page 18) and clicked on profiles that had more than one or two details listed.

Do we want to look into adding Tweets from Commons members this round?

If it's a manual thing, I'll volunteer. I can work off of the CUNY list. If it's something that can be extracted from the site with some awesome code that's way beyond my knowledge, even better.

Best,
Sarah

Actions #38

Updated by Boone Gorges over 11 years ago

I just sent a list to (don't want to post it publicly - spammers)

Actions #39

Updated by Sarah Morgano over 11 years ago

Boone = awesome

Actions #40

Updated by Matt Gold over 11 years ago

Hi all,

Just came across this social media page from Stern -- http://www.stern.nyu.edu/experience-stern/social/index.htm . The layout is a bit too tightly packed for my taste, but its functionality (click on the name of a social media platform, see content streamed on the page) is somewhat similar to what Dom implemented for us. Another model to consider as we move forward.

Actions #41

Updated by Sarah Morgano over 11 years ago

I just updated the list adding accounts with _ > 0 tweets. There are a total of 282 members: https://twitter.com/#!/cunycommons/cunycommons/members. In other news, I learned that the number of members in a list cannot exceed 500, which is what the https://twitter.com/#!/cunycommons/cuny list is maxed out at. = (

Actions #42

Updated by Matt Gold over 11 years ago

Hi Sarah,

Thanks. I'm assuming that you'll create a secondary list to accomodate additional accounts, right?

best,

Matt

Actions #43

Updated by Sarah Morgano over 11 years ago

Hi Matt,

I wasn't really sure what the best thing to do was, but that would work.

Thanks,
Sarah

Actions #44

Updated by Matt Gold over 11 years ago

  • Target version changed from Future release to 1.5
  • Severity set to Normal
Actions #45

Updated by Dominic Giglio over 11 years ago

Boone,

I've got a redesigned twitter page to show everyone. Is cdev available for testing?

Actions #46

Updated by Boone Gorges over 11 years ago

Yup, it's all yours.

Actions #47

Updated by Dominic Giglio over 11 years ago

Hello once again fellow Commoners,

A little over a week ago, before I got caught up in all the glamor and excitement of being a part of the 1.4.3 release, I completely rewrote my initial twitter page as per Boone's suggestions. It is now a single page collection of PHP, Javascript, HTML and CSS - all working together from the server to the client, in order to provide a custom twitter stream in a single drop in file.

It now uses PHP on the server to communicate with the twitter api (as opposed to all Javascript in the first version), and stores responses in the transients portion of the database to help control twitter's rate limits. All ajax calls now go directly to this page which will return responses from our database if they exist, or fetch new data from twitter if they don't (or have expired).

There is one known bug in the current code: clicking on the '#cuny' link in the sidebar will load tweets containing that hashtag, but clicking it a second time causes an error that prevents them from being displayed. I am working on this now. Everything else on the page should work as you'd expect.

Here's the page on cdev: http://cdev.gc.cuny.edu/twitter/

Sarah, thank you for all the text and instructions - it made the design SO much easier for me. :-)

Boone (and anyone else interested), here is the commit showing almost all of the redesigned code:

https://github.com/castiron/cac/commit/f3e1727bc6192f47e83a124a295d59fcf0dc8089

The bug I mentioned above is occurring at line 151. That method is receiving a $name from an ajax request. The js takes the name from the rel attr of the link clicked and requests that data through an ajax call. For some reason it is only the rel="cuny_hastag" link that is causing this error. I probably have a stupid misspelled variable somewhere, but I have been from top to bottom in the file over and over and the bug just doesn't make sense. If you have a few minutes and feel like looking at it I would appreciate it.

As always, let me know what you think. I hope this version address more of the great ideas from everyone above.

Actions #48

Updated by Matt Gold over 11 years ago

Looks fantastic, Dom -- nice work!

My only major suggested change is adding a short explanation of the "CUNY Twitter List." I believe it's a list of Commons members on twitter rather than a full list of all CUNY people on twitter.

This is great work and will be really fun to use and build on.

Actions #49

Updated by Dominic Giglio over 11 years ago

Chris expressed the same concern above. I will get a little description in there for the next revision.

Glad you like it so far though.

Actions #50

Updated by Boone Gorges over 11 years ago

Hi Dom,

Really great work on this. The implementation is quite elegant. (If it were for distribution, I would recommend a different architecture, but for a site-specific theme template file, this is excellent and efficient.)

Just a couple of technical notes. I pushed the following changeset https://github.com/castiron/cac/commit/f7b41149c72cfac7a38b136527e61c9d3601850a, which contains these mods:

- Fixes a couple of WP_DEBUG warnings
- Swaps out use of file_get_contents() for wp_remote_get(). wp_remote_get() is a procedural wrapper for the WP_Http class. That class is pretty sweet. It basically consists of a stack of PHP tools for HTTP transport, beginning with cURL, through fsockopen and file_get_contents(), etc, and chooses the best one it can find. This is especially important for code that has to run on different setups (file_get_contents() was returning an empty string for me, for some reason, while cURL worked).

Other than that, looks great. Thanks for your hard work on it! Though I think that turning this into a real plugin would take a prohibitive amount of work, it's definitely worth sharing - maybe at some point in the next month or so, you could think about writing a short piece for the dev blog on how it's built, and how someone could integrate it into their own theme.

Actions #51

Updated by Dominic Giglio over 11 years ago

Thank you sir, I'm glad you like it. While redesigning from all js to js/php I thought about just turning it into a plugin, but some of the implementation is so Commons specific that I decided against it. I used the NC State page as both a design and distribution example. I think we should make a little repo for it on the Commons Github account, I'll link to it in the bottom of the sidebar, and I will definitely write up a little tutorial on our dev blog once we take it live. I'll explain how it works and how another school/institution could incorporate it into their site as a drop-in twitter page template.

I'm going to look into your changes between classes today, I'm wondering if it fixes the #cuny issue I'm experiencing? I haven't had a need to use the WP_Http class so I am unfamiliar with it and wp_remote_get(), sounds very cool though.

Actions #52

Updated by Sarah Morgano over 11 years ago

This looks great, Dom!

Here's a link to the new list I created that only includes members on the Commons who had their handles listed on their profile: https://twitter.com/#!/cunycommons/cunycommons. You may want to change all references from the 'cuny' list to the new 'cunycommons' list. I've attached an updated copy of the Twitter page that includes the changes.

Thanks again for your work on this and I can't wait to see it live on the Commons!

Best,
Sarah

Actions #53

Updated by Michael Smith over 11 years ago

It's looking really great Dom. A quick one, were the headers "@cunycommons" and "CUNY Twitter List" supposed to link to something specific? When I click on either of them the space for tweets goes blank.

Actions #54

Updated by Dominic Giglio over 11 years ago

Interesting, @cunycommons is supposed to link to our twitter stream on twitters homepage. I don't remember linking "CUNY Twitter List." I will research this tonight and see what's wrong.

Actions #55

Updated by Chris Stein over 11 years ago

Hi Dom, great work. Re Michael's comment on the titles. Perhaps it is easiest to just not make any of them links. For @cunycommons you could add a link at the bottom that is something like "visit @cunycommons on Twitter." For the CUNY Twitter List, there could be the explanatory text IDK what, Sarah, maybe you can write a brief explanation. I am a bit confused as to how people get on the list. Also if we list the subscribers then we should explain under that how a people can subscribe themselves.

I also still think that the links should be active. I believe that all links in Tweets are now converted to http://t.co/******* format so writing a regex shouldn't be too hard. I did find in the API that you can use to get information on all of the links in a Tweet: https://dev.twitter.com/docs/tweet-entities. It seems a bit more complicated than needed but it does allow you to know what links are media and which are to web pages in case you wanted to do something special with images or whatever in the future.

Best,
Chris

Actions #56

Updated by Dominic Giglio over 11 years ago

I figured out Michael's issue last nite, those links are currently being intercepted in my js code and rendered "unclickable" by a call to preventDefault(). I'm pretty sure I can correct this by adding:

if (e.target.href == "#") {
  e.preventDefault()
{

Or something similar to that. So we can leave those links there or move them per your suggestion, it doesn't matter to me. If anyone else agrees with Chris' idea let me know and I will create a separate section in the sidebar, or bottom of the page, for external links to our various twitter pages.

You are correct about tweet-entities, that's exactly what I was referring to when I responded to Sarah in comment 23 above. I was hoping to stay away from parsing the tweet-entities to save myself a little bit of work, which I was able to do by incorporating Boone's twitterize() method mentioned in comment 24.

I agree that all links should be active. I meant to mention that to Boone above. I have a commented out line in the twitterize() method that, once completed, will turn the rest of the links inside of a tweet into functioning hyperlinks. I started writing it but my regex skills are a little rusty, I was hoping Boone would jump in and whip up a quick regex to complete the functionality of that method.

Actions #57

Updated by Chris Stein over 11 years ago

Hi Dom,
I believe (could be wrong didn't have time to check properly) that all tweets inside of the API have the same URL format (http://t.co/alphanumeric). It certainly seems to be true of the tweets you are displaying. That make the regex a bit easier. Something like:
(http://t\.co/)+\w+
should work.

If you want I did find this code on github that parses out the tweet entity stuff:
https://github.com/themattharris/tmhOAuth/blob/master/tmhUtilities.php

Actions #58

Updated by Chris Stein over 11 years ago

It tried to linkify my regex so just be aware that the parentheses around the http stuff are supposed to be there

"(http://t\.co/)+\w+"

Actions #59

Updated by Dominic Giglio over 11 years ago

Yup, your regex seems to do the trick because all http links in each tweet appear to follow that "*t.co*" pattern. Some of the list member's and list subscriber's descriptions aren't being linked though, because they don't follow a similar pattern. Some have http://, some just say [site].TLD. We should discuss whether or not these descriptions even need to be linked. Clicking on the persons name will take you to their Twitter page anyways.

Boone's change to using wp_remote_get() seems to have fixed the #cuny tweets issue.

I'm making some changes today (mostly to address the changes to the cuny list by Sarah in comment 52) and will have the newest version up as soon as I can.

Actions #60

Updated by Dominic Giglio over 11 years ago

I've updated the twitter-page branch:

1.) switched to cunycommons list
2.) added regex to parse http links in tweets (thanks Chris)
3.) fixed sidebar links issue
4.) updated twitter instructions copy (thanks Sarah)

Commit: https://github.com/castiron/cac/commit/5293d3afba6eeffb016565cf3ab8084569a5d671
updated page: http://cdev.gc.cuny.edu/twitter/

Boone,

I am still experiencing that really weird (sporadic/random) issue that prevents a specific stream from being displayed. At first it was the #cuny stream, now it's the tweets from the cunycommons list. If you put a var_dump( $this->streams[$name] ) at line 145 of the render_html() method you will see that all streams return an array except the cunycommons list tweet stream. What gets returned is the string of serialized data from the transients table, which throws the foreach() on line 147 into a panic. Do I need to (cast) something to ensure an array will always be returned?

Actions #61

Updated by Boone Gorges over 11 years ago

Do I need to (cast) something to ensure an array will always be returned?

You shouldn't - that stuff should be unserialized properly by the get_transient() function. It's not really a fix for the underlying issue, but you can always run the value through the WP function maybe_unserialize() before attempting to work with it - as the name suggests, that function will unserialize the data if needed.

It could be that something in the data object you're storing in the transient is causing PHP's serialize() function to barf. This sometimes happens when you have to double and triple escape stuff (like XML documents). So it could be that you're getting back what looks like a serialized string, but is actually malformed for some reason (which is why get_transient() isn't successfully parsing it). If nothing else, in addition to the maybe_unserialize() suggestion, you could have a fallback such that if the output of maybe_unserialize() is still not an array, then just kill the transient and get new data from Twitter.

Actions #62

Updated by Dominic Giglio over 11 years ago

I'll try out maybe_unserialize() when I get home from class tonight.

Actions #63

Updated by Dominic Giglio over 11 years ago

Boone,

It looks like maybe_unserialize() did the trick. I tried to test it as much as I could. Clearing out the transients table over and over and clicking links in a different order every time. I haven't seen the unserialized string error since adding that method. I've also created a repo for this code on the cuny-academic-commons account and wrote up a little readme. I also updated the link at the bottom of the sidebar to point to it.

I believe there is only one thing left for this first revision: figuring out a better description for the "list" section of the sidebar to make it a little more explanatory for non twitter veterans. We've discussed a few fixes above but I need a little direction as to which way we would all like to go. Should I place some text in the sidebar? Or maybe a paragraph above or below each stream when a visitor is viewing tweets/members/subscribers from the list? As soon as we work this out I think we'll be ready to throw it in the next release.

I have plans for revision two, but would like to see how revision one works in the wild before I start them. Mainly I would like to improve the loading of tweets so a visitor can request that more (older) tweets be loaded. Right now I've only been working with the basic defaults from twitter, which are like 15-20 responses per request. But there are ways that you can tell twitter to paginate the results, which I think would be a nice feature for rev 2.

Actions #64

Updated by Boone Gorges over 11 years ago

Where do things stand here? Are we ready to roll with this for 1.5, or does more need to be done? (From what I remember, it's working pretty well as it is.)

Actions #65

Updated by Dominic Giglio over 11 years ago

The topic branch has been patiently waiting for us to move towards 1.5.

I will revisit the code over the break and make sure it still works in the 1.4.x branch.

I believe it is ready for an initial release in 1.5. I would like to see how it works in production and get feedback from the team/community on how I can improve it.

Actions #66

Updated by Matt Gold about 11 years ago

Hi Dom -- where do we stand with this? I just visited the page on cdev and it's not working.

Actions #67

Updated by Dominic Giglio about 11 years ago

There have been a lot of WordPress updates since i first wrote it, I need to go back through the code and see where things are breaking.

I spoke to Boone about it at the meeting. He said it was still something we wanted for 1.5 so it's on my to do list. It shouldn't be too hard. Probably just a change to the way ajax is being handled, or the updates to WordPress' core support files like Javascript.

Could also be a twitter change, it'll definitely be ready for 1.5.

Actions #68

Updated by Matt Gold about 11 years ago

Thanks, Dom. I'd like to incorporate this, too, into a new CBOX install that my lab will be building for the DH Community in NYC. How long do you think it will take to update this and can we incorporate into a new CBOX install?

Actions #69

Updated by Dominic Giglio about 11 years ago

Well, it's pretty specific to the commons. I didn't build it as a plugin because there are so many Twitter plugins and we just wanted a page for the commons that looked like all the links that were referred to above throughout this whole conversation.

But that being said, I don't think it would be difficult to change a few urls to make it work with your site. I tried to design it in a way that would allow others to tweak it for their own implementation. Since you want to use t for another project I'll look at the code today and see where the problem is. That way we can discuss what would need to be tweaked to make it work with your CBOX project.

Actions #70

Updated by Matt Gold about 11 years ago

Okay -- thanks very much, Dom.

Actions #71

Updated by Dominic Giglio about 11 years ago

Matt, Boone,

The topic branch I was working on was so old that I just dumped it and created a new one off the latest 1.4.x branch. I re-added the cad-twitter-stream.php template that I created and verified that the page is still working as originally designed. So it's ready to be included in v1.5 whenever we're ready to release.

Matt,

Go ahead and give me the details of your new CBOX project and I'll create a version that can be used with that install.

Actions #72

Updated by local admin almost 11 years ago

i don't know if this is helpful -- or related -- to this thread but i started this resource on the wiki:

http://commons.gc.cuny.edu/wiki/index.php/CUNY_on_Twitter

it's all manual, and i planned on combing through the CUNY accounts for followers of reference.

just thought i'd mention i made this.... if it could tie into this project (which i think is a great idea).

erika

Actions #73

Updated by Matt Gold almost 11 years ago

Awesome work, Erika!

Actions #74

Updated by local admin almost 11 years ago

thanks matt... next week i was going to sit down and figure out a quicker methodology for capturing the twitter handles and links and stuff. i'd like to also organize the categories more effectively, especially for academic depts. ideas / feedback is welcome!

Actions #75

Updated by Dominic Giglio almost 11 years ago

Very cool, thats an awesome resource

Actions #76

Updated by Micki Kaufman almost 11 years ago

Hi Dom: does anything more need to be done on this issue? We'd like to slate it for the next upcoming major release.

Actions #77

Updated by Dominic Giglio almost 11 years ago

Nope, this one is ready. The changes and new features are still in the source control (git) topic branch that I used to create this feature, but that just means that it only needs to be merged into the branch that we're using to release the 1.5 version when the time comes.

I would like to review it on my local machine one more time right before we release, but the changes are pretty isolated (I did that on purpose). So I don't expect any errors/problems/conflicts when the time comes for me to merge this feature into the 1.5 branch. You can mark this feature as ready to go for version 1.5.

Sorry about the technical speak about "source control" and "branches" and "merging." I'm not sure how else to explain it, and I'm not sure how familiar/comfortable you are with source control management. Let me know if this update confuses more than informs. :-)

Actions #78

Updated by Boone Gorges almost 11 years ago

Awesome - thanks, Dom! I'm comfortable with you merging into the master branch whenever you're comfortable, as the features have been hashed out pretty thoroughly above.

Actions #79

Updated by Dominic Giglio almost 11 years ago

Boone,

I don't see a 1.5 or 1.5.x branch currently in our git repo. Does this mean that 1.5 will be released from master and then a 1.5.x branch will come off of master after the release for continued development similar to the way we develop and release off of the 1.4.x branch now?

Because of my lack of "advanced" git skills I'm worried about merging my twitter-page topic branch into master because it was branched from 1.4.x. Wouldn't this also merge other 1.4.x changes into master? Or is git really that smart? Or does master already contain 1.4.x changes? I never work with master so I am never sure of it's status in the overall state of the git repo. My new twitter functionality is so contained (it's just a new page template in our bp-nelo theme), I could just check out master in my local dev and paste the templates contents into a new file. This would allow me to also test the features to make sure they work in master.

Let me know what you think the easiest route will be. As soon as I've merged we can checkout on CDEV and make sure it's operating the way we all want it to.

Actions #80

Updated by Boone Gorges almost 11 years ago

Does this mean that 1.5 will be released from master and then a 1.5.x branch will come off of master after the release for continued development similar to the way we develop and release off of the 1.4.x branch now?

Correct.

Wouldn't this also merge other 1.4.x changes into master?

For one thing, I merge the 1.4.x branch into master after every release, so that the master branch contains all the fixes that go into minor releases. And if your fork point from 1.4.x is way in the past, it shouldn't be an issue, because Git is smart enough to see that there are changesets with more recent timestamps that should supercede whatever you've got in your topic branch.

In any case, try merging your topic branch into master on your local checkout. Worst case scenario, do a `git reset --hard` to undo your changes, and let me know what went wrong.

Actions #81

Updated by Dominic Giglio almost 11 years ago

Awesome, I'll merge today and report back with the results after testing to make sure all the features still work as expected.

Actions #82

Updated by Dominic Giglio almost 11 years ago

OK, as it turns out, the recent deprecation of v1.0 of Twitter's API (in favor of moving completely to their new v1.1) completely hosed my twitter list page. The new API hides everything I was using previously behind their OAuth authentication wall (and yes Boone, I can see you cringing). I spent a few hours last night going through Twitter's dev docs looking for a simple solution. I first considered turning this into a plugin but decided against that for now because it's going to take a TREMENDOUS amount of work to accomplish.

I instead opted to use their new oembed API in an attempt to salvage as much functionality from the old version as possible. It's good news and slightly less good news. I was able to recreate most of what the old version offered. There are a few features that I couldn't recreate (the list members and list subscribers most notably). But overall the feature set remains intact and if this page becomes more and more popular I can revisit a possible full-blown plugin version. There are so many twitter plugins I don't think we want to go down that path now though, at least not for the foreseeable future.

Becuase my code doesn't touch anything on the site (it's just a theme template), I've merged my twitter-page topic branch into master and pushed it up to our repo. This way the next time master is checked out on CDEV we can all take a look at what has and has not changed. I still feel this is ready for the 1.5 release.

Commit: https://github.com/castiron/cac/commit/d372e58742dc16c5fac688c11547e251a3f0c7fe

The main difference now is that it requires "Twitter Widgets" be created to query for different types of timelines (user, lists, searches, etc). As of right now the template is querying four widgets I created in my personal Twitter account settings, so I will need the @cunycommons password to create the appropriate widgets before we release 1.5.

I've pushed all the new code to the CAC Twitter Stream repo and updated the README to explain what the latest version does, how it operates and how it can be customized to drop into another theme.

Boone,

Let me know the next time you pull master onto CDEV and I'll login and setup a page to do some initial testing and update everyone here.

Actions #83

Updated by Matt Gold almost 11 years ago

Thanks, Dom. Sorry to hear that twitter's API changes caused so much pain, but it sounds like you've been able to work things out. Please email Sarah (cc'ing me) for the twitter credentials. Looking forward to checking this out on CDev when it's ready.

Actions #84

Updated by Boone Gorges almost 11 years ago

Hi Dom - I've pulled the latest master to cdev, so please feel free to set up whatever you need.

Actions #85

Updated by Sarah Morgano almost 11 years ago

Hi Dom, I can't remember if you were going to include lists on the Twitter page, but I just wanted to let you know that I've updated the 2 Twitter lists for the @cunycommons:

https://twitter.com/cunycommons/cuny (746 members)
https://twitter.com/cunycommons/cunycommons (436 members)

Actions #86

Updated by Dominic Giglio almost 11 years ago

Thanks Sarah.

I've tested and verified that the Twitter page currently on CDEV works as designed and expected. It is however still using my test widgets from my personal twitter account.

I've created the new widgets on the @cunycommons twitter account and updated the template to use those. If you haven't checked out the Twitter page, and would like to, head over to http://cdev.gc.cuny.edu/twitter and check it out. The new @cunycommons widgets will appear the next time Boone pulls the master branch onto the CDEV server (Boone, would you please notify us the next time you pull?). I've also created a sub-menu item under the About menu in the main navigation called @cunycommons that will load the twitter page.

One nice aspect to the new design is that because I am now forced to use these Twitter Widgets, the timelines that render in the main content area are a lot more "feature rich." They allow favoriting, replying and retweeting right inside the timeline and they also allow visitors to tweet to @cunycommons from the bottom of the timeline. So it turns out the deprecation of the old Twitter API was both a blessing and a curse. It's like we have our own personal twitter homepage embedded in our custom twitter page.

Latest Github Commit: https://github.com/castiron/cac/commit/f740fa40cf0bdc3060db803686d77d070fcae539

Actions #87

Updated by Sarah Morgano almost 11 years ago

Thanks for the link, Dom. I was just poking around the page and have a couple of notes/questions:

  • The "What is Twitter" page's content is cut off at the bottom
  • The "Mentions" also include RT's, perhaps it should be changed to Mentions/Retweets?
  • Should links that take you out of the Commons open in a new window (e.g. Mashable, Download the Source)?
  • The arrows in the right nav. look a little wonky in my FF browser. Is there something better we can use there, or perhaps just another type of arrow?
  • Did we want to include the #cunyevents hashtag? (It's not really being used now, but will pick back up in the fall.)
  • Did we want to include the @cunycommons/cuny list? (Not sure if this makes sense/is appropriate because I've added everyone and anyone I know associated with CUNY to this list.)
Actions #88

Updated by Dominic Giglio almost 11 years ago

The "What is Twitter" page's content is cut off at the bottom

I'll check this out, didn't notice that, but I was paying more attention to the timelines.

The "Mentions" also include RT's, perhaps it should be changed to Mentions/Retweets?

Pretty sure I set the widgets to not display RTs but I'll double check that setting.

Should links that take you out of the Commons open in a new window (e.g. Mashable, Download the Source)?

This is a debate that has been ongoing since links were invented. Some say you should open in a new window so you're not taking visitors away from your site. Others say that users undertand how to use a back button and get messed up/confused when they're forced to load a page in a new window. I'll leave this up to the rest of you. I vote for not opening in a new window, but will do whatever the team wants.

The arrows in the right nav. look a little wonky in my FF browser.

I'll double check in FF and see if I can come up with a better solution or just get rid of them

Did we want to include the #cunyevents hashtag?

I'm not familiar with how we use this hashtag so I'll wait for input from Matt or someone else. I can add it no problem if that's what we want.

Did we want to include the @cunycommons/cuny list?

Both of the lists you linked to above:

https://twitter.com/cunycommons/cuny (746 members)
https://twitter.com/cunycommons/cunycommons (436 members)

will be on the twitter list page once the master branch is updated on CDEV. Right now it's still pulling from the test widgets I created in my personal twitter acct.

Actions #89

Updated by Boone Gorges almost 11 years ago

cdev is now running the latest master branch.

Actions #90

Updated by Dominic Giglio almost 11 years ago

Thanks Boone. Aside from the issues Sarah raised it's looking pretty good.

Sarah,

I definitely need to add some min-height to that main content area. I checked on the RTs and there is no way to prevent them. I can only prevent replies from being displayed. You should be able to see both lists in the sidebar now. I will update when I've had a chance to look into the other issues.

Actions #91

Updated by Matt Gold almost 11 years ago

Excited to see this moving forward. Thanks, Dom. Like Sarah's ideas about adding #cunyevents and the cuny list.

Actions #92

Updated by Dominic Giglio over 10 years ago

Sarah,

I've updated the twitter page to fix the height issue on the "about" page. We won't be able to see the changes on CDEV until the next time Boone pulls the master branch to that server.

Boone, could you let us know when you do that?

I looked at the page on CDEV in Firefox and I'm not seeing the arrow issue you mentioned. Could you please post a screenshot for me when you have a chance?

Actions #93

Updated by Boone Gorges over 10 years ago

Hi Dom - Just checking on the status of this. http://cdev.gc.cuny.edu/twitter/ is not working for me as I'd expect. In FF, none of the "Our Tweets" links do anything - and I get no console errors. In Webkit, the Tweets load initially, but the links also don't do anything. Maybe I'm doing something wrong?

Actions #94

Updated by Matt Gold over 10 years ago

Hmmm. Everything looks good (beautiful, in fact) to me on OS X/Chrome. Perhaps this has something to do with your super-secure privacy settings, Boone?

Actions #95

Updated by Boone Gorges over 10 years ago

If it's working for others, I'm happy to mark the issue resolved. I'd like feedback from Dom before continuing.

Actions #96

Updated by Dominic Giglio over 10 years ago

It was working fine the last time you checked out master, I double checked to make sure because I needed to verify the height issue reported by Sarah. Now I'm getting this error in the console:

GET http://cdev.gc.cuny.edu/wp-includes/js/jquery/jquery-1.10.2.min.map 401 (Authorization Required)

Never seen a 401 while loading a JS file? Have you Boone?

Actions #97

Updated by Dominic Giglio over 10 years ago

Boone,

Did we just recently upgrade to jQuery 1.10.2?

My twitter page template pulls in some JS from Twitter (this is the only way their new API will work without a full blown oauth solution), maybe they're relying on a previous version of jQuery? Maybe they're not ready for 1.10.2?

Actions #98

Updated by Boone Gorges over 10 years ago

Yes, WordPress 3.6 ships with jQuery 1.10.

I can't reproduce the 401 error you've described, Dom. We have HTTP authentication set up on cdev.gc.cuny.edu, so it's possible that Twitter is trying to load our local version of jQuery remotely, and running into the auth. I have no idea why it would need to do that, but it's possible.

I did get a different problem, which seems to be on Twitter's end: https://dev.twitter.com/discussions/20793

Actions #99

Updated by Chris Stein over 10 years ago

I do see both the error with widgets.js (Dom I'm assuming this is the js from Twitter since it isn't showing in the resources?) on line 8 which is what Boone linked to in that discussion (they have an official issue on that as well, but it mentions 503 error https://dev.twitter.com/issues/1253). Maybe it's some combination of Twitter's issue and the authentication on the dev site?

I'll attach a screenshot of my console in Chrome OSX. Dom did you try running the code on a standalone page and see if it worked off the commons?

Actions #100

Updated by Boone Gorges over 10 years ago

  • Status changed from Assigned to Resolved

Hi all - I've checked again this morning, and the page is working as expected. So I'm guessing that this was a Twitter-level issue that was resolved on their end.

I'm marking this issue as resolved. If there are further refinements, let's handle them in later iterations. Dom, really great job on this one!

Actions #101

Updated by Dominic Giglio over 10 years ago

Thanks Boone.

I can confirm that it is also working again for me, both on CDEV and locally. I am still getting an error in the console, but it no longer appears to be breaking the page. The error is actually very weird:

On CDEV:
GET cdev.gc.cuny.edu/wp-includes/js/jquery/jquery-1.10.2.*min.map* 401 (Authorization Required)

On local:
GET cac.dev/wp-includes/js/jquery/jquery-1.10.2.*min.map* 404 (Not Found)

I don't know what that "min.map" is referring to, but as long as it's working we can release and figure it out separately.

I'm really glad everyone likes the final result and that Twitter's API changes didn't ruin the whole idea. :-)

Boone, would you like me to put a reminder in ACTION_REQUIRED to add a menu entry to the new page on the live site after the release?

Actions #102

Updated by Boone Gorges over 10 years ago

Boone, would you like me to put a reminder in ACTION_REQUIRED to add a menu entry to the new page on the live site after the release?

Yeah, please note whatever it is I have to do to make it work. I think I'll need to create a new page and set the page template. Not sure where the menu item goes, but please let me know in the ACTION_REQUIRED list

Actions #103

Updated by Dominic Giglio over 10 years ago

ACTION_REQUIRED updated: https://github.com/castiron/cac/wiki/Release-ACTION_REQUIRED-list

Boone, Sarah also mentioned that we might want to put a link to the new twitter page in the About section of the left-hand drop-down navigation in the Toolbar. I think that menu is populated programmatically because I can't find a menu in the admin that is associated with that area of the Toolbar. Let me know if you'd like me to open a 1.5.1 issue and I'll figure out how to take care of it. If we don't want an entry to the twitter page in that list then this feature should be complete.

Actions #104

Updated by Boone Gorges over 10 years ago

Awesome. Thanks for the notes, Dom.

Actions

Also available in: Atom PDF