ThinkUp Documentation Release 2.0-beta.10 ThinkUp LLC and the ThinkUp community January 30, 2015 Contents 1 Introduction 1.1 Who ThinkUp Is For . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 What ThinkUp Can Do . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Installation 2.1 Quick Start . . . . . . . . . . . . . . . . . . 2.2 Step-by-Step Installation Guide . . . . . . . 2.3 Install ThinkUp from Source . . . . . . . . . 2.4 Advanced Configuration . . . . . . . . . . . 2.5 Upgrade ThinkUp . . . . . . . . . . . . . . 2.6 Understanding ThinkUp’s Folder Permissions 2.7 Back Up and Export . . . . . . . . . . . . . 2.8 ThinkUp Security and Data Privacy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 5 5 13 13 14 16 17 18 User Guide 3.1 ThinkUp Users . . . 3.2 Service Users . . . . 3.3 Capture Social Data 3.4 Data Listings . . . . 3.5 Plugins . . . . . . . 3.6 Settings . . . . . . . 3.7 The ThinkUp API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 21 22 23 23 31 35 42 Frequently Asked Questions 4.1 I downloaded ThinkUp to my computer, but I don’t know how to install it. What do I do now? 4.2 I don’t have a web server. How can I use ThinkUp? . . . . . . . . . . . . . . . . . . . . . . . 4.3 Can I add more than one Twitter, Facebook, or Google+ account to ThinkUp? . . . . . . . . . 4.4 Does ThinkUp archive old tweets/posts, or just present and future ones? . . . . . . . . . . . . 4.5 Will ThinkUp make all my social data public? . . . . . . . . . . . . . . . . . . . . . . . . . 4.6 Does ThinkUp support multiple users? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7 How many service user accounts can you add to a ThinkUp installation? . . . . . . . . . . . 4.8 Can ThinkUp track Twitter hashtags? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9 Is it possible to fire the cron without having to put the username and password in the crontab? 4.10 Can I use ThinkUp for commercial purposes? . . . . . . . . . . . . . . . . . . . . . . . . . . 4.11 Can ThinkUp support a database engine other than MySQL? . . . . . . . . . . . . . . . . . . 4.12 Can I translate ThinkUp? Is there support for non-English languages? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 131 131 131 131 132 132 132 133 133 133 133 133 3 4 5 Troubleshoot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 3 135 i 5.1 5.2 5.3 6 Application Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Common Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 How to Report a Bug or Make a Feature Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 Contact Us 6.1 Mailing Lists . . . . . . . . . . . . . . . . . . 6.2 IRC Channel . . . . . . . . . . . . . . . . . . 6.3 Blog, Facebook, and Twitter . . . . . . . . . . 6.4 Live Community Conference Call and Podcast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 151 151 151 151 7 Contribute 153 7.1 Where to Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 7.2 How You Can Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 8 Development Team 183 8.1 Core Team . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 8.2 Community . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 9 Changelog 9.1 2.0-beta.10 - 13 Jan 2014 9.2 2.0-beta.9 - 26 Dec 2013 . 9.3 2.0-beta.8 - 23 May 2013 9.4 2.0-beta.7 - 20 May 2013 9.5 2.0-beta.6 - 4 Apr 2013 . . 9.6 2.0-beta.5 - 1 Apr 2013 . . 9.7 2.0-beta.4 - 25 Feb 2013 . 9.8 2.0-beta.3 - 23 Feb 2013 . 9.9 2.0-beta.2 - 24 Jan 2013 . 9.10 2.0-beta.1 - 1 Jan 2013 . . 9.11 1.3.1 - 1 Mar 2013 . . . . 9.12 1.3 - 24 Feb 2013 . . . . . 9.13 1.2.1 - 28 Dec 2012 . . . 9.14 1.2 - 26 Dec 2012 . . . . 9.15 1.1.1 - 12 Sept 2012 . . . 9.16 1.1 - 10 Sept 2012 . . . . 9.17 1.0.8 - 5 Jul 2012 . . . . . 9.18 1.0.7 - 7 Jun 2012 . . . . 9.19 1.0.6 - 7 May 2012 . . . . 9.20 1.0.5 - 4 May 2012 . . . . 9.21 1.0.4 - 25 Mar 2012 . . . 9.22 1.0.3 - 27 Feb 2012 . . . . 9.23 1.0.2 - 13 Feb 2012 . . . . 9.24 1.0.1 - 09 Feb 2012 . . . . 9.25 1.0 - 15 Nov 2011 . . . . 9.26 Beta 0.17 - 08 Nov 2011 . 9.27 Beta 0.16 - 06 Oct 2011 . 9.28 Beta 0.15 - 30 Aug 2011 . 9.29 Beta 0.14 - 09 Aug 2011 . 9.30 Beta 0.13 - 21 June 2011 . 9.31 Beta 0.12 - 17 May 2011 . 9.32 Beta 0.11 - 25 April 2011 9.33 Beta 0.10 - 20 April 2011 9.34 Beta 0.9 - 17 Mar 2011 . . 9.35 Beta 0.8 - 28 Jan 2011 . . 9.36 Beta 0.7 - 27 Dec 2010 . . ii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 185 185 187 187 188 188 188 188 189 189 189 189 190 190 190 190 191 192 192 192 192 193 193 194 195 195 196 197 198 198 199 200 200 201 202 203 9.37 9.38 9.39 9.40 9.41 9.42 Beta 0.6 - 13 Dec 2010 . Beta 0.5 - 22 Nov 2010 . Beta 0.4 - 14 Nov 2010 . Beta 0.3 - 19 Oct 2010 . Beta 0.2 - 4 Oct 2010 . . Beta 0.1 - 27 Sept 2010 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 205 206 206 207 207 iii iv ThinkUp Documentation, Release 2.0-beta.10 Welcome! This is the official documentation for ThinkUp, a social media insights engine. Contents 1 ThinkUp Documentation, Release 2.0-beta.10 2 Contents CHAPTER 1 Introduction Nice to Meet You We’re an open source community of developers, writers, designers, bloggers, journalists, data nerds, and social media enthusiasts whose goal is to make meaningful software with world-class documentation. You’re reading the very beginning of that effort. This documentation is an incomplete, work-in-progress. Please join us and help fill in the gaps. ThinkUp is a free, open source web application that captures your posts, tweets, replies, retweets, friends, followers and links on social networks like Twitter and Facebook. With ThinkUp, you can store your social activity in a database that YOU control, making it easy to search, sort, analyze, publish and display activity from your network. All you need is a web server that can run a PHP application. Gina Trapani began building ThinkUp as a personal project in 2009. From 2010 until 2012, Expert Labs incubated ThinkUp. Today, ThinkUp LLC, a company founded by Anil Dash and Gina Trapani, leads development on the project. ThinkUp’s source code is licensed under the GNU General Public License and is available on GitHub. Find out more at http://thinkup.com. 1.1 Who ThinkUp Is For ThinkUp is for organizations and personalities who are active on social media networks, have more than 1,000 friends or followers, and need deeper analysis tools to derive meaning from those interactions. ThinkUp is for: Government agencies who want easy ways to survey constituents, analyze and share response sets as well as track and archive conversations. Personalities like journalists, bloggers, and celebrities who want easier ways to manage interactions and compile feedback from fans and followers. Publishers like bloggers or broadcasters who want easy ways to measure reach and analyze content performance on social networks with readers, subscribers, and followers. 1.2 What ThinkUp Can Do 3 ThinkUp Documentation, Release 2.0-beta.10 ThinkUp’s Features in Action At its heart, ThinkUp is a conversation analysis tool. ThinkUp helps you pose questions to your followers on social networks, and compile and share the responses, whether you’re The White House asking U.S. citizens what our country’s next Grand Challenge should be, or a writer asking what the best brand of ballpoint pen is. ThinkUp also helps you answer questions about your social media activity, like “Who are my most popular followers?” and “How many people saw a retweet of this tweet?” Using ThinkUp, you can: Analyze: Get insightful graphs and charts in a single simple dashboard which helps you make sense of your social network activity. Search: Ever get frustrated that Twitter doesn’t let you find a tweet you posted a year ago? ThinkUp archives all your tweets from the time you start running it, plus all its replies and retweets, and makes them available to search and export. Visualize: ThinkUp’s rich visualizations let you see your conversations mapped across the globe, or as a collection of most-frequently mentioned keywords. Publish: ThinkUp lets you publish and embed conversations on a blog or website. Everyone can benefit from the wisdom of your social network. Export: Export your tweets at any time and open them as a spreadsheet in Excel for further analysis. Or just save them for recordkeeping. 4 Chapter 1. Introduction CHAPTER 2 Installation If you’ve installed a web application like WordPress or phpMyAdmin, you’ll have no trouble installing ThinkUp. Here’s everything you need to know to get ThinkUp up and running on your web server. 2.1 Quick Start To run ThinkUp, you’ll need a web server running PHP and MySQL. Most ThinkUp users purchase or already have server access from a web hosting provider. We built ThinkUp so that it can run on the most common and widelyavailable LAMP-based hosting plans. Once you have access to a public web server to install ThinkUp, you install it in three easy steps. 1. Download the latest distribution of ThinkUp. 2. Extract the zip file into a web-accessible folder on your web server via FTP. 3. Visit that URL in your browser to proceed through ThinkUp’s simple installer. Trouble? Check out the detailed installation guide. 2.1.1 Known Incompatibilities Some web hosting providers or plans have known incompatibilities with ThinkUp. Several ThinkUp users report that: • Dreamhost’s least expensive shared hosting package may time out when gathering data for busy accounts. Dreamhost’s 300MB VPS server (which costs around $15/month) will not. • GoDaddy’s shared hosting plan triggers database server timeout errors. Have notes about your ThinkUp hosting provider that should appear on this page? Please post them to the ThinkUp mailing list. 2.2 Step-by-Step Installation Guide The following is a general tutorial for how to install ThinkUp on an arbitrary web host. This document assumes some familiarity with basic web hosting concepts; you may need to refer to your hosting company’s documentation for specifics, or find an environment-specific tutorial in the Community Wiki. 5 ThinkUp Documentation, Release 2.0-beta.10 2.2.1 Prerequisites • File-system access to a web host, preferably over FTP or SFTP. • PHP 5.4 or higher with the Client URL (cURL) library, GD support, and the PDO MySQL driver. (ThinkUp also requires the following items, which PHP 5.4+ enables by default: the filter, hash, and JSON libraries, as well as session support.) • MySQL 5.0.3 or higher. • A publicly available web server. (Twitter authorization requires a public callback URL, so you’ll need to expose non-public servers to the internet for initial authorization; after that, the server no longer needs to be publicly available.) • The ability to send email. If your web server cannot send email, you will not be able to activate your ThinkUp account, or recover your account should you forget your password. 2.2.2 Download Download the latest distribution of ThinkUp. 2.2.3 Extract Once the download has completed, you should extract the contents using whatever tools your operating system provides. When completed, you should be left with a folder named “thinkup”. If your operating system does not automatically remove the .zip installation archive, you can delete it at this time. 6 Chapter 2. Installation ThinkUp Documentation, Release 2.0-beta.10 2.2.4 Upload With the installation extracted, connect to your web host using your usual FTP/SFTP client. Navigate to the root folder of your website and upload the “thinkup” folder into it. (There’s no requirement to put ThinkUp in the root directory of your website - we just find it easier. If you place it somewhere else, remember what folder it’s in - you’ll need to recall this later.) 2.2.5 Recommended: Create Database At this point, you might want to create a MySQL database for ThinkUp to use. Instructions for how to do this varies from host to host - many web hosting companies provide a control panel for database management, others may give you direct access into MySQL. Please contact your web host’s support desk if you’re unclear on how to do this. If you’re unable to create a new database but already have an existing one, that’s okay too! Be sure to pay attention later, as there’s an extra configuration variable you may need to change. Also, if you have permissions to create a database directly through MySQL, you can skip this step - ThinkUp can create the database during the install procedure. Before proceeding to the next step, make sure you have: • the address of the MySQL server you have access to, also known as the host; • the name of the database you either just created, are already using, or want to use; • a username and password that has rights to manipulate this database 2.2. Step-by-Step Installation Guide 7 ThinkUp Documentation, Release 2.0-beta.10 2.2.6 Launch the Installer You’re ready to begin the installation process. If you put the ThinkUp installation in the root document folder of your web site, then visit the following URL (replacing example.com with the appropriate domain name): http://example.com/thinkup/ If you put ThinkUp into a different folder than the site root, you may need to add additional folders to the URL. 2.2.7 Seeing a Permissions Error Message? At this point, you may see a permissions error message like this one: If you’re not seeing this error, congrats! You can move on to the next step. If you are, ThinkUp isn’t able to write files to a folder within its own installation because your web host doesn’t allow this by default. If you’re comfortable working in a terminal session, you can connect via SSH and execute the recommended commands to resolve the problem. If you’re not that technical, don’t worry: this is still easy to fix! Reconnect to your FTP/SFTP session, and find the ThinkUp folder you uploaded. Select it, and then look for a menu command named something like “Get Info” or “Manage Permissions”. You will likely find a list of “permission bits” you can assign to the folder - just enable the “World/Write” permission and apply it to the folder. (If your client gives you the option of applying the permission to the enclosed items, do so.) Find out more about ThinkUp’s folder permissions requirements. 8 Chapter 2. Installation ThinkUp Documentation, Release 2.0-beta.10 2.2.8 Create The Configuration File ThinkUp will now prompt you to create a configuration file. Click the “installing ThinkUp” link to begin. 2.2.9 Requirements Check The first screen in the install process is a requirements check, to ensure your environment matches the requirements listed above. If any of ThinkUp’s requirements aren’t provided by your system, you’ll see a detailed message like the one above. You will probably need to speak to your web hosting company about resolving these issues by getting additional PHP modules enabled or making sure your system is configured correctly. 2.2. Step-by-Step Installation Guide 9 ThinkUp Documentation, Release 2.0-beta.10 2.2.10 Configuration Details The second screen asks you for some information to help configure ThinkUp. The opening section creates your administrative account for the system: • Type your name into the Name field. • Type your preferred email address into the Email Address field. (Note that you will need to receive an email to activate your account, so make sure this is your real address.) • Enter your preferred password twice, once in Password and again into Confirm Password. • Select the nearest city to you in Time Zone, if it isn’t selected already. 10 Chapter 2. Installation ThinkUp Documentation, Release 2.0-beta.10 The second section is where ThinkUp needs the details about your database: • Under Database Host, enter the address of the server for your database. This is often “localhost”. • Under Database Name, type the name of the database you’ll use for ThinkUp. You may have created this database earlier, or you can enter the name of the database you’d like to create (if your database user has permissions to create them directly through MySQL). • Under User Name, type in the MySQL user name you have been given to access the database. • Under Password, type the MySQL password you have been given to access the database. 2.2. Step-by-Step Installation Guide 11 ThinkUp Documentation, Release 2.0-beta.10 A third section is available, entitled “Advanced Options”, which may be necessary for some hosting environments where you are given a specific MySQL socket or port that is needed to connect. This section also allows you to set a table prefix, which can be very useful if you’re reusing an existing database. Most people can leave this section alone. 2.2.11 Activate Your Account You’re in the home stretch! If your web server is able to send email, you will receive an email message with the subject line “Activate Your New ThinkUp Account.” (Make sure you check your spam folder, too.) Click the link found within the email and your account will be activated - and you’ll be ready to use ThinkUp! 12 Chapter 2. Installation ThinkUp Documentation, Release 2.0-beta.10 2.2.12 You’re Done! Congratulations! (That wasn’t so bad, was it?) At this point you want to get started using ThinkUp - and there’s still some more configuration to do - but for those details, you should visit the User Guide. 2.2.13 If You Get Stuck Installing web software can be tricky. Every host is a little different, and small things can cause large problems. Luckily, help is here! • Troubleshooting ThinkUp: Common Problems and Solutions contains answers to the most common installation issues. • Live help is available around the clock from the ThinkUp community on IRC. • Non-live (but still pretty snappy!) help is available on the ThinkUp mailing list. 2.3 Install ThinkUp from Source To run ThinkUp’s nightly code with all the latest features and fixes without waiting for the user distribution release, you can pull that code from the GitHub repository. To install ThinkUp from source: 1. First, clone ThinkUp’s GitHub repository to a publicly-accessible folder your web server using this command: $ git clone [email protected]:ginatrapani/ThinkUp.git 2. Visit ThinkUp’s location in your web browser, and walk through the application installation process. 3. Finally, run any necessary database migrations using this command in the root directory of ThinkUp’s source code: $ cd install/cli/; php upgrade.php --with-new-sql 2.3.1 Notes When you run ThinkUp from source, keep in mind you will have: • A slightly different folder structure than the user distribution. The application code for ThinkUp lives in the webapp folder in the GitHub repository. In the user distribution, the application code is the root folder. • Many more files than you’ll need to run ThinkUp which are not included in the user distribution, including tests, test data, developer tools, and more. • The need to run any database migrations which have occurred since the last user distribution. Instructions on how to do that are detailed above. 2.4 Advanced Configuration ThinkUp’s configuration file, config.inc.php, includes advanced settings for administrators to customize their installation. 2.3. Install ThinkUp from Source 13 ThinkUp Documentation, Release 2.0-beta.10 2.4.1 app_title_prefix ThinkUp prepends this value to all instances of the application title. For example, to name your installation Jane Smith’s ThinkUp, set this value to "Jane Smith’s ". When you do, all of the page titles and email notification copy will refer to your installation as Jane Smith’s ThinkUp. The default value is ‘’, or no prefix at all. 2.4.2 datadir_path This is the path to ThinkUp’s writable file cache directory. By default, this folder is located in ThinkUp’s root. To customize the location of the folder where ThinkUp writes its cache and data backup files, set it here. The default value is $THINKUP_CFG[’source_root_path’] . ’data/’. 2.4.3 use_db_sessions Defaults to true as of 2.0 beta 11. To store $_SESSION data in the database instead of on the filesystem (PHP’s default) or elsewhere, set this to true. The PHP Security Consortium recommends storing session data in a database versus on the filesystem to avoid potential exposure of sensitive app data to other apps or users on shared servers. 2.4.4 mandrill_api_key If your web server is unable to send email via PHP’s built-in mail() function, ThinkUp can send email via Mandrill, a transactional email service. To set ThinkUp to send email via Mandrill, in config.inc.php, set mandrill_api_key to your Mandrill API key. To get an API key, sign up for a Mandrill account, log in, and create a new API key in Settings > SMTP & API Credentials. 2.5 Upgrade ThinkUp To upgrade ThinkUp to its latest version, there are two steps. First, upgrade your installation’s application code. Then, upgrade its database structure. Tip: Before you begin, back up your current ThinkUp installation’s data in case anything goes wrong during the upgrade process. 2.5.1 Upgrade ThinkUp’s Application Code To upgrade your existing installation to the latest version of ThinkUp, simply replace your current ThinkUp folder with the most recent release while preserving your existing configuration file. 14 Chapter 2. Installation ThinkUp Documentation, Release 2.0-beta.10 Web-Based Upgrade (Greater Than Version 1.0.4) All versions of ThinkUp greater than 1.0.4 come with a web-based application upgrader built in. When there’s a new version of ThinkUp available to install, in ThinkUp’s status bar, click on the “Upgrade ThinkUp” button. Prerequisites: In order for the web-based upgrade to complete successfully: • All ThinkUp’s application files and directories must be writable by the web server user. Find out more about the web-based upgrader’s required folder permissions. • Your server must have at least 100 megabytes of free disk space available. If your installation is able to upgrade itself and there’s a new version available, click on the “Upgrade ThinkUp” button to replace your installation’s application files with the latest version. To recover from catastrophic failure: Before it replaces your application files, ThinkUp’s web-based upgrader makes a backup copy of the original installation files in your data directory in two parts: a zip file with all the application files except your config file, and the config file. To recover from a catastrophic failure during the upgrade, manually replace your installation files with the backup copy located in your data directory. Manual Upgrade If you’re unable to run the web-based upgrader, upgrade ThinkUp manually. First, download ThinkUp’s latest release and extract the zip archive on your computer. Then, log into your ThinkUp installation as an administrator. Using your favorite FTP program, connect to your web hosting provider, and rename your existing ThinkUp folder to something like thinkup.old. Then, upload the new ThinkUp folder you just extracted from your computer to your web server. Finally, copy your existing configuration file–i.e., thinkup.old/config.inc.php–into the new ThinkUp folder. Reload ThinkUp in your web browser. Follow the on-screen instructions on how to set ThinkUp’s minimum required folder permissions in your updated installation. 2.5.2 Upgrade ThinkUp’s Database Structure Now that your installation has the most up-to-date code, that code may have to upgrade your database structure to match it. Reload ThinkUp in your web browser. When you see the message “ThinkUp’s database needs an update” click on the “Capture Data” link. If the message reads “ThinkUp is currently in the process of upgrading. Please try back again in a little while”, here’s how to continue the upgrade process. Web-Based Upgrade (Small Databases) The Upgrade page will let you know how many database migrations have to run to get up-to-date. If your ThinkUp installation only has 1 or 2 moderately active social media accounts set up in it, and none of your database tables have more than half a million rows, then you should use the easy web-based upgrader. ThinkUp will let you know if any of your tables are this large when you begin the upgrade process. Click on the “Upgrade Database” button to update ThinkUp’s database structure. 2.5. Upgrade ThinkUp 15 ThinkUp Documentation, Release 2.0-beta.10 Command Line Upgrade (Large Databases) If your ThinkUp installation has more than 2 very active social media accounts set up, chances are your database tables are large. (We consider a ThinkUp database with any table over half a million rows large.) Depending on your server speed and utilization, it can take a very long time for database structure updates to complete on very large installations; so the web-based upgrader can time out. To be on the safe side, large installation administrators should use the command line upgrader to avoid potential time-outs.. To use the CLI upgrader, SSH into your web server and cd into the thinkup/install/cli/ folder. Then, run: $ php upgrade.php This command will upgrade your database structure (and give you the option to back it up first as well). Your ThinkUp application code and database is now up-to-date. Great! 2.5.3 Running Beta Versions or Code from GitHub If you’re a developer running nightly code from ThinkUp’s git repository or a beta tester, after you upgrade ThinkUp’s application code, you’ll need to catch up on any necessary database migrations. As of beta 16 (v0.16), developers can use the CLI upgrade tool to run any new database migrations using the argument “–with-new-sql”: $ cd install/cli/; php upgrade.php --with-new-sql The CLI tool will keep track of any migrations that have been applied and only run new migrations. Developers can just run the tool with the “–with-new-sql” option to get their install up to date. This also applies to migration files rolled into the release builds. 2.6 Understanding ThinkUp’s Folder Permissions ThinkUp requires minimum folder permissions in order to run. Its optional web-based upgrader also requires certain file permissions in order to complete successfully. 2.6.1 Minimum Required File Permissions In order to run, ThinkUp must be able to write files to a specific data directory defined in the config.inc.php file as $THINKUP_CFG[’datadir_path’]. By default the data directory is located in the root of the thinkup web-accessible directory and is named data. The recommended and most secure way to grant ThinkUp write access to this folder is to change the owner of this folder to the web server user. The command for doing this is: chown -R apache your_datadir_path Where your_datadir_path is your installation’s data directory path and apache is the name of the web server user. (Note that this username could vary depending on your server.) If you are unable to change owner (chown) the folder, a less secure but just as effective method is to make the folder writable by the world. To do that, you can run this command: chmod -R 777 your_datadir_path If possible, change the folder’s owner to the web server user or group instead of setting its permissions to worldwritable. 16 Chapter 2. Installation ThinkUp Documentation, Release 2.0-beta.10 Change the Location of ThinkUp’s Data Directory For security-related or other reasons, you may not want ThinkUp’s data directory to live in a web-accessible folder. To change the location ThinkUp’s data directory, open the config.inc.php in any text editor and set your desired location in the $THINKUP_CFG[’datadir_path’] value. Note that ThinkUp’s data directory must be writable by the web server and MySQL user for ThinkUp to function. Grant ThinkUp those access permissions using the instructions above. 2.6.2 Web-based Upgrader File Permissions In order to use its web-based upgrader, ThinkUp must have the permission able to write new application files. The recommended and most secure way to enable the ThinkUp web-based upgrader is to change the owner of all of ThinkUp’s files and folders. The command to do this using sudo is: sudo chown -R apache your_thinkup_path Where your_thinkup_path is your installation’s directory and apache is the name of the web server user. (Note that this username could vary depending on your server.) If you are unable to change owner (chown) the folder, a less secure but just as effective method is to make the folder writable. To do that, you can run this command: chmod -R a+rw your_thinkup_path If possible, change the folder’s owner to the web server user or group instead of setting its permissions to writable. 2.7 Back Up and Export ThinkUp provides two tools for exporting and restoring your data: Backup and Export. 2.7.1 Back Up and Restore ThinkUp’s Entire Database ThinkUp provides both a web-based and command line tool for backing up your installation’s data. The best method depends on how large your ThinkUp installation’s database has grown. Small Databases: Web-Based Backup (Logged-in admin only) If your ThinkUp installation only has 1 or 2 moderately active social media accounts set up in it, and none of your database tables have more than a half million rows, then you should use the easy web-based backup tool. ThinkUp will let you know if a table is larger than that when you begin the backup process. To use the web-based backup tool, log into ThinkUp as an administrator. Under Settings>Application, click on the “Backup ThinkUp’s database” link. On the Backup page, click on the “Backup Now” button. The web based backup tool has two permissions requirements. 1. Your ThinkUp installation’s database user must have “GRANT FILE ON” permissions 2. The MySQL user must have write permissions to the data directory (data by default, or defined in config.inc.php‘s $THINKUP_CFG[’datadir_path’] value). If you don’t have those permissions, you can use mysqldump or a tool like phpMyAdmin to back up your database manually. When running a web-based backup, here’s what to do if you see the error Can’t create/write to file. 2.7. Back Up and Export 17 ThinkUp Documentation, Release 2.0-beta.10 Large Databases: Command Line Backup If your ThinkUp installation has more than 2 very active social media accounts set up, chances are your database tables are large. (We consider a ThinkUp database with any table over half a million rows large.) Depending on your server speed and utilization, it can take a very long time for database structure updates to complete on very large installations; so the web-based backup tool can time out. To be on the safe side, large installation administrators should use the command line backup tool to avoid potential time-outs. To use the CLI backup, SSH into your web server and cd into the thinkup/install/cli/ folder. Then, run: $ php backup.php This command will back up your current database. Restore Your ThinkUp Backup In Settings>Application, you can upload a ThinkUp backup file under the “Restore Your Thinkup Database.” Click on the “Choose File” button to upload your ThinkUp backup file and restore it. This restore operation will overwrite your entire existing database; use with caution. 2.7.2 Export a Single Service User’s Data If you want to move a single service user’s ThinkUp archive to another ThinkUp installation–if, say, your database has become too big and unwieldy, or a user has set up a new ThinkUp installation and wants to import their existing archive–you can do that. Under Settings>Application, click on the “Export a single service user’s data” link. Choose a service user to export and click on the “Export User Data” button. You will download a zip file. Extract it, and refer to the README.txt contained inside that zip file for how to import the data into another ThinkUp installation. 2.7.3 When to Back Up and When to Export ThinkUp’s Backup tool exports the entire database, including internal database ID’s, to a file. Use the backup tool when you are starting with a completely fresh, new database and want to restore everything: including ThinkUp users, passwords, and plugin settings. ThinkUp’s Service User Export tool only exports the data associated with a particular service user, without internal ID’s: posts, friends, followers, links, mentions, replies, retweets, and favorites. This export file can be imported into an existing ThinkUp installation with established ThinkUp users and existing service users. Because the export file doesn’t include internal ID’s, the data will be appended to existing data rather than replacing the entire database. Use the Export tool when you only want to transfer a single service user to another ThinkUp installation. 2.8 ThinkUp Security and Data Privacy The ThinkUp development team takes security and data privacy very seriously. This document describes what data ThinkUp stores, how it handles sensitive data, what security measures the application puts in place to protect that data, what you can do to keep your ThinkUp installation secure, and how to report potential security and privacy bugs in the software. 18 Chapter 2. Installation ThinkUp Documentation, Release 2.0-beta.10 2.8.1 What Data ThinkUp Stores ThinkUp does store: • ThinkUp user email addresses and encrypted ThinkUp account passwords • API keys to access social networks and other web services • Social network authorization (OAuth) keys • Public and private posts on social networks • Public and private user data on social networks ThinkUp does not store: • Passwords to log into social networks • Direct messages or private messages on social networks 2.8.2 How ThinkUp Handles Sensitive Data ThinkUp’s official distribution adheres to a set of rules and standards for handling sensitive data, such as: Passwords The only password that ThinkUp stores in its database is each user’s ThinkUp account password. This password is hashed (not stored in clear text). To prevent brute force attacks which attempt to guess this password, ThinkUp enforces a failed login attempt cap. Social network credentials ThinkUp and its core plugins do not store passwords to social networks like Facebook or Twitter. Instead, ThinkUp stores OAuth credentials to access these networks. This gives users the ability to revoke ThinkUp’s access to their data on the originating network’s settings. Private post and user details While ThinkUp collects private posts and data its authorized users have access to on the originating network, ThinkUp does not make those posts available to anyone not logged into ThinkUp. Facebook data privacy levels: ThinkUp’s current Facebook support is a work in progress and Facebook’s access permissions system is complex. As such, ThinkUp marks all posts to a Facebook user’s profile private; ThinkUp marks all posts to a Facebook page as public. ThinkUp assumes all Facebook users are private. Only plugins which adhere to these standards will be accepted into the official ThinkUp distribution. Warning: If you install third-party plugins which are not included in the official ThinkUp distribution, you are taking the risk that they don’t adhere to these guidelines. 2.8. ThinkUp Security and Data Privacy 19 ThinkUp Documentation, Release 2.0-beta.10 2.8.3 Security Measure ThinkUp’s Application Code Puts in Place Currently ThinkUp’s application code enforces: • One-way password hashing using SHA-2 hash and a unique, per-user salt which obscures plaintext passwords from anyone with direct access to the ThinkUp database. • A failed login attempt cap to stave off brute force password-guessing attacks. • The use of OAuth credentials instead of storing third-party usernames and passwords. • Protection against cross-site request forgery attacks per The Open Web Application Security Project’s recommendation. (More info) 2.8.4 How to Secure Your ThinkUp Installation Since users install ThinkUp on their own web servers, there are a number of security measures a ThinkUp administrator can take to secure the application and the data it stores. The ThinkUp development team strongly urges all users to: Run ThinkUp on a dedicated server. On a shared web server, other server users potentially can access PHP session files and ThinkUp’s configuration file, which contains your database username and password. Install ThinkUp on a dedicated (even if virtual) server to prevent unauthorized data access. Get more information about ThinkUp hosting providers. Use an encrypted connection. Run ThinkUp on a web server with https/SSL or only access your ThinkUp installation through a VPN or secure proxy, so that no one can “sniff” your ThinkUp password when you log in. Limit your MySQL user access to ONLY your ThinkUp database. Never use ‘root’ or a database user with unlimited access permissions to all your MySQL databases. Set up a ThinkUp-specific database user which can only access your ThinkUp database, not any others. Make sure no ThinkUp files are writable except the ones required by the application. Move ThinkUp’s data directory. By default ThinkUp’s writeable data directory is located in a web-accessible folder. Move that folder to a more secure location by setting its path in ThinkUp’s config file. Use strong, unique passwords for your ThinkUp user account as well as all your social network accounts. 2.8.5 How to Report a Security Bug If you find a security bug in ThinkUp, send an email with a descriptive subject line to thinkupsecurity[at]thinkup.com. If you think you’ve found a serious vulnerability, please do not file a public issue or post to ThinkUp’s public mailing lists. Your report will go to the core ThinkUp development team. You will receive acknowledgement of the report in 24-48 hours, and what our next steps will be to release a fix. If you don’t get a report acknowledgement in 48 hours, contact Gina Trapani or Anil Dash directly. A working list of public, known security-related issues can be found in the issue tracker. Thanks for your help. 20 Chapter 2. Installation CHAPTER 3 User Guide ThinkUp is an extensible platform with core features, and features added by plugins. This user guide runs down all the ThinkUp features offered by both the core application and the default plugins which are distributed with it. 3.1 ThinkUp Users To use ThinkUp, first you must create a ThinkUp user account either during installation or using the registration form. 3.1.1 Create an Account To create a new ThinkUp user account, in ThinkUp’s status bar click on the “Log In” link. Then click on “Register.” If the installation administrator has opened registration to new users, fill out the form and click on the “Register” button to create a new user account. You will receive an email with a link to activate your new account. (Note that if the web server is unable to send email, an administrator will have to activate your new account manually.) If the installation administrator has not opened registration to new users, when you click on the Register link, you will see the Sorry, registration is closed on this ThinkUp installation message. 3.1.2 Log In to ThinkUp To log in to ThinkUp, click on the “Log In” link on the right side of ThinkUp’s status bar. Then, enter the email address and password you used when you created your user account and click on the “Log In” button. On the Roadmap You must log in every time you visit ThinkUp. We hope to offer a “Remember me” checkbox on the log in page soon. To log out of ThinkUp, click on the “Log out” link on the right side of ThinkUp’s status bar when you’re logged in. 3.1.3 Login Lockout You can only log in to ThinkUp if you provide the correct email address and password, and your user account is activated. To prevent brute force attacks which attempt to guess a user’s ThinkUp password, ThinkUp enforces a failed login attempt cap. After 10 failed login attempts, ThinkUp deactivates the user account. An administrator must reactivate it. (If the administrator account is deactivated, you can manually reactivate it.) 21 ThinkUp Documentation, Release 2.0-beta.10 3.1.4 Forgot Password If you’ve forgotten your ThinkUp password, on the Log In page, click on “Forgot password.” Enter the email address associated with your user account and click on the “Send Reset” button. If the web server is able, ThinkUp will send you an email which contains a link to reset your password. 3.1.5 User Permissions Currently there are two levels of user permissions in ThinkUp: user-level and administrator-level permissions. • Users cannot enable, disable, or configure plugins, or see a list of users for a given ThinkUp installation. • Administrators can enable, disable, and configure plugins, see a list of users on a given ThinkUp installation, see all the views for social media accounts registered on the installation, deactivate ThinkUp user accounts, and configure global application settings like whether or not registration is open to new users. Every ThinkUp installation must have at least one administrator account. A ThinkUp installation can have any number of user accounts, and it may have multiple administrator accounts. When an administrator with the email address [email protected] is logged into ThinkUp, the text on the right side of ThinkUp’s status bar reads “Logged in as admin: [email protected].” Otherwise, it simply reads “Logged in as: [email protected].” 3.2 Service Users Once you install ThinkUp, to start gathering data from various social networks, you’ll add one or more service users. A service user is a user account on a particular network. For example, a Twitter user, a Facebook page, or a Facebook user profile are all service users. A ThinkUp user can have multiple service users associated with it. For example, ThinkUp user [email protected] might have three service users set up: @aplusk on Twitter, @mrskutcher on Twitter, and the Ashton Kutcher Facebook page. 3.2.1 How to Add a Service User Add service users to your ThinkUp account through a series of approved plugins included with your installation. To get started, in Settings > Plugins, click on the Facebook, Google+, or Twitter plugin to add a new service user for each respective network. See the links below for further instructions on how to add new service users for each ThinkUp plugin. • Facebook • Google+ • Twitter • Foursquare • YouTube 3.2.2 Switch Service User Once you have multiple service users set up, to view data associated with another service user, from the dashboard click on the “Switch service user” link on the left side of ThinkUp’s status bar. 22 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 3.3 Capture Social Data Once you’ve set up service users like your Twitter, Facebook, or Google+ account, you want to start capturing data from those networks. Here’s how. 3.3.1 Manually in Your Browser The simplest (and most manual) way to update your data is to click on the “Capture Data” link on the left side of ThinkUp’s status bar. This will run ThinkUp’s data crawler and show you its activity as it runs right in your web browser. Once you’ve begun a manual update on this page, keep your browser tab open until it’s complete. Then, go to your ThinkUp dashboard to see the data ThinkUp has collected. Once you’ve determined that ThinkUp’s crawler is successfully capturing your data, set up an automatic update schedule using either RSS or cron. 3.3.2 Automatically via RSS Use your RSS newsreader to capture social media data on a regular basis. In Settings > Account, you’ll find a secret RSS URL button. Copy and paste the feed link into your favorite newsreader, and refresh the subscription in order to kick off a ThinkUp update. Anyone who knows your ThinkUp RSS URL can run a data update. If you’ve shared the URL with someone who should not have it, you can reset it in Settings > Account. Resetting your API key will disable any future updates from URLs which contain the old API key. 3.3.3 Automatically via Cron Alternately, advanced users can add a command to the server’s crontab which runs hourly (or whatever interval you prefer) to update ThinkUp data. Copy and paste the command from the “Automate ThinkUp Crawls” section of the Settings > Account page. Just be sure to change yourpassword to your real password! 3.4 Data Listings ThinkUp offers various views of the data it stores–posts, users, replies, retweets, friends and followers–based on what plugins are enabled. To switch see the contents of a list, click on its title in the left-hand navigation bar. 3.4.1 Dashboard Data Listings Dashboard data listings apply to sets of posts or users. Twitter ThinkUp offers several listings for a registered Twitter user’s data. Dashboard The dashboard for a Twitter user contains brief sections of information you can find in more depth in individual data listings. 3.3. Capture Social Data 23 ThinkUp Documentation, Release 2.0-beta.10 Twitter User Username, service name (Twitter), Twitter avatar, and last updated time. Response Rates A bar chart of your replies and retweet totals for recent tweets. Most Discerning Followers Your top 12 most discerning followers. Clickthrough Rates A bar chart of the clickthrough rates on your most recent tweets which contain shortened links from services which provide click stats, like Bit.ly. This chart only appears if the Expand URLs plugin is set up to capture link stats via Bit.ly. This Week’s Most Replied-To Posts The tweets with the most replies posted in the last 7 days, ordered by number of replies descending. Follower Count by Day and Week If there’s data, these line charts display your follower count history the past 5 days and 5 weeks. Next Milestone If a notable milestone is within sight, you’ll see a “Next milestone” message which tells you how many weeks it will take to reach that milestone. Specifically, based on your current rising follower count trend, if you will reach 1k, 5k, 10k, 25k, 50k, 100k, 150k, 200k, 250k, 300k, 500k, 750k, or 1M followers within the next 10 weeks, you will see this next milestone message. This Week’s Most Retweeted The tweets with the most retweets posted in the last 7 days, ordered by number of replies descending. Post Types A bar chart of how many tweets by this user are replies and how many contain links. Client Usage Pie chart of which Twitter clients this user uses over all time. Time Machine: On This Day In Years Past Tweets you published on this day in past years. For example, your posts from 1 year ago, 2 years ago, and 3 years ago. Tweets All tweets All the tweets ThinkUp has captured for this Twitter instance. Search (Logged-in only) To search the service user’s tweets by keyword, click on the “Search” link. Type your keyword into the input box click on the “Search” button. If there are more than 5000 favorites in the database, you may see the Only showing 5000 results message. To export a set of results to a CSV file for download, click on the “Export” button. Tweets To You Tweets sent to you that are not replies to an earlier post by you. Inquiries 24 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 Most Replied-To Tweets with most replies by this Twitter instance. Most Retweeted Most retweeted tweets posted by this Twitter instance. Conversations See back-and-forth tweet exchanges between you and other users in the Conversation view. If you are signed into ThinkUp, you’ll see replies to private replies; if not, you’ll only see public exchanges. On the Roadmap Currently, conversation view only displays exchanges in pairs, a single tweet and a single reply. We hope to support multi-tweet exchanges that exceed a tweet and a single reply soon. Favorites All the tweets this Twitter instance has starred (marked as a favorite). Search (Logged-in only) To search the service user’s favorites by keyword, click on the “Search” link. Type your keyword into the input box click on the “Search” button. If there are more than 5000 favorites in the database, you may see the Only showing 5000 results message. To export a set of results to a CSV file for download, click on the “Export” button. Who You Follow Chatterboxes People this Twitter instance follows who tweet the most. Quietest People this Twitter instance follows who tweet the least. Popular Popular people you follow. The people the Twitter user follows, ordered by their number of followers. Followers Most Discerning Twitter followers of this instance with the greatest follower-to-friend ratio. Most-followed Twitter followers of this instance ordered by the number of followers they have descending. Follower Count History The Twitter instance user’s follower count history over time, by day, week, and month. If a notable milestone is within sight, you’ll see a “Next milestone” message which tells you how many weeks it will take to reach that milestone. Specifically, based on your current rising follower count trend, if you will reach 100, 200, 500, 1k, 5k, 10k, 25k, 50k, 100k, 150k, 200k, 250k, 300k, 500k, 750k, or 1M followers within the next 10 days, weeks, or months, you will see this next milestone message. 3.4. Data Listings 25 ThinkUp Documentation, Release 2.0-beta.10 List Membership Count History month. The Twitter user’s list membership count history over time, by day, week, and If a notable milestone is within sight, you’ll see a “Next milestone” message which tells you how many weeks it will take to reach that milestone. Specifically, based on your current rising follower count trend, if you will reach 100, 200, 500, 1k, 5k, 10k, 25k, 50k, 100k, 150k, 200k, 250k, 300k, 500k, 750k, or 1M followers within the next 10 days, weeks, or months, you will see this next milestone message. Links Links in Favorites Links in tweets you have marked as a favorite. Links by Who You Follow Links in tweets posted by people this Twitter instance follows. Photos by Who You Follow Photos your friends have tweeted. Facebook ThinkUp offers several listings for a registered Facebook user profile or page data. Dashboard The dashboard for a Facebook user profile or page contains brief sections of information you can find in more depth in individual data listings. Facebook User Name or Page Name time last updated in ThinkUp. Name, whether or not it’s a Facebook profile or Facebook page, avatar, and Response Rates A bar chart of post replies, likes and share totals for recent posts Clickthrough Rates A bar chart of the clickthrough rates on your most recent posts which contain shortened links from services which provide click stats, like Bit.ly. This chart only appears if the Expand URLs plugin is set up to capture link stats via Bit.ly. This Week’s Most Replied-To Posts of replies descending. The posts with the most replies posted in the last 7 days, ordered by number This Week’s Most Liked Posts The posts with the most “likes” posted in the last 7 days, ordered by number of likes descending. Friend Count by Day and Week If there’s data, these line charts display your friend count history the past 5 days and 5 weeks. Time Machine: On This Day In Years Past Status updates you posted on this day in past years. For example, your posts from 1 year ago, 2 years ago, and 3 years ago. 26 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 Posts All posts All the status updates for the Facebook user or page instance which ThinkUp has captured, displayed in reverse-chronological order. Wall Posts Posts on the wall of a user or page. Most Replied-To All the status updates for this Facebook user or page instance with replies, ordered by most-replied to first. Most Liked All the status updates for this Facebook user or page instance with replies, ordered by number of likes. Inquiries The Facebook user or page status updates which are an inquiry (ie, contain a question mark). Friend/Fan Count History The Facebook page or user’s fan or friend count history over time, by day, week, and month. If a notable milestone is within sight, you’ll see a “Next milestone” message which tells you how many weeks it will take to reach that milestone. Specifically, based on your current rising follower count trend, if you will reach 100, 200, 500, 1k, 5k, 10k, 25k, 50k, 100k, 150k, 200k, 250k, 300k, 500k, 750k, or 1M followers within the next 10 days, weeks, or months, you will see this next milestone message. Foursquare ThinkUp offers several listings for an authorized Foursquare user account. Dashboard The dashboard for a Foursquare user contains brief sections of information you can find in more depth in individual data listings. Foursquare User name Name, service name (Foursquare), Foursquare avatar, and last updated time. This Week’s Checkins Map A Google Map of your last 7 days of checkins. Checkins Per Hour A bar chart of checkins per hour of the day in the past 7 days compared to all-time. This Week’s Places A pie chart of the types of places you have checked in at in the past 7 days. All-Time Places A pie chart of the types of places you have ever checked in at. Time Machine: On This Day In Years Past 1 year ago, 2 years ago, and 3 years ago. 3.4. Data Listings Checkins on this day in past years. For example, your checkins from 27 ThinkUp Documentation, Release 2.0-beta.10 Checkins Checkins All the checkins ThinkUp has captured for this Foursquare user. Export (Logged-in only) To export a set of results to a CSV file for download, click on the “Export” link. Google+ ThinkUp offers several listings for a registered Google+ user’s data. Dashboard The dashboard for a Google+ user contains brief sections of information you can find in more depth in individual data listings. Google+ User Name Name, service name (Google+), Google+ avatar, and last updated time. Response Rates A bar chart of post replies, likes and share totals for recent posts Clickthrough Rates A bar chart of the clickthrough rates on your most recent posts which contain shortened links from services which provide click stats, like Bit.ly. This chart only appears if the Expand URLs plugin is set up to capture link stats via Bit.ly. This Week’s Most Discussed Posts of comments descending. This Week’s Most +1ed Posts descending. The posts with the most comments posted in the last 7 days, ordered by number The posts with the most +1s posted in the last 7 days, ordered by number of +1s This Week’s Most Reshared Posts The posts with the most reshares posted in the last 7 days, ordered by number of reshares descending. Time Machine: On This Day In Years Past Posts you published on this day in past years. For example, your posts from 1 year ago, 2 years ago, and 3 years ago. Posts All posts All the posts ThinkUp has captured for this Google+ user. Search (Logged-in only) To search the service user’s posts by keyword, click on the “Search” link. Type your keyword into the input box click on the “Search” button. If there are more than 5000 favorites in the database, you may see the Only showing 5000 results message. To export a set of results to a CSV file for download, click on the “Export” button. 28 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 Most Replied-To Posts with most replies by this Google+ user. Posts With Most +1s All the posts for this Google+ user with comments, ordered by number of +1s. Inquiries The Google+ user posts which are an inquiry (ie, contain a question mark). 3.4.2 Post Data Listings Per-post data listings show information as it relates to a single post. Individual Post The individual post page offers several ways to view, search, export, share, and interact with a post and its replies. Post Replies The default post page view, the Replies listing displays all the replies to the parent post. By default, the replies listing is replies by the original post’s author’s friends first, then ordered by replier’s follower count descending. Search Replies (Logged-in only) To search a set of replies by keyword, type your keyword into the input box below “Post Replies” and click on the “Search” button. To export a set of results to a CSV file for download, click on the “Export” button above the search results. Embed Thread on an External Web Page You can share and publish a ThinkUp conversation by copying and pasting a bit of JavaScript into any web page. To do so, on an individual post page, expand the post’s metadata by clicking on the down arrow. Then, copy and paste the JavaScript code available in the text box. If a post is private or if the administrator has disabled embedding, this embed code will not be displayed on the post page. Warning: If you embedded a ThinkUp thread prior to beta 12, when you upgrade to beta 12 or greater those existing embeds will break. To fix them, visit the post’s page in ThinkUp and replace the old embed code with the latest version. Apologies for this inconvenience. Beta 12 defines ThinkUp version 1.0’s API, which will always be supported. All future major releases will be backwards-compatible to version 1.0’s API. Tweets ThinkUp’s Twitter plugin offers listings for the data related to a given tweet. 3.4. Data Listings 29 ThinkUp Documentation, Release 2.0-beta.10 Retweets All the retweets of this tweet. ThinkUp displays both a total number of retweets, and a list of all the retweets it has captured. In some cases, ThinkUp may report a larger retweet total than it displays in its list of retweets. For example, ThinkUp might report a tweet has 58 retweets, but only show 40 of them. This situation can happen when Twitter has let ThinkUp know how many retweets there are, but ThinkUp has not captured every individual retweet. How ThinkUp Counts Retweets Twitter users retweet in one of two ways: • They post a “native” retweet, where their Twitter client tells Twitter the tweet is a retweet and the retweeted tweet is unmodified. • They post an “old-style” retweet, where a user or Twitter client simply copies a tweet’s contents and adds the letters “RT” to the front of it. Sometimes the retweeter adds commentary or edits the content of the original tweet when they manually retweet. Therefore, ThinkUp captures retweets in two ways: • ThinkUp captures the total number of native retweets for a particular tweet that the Twitter API reports. The Twitter API maxes out its individual tweet’s retweet count at 100. • Additionally, ThinkUp uses a simple algorithm to attempt to detect old-style retweets. If a tweet contains the letters “RT” and a username and 25 matching characters from a recent tweet by that author, ThinkUp marks it as a manual retweet. This method doesn’t identify every retweet–for example, if the original tweet has been modified so 25 characters of it don’t match the original–but the ones it does identify are correct. ThinkUp displays the sum of the total number of old-style retweets it has counted as well as the number of native retweets Twitter has reported. The number of retweets ThinkUp displays is the sum of two numbers: the number of old-style retweets it has counted and either the number of native retweets Twitter has reported or the number of native retweets it has in its database (whichever is larger). Note on Retweet Counts Prior to Beta 13 Prior to beta 13, some tweets’ retweet counts got set at Twitter’s max of 100. As of beta 13, retweet counts are a more accurate sum of old-style and native retweets. Facebook ThinkUp’s Facebook plugin offers listings for the data related to a given post. Likes A list of Facebook users who “liked” this post. Google+ ThinkUp’s Google+ plugin offers listings for the data related to a given post. 30 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 +1s A list of Google+ users who +1ed this post. GeoEncoder ThinkUp’s GeoEncoder plugin offers location listings for the data related to a given post. Response Map Google Map of post replies and retweets. Nearest Responses List of post replies and retweets ordered by nearest to furthest from the location of the original post. 3.5 Plugins The official ThinkUp distribution comes with a set of approved plugins. Click on Settings > Plugins to configure them. 3.5.1 Expand URLs The Expand URLs plugin captures the full-length URL which shortened links point to from tweets and other posts, including images. The plugin can store photo thumbnails for short Flickr URLs (flic.kr). It can also capture click counts and titles for Bit.ly (bit.ly, j.mp, and bitly.com) links. Plugin Settings Links to expand per crawl (required) is the total number of links the plugin should process in a given crawler run. The default value is 1500 links. The higher this number is, the longer a given crawl can take to complete. The plugin also enforces a 5-second timeout on every shortened URL request. If it cannot get the expanded URL information back in less than 5 seconds, it will save the error in the links table and the plugin will not try again. The plugin has a “no unshortened link without an error left behind” policy: any links the plugin does not expand in one run, it will attempt to expand in the next. Flickr API key (optional) is the API key the plugin uses to acquire direct links to Flickr thumbnails. This key must be set for the plugin to process Flickr image links. Here’s where to obtain a Flickr API key. Bit.ly username (optional) is the username you use to log into Bit.ly. This and the Bit.ly API key must be set for the plugin to capture click counts and link titles for bit.ly, bitly.com, and j.mp shortened links. Sign up for an account at Bit.ly. Bit.ly API key (optional) is your Bit.ly-provided API key. This and your Bit.ly username must be set for the plugin to capture click counts and link titles for bit.ly, bitly.com, and j.mp shortened links. Here’s where to get your Bit.ly API key. 3.5. Plugins 31 ThinkUp Documentation, Release 2.0-beta.10 Related The Twitter plugin automatically stores photo thumbnails for short links from known image sources Yfrog, Twitpic, Twitgoo, Instagr.am, Picplz, and Lockerz. 3.5.2 Facebook ThinkUp’s Facebook plugin collects posts and status updates for Facebook user profiles and pages. Set Up the Facebook Plugin (Admin only) To use the Facebook plugin, you’ll need to create a Facebook application on facebook.com. Set the Web Site > Site URL as recommended, and the Facebook-provided API Key, Application Secret and Application ID in the Facebook plugin’s settings page in ThinkUp. Plugin Settings App ID (required) is the Application ID provided when you create a Facebook application on facebook.com for use with ThinkUp. App Secret: (required) is the Application Secret provided when you create a Facebook application on facebook.com for use with ThinkUp. Max crawl time in minutes: (optional) is the maximum amount of time that ThinkUp will spend crawling a single Facebook user or page. This cap is in place for very busy pages or profiles with deep archives which could take hours to crawl. The default value is 20 minutes. This means that by default, after 20 minutes of crawling a particular Facebook profile or page, the crawler will move onto the next one. Add a Facebook user profile to ThinkUp Click on the “Authorize ThinkUp on Facebook” button to add your Facebook user account to ThinkUp. This button will only appear if the Facebook plugin is configured. Add a Facebook page to ThinkUp ThinkUp’s Facebook plugin works with Facebook pages, but it can only connect with regular Facebook user accounts. To add a Facebook page, connect a regular Facebook user account to ThinkUp. Then, either create a new page or “like” an existing page on Facebook.com. Add it to ThinkUp from the pages dropdown in ThinkUp, which contains both pages you manage and pages you “like.” Any pages you manage will be listed first. Note about business accounts ThinkUp’s Facebook plugin does not support business accounts. When you try to connect your Facebook business account to ThinkUp, you will see the error message “Sorry, ThinkUp does not support business accounts.” Help! I don’t see Facebook pages I manage in the dropdown list If you’re only seeing pages you “like” but not pages you manage in the pages dropdown list, delete your Facebook user account from ThinkUp, and re-add it. Authorize ThinkUp to get access to your managed pages, and then they will appear in the dropdown list. 32 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 3.5.3 Insights Generator The Insights Generator runs pluggable insight generators and creates ThinkUp’s insight stream. Plugin Settings Mandrill Template Name (optional) is the name of a template in your Mandrill account. If the template name is blank, ThinkUp will send the email as plain text. Set Up Mandrill In order to send HTML email, you must configure Mandrill and create an HTML template in your Mandrill account. Step 1. Set up the Mandrill API. 1. Create an account at Mandrill: http://mandrill.com/ 2. Click SMTP & API Credentials in the Configuration/Gear menu. 3. Click “+ New API Key.” 4. Enter a description, such as “ThinkUp.” 5. Click “Create API Key.” 6. Modify your ThinkUp config file, ThinkUp/webapp/config.inc.php 7. Edit this line: $THINKUP_CFG[’mandrill_api_key’] = ’<YOUR NEW KEY GOES HERE>’; Step 2. Create a Mandrill HTML template. 1. In Mandrill, navigate to Outbound -> Templates. 2. Click “+ Create a Template.” 3. You can name it anything, such as “ThinkUp Insights Email Template” and click “Start Coding.” 4. In the text area, create your template. This is an example which illustrates the possible variables: <h1>*|app_title|* has Insights For You!</h1> Visit <a href="*|app_url|*">*|app_title|*</a>. <div> *|insights|* </div> <hr/> Change settings here: *|unsub_url|* 5. Click the “Publish” button. 6. Copy the Template Slug from the left side of the page (thinkup-insights-email-template if you used the example title). 7. In ThinkUp, navigate to the Insights Generator settings (Settings -> Plugins -> Insights Generator -> Configure). 8. Open Advanced settings and enter the Mandrill Template Name (thinkup-insights-email-template in our example). 9. Click “Save Settings.” You’re done! Now ThinkUp will send your daily and weekly insights email notifications using your HTML template. 3.5. Plugins 33 ThinkUp Documentation, Release 2.0-beta.10 3.5.4 Instagram ThinkUp’s Instagram plugin collects photos, likes and comments from Instagram for an authorized user. Configure the Instagram Plugin (Admin only) To set up the Instagram plugin: 1. Go to http://instagram.com/developer/clients/manage/ and click the “Register a new Client” button. 2. In “Application Name” fill your email address followed by ThinkUp. 3. In “Description” put Thinkups Instagram access. 4. In “Website” put the URL of your ThinkUp install. 5. In “OAuth redirect_uri” copy and paste the URL displayed on the Instagram settings page in ThinkUp. 6. Click “Register”. Plugin Settings Client ID (required) is the Client ID provided when you ‘registered a new client with Instagram. Client secret (required) is the Client secret provided when you ‘registered a new client with Instagram. Maximum Crawl Time (optional) Optionally set the maximum amount of time ThinkUp should spend crawling your Instagram data. Defaults to 20 minutes. Add a Instagram user to ThinkUp Click on the “Authorize ThinkUp on Instagram” button to add your Instagram user account to ThinkUp. This button will only appear if the Instagram plugin is configured. 3.5.5 Twitter TODO Port this wiki page here with updated screenshots on both Twitter’s end and ThinkUp’s https://github.com/ginatrapani/ThinkUp/wiki/Configuration:-Twitter Twitter Saved Searches Twitter saved searches captures tweets from the Twitter API that contain keyword or hashtag specified using an authorized Twitter account’s API calls. Set Up the Twitter Plugin (Admin only) To search a keyword or hashtag, you will need to create a new application on Twitter for ThinkUp and then configure Consumer key and Consumer secret in Settings > Plugins > Twitter > Configure Set Up a Twitter account Then you will need to add a Twitter account in Settings > Plugins > Twitter > Configure > Add a Twitter account. 34 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 Adding a keyword or hashtag search (Admin only) Once a Twitter account has been authorized, you can save a search for hashtags or keywords in Settings > Plugins > Twitter > Configure > Saved searches. Then you can add a hashtag (ex: #mwc2013) or keyword (ex: Messi) and click on Save Search. Next time ThinkUp’s crawler runs it will execute this search and save the resulting tweets. Viewing a keyword or hashtag search To view tweets retrieved from a search, use ThinkUp’s search box. Deleting a keyword or hashtag search (Admin only) To delete a saved search, on the saved search page, click on the Delete button. This action deletes: • The saved search • The posts relationship to the hashtag • If another instance has not saved it, the hashtag. It does not delete: • Links • Posts • Users Related to the saved search results. 3.6 Settings To configure the ThinkUp application, its plugins, and your user account, when you are logged into ThinkUp, click on the Settings link on the status bar. 3.6.1 Plugins The official ThinkUp distribution comes with a set of approved plugins. Click on Settings > Plugins to configure them. Expand URLs The Expand URLs plugin captures the full-length URL which shortened links point to from tweets and other posts, including images. The plugin can store photo thumbnails for short Flickr URLs (flic.kr). It can also capture click counts and titles for Bit.ly (bit.ly, j.mp, and bitly.com) links. 3.6. Settings 35 ThinkUp Documentation, Release 2.0-beta.10 Plugin Settings Links to expand per crawl (required) is the total number of links the plugin should process in a given crawler run. The default value is 1500 links. The higher this number is, the longer a given crawl can take to complete. The plugin also enforces a 5-second timeout on every shortened URL request. If it cannot get the expanded URL information back in less than 5 seconds, it will save the error in the links table and the plugin will not try again. The plugin has a “no unshortened link without an error left behind” policy: any links the plugin does not expand in one run, it will attempt to expand in the next. Flickr API key (optional) is the API key the plugin uses to acquire direct links to Flickr thumbnails. This key must be set for the plugin to process Flickr image links. Here’s where to obtain a Flickr API key. Bit.ly username (optional) is the username you use to log into Bit.ly. This and the Bit.ly API key must be set for the plugin to capture click counts and link titles for bit.ly, bitly.com, and j.mp shortened links. Sign up for an account at Bit.ly. Bit.ly API key (optional) is your Bit.ly-provided API key. This and your Bit.ly username must be set for the plugin to capture click counts and link titles for bit.ly, bitly.com, and j.mp shortened links. Here’s where to get your Bit.ly API key. Related The Twitter plugin automatically stores photo thumbnails for short links from known image sources Yfrog, Twitpic, Twitgoo, Instagr.am, Picplz, and Lockerz. Facebook ThinkUp’s Facebook plugin collects posts and status updates for Facebook user profiles and pages. Set Up the Facebook Plugin (Admin only) To use the Facebook plugin, you’ll need to create a Facebook application on facebook.com. Set the Web Site > Site URL as recommended, and the Facebook-provided API Key, Application Secret and Application ID in the Facebook plugin’s settings page in ThinkUp. Plugin Settings App ID (required) is the Application ID provided when you create a Facebook application on facebook.com for use with ThinkUp. App Secret: (required) is the Application Secret provided when you create a Facebook application on facebook.com for use with ThinkUp. Max crawl time in minutes: (optional) is the maximum amount of time that ThinkUp will spend crawling a single Facebook user or page. This cap is in place for very busy pages or profiles with deep archives which could take hours to crawl. The default value is 20 minutes. This means that by default, after 20 minutes of crawling a particular Facebook profile or page, the crawler will move onto the next one. Add a Facebook user profile to ThinkUp Click on the “Authorize ThinkUp on Facebook” button to add your Facebook user account to ThinkUp. This button will only appear if the Facebook plugin is configured. 36 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 Add a Facebook page to ThinkUp ThinkUp’s Facebook plugin works with Facebook pages, but it can only connect with regular Facebook user accounts. To add a Facebook page, connect a regular Facebook user account to ThinkUp. Then, either create a new page or “like” an existing page on Facebook.com. Add it to ThinkUp from the pages dropdown in ThinkUp, which contains both pages you manage and pages you “like.” Any pages you manage will be listed first. Note about business accounts ThinkUp’s Facebook plugin does not support business accounts. When you try to connect your Facebook business account to ThinkUp, you will see the error message “Sorry, ThinkUp does not support business accounts.” Help! I don’t see Facebook pages I manage in the dropdown list If you’re only seeing pages you “like” but not pages you manage in the pages dropdown list, delete your Facebook user account from ThinkUp, and re-add it. Authorize ThinkUp to get access to your managed pages, and then they will appear in the dropdown list. Insights Generator The Insights Generator runs pluggable insight generators and creates ThinkUp’s insight stream. Plugin Settings Mandrill Template Name (optional) is the name of a template in your Mandrill account. If the template name is blank, ThinkUp will send the email as plain text. Set Up Mandrill In order to send HTML email, you must configure Mandrill and create an HTML template in your Mandrill account. Step 1. Set up the Mandrill API. 1. Create an account at Mandrill: http://mandrill.com/ 2. Click SMTP & API Credentials in the Configuration/Gear menu. 3. Click “+ New API Key.” 4. Enter a description, such as “ThinkUp.” 5. Click “Create API Key.” 6. Modify your ThinkUp config file, ThinkUp/webapp/config.inc.php 7. Edit this line: $THINKUP_CFG[’mandrill_api_key’] = ’<YOUR NEW KEY GOES HERE>’; Step 2. Create a Mandrill HTML template. 1. In Mandrill, navigate to Outbound -> Templates. 2. Click “+ Create a Template.” 3.6. Settings 37 ThinkUp Documentation, Release 2.0-beta.10 3. You can name it anything, such as “ThinkUp Insights Email Template” and click “Start Coding.” 4. In the text area, create your template. This is an example which illustrates the possible variables: <h1>*|app_title|* has Insights For You!</h1> Visit <a href="*|app_url|*">*|app_title|*</a>. <div> *|insights|* </div> <hr/> Change settings here: *|unsub_url|* 5. Click the “Publish” button. 6. Copy the Template Slug from the left side of the page (thinkup-insights-email-template if you used the example title). 7. In ThinkUp, navigate to the Insights Generator settings (Settings -> Plugins -> Insights Generator -> Configure). 8. Open Advanced settings and enter the Mandrill Template Name (thinkup-insights-email-template in our example). 9. Click “Save Settings.” You’re done! Now ThinkUp will send your daily and weekly insights email notifications using your HTML template. Instagram ThinkUp’s Instagram plugin collects photos, likes and comments from Instagram for an authorized user. Configure the Instagram Plugin (Admin only) To set up the Instagram plugin: 1. Go to http://instagram.com/developer/clients/manage/ and click the “Register a new Client” button. 2. In “Application Name” fill your email address followed by ThinkUp. 3. In “Description” put Thinkups Instagram access. 4. In “Website” put the URL of your ThinkUp install. 5. In “OAuth redirect_uri” copy and paste the URL displayed on the Instagram settings page in ThinkUp. 6. Click “Register”. Plugin Settings Client ID (required) is the Client ID provided when you ‘registered a new client with Instagram. Client secret (required) is the Client secret provided when you ‘registered a new client with Instagram. Maximum Crawl Time (optional) Optionally set the maximum amount of time ThinkUp should spend crawling your Instagram data. Defaults to 20 minutes. Add a Instagram user to ThinkUp Click on the “Authorize ThinkUp on Instagram” button to add your Instagram user account to ThinkUp. This button will only appear if the Instagram plugin is configured. 38 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 Twitter TODO Port this wiki page here with updated screenshots on both Twitter’s end and ThinkUp’s https://github.com/ginatrapani/ThinkUp/wiki/Configuration:-Twitter Twitter Saved Searches Twitter saved searches captures tweets from the Twitter API that contain keyword or hashtag specified using an authorized Twitter account’s API calls. Set Up the Twitter Plugin (Admin only) To search a keyword or hashtag, you will need to create a new application on Twitter for ThinkUp and then configure Consumer key and Consumer secret in Settings > Plugins > Twitter > Configure Set Up a Twitter account Then you will need to add a Twitter account in Settings > Plugins > Twitter > Configure > Add a Twitter account. Adding a keyword or hashtag search (Admin only) Once a Twitter account has been authorized, you can save a search for hashtags or keywords in Settings > Plugins > Twitter > Configure > Saved searches. Then you can add a hashtag (ex: #mwc2013) or keyword (ex: Messi) and click on Save Search. Next time ThinkUp’s crawler runs it will execute this search and save the resulting tweets. Viewing a keyword or hashtag search To view tweets retrieved from a search, use ThinkUp’s search box. Deleting a keyword or hashtag search (Admin only) the Delete button. To delete a saved search, on the saved search page, click on This action deletes: • The saved search • The posts relationship to the hashtag • If another instance has not saved it, the hashtag. It does not delete: • Links • Posts • Users Related to the saved search results. 3.6.2 Application (Administrators only) Administrators can change application-level settings in ThinkUp. 3.6. Settings 39 ThinkUp Documentation, Release 2.0-beta.10 Default service user Choose the public service user which will appear by default when a non-logged in user visits the ThinkUp dashboard. By default, this is set to the last updated service user, that is, the service user which was last crawled successfully. If you set this to a public service user which becomes private, this setting will fall back to its default, the last updated service user. Open registration to new ThinkUp users Allow new users to register for accounts on your ThinkUp installation. When this box is checked, ThinkUp’s register link will present a registration form. Otherwise, ThinkUp displays a message that registration is closed. The default value is registration closed (unchecked). Enable Developer Log Check this box if you want to see the verbose, unformatted developer log on the “Capture Data” screen, instead of the quieter, formatted user log. Once you change this setting, go back to the Dashboard and click on “Capture Data” to see the change in action. Enable reCAPTCHA Configure reCAPTCHA in the ThinkUp user registration form. By default, ThinkUp generates a CAPTCHA image using the GD library. However, reCAPTCHA helps digitize books, and works without GD. To enable reCAPTCHA, get reCAPTCHA API keys, then check the Enable ReCAPTCHA box and enter the keys. If you do not have the GD library installed on your server, reCAPTCHA is a good alternative CAPTCHA solution. Enable beta upgrades Get notified when there is a new ThinkUp beta version available, and have the option to upgrade to it using the web-based upgrader. Proceed at your own risk! ThinkUp betas are unstable versions for testers only. Some may include database migrations that you must run manually (using $ cd install/cli/; php upgrade.php --with-new-sql). Disable the JSON API Check this box if you don’t want to allow users or third-party applications access to public data via the ThinkUp API. When this box is checked, every API request will get an APIDisabledException. Disable thread embeds Check this box if you don’t want to allow users to embed ThinkUp threads on third-party web sites using a JavaScript embed code. When this box is checked, the code will not be available for use. 40 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 Disable usage reporting ThinkUp sends usage information to thinkup.com when it checks if there’s a new version available. Collecting this usage information enables ThinkUp’s core development team to gain insight into what features are in use, and make data-informed decisions about how to improve the application. The information collected about individual ThinkUp installations is not public; it is only available to ThinkUp’s core development team. From time to time, the team may publish usage statistics in aggregate. The usage information includes: • The location and version of the ThinkUp installation • How many and which service users have been added to the installation • The last time an administrator logged into the ThinkUp installation Check this box to disable usage reporting on your ThinkUp installation. Back Up and Export Data Click on the appropriate link to back up or export data from your ThinkUp installation. 3.6.3 Account In the account area of ThinkUp’s settings, you can change your ThinkUp account password, automate ThinkUp crawls, and reset your ThinkUp API key. Password To change your ThinkUp user password, enter your current password, and your new password (once more to confirm). Then click on the “Change password” button. Remember, your ThinkUp password must be at least 5 characters long. Automate ThinkUp Data Capture Instead of manually clicking the “Capture Data” link in ThinkUp’s status bar, you can set up ThinkUp to automatically update its data. You can do so in one of two ways: using a special secret RSS feed subscription in your favorite newsreader, or by scheduling a cron job to run on your web server. You can get your RSS feed URL and the cron job command in ThinkUp’s Settings > Account. Find out more about how to capture data in ThinkUp. Your API Key External applications use your ThinkUp API key for authentication via a special, secret URL which contains the key. For example, RSS news readers can update your ThinkUp data using a special URL which contains this key. If the URL does not contain the right key, ThinkUp will not update. If you’ve accidentally published or shared a URL which contains your ThinkUp API key, change it and update any places you’ve used the URL. For example, once you’ve reset your API key, you’ll have to update your RSS feed subscription URL to the new key. 3.6. Settings 41 ThinkUp Documentation, Release 2.0-beta.10 To change your API key, click on the “Reset Your API Key” button. Then, visit the Capture Data page to copy and paste the updated feed URL into your newsreader. 3.6.4 Users (Administrators only) The Users area of Settings lets administrators manage ThinkUp users and activity. All Users TODO See a full list of users, when they last logged in, activate/deactivate user accounts, etc Invite User While a ThinkUp administrator may not want to keep application registration open to everyone, she might want to invite a specific individual to register for an account. To do so, click on the “Create Invitation” button. ThinkUp will provide a unique, single user registration link which expires in 7 days. Copy and paste that link into an email or instant message to a user to invite that person to register for an account. The invitation link is good for one-time use, and expires after 7 days. 3.7 The ThinkUp API An Application Programming Interface is a set of rules and specifications which let software programs communicate with each other. ThinkUp’s API exposes the data stored by a given ThinkUp installation in a machine-readable format, JSON, via simple REST calls for use by other applications or mashups. 3.7.1 Example API Request For example, to make a Post API request from your ThinkUp installations to see posts by “samwhoo”, the URL would look like this: http://example.com/your_thinkup_install/api/v1/post.php?type=user_posts&username=samwhoo To try it yourself, replace example.com with your domain name and your_thinkup_install with your installation’s path. 3.7.2 Private Data and Authentication ThinkUp’s API currently does not support authentication. Therefore, you cannot retrieve private information using the API. The API will only return posts that are public on Twitter or published on a Facebook Page. 3.7.3 API Reference Currently ThinkUp offers a Post API, which provides methods to retrieve information about posts, such as replies, retweets, user mentions, and hashtags. Post API ThinkUp’s Post API provides methods to retrieve information about posts, such as replies, retweets, user mentions, and hashtags. 42 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 How does it work? The page to request post API results from is located in <thinkup>/api/v1/post.php. There are a number of API call “types” and these can be specified in a “type” URL parameter. Different API call types have their own set of required and optional parameters. Some of these are mapped to work in exactly the same way as the Twitter API but some are ThinkUp-specific. The output from the API is modeled after the Twitter Mentions API and it’s overloaded with ThinkUp data. ThinkUpspecific data can be found in a “thinkup” namespace in each post and user JSON object. How do I use it? To make an API call of type “user_posts” for the user “samwhoo”, your request would look like this: http://example.com/your_thinkup_install/api/v1/post.php?type=user_posts&username=samwhoo That URL will output the latest 20 posts made by samwhoo (as the default number of posts to return is 20) in JSON. Post API Method Reference Refer to each API method’s definition below to see its parameters and example return data. Post Gets a single post. API type slug: post Example usage: api/v1/post.php?type=post&post_id=12345 Required arguments • post_id The ID of the post to retrieve. Optional Arguments • network The network to use in the call. Defaults to ‘twitter’. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. 3.7. The ThinkUp API 43 ThinkUp Documentation, Release 2.0-beta.10 Example output api/v1/post.php?post_id=18152896965124096 (the API type defaults to post): { "id":18152896965124096, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":20636385, "is_reply_by_friend":false, "in_reply_to_post_id":17764087211491328, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@Stellar190 Application in astronomy, you say? Do you have any examples? :) (I don’t doub "created_at":"Fri Dec 24 03:56:02 +0000 2010", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":2, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa member, "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_10150158194220371_54 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } } Post Replies Gets the replies to a post. API call type slug: post_replies Example Usage: api/v1/post.php?type=post_replies&post_id=12345 Required arguments 44 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 • post_id The ID of the post to retrieve replies to. Optional Arguments • network The network to use in the call. Defaults to ‘twitter’. • order_by The column to order the results by. Defaults to chronological order (“date”). The default direction to order results from this call are descending. • unit Sets the unit of measurement to return the reply_retweet_distance in. Can be either “mi” for miles or “km” for kilometres. Defaults to “km”. • count The number of results to display from this API call. Defaults to 20. If you supply something that is not a valid number, this argument will revert to its default value of 20. For performance reasons, the maximum number of posts the ThinkUp API returns per call is 200. • page The page of results to display for this API call. Defaults to 1. When you get to the end of the pages of results, API calls will just return empty JSON. No error is generated. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. Example output api/v1/post.php?type=post_replies&post_id=52490798066958336&include_entities=t [ { "id":52495440951771136, "source":"<a href=\"http://mobile.twitter.com\" rel=\"nofollow\">Twitter for Android</a>", "location":"Seattle, WA, USA", "place":null, "geo":null, "in_reply_to_user_id":69410725, "is_reply_by_friend":false, "in_reply_to_post_id":52490798066958336, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, 3.7. The ThinkUp API 45 ThinkUp Documentation, Release 2.0-beta.10 "favorited":false, "all_retweets":0, "text":"@samwhoo Webfinger: http://t.co/zmlLgeG", "created_at":"Mon Mar 28 22:21:03 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":13205432, "location":"Seattle, WA, USA", "description":"Habitual edge case", "url":"http://trevorbramble.com/", "friend_count":187, "followers_count":270, "profile_image_url":"http://a1.twimg.com/profile_images/1304895448/trevor_nyc_bw_normal.p "name":"Trevor Bramble", "screen_name":"TrevorBramble", "statuses_count":5374, "created_at":"Thu Feb 07 14:32:32 +0000 2008", "utc_offset":3600, "avg_tweets_per_day":4.59, "last_updated":"2011-04-22 05:01:49", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":60224776932835328, "found_in":"retweets" } }, "entities":{ "urls":[ ], "hashtags":[ ], "user_mentions":[ { "name":"Sam Rose", "id":69410725, "screen_name":"samwhoo", "indices":[ 0, 8 ] } ] } }, { "id":52496414823038977, "source":"<a href=\"http://www.tweetdeck.com\" rel=\"nofollow\">TweetDeck</a>", "location":"Atlanta, Georgia", 46 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "place":null, "geo":null, "in_reply_to_user_id":69410725, "is_reply_by_friend":false, "in_reply_to_post_id":52490798066958336, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@samwhoo on it right now", "created_at":"Mon Mar 28 22:24:55 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":19941670, "location":"Atlanta, Georgia", "description":"Living Life the way it shouldn’t be lived... did that make sense??? :) Wri "url":"http://intety.com", "friend_count":124, "followers_count":177, "profile_image_url":"http://a1.twimg.com/profile_images/1312020176/189294_101501047055581 "name":"randi miller", "screen_name":"randi2kewl", "statuses_count":2494, "created_at":"Mon Feb 02 23:34:49 +0000 2009", "utc_offset":3600, "avg_tweets_per_day":3.08, "last_updated":"2011-04-22 04:02:36", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"retweets" } }, "entities":{ "urls":[ ], "hashtags":[ ], "user_mentions":[ { "name":"Sam Rose", "id":69410725, "screen_name":"samwhoo", "indices":[ 0, 8 ] 3.7. The ThinkUp API 47 ThinkUp Documentation, Release 2.0-beta.10 } ] } } ] Post Replies in Range Gets the replies to a post in a given time frame. API call type slug: post_replies_in_range Example Usage: api/v1/post.php?type=post_replies_in_range&from=29-03-2011&until=04-04-2011&pos Required arguments • post_id The ID of the post to retrieve replies to. • from The date/time to start searching from. This can either be a valid date string or a Unix timestamp. • until The date/time to search until. This can either be a valid date string or a Unix timestamp. Optional Arguments • network The network to use in the call. Defaults to ‘twitter’. • order_by The column to order the results by. Defaults to chronological order (“date”). The default direction to order results from this call are descending. • unit Sets the unit of measurement to return the reply_retweet_distance in. Can be either “mi” for miles or “km” for kilometres. Defaults to “km”. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. 48 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 Warning: The method ‘post_replies_in_range’, along with user_replies_in_range, user_questions_in_range, user_mentions_in_range and user_posts_in_range are the ThinkUp Post API methods which do not enforce a cap of 200 post results returned per call. As such, when querying time ranges which contain more than 200 posts, keep in mind that processing that amount of data may exceed your server’s memory limits. Example output /api/v1/post.php?type=post_replies_in_range&post_id=242576686674223106&from=20 [ { "id":242578744764690432, "author_follower_count":null, "source":"web", "location":"Tordera-Barcelona", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576686674223106, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "text":"@penia19 #fcb", "created_at":"Mon Sep 03 11:04:14 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":256559225, "location":"Tordera-Barcelona", "description":"Llicenciada en Ci\u00e8ncies Pol\u00edtiques i de l’Administraci\u00f3, a "url":"", "friend_count":520, "last_updated":"2012-09-03 13:23:58", "followers_count":283, "profile_image_url":"http://a0.twimg.com/profile_images/2169909420/ji_normal.jpg", "name":"Judith", "screen_name":"judithtoronjo", "statuses_count":585, "created_at":"Wed Feb 23 15:58:39 +0100 2011", "avg_tweets_per_day":1.05, "thinkup":{ 3.7. The ThinkUp API 49 ThinkUp Documentation, Release 2.0-beta.10 "last_post":"0000-00-00 00:00:00", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ { "text":"fcb", "indices":[ 9, 13 ] } ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 0, 8 ] } ] } }, { "id":242579576025403392, "author_follower_count":null, "source":"web", "location":"Barcelona", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576686674223106, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "text":"@penia19 me too!", "created_at":"Mon Sep 03 11:07:32 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, 50 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":302708860, "location":"Barcelona", "description":"Research Project Manager @ TVC - I never think of the future. It comes soo "url":"http://es.linkedin.com/in/eusebiocarasusan", "friend_count":247, "last_updated":"2012-09-03 13:23:58", "followers_count":113, "profile_image_url":"http://a0.twimg.com/profile_images/2432460341/810fonvgxd8c9z65pgdi_n "name":"Eusebio Carasus\u00e1n", "screen_name":"ecarasusan", "statuses_count":417, "created_at":"Sat May 21 16:40:17 +0200 2011", "avg_tweets_per_day":0.89, "thinkup":{ "last_post":"2012-08-23 17:51:19", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 0, 8 ] } ] } } ] Post Retweets Gets all retweets of a post. API call type slug: post_retweets Example Usage: api/v1/post.php?type=post_retweets&post_id=12345 Required arguments • post_id The ID of the post to retrieve retweets of. Optional Arguments • network 3.7. The ThinkUp API 51 ThinkUp Documentation, Release 2.0-beta.10 The network to use in the call. Defaults to ‘twitter’. • order_by The column to order the results by. Defaults to chronological order (“date”). The default direction to order results from this call are descending. • unit Sets the unit of measurement to return the reply_retweet_distance in. Can be either “mi” for miles or “km” for kilometres. Defaults to “km”. • count The number of results to display from this API call. Defaults to 20. If you supply something that is not a valid number, this argument will revert to its default value of 20. For performance reasons, the maximum number of posts the ThinkUp API returns per call is 200. • page The page of results to display for this API call. Defaults to 1. When you get to the end of the pages of results, API calls will just return empty JSON. No error is generated. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. Example output api/v1/post.php?type=post_retweets&post_id=17393678888738816: [ { "id":17438947407831040, "source":"web", "location":"Liverpool.", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":69410725, "reply_retweet_distance":0, "is_retweet_by_friend":true, "favorited":false, "all_retweets":0, "text":"RT @samwhoo: Comic Sans is trending? A bit late aren’t you, Twitter?", "created_at":"Wed Dec 22 04:39:03 +0000 2010", "annotations":null, "truncated":false, "protected":false, "thinkup":{ 52 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":92529373, "location":"Liverpool.", "description":"Online and pissed off.", "url":"", "friend_count":38, "followers_count":42, "profile_image_url":"http://a0.twimg.com/profile_images/1249376120/Photo_1_normal.jpg", "name":"David Parry", "screen_name":"buildthewall", "statuses_count":515, "created_at":"Wed Nov 25 14:11:37 +0000 2009", "utc_offset":3600, "avg_tweets_per_day":1.00, "last_updated":"2011-04-22 03:05:21", "thinkup":{ "last_post":"2011-04-12 03:46:18", "last_post_id":57650725152493569, "found_in":"Friends" } }, "retweeted_status":{ "id":17393678888738816, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":1, "text":"Comic Sans is trending? A bit late aren’t you, Twitter?", "created_at":"Wed Dec 22 01:39:10 +0000 2010", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":1, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, 3.7. The ThinkUp API 53 ThinkUp Documentation, Release 2.0-beta.10 "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_101501581942 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } } } ] Related Posts Gets posts that are related to a post. By this we mean replies and retweets. API call type slug: related_posts Example Usage: api/v1/post.php?type=related_posts&post_id=12345 Required arguments • post_id The ID of the post to find related posts for. Optional Arguments • network The network to use in the call. Defaults to ‘twitter’. • count The number of results to display from this API call. Defaults to 20. If you supply something that is not a valid number, this argument will revert to its default value of 20. For performance reasons, the maximum number of posts the ThinkUp API returns per call is 200. • page The page of results to display for this API call. Defaults to 1. When you get to the end of the pages of results, API calls will just return empty JSON. No error is generated. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user 54 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. Example output api/v1/post.php?type=related_posts&post_id=4329245409021953&include_entities=t [ { "id":5658882579898369, "source":"<a href=\"http://itunes.apple.com/app/twitter/id333903271?mt=8\" rel=\"nofollow\">T "location":"Cardiff", "place":null, "geo":null, "in_reply_to_user_id":69410725, "is_reply_by_friend":false, "in_reply_to_post_id":4329245409021953, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@samwhoo Very, very annoyed with my parents for not letting me go :(", "created_at":"Fri Nov 19 16:29:17 +0000 2010", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":15040935, "location":"Cardiff", "description":"16 year old. I do a podcast, SDWFD(w/c!) http://v.gd/superwooduo. Skeptic. "url":"http://thewelshboyo.co.uk", "friend_count":310, "followers_count":1377, "profile_image_url":"http://a3.twimg.com/profile_images/1295858459/4aed4901-d81b-490d-a35 "name":"Rhys Morgan", "screen_name":"rhysmorgan", "statuses_count":32396, "created_at":"Sat Jun 07 19:42:58 +0100 2008", "utc_offset":3600, "avg_tweets_per_day":30.88, "last_updated":"2011-04-22 13:01:31", "thinkup":{ "last_post":"2011-04-22 11:33:42", "last_post_id":0, "found_in":"retweets" } }, "entities":{ "urls":[ ], "hashtags":[ 3.7. The ThinkUp API 55 ThinkUp Documentation, Release 2.0-beta.10 ], "user_mentions":[ { "name":"Sam Rose", "id":69410725, "screen_name":"samwhoo", "indices":[ 0, 8 ] } ] } }, { "id":5639421072244736, "source":"web", "location":"Milky Way Galaxy", "place":null, "geo":null, "in_reply_to_user_id":69410725, "is_reply_by_friend":false, "in_reply_to_post_id":4329245409021953, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@samwhoo Hey, only just saw your great blogpost! Thanks so much, and heck I’m useless "created_at":"Fri Nov 19 15:11:57 +0000 2010", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":20635230, "location":"Milky Way Galaxy", "description":"Moderator of Galaxy Zoo & co-founder of Skeptics in the Pub in Wales; citi "url":"http://www.aliceingalaxyland.blogspot.com", "friend_count":475, "followers_count":1416, "profile_image_url":"http://a2.twimg.com/profile_images/1207391142/penguin_shrunk_SDSS_wi "name":"Alice Sheppard", "screen_name":"PenguinGalaxy", "statuses_count":27569, "created_at":"Wed Feb 11 22:27:37 +0000 2009", "utc_offset":3600, "avg_tweets_per_day":34.46, "last_updated":"2011-04-22 13:02:34", "thinkup":{ "last_post":"2011-04-22 11:31:57", "last_post_id":0, "found_in":"retweets" 56 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 } }, "entities":{ "urls":[ ], "hashtags":[ ], "user_mentions":[ { "name":"Sam Rose", "id":69410725, "screen_name":"samwhoo", "indices":[ 0, 8 ] } ] } } ] User Mentions Gets posts that a user is mentioned in. API call type slug: user_mentions Example Usage: api/v1/post.php?type=user_mentions&username=samwhoo Required arguments • user_id or username Only one of these is required. They are to specify the user to gather posts for in this call. Optional Arguments • network The network to use in the call. Defaults to ‘twitter’. • order_by The column to order the results by. Defaults to chronological order (“date”). • direction The direction to order the results in. Can be either DESC or ASC. Defaults to DESC. • include_rts Whether or not to include retweets as mentions. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • count The number of results to display from this API call. Defaults to 20. If you supply something that is not a valid number, this argument will revert to its default value of 20. For performance reasons, the maximum number of posts the ThinkUp API returns per call is 200. 3.7. The ThinkUp API 57 ThinkUp Documentation, Release 2.0-beta.10 • page The page of results to display for this API call. Defaults to 1. When you get to the end of the pages of results, API calls will just return empty JSON. No error is generated. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. Example output api/v1/post.php?type=user_mentions&username=samwhoo&count=5: [ { "id":61263346028122114, "source":"web", "location":"Canada", "place":null, "geo":null, "in_reply_to_user_id":69410725, "is_reply_by_friend":true, "in_reply_to_post_id":61257731159490560, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@samwhoo Passionate", "created_at":"Fri Apr 22 03:01:34 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":85760550, "location":"Canada", "description":"Hah!", "url":"", "friend_count":18, "followers_count":18, "profile_image_url":"http://a3.twimg.com/profile_images/855291577/twitterProfilePhoto_nor "name":"Benoit Landry", "screen_name":"Salvidrim", "statuses_count":837, 58 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "created_at":"Wed Oct 28 06:50:42 +0000 2009", "utc_offset":3600, "avg_tweets_per_day":1.55, "last_updated":"2011-04-22 07:00:53", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"retweets" } } }, { "id":61263078871937024, "source":"web", "location":"Lehi, Utah", "place":null, "geo":null, "in_reply_to_user_id":69410725, "is_reply_by_friend":false, "in_reply_to_post_id":61238661223682048, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@samwhoo I’m glad i got my degree, but the every day skills came from open source and "created_at":"Fri Apr 22 03:00:30 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":9905392, "location":"Lehi, Utah", "description":"A software toolsmith that creates, customizes, and masters great software "url":"http://findme.travishartwell.net/", "friend_count":805, "followers_count":1620, "profile_image_url":"http://a3.twimg.com/profile_images/35267502/n882175547_27194_normal. "name":"Travis B. Hartwell", "screen_name":"travisbhartwell", "statuses_count":1744, "created_at":"Sat Nov 03 02:50:41 +0000 2007", "utc_offset":3600, "avg_tweets_per_day":1.38, "last_updated":"2011-04-22 04:01:12", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"mentions" } } }, 3.7. The ThinkUp API 59 ThinkUp Documentation, Release 2.0-beta.10 { "id":61214633675067392, "source":"<a href=\"http://mobile.twitter.com\" rel=\"nofollow\">Twitter for Android</a>", "location":"", "place":null, "geo":null, "in_reply_to_user_id":69410725, "is_reply_by_friend":false, "in_reply_to_post_id":61136478058708992, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@samwhoo l kicked off quite a thread. Sorry! :)", "created_at":"Thu Apr 21 23:48:00 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":18326200, "location":"", "description":"", "url":"http://pdurbin.freeshell.org", "friend_count":100, "followers_count":51, "profile_image_url":"http://a0.twimg.com/profile_images/68449525/6b686fe7f07115890ca63099 "name":"Philip Durbin", "screen_name":"philipdurbin", "statuses_count":364, "created_at":"Tue Dec 23 04:17:49 +0000 2008", "utc_offset":3600, "avg_tweets_per_day":0.43, "last_updated":"2011-04-22 01:00:21", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"mentions" } } }, { "id":61185698706886657, "source":"web", "location":"Seattle, WA, USA", "place":null, "geo":null, "in_reply_to_user_id":69410725, "is_reply_by_friend":true, "in_reply_to_post_id":61179112676528128, "in_rt_of_user_id":null, "reply_retweet_distance":0, 60 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@samwhoo Perhaps you can soothe your wounded heart with the warm microprocessors of a "created_at":"Thu Apr 21 21:53:02 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":13205432, "location":"Seattle, WA, USA", "description":"Habitual edge case", "url":"http://trevorbramble.com/", "friend_count":187, "followers_count":270, "profile_image_url":"http://a1.twimg.com/profile_images/1304895448/trevor_nyc_bw_normal.p "name":"Trevor Bramble", "screen_name":"TrevorBramble", "statuses_count":5374, "created_at":"Thu Feb 07 14:32:32 +0000 2008", "utc_offset":3600, "avg_tweets_per_day":4.59, "last_updated":"2011-04-22 05:01:49", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":60224776932835328, "found_in":"retweets" } } }, { "id":61134153202151424, "source":"<a href=\"http://www.tweetdeck.com\" rel=\"nofollow\">TweetDeck</a>", "location":"Montreal, Canada", "place":null, "geo":null, "in_reply_to_user_id":69410725, "is_reply_by_friend":true, "in_reply_to_post_id":61133719125237760, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@samwhoo I know, same here! You should hear us speak component part codes out loud he "created_at":"Thu Apr 21 18:28:12 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, 3.7. The ThinkUp API 61 ThinkUp Documentation, Release 2.0-beta.10 "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":15496351, "location":"Montreal, Canada", "description":"Prefer to enjoy the big picture than examine the individual pictures; take "url":"http://angelostavrow.com", "friend_count":1122, "followers_count":774, "profile_image_url":"http://a0.twimg.com/profile_images/1177837673/bluemountains_normal.j "name":"Angelo Stavrow", "screen_name":"AngeloStavrow", "statuses_count":8859, "created_at":"Sat Jul 19 23:01:16 +0100 2008", "utc_offset":3600, "avg_tweets_per_day":8.80, "last_updated":"2011-04-21 20:00:41", "thinkup":{ "last_post":"2011-04-20 20:29:01", "last_post_id":60338425013878784, "found_in":"mentions" } } } ] User Mentions in Range Gets posts that a user is mentioned in a given time frame. API call type slug: user_mentions_in_range Example Usage: api/v1/post.php?type=user_mentions_in_range&from=29-03-2011&until=04-04-2011&us Required arguments • user_id or username Only one of these is required. They are to specify the user to gather posts for in this call. • from The date/time to start searching from. This can either be a valid date string or a Unix timestamp. • until The date/time to search until. This can either be a valid date string or a Unix timestamp. Optional Arguments • network The network to use in the call. Defaults to ‘twitter’. • order_by The column to order the results by. Defaults to chronological order (“date”). • direction The direction to order the results in. Can be either DESC or ASC. Defaults to DESC. 62 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 • include_rts Whether or not to include retweets as mentions. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. Warning: The method ‘user_mentions_in_range’, along with user_replies_in_range, post_replies_in_range, user_questions_in_range and user_posts_in_range are the ThinkUp Post API methods which do not enforce a cap of 200 post results returned per call. As such, when querying time ranges which contain more than 200 posts, keep in mind that processing that amount of data may exceed your server’s memory limits. Example output /api/v1/post.php?type=user_mentions_in_range&username=penia19&from=2012-09-03T [ { "id":242580106491596801, "author_follower_count":null, "source":"web", "location":"Barcelona", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":null, "in_reply_to_post_id":null, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "text":"1.500 alojamientos rurales han echado el cierre este a\u00f1o http://t.co/ZxbcJAqt Qu "created_at":"Mon Sep 03 11:09:38 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, 3.7. The ThinkUp API 63 ThinkUp Documentation, Release 2.0-beta.10 "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":302708860, "location":"Barcelona", "description":"Research Project Manager @ TVC - I never think of the future. It comes soo "url":"http://es.linkedin.com/in/eusebiocarasusan", "friend_count":247, "last_updated":"2012-09-03 13:23:58", "followers_count":113, "profile_image_url":"http://a0.twimg.com/profile_images/2432460341/810fonvgxd8c9z65pgdi_n "name":"Eusebio Carasus\u00e1n", "screen_name":"ecarasusan", "statuses_count":417, "created_at":"Sat May 21 16:40:17 +0200 2011", "avg_tweets_per_day":0.89, "thinkup":{ "last_post":"2012-08-23 17:51:19", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 113, 121 ] } ] } }, { "id":242579576025403392, "author_follower_count":null, "source":"web", "location":"Barcelona", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576686674223106, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ 64 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 ], "favorited":false, "all_retweets":0, "text":"@penia19 me too!", "created_at":"Mon Sep 03 11:07:32 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":302708860, "location":"Barcelona", "description":"Research Project Manager @ TVC - I never think of the future. It comes soo "url":"http://es.linkedin.com/in/eusebiocarasusan", "friend_count":247, "last_updated":"2012-09-03 13:23:58", "followers_count":113, "profile_image_url":"http://a0.twimg.com/profile_images/2432460341/810fonvgxd8c9z65pgdi_n "name":"Eusebio Carasus\u00e1n", "screen_name":"ecarasusan", "statuses_count":417, "created_at":"Sat May 21 16:40:17 +0200 2011", "avg_tweets_per_day":0.89, "thinkup":{ "last_post":"2012-08-23 17:51:19", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 0, 8 ] } ] } }, { "id":242579461676101632, "author_follower_count":null, "source":"web", "location":"Barcelona", "place":null, 3.7. The ThinkUp API 65 ThinkUp Documentation, Release 2.0-beta.10 "place_id":null, "geo":null, "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576991033888768, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "text":"@penia19 he’s gonna win a lot of titles with FCB", "created_at":"Mon Sep 03 11:07:05 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":302708860, "location":"Barcelona", "description":"Research Project Manager @ TVC - I never think of the future. It comes soo "url":"http://es.linkedin.com/in/eusebiocarasusan", "friend_count":247, "last_updated":"2012-09-03 13:23:58", "followers_count":113, "profile_image_url":"http://a0.twimg.com/profile_images/2432460341/810fonvgxd8c9z65pgdi_n "name":"Eusebio Carasus\u00e1n", "screen_name":"ecarasusan", "statuses_count":417, "created_at":"Sat May 21 16:40:17 +0200 2011", "avg_tweets_per_day":0.89, "thinkup":{ "last_post":"2012-08-23 17:51:19", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 0, 66 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 8 ] } ] } }, { "id":242578915867111424, "author_follower_count":null, "source":"web", "location":"Tordera-Barcelona", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576991033888768, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "text":"@penia19 I don’t like Alex Song", "created_at":"Mon Sep 03 11:04:55 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":256559225, "location":"Tordera-Barcelona", "description":"Llicenciada en Ci\u00e8ncies Pol\u00edtiques i de l’Administraci\u00f3, a "url":"", "friend_count":520, "last_updated":"2012-09-03 13:23:58", "followers_count":283, "profile_image_url":"http://a0.twimg.com/profile_images/2169909420/ji_normal.jpg", "name":"Judith", "screen_name":"judithtoronjo", "statuses_count":585, "created_at":"Wed Feb 23 15:58:39 +0100 2011", "avg_tweets_per_day":1.05, "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":"", "found_in":"mentions" } 3.7. The ThinkUp API 67 ThinkUp Documentation, Release 2.0-beta.10 }, "entities":{ "hashtags":[ ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 0, 8 ] } ] } }, { "id":242578744764690432, "author_follower_count":null, "source":"web", "location":"Tordera-Barcelona", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576686674223106, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "text":"@penia19 #fcb", "created_at":"Mon Sep 03 11:04:14 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":256559225, "location":"Tordera-Barcelona", "description":"Llicenciada en Ci\u00e8ncies Pol\u00edtiques i de l’Administraci\u00f3, a "url":"", "friend_count":520, "last_updated":"2012-09-03 13:23:58", 68 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "followers_count":283, "profile_image_url":"http://a0.twimg.com/profile_images/2169909420/ji_normal.jpg", "name":"Judith", "screen_name":"judithtoronjo", "statuses_count":585, "created_at":"Wed Feb 23 15:58:39 +0100 2011", "avg_tweets_per_day":1.05, "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ { "text":"fcb", "indices":[ 9, 13 ] } ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 0, 8 ] } ] } }, { "id":242577856054587392, "author_follower_count":null, "source":"web", "location":"", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576991033888768, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "text":"@penia19 I think he’s doing great so far. #Song’s contributions to the team have only 3.7. The ThinkUp API 69 ThinkUp Documentation, Release 2.0-beta.10 "created_at":"Mon Sep 03 11:00:42 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":45437435, "location":"", "description":"Powering the next Renaissance", "url":"http://dani.calidos.com", "friend_count":142, "last_updated":"2012-09-03 13:23:59", "followers_count":141, "profile_image_url":"http://a0.twimg.com/profile_images/268758740/dani_normal.jpg", "name":"Daniel Giribet", "screen_name":"danielgiri", "statuses_count":625, "created_at":"Sun Jun 07 22:19:14 +0200 2009", "avg_tweets_per_day":0.53, "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ { "text":"Song", "indices":[ 42, 47 ] }, { "text":"fcb", "indices":[ 99, 103 ] } ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 0, 8 ] } 70 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 ] } } ] User Posts Gets a user’s posts. API call type slug: user_posts Example Usage: api/v1/post.php?type=user_posts&username=samwhoo Required arguments • user_id or username Only one of these is required. They are to specify the user to gather posts for in this call. Optional Arguments • network The network to use in the call. Defaults to ‘twitter’. • order_by The column to order the results by. Defaults to chronological order (“date”). • direction The direction to order the results in. Can be either DESC or ASC. Defaults to DESC. • count The number of results to display from this API call. Defaults to 20. If you supply something that is not a valid number, this argument will revert to its default value of 20. For performance reasons, the maximum number of posts the ThinkUp API returns per call is 200. • page The page of results to display for this API call. Defaults to 1. When you get to the end of the pages of results, API calls will just return empty JSON. No error is generated. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. 3.7. The ThinkUp API 71 ThinkUp Documentation, Release 2.0-beta.10 Example output api/v1/post.php?type=user_posts&username=samwhoo&count=5&order_by=date&directi (this is getting the first 5 posts I ever made on Twitter! :)): [ { "id":15719632017, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":21075943, "is_reply_by_friend":false, "in_reply_to_post_id":15719242236, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@barnsleysime Spotify invite, wasn’t it? :)", "created_at":"Tue Jun 08 17:12:42 +0100 2010", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":15735656159, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":21075943, "is_reply_by_friend":false, 72 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "in_reply_to_post_id":15720735591, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@barnsleysime Thanks man, appreciated :) Could you give me a shout when it’s sent? It "created_at":"Tue Jun 08 22:08:35 +0100 2010", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":15753982331, "source":"<a href=\"http://dev.twitter.com/\" rel=\"nofollow\">API</a>", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"Interesting...", "created_at":"Wed Jun 09 03:20:46 +0100 2010", "annotations":null, "truncated":false, "protected":false, 3.7. The ThinkUp API 73 ThinkUp Documentation, Release 2.0-beta.10 "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":15779270312, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":20668363, "is_reply_by_friend":false, "in_reply_to_post_id":15772812067, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@Tadhg17 Everything alright, mate? I did see :(", "created_at":"Wed Jun 09 12:47:55 +0100 2010", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", 74 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":15779305392, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":21075943, "is_reply_by_friend":false, "in_reply_to_post_id":15765794056, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@barnsleysime Thanks, man :)", "created_at":"Wed Jun 09 12:48:32 +0100 2010", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ 3.7. The ThinkUp API 75 ThinkUp Documentation, Release 2.0-beta.10 "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } } ] User Posts In Range Gets a user’s posts in a given time range. API call type slug: user_posts_in_range Example Usage: api/v1/post.php?type=user_posts_in_range&from=29-03-2011&until=04-04-2011&usern Required arguments • user_id or username Only one of these is required. They are to specify the user to gather posts for in this call. • from The date/time to start searching from. This can either be a valid date string or a Unix timestamp. • until The date/time to search until. This can either be a valid date string or a Unix timestamp. Optional Arguments • network The network to use in the call. Defaults to ‘twitter’. • order_by The column to order the results by. Defaults to chronological order (“date”). • direction The direction to order the results in. Can be either DESC or ASC. Defaults to DESC. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. 76 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 Warning: The method ‘user_questions_in_range’, along with user_replies_in_range, post_replies_in_range, user_mentions_in_range and user_posts_in_range are the ThinkUp Post API methods which do not enforce a cap of 200 post results returned per call. As such, when querying time ranges which contain more than 200 posts, keep in mind that processing that amount of data may exceed your server’s memory limits. Example output api/v1/post.php?type=user_posts_in_range&from=02-04-2011&until=04-04-2011&user [ { "id":54682603856474112, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"That was absolutely terrifying. #westboro", "created_at":"Sun Apr 03 23:12:03 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { 3.7. The ThinkUp API 77 ThinkUp Documentation, Release 2.0-beta.10 "id":54651076317687809, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":19228261, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"RT @RayPeacock: There is no \"heaven\" up in the sky. That is called \"space\". We "created_at":"Sun Apr 03 21:06:46 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } }, "retweeted_status":{ "id":54650142262964224, "source":"web", "location":"UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, 78 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "all_retweets":20, "text":"There is no \"heaven\" up in the sky. That is called \"space\". We have been up "created_at":"Sun Apr 03 21:03:03 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":20, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":19228261, "location":"UK", "description":"Comedian, actor, writer, warm-up, prick. I do that Peacock & Gamble Po "url":"http://www.peacockandgamble.com", "friend_count":178, "followers_count":1957, "profile_image_url":"http://a2.twimg.com/profile_images/1316595931/Photo_on_2010-09-0 "name":"Ray Peacock", "screen_name":"RayPeacock", "statuses_count":2515, "created_at":"Tue Jan 20 10:36:13 +0000 2009", "utc_offset":3600, "avg_tweets_per_day":3.06, "last_updated":"2011-04-22 02:02:06", "thinkup":{ "last_post":"2011-04-20 23:57:31", "last_post_id":61226639987720193, "found_in":"Friends" } } } }, { "id":54631742396579840, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":20474878, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"RT @garwboy: Thanks to Channel 4 news, I now know what the respected philosopher Liam "created_at":"Sun Apr 03 19:49:57 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, 3.7. The ThinkUp API 79 ThinkUp Documentation, Release 2.0-beta.10 "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } }, "retweeted_status":{ "id":54630960607657984, "source":"web", "location":"Cardiff", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":4, "text":"Thanks to Channel 4 news, I now know what the respected philosopher Liam Gallaghe "created_at":"Sun Apr 03 19:46:50 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":4, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":20474878, "location":"Cardiff", "description":"Neuroscience Doctor (on paper), sort of\ncomedian, skeptic, human, wri "url":"http://sciencedigestive.blogspot.com", "friend_count":423, "followers_count":1735, "profile_image_url":"http://a2.twimg.com/profile_images/1195827475/Dean_headshot_norm "name":"Dean Burnett", "screen_name":"garwboy", 80 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "statuses_count":11322, "created_at":"Mon Feb 09 22:45:43 +0000 2009", "utc_offset":3600, "avg_tweets_per_day":14.12, "last_updated":"2011-04-22 01:09:22", "thinkup":{ "last_post":"2011-04-20 15:42:32", "last_post_id":61076030407966720, "found_in":"Friends" } } } }, { "id":54390296020135936, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":10697232, "is_reply_by_friend":false, "in_reply_to_post_id":54368439489413120, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@drdrang Woot :D Thanks for the feedback!", "created_at":"Sun Apr 03 03:50:31 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } 3.7. The ThinkUp API 81 ThinkUp Documentation, Release 2.0-beta.10 } }, { "id":54383212843106304, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"OH: I mean the 20 words; it does nothing, just silently mocks me when I click - @char "created_at":"Sun Apr 03 03:22:22 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":54365021995663360, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":10697232, "is_reply_by_friend":false, "in_reply_to_post_id":54361082340458498, 82 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@drdrang Hm. Doesn’t seem to be doing anything for me either. Wanna post this to the "created_at":"Sun Apr 03 02:10:05 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":54356409298587648, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":930061, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@ginatrapani \"NEXT MILESTONE: 917 days till you reach 1,000 followers at this rate.\ "created_at":"Sun Apr 03 01:35:52 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ 3.7. The ThinkUp API 83 ThinkUp Documentation, Release 2.0-beta.10 "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":54355802038878208, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":10697232, "is_reply_by_friend":false, "in_reply_to_post_id":54316403053969408, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@drdrang @matthewmcvickar How are you guys finding ThinkUp? Any suggestions for featu "created_at":"Sun Apr 03 01:33:27 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":2, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, 84 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":54355320696356864, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":20635230, "is_reply_by_friend":false, "in_reply_to_post_id":54351904683200513, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@PenguinGalaxy Haha! Mm, lots of kids just do a degree in easy so they can hide from "created_at":"Sun Apr 03 01:31:32 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", 3.7. The ThinkUp API 85 ThinkUp Documentation, Release 2.0-beta.10 "last_post_id":0, "found_in":"Owner Status" } } }, { "id":54351245707722752, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":1, "text":"When I finish my education, I want a first class honours degree from the University o "created_at":"Sun Apr 03 01:15:21 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":1, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":54346303643189248, "source":"web", "location":"Wales, UK", "place":null, "geo":null, 86 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":838211, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"RT @digitalvision: \"Oh my God, Becky. Look at that pizza. It’s so.. Big. So round. L "created_at":"Sun Apr 03 00:55:43 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } }, "retweeted_status":{ "id":54345143683264513, "source":"<a href=\"http://twitter.com/\" rel=\"nofollow\">Twitter for iPhone</a>", "location":"Detroit, MI", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":1, "text":"\"Oh my God, Becky. Look at that pizza. It’s so.. Big. So round. Like one of thos "created_at":"Sun Apr 03 00:51:06 +0100 2011", "annotations":null, "truncated":false, 3.7. The ThinkUp API 87 ThinkUp Documentation, Release 2.0-beta.10 "protected":false, "thinkup":{ "retweet_count_cache":1, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":838211, "location":"Detroit, MI", "description":"1/2 cup Urbanist, 3/4 cup Digital Marketing Pro, 1/2 cup Geek Culture, "url":"http://www.portagemedia.com", "friend_count":2019, "followers_count":2229, "profile_image_url":"http://a2.twimg.com/profile_images/1297333462/twitter-export_nor "name":"Jeremiah Staes", "screen_name":"digitalvision", "statuses_count":16044, "created_at":"Fri Mar 09 17:13:01 +0000 2007", "utc_offset":3600, "avg_tweets_per_day":10.66, "last_updated":"2011-04-22 01:02:06", "thinkup":{ "last_post":"2011-04-20 22:14:55", "last_post_id":61217238421733376, "found_in":"Friends" } } } }, { "id":54212753145069568, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":221187763, "is_reply_by_friend":false, "in_reply_to_post_id":54189744225124352, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@Carlos13th I broke ThinkUp’s ability to store posts in its database :p I only did it "created_at":"Sat Apr 02 16:05:02 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", 88 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":54199405577904128, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":15040935, "is_reply_by_friend":false, "in_reply_to_post_id":54193366124085249, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@rhysmorgan The scout is amazing if you’re quick on the headshots :) Makes you look p "created_at":"Sat Apr 02 15:11:59 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, 3.7. The ThinkUp API 89 ThinkUp Documentation, Release 2.0-beta.10 "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":54173992705204224, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":19544379, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"RT @_L_M_C_: If this audiobook doesn’t download properly I’ll never hear the end of i "created_at":"Sat Apr 02 13:31:01 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } }, "retweeted_status":{ "id":54168009958367232, "source":"web", "location":null, 90 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":10, "text":"If this audiobook doesn’t download properly I’ll never hear the end of it.", "created_at":"Sat Apr 02 13:07:14 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":10, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":null } }, { "id":54025293215711232, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":32372003, "is_reply_by_friend":false, "in_reply_to_post_id":54023437231980544, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@MaizieFellows @ben_hay I wouldn’t worry, Maizie, I wasn’t included either :<", "created_at":"Sat Apr 02 03:40:08 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", 3.7. The ThinkUp API 91 ThinkUp Documentation, Release 2.0-beta.10 "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":54001484991430656, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"Wow. It’s remarkable how much damage 11 characters can do when they’re put somewhere "created_at":"Sat Apr 02 02:05:31 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } 92 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 } } ] Most Replied To Posts Gets a user’s most replied to posts. API call type slug: user_posts_most_replied_to Example Usage: webapp/api/v1/post.php?type=user_posts_most_replied_to&username=samwhoo Required arguments • user_id or username Only one of these is required. They are to specify the user to gather posts for in this call. Optional Arguments • network The network to use in the call. Defaults to ‘twitter’. • count The number of results to display from this API call. Defaults to 20. If you supply something that is not a valid number, this argument will revert to its default value of 20. For performance reasons, the maximum number of posts the ThinkUp API returns per call is 200. • page The page of results to display for this API call. Defaults to 1. When you get to the end of the pages of results, API calls will just return empty JSON. No error is generated. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. Example output webapp/api/v1/post.php?type=user_posts_most_replied_to&username=samwhoo&count= [ { "id":13719897980805120, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":20108370, "is_reply_by_friend":false, 3.7. The ThinkUp API 93 ThinkUp Documentation, Release 2.0-beta.10 "in_reply_to_post_id":13716755222368256, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@RAtheist Broken link?", "created_at":"Sat Dec 11 22:20:53 +0000 2010", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":3, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725 } }, { "id":12275344295862272, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":20108370, "is_reply_by_friend":false, "in_reply_to_post_id":12252101350531072, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@RAtheist I selected United Kingdom from a dropdown list O.o", "created_at":"Tue Dec 07 22:40:44 +0000 2010", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":3, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725 } }, { "id":1327470519259136, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":20635230, "is_reply_by_friend":false, 94 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "in_reply_to_post_id":1326700147249152, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@PenguinGalaxy Implement a font colour selector if you had access to the theme’s code "created_at":"Sun Nov 07 17:37:48 +0000 2010", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":3, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725 } }, { "id":28922695221, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":15040935, "is_reply_by_friend":false, "in_reply_to_post_id":28922592976, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@rhysmorgan @garwboy @PenguinGalaxy I still have absolutely no idea what it is ^_^ S "created_at":"Wed Oct 27 20:41:02 +0100 2010", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":3, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725 } }, { "id":57489200131485696, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":9923162, "is_reply_by_friend":false, 3.7. The ThinkUp API 95 ThinkUp Documentation, Release 2.0-beta.10 "in_reply_to_post_id":57354343355138048, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@DazMSmith Hopefully someone else at ThinkUp will have a more coherent answer for you "created_at":"Mon Apr 11 17:04:28 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":2, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725 } } ] Most Retweeted Posts Gets a user’s most retweeted posts. API call type slug: user_posts_most_retweeted Example Usage: webapp/api/v1/post.php?type=user_posts_most_retweeted&username=samwhoo Required arguments • user_id or username Only one of these is required. They are to specify the user to gather posts for in this call. Optional Arguments • network The network to use in the call. Defaults to ‘twitter’. • count The number of results to display from this API call. Defaults to 20. • page The page of results to display for this API call. Defaults to 1. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user 96 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. Example output webapp/api/v1/post.php?type=user_posts_most_retweeted&username=samwhoo&count=5 [ { "id":55040741323448320, "source":"<a href=\"http://mobile.twitter.com\" rel=\"nofollow\">Twitter for Android</a>", "location":"Wales, UK", "place":"Rhondda Cynon Taff, Rhondda Cynon Taff", "geo":{ "coordinates":[ 51.594253, -3.3257351 ] }, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":4, "text":"My house mate is trying to convert me so I keep fixing his propaganda. http://t.co/kW "created_at":"Mon Apr 04 22:55:09 +0100 2011", "annotations":null, "truncated":false, "protected":false, "coordinates":{ "coordinates":[ 51.594253, -3.3257351 ] }, "thinkup":{ "retweet_count_cache":4, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":237, "followers_count":102, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":941, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.55, "last_updated":"2011-04-26 15:00:05", "thinkup":{ 3.7. The ThinkUp API 97 ThinkUp Documentation, Release 2.0-beta.10 "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":21760224817840128, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":2, "text":"\"Vaginas\" are trending! I feel so left out.", "created_at":"Mon Jan 03 02:50:16 +0000 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":2, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":237, "followers_count":102, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":941, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.55, "last_updated":"2011-04-26 15:00:05", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":4329245409021953, "source":"web", "location":"Wales, UK", "place":null, 98 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":2, "text":"Had a great time tonight at #Cardiff #SitP My post about it: http://lbak.co.uk/blog/1 "created_at":"Tue Nov 16 00:25:47 +0000 2010", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":2, "reply_count_cache":2, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":237, "followers_count":102, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":941, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.55, "last_updated":"2011-04-26 15:00:05", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":59051247554146304, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":1, "text":"Anyone know a good way to reliably reproduce the following errors in the Twitter API: "created_at":"Sat Apr 16 00:31:29 +0100 2011", 3.7. The ThinkUp API 99 ThinkUp Documentation, Release 2.0-beta.10 "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":1, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":237, "followers_count":102, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":941, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.55, "last_updated":"2011-04-26 15:00:05", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":55589617977663488, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":1, "text":"http://isblackmesareleased.com/releasedate/ - Absolutely brilliant ^_^", "created_at":"Wed Apr 06 11:16:12 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":1, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, 100 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":237, "followers_count":102, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":941, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.55, "last_updated":"2011-04-26 15:00:05", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } } ] User Questions Gets question posts by a user. This will return all of the posts a user has made that contain questions. API call type slug: user_questions Example Usage: api/v1/post.php?type=user_questions&username=samwhoo Required arguments • user_id or username Only one of these is required. They are to specify the user to gather posts for in this call. Optional Arguments • network The network to use in the call. Defaults to ‘twitter’. • order_by The column to order the results by. Defaults to chronological order (“date”). • direction The direction to order the results in. Can be either DESC or ASC. Defaults to DESC. • count The number of results to display from this API call. Defaults to 20. If you supply something that is not a valid number, this argument will revert to its default value of 20. For performance reasons, the maximum number of posts the ThinkUp API returns per call is 200. • page The page of results to display for this API call. Defaults to 1. When you get to the end of the pages of results, API calls will just return empty JSON. No error is generated. • include_entities 3.7. The ThinkUp API 101 ThinkUp Documentation, Release 2.0-beta.10 Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. Example output api/v1/post.php?type=user_questions&username=samwhoo&count=5: [ { "id":61257731159490560, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"Time to hibernate while I download this massive file containing my next all-nighter. "created_at":"Fri Apr 22 02:39:15 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", 102 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "last_post_id":0, "found_in":"Owner Status" } } }, { "id":60884841750732800, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":15040935, "reply_retweet_distance":0, "is_retweet_by_friend":true, "favorited":false, "all_retweets":0, "text":"RT @rhysmorgan: A-HERP-DERP. PEOPLE DYING, CHILDREN CRYING. WHAT CAN I DO? PRAY! IT W "created_at":"Thu Apr 21 01:57:32 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } }, "retweeted_status":{ "id":60884527941296128, "source":"<a href=\"http://www.tweetdeck.com\" rel=\"nofollow\">TweetDeck</a>", "location":"Cardiff", "place":null, "geo":null, "in_reply_to_user_id":null, 3.7. The ThinkUp API 103 ThinkUp Documentation, Release 2.0-beta.10 "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":1, "text":"A-HERP-DERP. PEOPLE DYING, CHILDREN CRYING. WHAT CAN I DO? PRAY! IT WILL MAKE IT "created_at":"Thu Apr 21 01:56:17 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":1, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":15040935, "location":"Cardiff", "description":"16 year old. I do a podcast, SDWFD(w/c!) http://v.gd/superwooduo. Skep "url":"http://thewelshboyo.co.uk", "friend_count":310, "followers_count":1377, "profile_image_url":"http://a3.twimg.com/profile_images/1295858459/4aed4901-d81b-490d "name":"Rhys Morgan", "screen_name":"rhysmorgan", "statuses_count":32396, "created_at":"Sat Jun 07 19:42:58 +0100 2008", "utc_offset":3600, "avg_tweets_per_day":30.88, "last_updated":"2011-04-22 13:01:31", "thinkup":{ "last_post":"2011-04-22 11:33:42", "last_post_id":0, "found_in":"retweets" } } } }, { "id":60841137652514816, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":1, "text":"A @thinkupapp API you say? Don’t mind if I do. :D https://github.com/ginatrapani/Thin "created_at":"Wed Apr 20 23:03:52 +0100 2011", "annotations":null, 104 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":1, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":59051247554146304, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":1, "text":"Anyone know a good way to reliably reproduce the following errors in the Twitter API: "created_at":"Sat Apr 16 00:31:29 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":1, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", 3.7. The ThinkUp API 105 ThinkUp Documentation, Release 2.0-beta.10 "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } }, { "id":58893004492120064, "source":"web", "location":"Wales, UK", "place":null, "geo":null, "in_reply_to_user_id":null, "is_reply_by_friend":false, "in_reply_to_post_id":null, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"Talking about our favourite Doritos in @thinkupapp_irc. Who said programmers can’t ha "created_at":"Fri Apr 15 14:02:41 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":69410725, "location":"Wales, UK", "description":"20 years old. Born and raised in Wales, UK. Programmer, British Mensa memb "url":"http://lbak.co.uk", "friend_count":234, "followers_count":103, "profile_image_url":"http://a1.twimg.com/profile_images/1140823002/28567_1015015819422037 "name":"Sam Rose", "screen_name":"samwhoo", "statuses_count":921, "created_at":"Thu Aug 27 21:32:42 +0100 2009", "utc_offset":3600, "avg_tweets_per_day":1.53, 106 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "last_updated":"2011-04-22 13:00:10", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"Owner Status" } } } ] User Questions in Range Gets question posts by a user in a given time range. This will return all of the posts a user has made that contain questions in a given time range. API call type slug: user_questions_in_range Example Usage: api/v1/post.php?type=user_questions_in_range&from=29-03-2011&until=04-04-2011&u Required arguments • user_id or username Only one of these is required. They are to specify the user to gather posts for in this call. – from The date/time to start searching from. This can either be a valid date string or a Unix timestamp. • until The date/time to search until. This can either be a valid date string or a Unix timestamp. Optional Arguments • network The network to use in the call. Defaults to ‘twitter’. • order_by The column to order the results by. Defaults to chronological order (“date”). • direction The direction to order the results in. Can be either DESC or ASC. Defaults to DESC. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. 3.7. The ThinkUp API 107 ThinkUp Documentation, Release 2.0-beta.10 Warning: The method ‘user_posts_in_range’, along with user_replies_in_range, post_replies_in_range, user_mentions_in_range and user_questions_in_range are the ThinkUp Post API methods which do not enforce a cap of 200 post results returned per call. As such, when querying time ranges which contain more than 200 posts, keep in mind that processing that amount of data may exceed your server’s memory limits. Example output /api/v1/post.php?type=user_questions_in_range&username=penia19&from=2012-09-03 [ { "id":242576991033888768, "author_follower_count":null, "source":"web", "location":"Alcarr\u00e0s", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":null, "in_reply_to_post_id":null, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "replies":[ { "id":242578915867111424, "author_follower_count":null, "source":"web", "location":"Tordera-Barcelona", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576991033888768, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "text":"@penia19 I don’t like Alex Song", "created_at":"Mon Sep 03 11:04:55 +0200 2012", "annotations":null, "truncated":false, "protected":false, 108 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":256559225, "location":"Tordera-Barcelona", "description":"Llicenciada en Ci\u00e8ncies Pol\u00edtiques i de l’Administraci\u "url":"", "friend_count":520, "last_updated":"2012-09-03 13:23:58", "followers_count":283, "profile_image_url":"http://a0.twimg.com/profile_images/2169909420/ji_normal.jpg" "name":"Judith", "screen_name":"judithtoronjo", "statuses_count":585, "created_at":"Wed Feb 23 15:58:39 +0100 2011", "avg_tweets_per_day":1.05, "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 0, 8 ] } ] } }, { "id":242577856054587392, "author_follower_count":null, "source":"web", "location":null, "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576991033888768, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, 3.7. The ThinkUp API 109 ThinkUp Documentation, Release 2.0-beta.10 "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "text":"@penia19 I think he’s doing great so far. #Song’s contributions to the team h "created_at":"Mon Sep 03 11:00:42 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":45437435, "location":"", "description":"Powering the next Renaissance", "url":"http://dani.calidos.com", "friend_count":142, "last_updated":"2012-09-03 13:23:59", "followers_count":141, "profile_image_url":"http://a0.twimg.com/profile_images/268758740/dani_normal.jpg "name":"Daniel Giribet", "screen_name":"danielgiri", "statuses_count":625, "created_at":"Sun Jun 07 22:19:14 +0200 2009", "avg_tweets_per_day":0.53, "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ { "text":"Song", "indices":[ 42, 47 ] }, { "text":"fcb", "indices":[ 99, 103 ] } ], "user_mentions":[ { 110 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 0, 8 ] } ] } }, { "id":242579461676101632, "author_follower_count":null, "source":"web", "location":"Barcelona", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576991033888768, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "text":"@penia19 he’s gonna win a lot of titles with FCB", "created_at":"Mon Sep 03 11:07:05 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":302708860, "location":"Barcelona", "description":"Research Project Manager @ TVC - I never think of the future. It c "url":"http://es.linkedin.com/in/eusebiocarasusan", "friend_count":247, "last_updated":"2012-09-03 13:23:58", "followers_count":113, "profile_image_url":"http://a0.twimg.com/profile_images/2432460341/810fonvgxd8c9z "name":"Eusebio Carasus\u00e1n", "screen_name":"ecarasusan", "statuses_count":417, "created_at":"Sat May 21 16:40:17 +0200 2011", "avg_tweets_per_day":0.89, 3.7. The ThinkUp API 111 ThinkUp Documentation, Release 2.0-beta.10 "thinkup":{ "last_post":"2012-08-23 17:51:19", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 0, 8 ] } ] } } ], "text":"#fcb What are your thoughts about Alex Song so far?", "created_at":"Mon Sep 03 10:57:16 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":227641758, "location":"Alcarr\u00e0s", "description":"he anat creixent...", "url":"", "friend_count":100, "last_updated":"2012-09-03 14:43:25", "followers_count":45, "profile_image_url":"http://a0.twimg.com/profile_images/1830063000/IMG_0539_normal.JPG", "name":"Daniel Pe\u00f1a Pizarro", "screen_name":"penia19", "statuses_count":91, "created_at":"Fri Dec 17 11:40:19 +0100 2010", "avg_tweets_per_day":0.15, "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":"", "found_in":"Owner Status" } }, "entities":{ "hashtags":[ 112 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 { "text":"fcb", "indices":[ 0, 4 ] } ], "user_mentions":[ ] } } ] User Replies Gets the replies to a specific user. API call type slug: user_replies Example Usage: api/v1/post.php?type=user_replies&username=samwhoo Required arguments • user_id or username Only one of these is required. They are to specify the user to gather posts for in this call. Optional Arguments • network The network to use in the call. Defaults to ‘twitter’. • order_by The column to order the results by. Defaults to chronological order (“date”). • direction The direction to order the results in. Can be either DESC or ASC. Defaults to DESC. • count The number of results to display from this API call. Defaults to 20. If you supply something that is not a valid number, this argument will revert to its default value of 20. For performance reasons, the maximum number of posts the ThinkUp API returns per call is 200. • page The page of results to display for this API call. Defaults to 1. When you get to the end of the pages of results, API calls will just return empty JSON. No error is generated. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies 3.7. The ThinkUp API 113 ThinkUp Documentation, Release 2.0-beta.10 Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. Example output api/v1/post.php?type=user_replies&username=samwhoo&count=5: [ { "id":61263346028122114, "source":"web", "location":"Canada", "place":null, "geo":null, "in_reply_to_user_id":69410725, "is_reply_by_friend":true, "in_reply_to_post_id":61257731159490560, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@samwhoo Passionate", "created_at":"Fri Apr 22 03:01:34 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":85760550, "location":"Canada", "description":"Hah!", "url":"", "friend_count":18, "followers_count":18, "profile_image_url":"http://a3.twimg.com/profile_images/855291577/twitterProfilePhoto_nor "name":"Benoit Landry", "screen_name":"Salvidrim", "statuses_count":837, "created_at":"Wed Oct 28 06:50:42 +0000 2009", "utc_offset":3600, "avg_tweets_per_day":1.55, "last_updated":"2011-04-22 07:00:53", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"retweets" } } 114 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 }, { "id":61263078871937024, "source":"web", "location":"Lehi, Utah", "place":null, "geo":null, "in_reply_to_user_id":69410725, "is_reply_by_friend":false, "in_reply_to_post_id":61238661223682048, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@samwhoo I’m glad i got my degree, but the every day skills came from open source and "created_at":"Fri Apr 22 03:00:30 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":9905392, "location":"Lehi, Utah", "description":"A software toolsmith that creates, customizes, and masters great software "url":"http://findme.travishartwell.net/", "friend_count":805, "followers_count":1620, "profile_image_url":"http://a3.twimg.com/profile_images/35267502/n882175547_27194_normal. "name":"Travis B. Hartwell", "screen_name":"travisbhartwell", "statuses_count":1744, "created_at":"Sat Nov 03 02:50:41 +0000 2007", "utc_offset":3600, "avg_tweets_per_day":1.38, "last_updated":"2011-04-22 04:01:12", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"mentions" } } }, { "id":61214633675067392, "source":"<a href=\"http://mobile.twitter.com\" rel=\"nofollow\">Twitter for Android</a>", "location":"", "place":null, "geo":null, "in_reply_to_user_id":69410725, "is_reply_by_friend":false, "in_reply_to_post_id":61136478058708992, "in_rt_of_user_id":null, 3.7. The ThinkUp API 115 ThinkUp Documentation, Release 2.0-beta.10 "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@samwhoo l kicked off quite a thread. Sorry! :)", "created_at":"Thu Apr 21 23:48:00 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":18326200, "location":"", "description":"", "url":"http://pdurbin.freeshell.org", "friend_count":100, "followers_count":51, "profile_image_url":"http://a0.twimg.com/profile_images/68449525/6b686fe7f07115890ca63099 "name":"Philip Durbin", "screen_name":"philipdurbin", "statuses_count":364, "created_at":"Tue Dec 23 04:17:49 +0000 2008", "utc_offset":3600, "avg_tweets_per_day":0.43, "last_updated":"2011-04-22 01:00:21", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":0, "found_in":"mentions" } } }, { "id":61185698706886657, "source":"web", "location":"Seattle, WA, USA", "place":null, "geo":null, "in_reply_to_user_id":69410725, "is_reply_by_friend":true, "in_reply_to_post_id":61179112676528128, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@samwhoo Perhaps you can soothe your wounded heart with the warm microprocessors of a "created_at":"Thu Apr 21 21:53:02 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, 116 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "reply_count_cache":1, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":13205432, "location":"Seattle, WA, USA", "description":"Habitual edge case", "url":"http://trevorbramble.com/", "friend_count":187, "followers_count":270, "profile_image_url":"http://a1.twimg.com/profile_images/1304895448/trevor_nyc_bw_normal.p "name":"Trevor Bramble", "screen_name":"TrevorBramble", "statuses_count":5374, "created_at":"Thu Feb 07 14:32:32 +0000 2008", "utc_offset":3600, "avg_tweets_per_day":4.59, "last_updated":"2011-04-22 05:01:49", "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":60224776932835328, "found_in":"retweets" } } }, { "id":61134153202151424, "source":"<a href=\"http://www.tweetdeck.com\" rel=\"nofollow\">TweetDeck</a>", "location":"Montreal, Canada", "place":null, "geo":null, "in_reply_to_user_id":69410725, "is_reply_by_friend":true, "in_reply_to_post_id":61133719125237760, "in_rt_of_user_id":null, "reply_retweet_distance":0, "is_retweet_by_friend":false, "favorited":false, "all_retweets":0, "text":"@samwhoo I know, same here! You should hear us speak component part codes out loud he "created_at":"Thu Apr 21 18:28:12 +0100 2011", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":15496351, "location":"Montreal, Canada", "description":"Prefer to enjoy the big picture than examine the individual pictures; take "url":"http://angelostavrow.com", "friend_count":1122, "followers_count":774, 3.7. The ThinkUp API 117 ThinkUp Documentation, Release 2.0-beta.10 "profile_image_url":"http://a0.twimg.com/profile_images/1177837673/bluemountains_normal.j "name":"Angelo Stavrow", "screen_name":"AngeloStavrow", "statuses_count":8859, "created_at":"Sat Jul 19 23:01:16 +0100 2008", "utc_offset":3600, "avg_tweets_per_day":8.80, "last_updated":"2011-04-21 20:00:41", "thinkup":{ "last_post":"2011-04-20 20:29:01", "last_post_id":60338425013878784, "found_in":"mentions" } } } ] User Replies in Range Gets the replies to a specific user in a given time frame. API call type slug: user_replies_in_range Example Usage: api/v1/post.php?type=user_replies_in_range&from=29-03-2011&until=04-04-2011&use Required arguments • user_id or username Only one of these is required. They are to specify the user to gather posts for in this call. • from The date/time to start searching from. This can either be a valid date string or a Unix timestamp. • until The date/time to search until. This can either be a valid date string or a Unix timestamp. Optional Arguments • network The network to use in the call. Defaults to ‘twitter’. • order_by The column to order the results by. Defaults to chronological order (“date”). • direction The direction to order the results in. Can be either DESC or ASC. Defaults to DESC. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • include_replies Whether or not to include replies to this post in the output. This argument is recursive and will retrieve replies to replies also. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. 118 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 • trim_user If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. Warning: The method ‘user_replies_in_range’, along with user_questions_in_range, post_replies_in_range, user_mentions_in_range and user_posts_in_range are the ThinkUp Post API methods which do not enforce a cap of 200 post results returned per call. As such, when querying time ranges which contain more than 200 posts, keep in mind that processing that amount of data may exceed your server’s memory limits. Example output /api/v1/post.php?type=user_replies_in_range&username=penia19&from=2012-09-03T1 [ { "id":242579576025403392, "author_follower_count":null, "source":"web", "location":"Barcelona", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576686674223106, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "text":"@penia19 me too!", "created_at":"Mon Sep 03 11:07:32 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":302708860, "location":"Barcelona", "description":"Research Project Manager @ TVC - I never think of the future. It comes soo "url":"http://es.linkedin.com/in/eusebiocarasusan", "friend_count":247, "last_updated":"2012-09-03 13:23:58", "followers_count":113, "profile_image_url":"http://a0.twimg.com/profile_images/2432460341/810fonvgxd8c9z65pgdi_n "name":"Eusebio Carasus\u00e1n", "screen_name":"ecarasusan", 3.7. The ThinkUp API 119 ThinkUp Documentation, Release 2.0-beta.10 "statuses_count":417, "created_at":"Sat May 21 16:40:17 +0200 2011", "avg_tweets_per_day":0.89, "thinkup":{ "last_post":"2012-08-23 17:51:19", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 0, 8 ] } ] } }, { "id":242579461676101632, "author_follower_count":null, "source":"web", "location":"Barcelona", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576991033888768, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "text":"@penia19 he’s gonna win a lot of titles with FCB", "created_at":"Mon Sep 03 11:07:05 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 120 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 }, "user":{ "id":302708860, "location":"Barcelona", "description":"Research Project Manager @ TVC - I never think of the future. It comes soo "url":"http://es.linkedin.com/in/eusebiocarasusan", "friend_count":247, "last_updated":"2012-09-03 13:23:58", "followers_count":113, "profile_image_url":"http://a0.twimg.com/profile_images/2432460341/810fonvgxd8c9z65pgdi_n "name":"Eusebio Carasus\u00e1n", "screen_name":"ecarasusan", "statuses_count":417, "created_at":"Sat May 21 16:40:17 +0200 2011", "avg_tweets_per_day":0.89, "thinkup":{ "last_post":"2012-08-23 17:51:19", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 0, 8 ] } ] } }, { "id":242578915867111424, "author_follower_count":null, "source":"web", "location":"Tordera-Barcelona", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576991033888768, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, 3.7. The ThinkUp API 121 ThinkUp Documentation, Release 2.0-beta.10 "all_retweets":0, "text":"@penia19 I don’t like Alex Song", "created_at":"Mon Sep 03 11:04:55 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":256559225, "location":"Tordera-Barcelona", "description":"Llicenciada en Ci\u00e8ncies Pol\u00edtiques i de l’Administraci\u00f3, a "url":"", "friend_count":520, "last_updated":"2012-09-03 13:23:58", "followers_count":283, "profile_image_url":"http://a0.twimg.com/profile_images/2169909420/ji_normal.jpg", "name":"Judith", "screen_name":"judithtoronjo", "statuses_count":585, "created_at":"Wed Feb 23 15:58:39 +0100 2011", "avg_tweets_per_day":1.05, "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 0, 8 ] } ] } }, { "id":242578744764690432, "author_follower_count":null, "source":"web", "location":"Tordera-Barcelona", "place":null, "place_id":null, "geo":null, 122 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576686674223106, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "text":"@penia19 #fcb", "created_at":"Mon Sep 03 11:04:14 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":256559225, "location":"Tordera-Barcelona", "description":"Llicenciada en Ci\u00e8ncies Pol\u00edtiques i de l’Administraci\u00f3, a "url":"", "friend_count":520, "last_updated":"2012-09-03 13:23:58", "followers_count":283, "profile_image_url":"http://a0.twimg.com/profile_images/2169909420/ji_normal.jpg", "name":"Judith", "screen_name":"judithtoronjo", "statuses_count":585, "created_at":"Wed Feb 23 15:58:39 +0100 2011", "avg_tweets_per_day":1.05, "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ { "text":"fcb", "indices":[ 9, 13 ] } ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", 3.7. The ThinkUp API 123 ThinkUp Documentation, Release 2.0-beta.10 "id":227641758, "screen_name":"penia19", "indices":[ 0, 8 ] } ] } }, { "id":242577856054587392, "author_follower_count":null, "source":"web", "location":"", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":227641758, "in_reply_to_post_id":242576991033888768, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ ], "favorited":false, "all_retweets":0, "text":"@penia19 I think he’s doing great so far. #Song’s contributions to the team have only "created_at":"Mon Sep 03 11:00:42 +0200 2012", "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":45437435, "location":"", "description":"Powering the next Renaissance", "url":"http://dani.calidos.com", "friend_count":142, "last_updated":"2012-09-03 13:23:59", "followers_count":141, "profile_image_url":"http://a0.twimg.com/profile_images/268758740/dani_normal.jpg", "name":"Daniel Giribet", "screen_name":"danielgiri", "statuses_count":625, "created_at":"Sun Jun 07 22:19:14 +0200 2009", "avg_tweets_per_day":0.53, "thinkup":{ 124 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "last_post":"0000-00-00 00:00:00", "last_post_id":"", "found_in":"mentions" } }, "entities":{ "hashtags":[ { "text":"Song", "indices":[ 42, 47 ] }, { "text":"fcb", "indices":[ 99, 103 ] } ], "user_mentions":[ { "name":"Daniel Pe\u00f1a Pizarro", "id":227641758, "screen_name":"penia19", "indices":[ 0, 8 ] } ] } } ] Keyword Posts Gets posts from saved search that contains a keyword. API call type slug: keyword_posts Example Keyword Usage: api/v1/post.php?type=keyword_posts&keyword=mwc2013&network=twitter Example Hashtag Usage: api/v1/post.php?type=keyword_posts&keyword=%23conselldeguerra&network=twi Required arguments • keyword and network The keyword that posts contain to retrieve and save. The network where posts have been searched and saved. Optional Arguments • order_by The column to order the results by. Defaults to chronological order (“date”). • direction 3.7. The ThinkUp API 125 ThinkUp Documentation, Release 2.0-beta.10 The direction to order the results in. Can be either DESC or ASC. Defaults to DESC. • count The number of results to display from this API call. Defaults to 20. If you supply something that is not a valid number, this argument will revert to its default value of 20. For performance reasons, the maximum number of posts the ThinkUp API returns per call is 200. • page The page of results to display for this API call. Defaults to 1. When you get to the end of the pages of results, API calls will just return empty JSON. No error is generated. • include_entities Whether or not to include Tweet Entities in the output. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. • trim_user If set to true, this flag strips the user part of the output to just the user’s ID and nothing else. Defaults to false. This argument can be set to true by making it equal to either 1, t or true. Example output api/v1/post.php?type=keyword_posts&keyword=VIH&network=twitter&count=2 (this is getting the first 2 posts for saved search of the keyword #VIH :)): [ { "id":308554341550272512, "author_follower_count":null, "source":"web", "location":"BDN - BCN - L’H [Catalunya]", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":null, "in_reply_to_post_id":null, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ { "id":10004, "url":"http://t.co/kwq1vDIaPB", "expanded_url":"", "title":"", "description":"", "image_src":"", "caption":"", "post_key":19287, "error":"", "container_post":null, "other":[ ] } ], 126 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 "favorited":false, "all_retweets":0, "text":"M\u00e9dicos de EEUU curan por primera vez a un beb\u00e9 con #VIH: http://t. "created_at":false, "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":44361937, "location":"BDN - BCN - L’H [Catalunya]", "description":"T\u00e9c. superior en Doc. Sanitaria. 3o Enfermer\u00eda #UB. "url":"", "friend_count":704, "last_updated":"2013-03-04 13:28:28", "followers_count":744, "profile_image_url":"http://a0.twimg.com/profile_images/3179891390/3a82fbfca5 "name":"Isaac", "screen_name":"sack_am", "statuses_count":33452, "created_at":false, "avg_tweets_per_day":24.40, "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":"", "found_in":"" } } }, { "id":308554204719493120, "author_follower_count":null, "source":"<a href=\"http://itunes.apple.com/us/app/bbc-news/id364147881?mt=8&uo=4\" r "location":"En la red", "place":null, "place_id":null, "geo":null, "in_reply_to_user_id":null, "in_reply_to_post_id":null, "is_reply_by_friend":false, "is_retweet_by_friend":false, "reply_retweet_distance":0, "in_rt_of_user_id":null, "retweet_count_api":0, "favlike_count_cache":0, "links":[ { "id":10005, "url":"http://t.co/mvVdcXf6TC", "expanded_url":"", "title":"", "description":"", 3.7. The ThinkUp API 127 ThinkUp Documentation, Release 2.0-beta.10 "image_src":"", "caption":"", "post_key":19288, "error":"", "container_post":null, "other":[ ] } ], "favorited":false, "all_retweets":0, "text":"Curan a beb\u00e9 infectada por virus del VIH con tratamiento normal de f\u00 "created_at":false, "annotations":null, "truncated":false, "protected":false, "thinkup":{ "retweet_count_cache":0, "retweet_count_api":0, "reply_count_cache":0, "old_retweet_count_cache":0, "is_geo_encoded":0 }, "user":{ "id":86603388, "location":"En la red", "description":"Periodista - Locutor | Curioso y siempre aprendiz | Entusiasta "url":"http://t.co/8f9msKRYxn", "friend_count":1902, "last_updated":"2013-03-04 13:28:28", "followers_count":3513, "profile_image_url":"http://a0.twimg.com/profile_images/3071772492/cb292667fd "name":"Gustavo M\u00e9ndez", "screen_name":"mendeztavo", "statuses_count":17637, "created_at":false, "avg_tweets_per_day":14.44, "thinkup":{ "last_post":"0000-00-00 00:00:00", "last_post_id":"", "found_in":"" } } } ] API Errors Contents: APICallTpyeNotRecognizedException This exception is thrown when you make an API call with a type that is not recognized. 128 Chapter 3. User Guide ThinkUp Documentation, Release 2.0-beta.10 Example api/v1/post.php?type=not_a_recognized_type&post_id=18152896965124096: { "error":{ "type":"APICallTypeNotRecognized", "message":"Your API call type not_a_recognized_type was not recognized." } } RequiredArgumentMissingException This exception is thrown when a required argument is missing from your API call. Required arguments are listed with each API type in the ThinkUp Post API wiki. Example api/v1/post.php?type=user_posts: { "error":{ "type":"RequiredArgumentMissingException", "message":"A request of type user_posts requires a user_id or username to be specified." } } UserNotFoundException This exception is thrown when you have queried for a user that does not exist in ThinkUp’s database. Example api/v1/post.php?type=user_posts&username=samwhat: { "error":{ "type":"UserNotFoundException", "message":"The user that you specified could not be found in our database." } } APIDisabledException This exception is thrown when a ThinkUp installation has disabled access to their JSON API. Example { "error": { "type": "APIDisabledException", "message": "Access to ThinkUp’s API has been disabled." } } KeywordNotFoundException This exception is thrown when you have queried for a keyword saved search that does not exist in ThinkUp’s database. 3.7. The ThinkUp API 129 ThinkUp Documentation, Release 2.0-beta.10 Example api/v1/post.php?type=keyword_posts&keyword=mwc2013&network=twitter: { "error": { "type": "KeywordNotFoundException", "message": "The requested keyword data is not available." } } 130 Chapter 3. User Guide CHAPTER 4 Frequently Asked Questions Answers to users’ most frequently asked questions about ThinkUp. 4.1 I downloaded ThinkUp to my computer, but I don’t know how to install it. What do I do now? ThinkUp doesn’t run on your desktop computer like a regular application. You’ll need a web server to install and run it. Typically users purchase a web hosting plan and install ThinkUp on it the same way they’d install WordPress. Here’s how to install ThinkUp. ThinkUp developers have documented how to install ThinkUp on Windows and Mac OS X on the community wiki. 4.2 I don’t have a web server. How can I use ThinkUp? ThinkUp requires a public web server to run. Here’s more information on ThinkUp hosting providers. 4.3 Can I add more than one Twitter, Facebook, or Google+ account to ThinkUp? Yes. You can add as many Twitter accounts and/or Facebook profiles and pages and/or Google accounts as you want to a single ThinkUp installation. For performance reasons, we recommend you don’t add more than six accounts to one installation, especially if one or more of the accounts are busy and have a lot of data associated with them. ThinkUp requires that you authorize the addition of these accounts by providing the right credentials to log into them, i.e., you cannot add an account if you don’t have a valid username and password for it. 4.4 Does ThinkUp archive old tweets/posts, or just present and future ones? ThinkUp does everything it can to go back and capture historical tweets and posts, but it is subject to API limitations of the services it crawls. 131 ThinkUp Documentation, Release 2.0-beta.10 For example, Twitter currently only allows API access to the last 3,200 tweets in your history. If you’ve tweeted more than 3,200 times, ThinkUp will only capture your last 3,200 tweets and every new tweet going forward. 4.5 Will ThinkUp make all my social data public? No. By default, the data ThinkUp captures is private, meaning, you have to log into ThinkUp to see it. You can choose to set your ThinkUp archives public on per-account basis. For example, you can set your Twitter account public in ThinkUp so non-logged in users can see it, but not your Facebook account. Any “protected” tweets or posts are never made public in ThinkUp. For example, if a tweet of yours gets three replies– two public and one protected–non-logged-in users will only see the public replies, not the private one. Find out more about ThinkUp security and data privacy. 4.6 Does ThinkUp support multiple users? Yes. ThinkUp supports multiple ThinkUp users as well as multiple service users (i.e., Twitter, Facebook, or Google+ users). Any ThinkUp user can have any number of service users. 4.6.1 ThinkUp Users Every ThinkUp installation has at least one user, who is an admin. This person is generally the one who installs ThinkUp and sets up plugins for use. The ThinkUp admin can open registration to the public so that any new users can create accounts. The ThinkUp admin can also generate invitations to invite specific people into the ThinkUp installation, using a secret, one-time use URL. 4.6.2 Service Users Each ThinkUp user can add any number of service users, and may even add multiple users on the same service. For example, a ThinkUp user can add 3 Twitter accounts, 2 Facebook users, and 1 Google+ account into ThinkUp. We recommend adding a maximum of 6 service user accounts to a single ThinkUp installation. 4.7 How many service user accounts can you add to a ThinkUp installation? We recommend you don’t add more than six (6) Twitter, Facebook, Google+ or other service user accounts to a given ThinkUp installation. More accounts than that will blow up ThinkUp’s database to large proportions which could make it slow to respond and difficult to upgrade. If you’ve added more than six accounts to your ThinkUp installation and performance has degraded, here’s how to move accounts to another installation. 132 Chapter 4. Frequently Asked Questions ThinkUp Documentation, Release 2.0-beta.10 4.8 Can ThinkUp track Twitter hashtags? No. ThinkUp only tracks tweets posted by and related to a given user. We plan to add the ability to track hashtags in a future version of ThinkUp. 4.9 Is it possible to fire the cron without having to put the username and password in the crontab? Yes. To do so, use the cron script in the repository’s extras directory, which stores your password in its config file. Here’s more information. 4.10 Can I use ThinkUp for commercial purposes? ThinkUp’s source code is licensed under the GNU General Public License. This license doesn’t restrict commercial use. However, if you modify ThinkUp’s source code, as per the GPL, the community expects that you will submit your modifications back to the project by issuing a pull request. Answers to contributors’ most frequently asked questions about ThinkUp. 4.11 Can ThinkUp support a database engine other than MySQL? We built ThinkUp’s data layer to make it easy for developers to implement storage solutions in addition to MySQL. We welcome community developers to work on new database implementations. Here’s a technical discussion on ThinkUp’s data layer abstraction: https://groups.google.com/a/expertlabs.org/group/thinkup-dev/browse_thread/thread/7c574960069927ce 4.12 Can I translate ThinkUp? Is there support for non-English languages? Unfortunately, ThinkUp is not yet set up to accept translations. If you are a developer willing and able to help us make the structural changes necessary to support localization, please do get in touch. 4.8. Can ThinkUp track Twitter hashtags? 133 ThinkUp Documentation, Release 2.0-beta.10 134 Chapter 4. Frequently Asked Questions CHAPTER 5 Troubleshoot Run into trouble using ThinkUp? Check out these lists of application messages and common problems and solutions. 5.1 Application Messages This is a working list of ThinkUp’s error, information, and success messages, and what they mean. 5.1.1 You must log in to do this The feature you tried to use is only available to logged-in ThinkUp users. Log in and try again. 5.1.2 Sorry, registration is closed on this ThinkUp installation The administrator of this ThinkUp installation has closed registration to new users. To register, contact him or her and request to have it opened; the administrator may do so in the Settings > Application area. 5.1.3 ThinkUp is currently in the process of upgrading When you visit a ThinkUp installation and you see the message, “ThinkUp is currently in the process of upgrading. Please try back again in a little while.” that means that ThinkUp administrators need to complete the upgrade process. If you are that installation’s administrator: check your email. A message with a link to complete the upgrade process should be in your inbox. If your ThinkUp server’s email function doesn’t work, do the following: Open the .htupgrade_token file in ThinkUp’s data directory and copy its contents to your clipboard. By default, the data directory is called data and is located in ThinkUp’s root folder; if not it is specified in ThinkUp’s config.inc.php file as the value of $THINKUP_CFG[’datadir_path’]. Then, enter the upgrade token into ThinkUp’s form and click on the “Submit Token” button to continue the upgrade process. 135 ThinkUp Documentation, Release 2.0-beta.10 5.1.4 Error starting crawler; another crawl is already in progress ThinkUp’s crawler won’t start if a previous crawl process is still running. If you run into this error, make sure you wait for the first crawl to complete and try again. If you constantly get this error always and ThinkUp’s data isn’t updating, something is wrong. There are a few things you can try: 1. Run ps -ax | grep crawl on your server and manually kill any crawler process you see there. Then, delete the crawl.pid file from the crawler/logs/ directory. 2. Restart your MySQL server to clear away any MUTEX locks which are being held. 3. More troubleshooting on the mailing list. 5.1.5 Only showing 5000 results. Show all? When you’re searching large sets of data within ThinkUp, you may see the message “Only showing 5000 results. Show all? (Can be slow).” Since ThinkUp’s search results functionality is JavaScript-based, the application limits how many results it returns by default for performance reasons. To see more than the default number (5000), click on the “Show all” link. If the query returns a large amount of data, depending on the size of the dataset and the speed of your server and local computer, see all the results can be a very slow operation. 5.1.6 The MySQL user does not have the proper permissions to grant backup/export access The Thinkup MySQL user needs GRANT permission to backup or export data. Make sure the MySQL user has been granted both FILE and LOCK TABLE permissions to the ThinkUp database. Find out more about MySQL GRANT permission. 5.1.7 The MySQL user does not have the proper file permissions to backup/export data ThinkUp’s MySQL user does not have the proper file permissions to back up or export data. Make sure the MySQL user has write privileges to ThinkUp’s backup folder under the data directory defined in config.inc.php‘s $THINKUP_CFG[’datadir_path’] value. 5.2 Common Problems ThinkUp is a work in progress. Certain known problems can occur on different server setups have known solutions. 5.2.1 Didn’t receive an account activation email If you didn’t receive an account activation email to the address you entered during installation, double-check your spam folder. If the email didn’t arrive, check with your hosting provider about whether or not the server is able to send email via PHP’s mail function. If your web host is unable to send email, configure ThinkUp to send email via Mandrill, a third-party transactional email provider. ThinkUp must be able to send email. If it cannot, several ThinkUp functions are affected: 136 Chapter 5. Troubleshoot ThinkUp Documentation, Release 2.0-beta.10 • You won’t receive the initial account activation email during ThinkUp installation. • You won’t receive the authorization link to upgrade your ThinkUp installation when updating the application. • Users won’t receive an email to reset their password when using the “Forgot Password” link. • New users will not receive an account activation email when they fill out the registration form. • You won’t get other important email alerts, like when your Facebook connection expires. ThinkUp will continue to add email notifications to the application in the future. 5.2.2 My administrator account is deactivated Normally an administrator can reactivate deactivated user accounts in Settings > All Accounts. However, that’s not possible if the administrator’s account has been deactivated. Manually reactivate an administrator’s ThinkUp account by setting the is_activated field equal to 1 in the ThinkUp installation’s owners table. Here’s how to directly access your ThinkUp database to make this change. 5.2.3 “SSL certificate problem, verify that the CA cert is OK” This error means that cURL’s CA cert bundle on your server is out of date. Recommended: Update Your Server Certificates To fix this problem, update cURL’s SSL certificates on your server. Contact your web hosting provider with the request. Read more at Details on Server SSL Certificates. Not Recommended: A Less Secure Workaround Alternately, you can manually edit ThinkUp’s application set cURL to not verify HTTPS connections. Anywhere ThinkUp connects to an SSL URL, add the following lines before the curl_exec call: $opts[CURLOPT_SSL_VERIFYHOST] = false; $opts[CURLOPT_SSL_VERIFYPEER] = false; See also this mailing list thread about SSL certs. 5.2.4 PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away ThinkUp is a data-intensive application that generates large tables and keeps the database connection open for extended periods of time during its crawl and queries. Therefore, tracking busy accounts on low-powered shared web hosting packages in ThinkUp can result in database timeouts. Coming Soon We’re working on a fix that will make future versions of ThinkUp able to auto-recover from this error and re-establish database connectivity regardless of timeout. 5.2. Common Problems 137 ThinkUp Documentation, Release 2.0-beta.10 To fix the “MySQL server has gone away” error, contact your web host about increasing your server’s timeout configuration to the maximum value. Here’s more information: http://dev.mysql.com/doc/refman/5.0/en/gone-away.html If you have root access, a simple fix is to edit /etc/my.cnf and change the variable wait_timeout from 30 to 300, then reboot or restart mysql. If that’s not possible, export your ThinkUp data and install ThinkUp in a server environment with more liberal timeouts. 5.2.5 Premature end of script headers If you’re seeing an error like “Premature end of script headers” in ThinkUp’s Apache error logs, it means your web server is timing out before ThinkUp’s action (usually the crawler output page) can complete. To fix this problem, contact your web hosting provider and ask them for two things: 1. To increase the amount of memory available for ThinkUp’s use so that the application can run faster. For example, Dreamhost’s cheapest shared hosting package may time out when gathering data for busy accounts, but Dreamhost’s 300MB VPS server (which costs around $15/month) will not. 2. To increase the PHP script timeout for PHP pages served for your account. 5.2.6 Internal Server Error, or blank page when loading ThinkUp If loading ThinkUp shows a blank page, or you see an HTTP 500, you’re likely experiencing an “Internal Server Error.” To troubleshoot this problem, check your server’s Apache error logs, which will contain details of exactly what’s going wrong. If you don’t know where the error log is located on your web server, contact your web hosting provider to find out. Once you can see your web server error log, reload the ThinkUp page causing the error to see its details. Send the error line in your log to the ThinkUp community to troubleshoot. 5.2.7 Crawler encounters Twitter API errors (ERROR 502) Twitter’s API serves a lot of “fail whales”, or HTTP errors. Every time ThinkUp encounters one, you will see it listed in red in your crawler log. By default, the ThinkUp crawler will give up after receiving 5 error responses from Twitter.com. To increase the number of errors ThinkUp tolerates, in the Twitter plugin’s advanced options area, increase the number to something higher (like 50). 5.2.8 “Fatal error: Allowed memory size of XXXX bytes exhausted (tried to allocate 16 bytes)” ThinkUp’s crawler script can require a lot of memory due to all the data certain APIs return; at times, more memory than PHP is allocated. If you run into this error, set ThinkUp to allow scripts to use more memory. To do so, add the following line anywhere in your config.inc.php file: ini_set(’memory_limit’, ’32M’); 138 Chapter 5. Troubleshoot ThinkUp Documentation, Release 2.0-beta.10 5.2.9 Something’s going wrong during crawls, but the log on the “Capture Data” page doesn’t give enough information To closely troubleshoot crawler activity, enable the crawler’s verbose developer log, which provides detailed information like memory usage, class and method names, and line numbers. To do that, log in as an administrator. In Settings > Application check the “Developer log” checkbox. If you know that the problem is confined to a specific crawler, skip all the other service users crawls by deactivating all the plugins except the one you’re having trouble with. Then, click on the “Capture Data” link. The log output will contain more detailed debugging information. Send details to the community to troubleshoot. If you’re automating ThinkUp’s data capture, here’s how to capture the output of the verbose developer log for troubleshooting after the fact. 5.2.10 “Fatal error: Maximum execution time of 30 seconds exceeded” ThinkUp’s crawler script can take a long time because it can make hundreds of requests to external web sites during the course of one crawl. By default PHP is set to only allow a script to take 30 seconds. If you run into this error, you must set ThinkUp to allow scripts to run longer. To do so, add the following line anywhere in your config.inc.php file set_time_limit ( 500 ); 5.2.11 Exporting posts outputs gibberish This is a problem with non-Latin characters written to the datastore using a latin1 PDO connection but read using UTF-8. To fix it, make sure ‘set_pdo_charset’ is set to true in your config file to set the PDO connection to UTF-8. To convert an existing datastore to UTF-8, do the following: (Notes: This won’t work on Windows due to UTF-8 incompatibilities.) 1. Back up your DB the normal way just in case you need to revert to this. mysqldump --opt thinkupDB > thinkup.sql 2. Back up your DB using latin1. This will decode the gibberish into proper “text”. mysqldump --opt --default-character-set=latin1 thinkupDB > thinkup.latin.sql 3. Remove the following line or change latin1 to utf8 in thinkup.latin.sql. Note: This file is huge. Use a text editor which is able to handle huge files. /*!40101 SET NAMES latin1 */; 4. Restore the decoded SQL data as UTF8. (–default-character-set=utf8 is only necessary if UTF8 is not default) mysql --default-character-set=utf8 thinkupDB < thinkup.latin.sql 5. Set Thinkup to use UTF8 by adding the following line to config.inc.php. $THINKUP_CFG[’set_pdo_charset’] = true; Mailing list thread “Gibberish in TU database” 5.2. Common Problems 139 ThinkUp Documentation, Release 2.0-beta.10 5.2.12 Repeated errors: “Warning: require_once(): Unable to allocate memory for pool.” ThinkUp has a conflict with the Alternative PHP Cache (APC) which can trigger this error. To work around this problem, disable APC for ThinkUp by adding the following line anywhere in your config.inc.php file: ini_set(’apc.cache_by_default’,0); 5.2.13 Can’t change my account’s email address If you find your email isn’t being received and you are sure it’s because of the destination address, you can change it in the database. In the tu_owners table, update the value of the email field in your account’s row. Here’s how to directly access your ThinkUp database to make changes to it. 5.2.14 Cannot back up or export data While running a database backup or export either during the test run or using the application, you may get the error: It looks like the MySQL user does not have the proper permissions to grant back up/export access or It looks like the MySQL user does not have the proper file permissions to back up/export data or PDOException: SQLSTATE[HY000]: General error: 1 Can’t create/write to file ’<thinkup>/data/backup/tu_encoded_locations.txt’ (Errcode: 13) ThinkUp’s backup or export tool doesn’t have the permissions it needs to back up your files. Make sure that the MySQL user has GRANT FILE and LOCK TABLE privileges in the database as well as write privileges to ThinkUp’s data directory. Find out more about MySQL GRANT permission. If you still get the error, make sure that there aren’t restrictive permissions set in any of the compiled_view folder’s parent folders up the tree which would keep the MySQL user from writing to that directory. 5.2.15 My database is so big, every migration takes forever or doesn’t complete ThinkUp’s database grows very quickly, especially if an installation has several active service users set up in it. If your database is so big and unwieldy that your server slows to a crawl while running migrations–and maybe doesn’t ever complete them–it’s time to reduce the size of your database. Transfer Active Service Users to Fresh ThinkUp Installation The easiest way to to reduce the size of a big ThinkUp installation’s database is to separate out data-heavy service users to other databases/installations. To do so, use the service user export tool to download each individual user’s archive. Then, set up new ThinkUp installations and import that data into them. 140 Chapter 5. Troubleshoot ThinkUp Documentation, Release 2.0-beta.10 Advanced: Tweak Your MySQL Server’s Settings to Complete Migrations on Large Tables ThinkUp user Brian Lenz describes how he performance-tuned MySQL for ThinkUp’s upgrade: The first issue was that we had the key_buffer_size and myisam_sort_buffer_size set way too low. We had them both set at 8MB, I believe (probably just MySQL defaults). I upped those values to 1GB each (on a machine with 4GB RAM). MySQL isn’t guaranteed to use the full 1GB of RAM for each, though. The key_buffer_size should be somewhere between 25% and 50% of the total RAM of the machine (assuming that is reasonable based on other services on the machine): http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_key_buffer_size I believe that the myisam_sort_buffer_size had a much bigger impact on the performance of the alter tables, though: http://dev.mysql.com/doc/refman/5.0/en/alter-table.html Specifically, this section: “If you use any option to ALTER TABLE other than RENAME, MySQL always creates a temporary table, even if the data wouldn’t strictly need to be copied (such as when you change the name of a column). For MyISAM tables, you can speed up index re-creation (the slowest part of the alteration process) by setting the myisam_sort_buffer_size system variable to a high value.” http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_myisam_sort_buffer_size Once I had those in place, I could watch the temp table as the index built much faster. Once it got past creating the temp table, however, it went into “Repair with keycache”, which is un-fast: http://stackoverflow.com/questions/1067367/how-to-avoid-repair-with-keycache Ideally, you want MySQL to use “Repair with sorting” (which uses the MySQL tmpdir) when doing an index rebuild for an alter. In order to use “Repair with sorting”, there must be enough room in the tmpdir to store a small factor (2-5?) times the size of the total indexes. In our case, we had the tmpdir set to /tmp, which is only a 2GB partition. 2GB wasn’t enough space for the index, so it was falling back to “Repair with keycache”. I switched our tmpdir to a different directory/partition with more space and tried again. I was still running into “Repair with keycache”. This time, the issue was the myisam_max_sort_file_size. It defaults to 2GB, but 2GB wasn’t enough for our follows table. Since we have sufficient disk, I upped this value up to 32GB. Then, MySQL was able to properly use “Repair with sorting”. At that point, the alter table took 45 minutes vs. the unknown amount of time it was going to take prior to making any of these changes (10+ hours just to build half of the temp table before I killed it). 5.2.16 Failed to write session data (files) ThinkUp requires that PHP can save session files successfully to maintain user sessions. This error means that PHP isn’t able to save session files because the directory where it’s trying to do so isn’t writable or doesn’t exist. To fix this problem, set session.save_path to a writable directory in your php.ini file or contact your host asking for help doing that. Here’s more info about the session.save_path directive: http://www.php.net/manual/en/session.configuration.php#ini.session.save-path This problem can also manifest itself by constantly asking users to log in over and over again, or by showing this error text: Warning: session_start() [function.session-start]: open(/path/to/folder, O_RDWR) failed: No such file or directory 5.2. Common Problems 141 ThinkUp Documentation, Release 2.0-beta.10 5.2.17 The GeoEncoder plugin is activated and set up, but there are no post maps The GeoEncoder plugin uses the Google Maps API to store latitude and longitude points for each post and user. There are three possible reasons why you’re not seeing mapped posts: • The GeoEncoder plugin isn’t set up correctly. • The GeoEncoder exceeded its allocation of API calls for the time it’s been running and needs more time to catch up. • Post replies don’t have locations associated with them. Here’s how to troubleshoot the GeoEncoder plugin. Check the crawler log and database table If the GeoEncoder plugin is activated , click the “Capture Data” button in ThinkUp and look for the GeoEncoder’s entries in the crawl progress log. These lines will tell you how many locations the plugin has geoencoded and their status. To see what the GeoEncoder plugin has completed, go into your ThinkUp database and take a look at the encoded_locations table. If there’s data in that table, the plugin is working. If there is data in that table but you’re not seeing maps in ThinkUp, likely it’s because there just aren’t locations associated with your original post and/or the replies. ThinkUp uses the individual post location, and if that’s not set, then uses the user’s location as specified in their profile as a second resort. That doesn’t always work, though. On Twitter, the user profile location field is just an open text field, and often people put data in there like “the planet Earth” or “your computer screen” and the GeoEncoder plugin obviously can’t find latitude and longitude points for those values. Exceeded API call allocation The Google Maps API imposes a daily API request limit of 2,500 requests. If you enable the plugin when you have more than 2,500 posts and users in your ThinkUp database, it may take several weeks to back-encode your ThinkUp data. If your ThinkUp crawler has run today, but you still get this error message, chances are the GeoEncoder plugin has used up its allocation of Google Maps API requests for the day. Check back in 24 hours. 5.2.18 Advanced Troubleshooting Capture the output of ThinkUp’s verbose crawler log To capture the output of ThinkUp’s verbose developer log, $THINKUP_CFG[’log_location’] value, like this: in the config.inc.php file, set the $THINKUP_CFG[’log_location’] = $THINKUP_CFG[’source_root_path’].’logs/crawler.log’; Then, when the crawler runs, the crawler.log file will contain the output. To test, SSH into your web server, run the crawler at the command line and tail -f crawler.log as you go. The output will look something like this (annotated). 142 Chapter 5. Troubleshoot ThinkUp Documentation, Release 2.0-beta.10 Problem: the crawler log / SQL log are not being created At the moment, ThinkUp will not explicitly create the crawler log and SQL log files. They need to be manually created by you. To do this, execute this command: $ touch path/to/log/file.log You will need to replace the path with the actual path to where you have set your log files to be in your config. If I were in my root ThinkUp directory (the one above webapp/) and I wanted to create the log files in log/crawler.log and log/sql.log, I would execute the following commands from my root ThinkUp directory: $ touch log/crawler.log $ touch log/sql.log Enable the Slow SQL Log TODO Page Profiler If your ThinkUp installation’s pages are slow to load, you can enable the page profiler to help diagnose the problem. What the Page Profiler Shows You When the page profiler is enabled, at the bottom of every ThinkUp application web page, you’ll see how long it took your web server to generate the page, followed by a list of all the database queries that ran in it and how many rows 5.2. Common Problems 143 ThinkUp Documentation, Release 2.0-beta.10 they returned, how long each query took to complete, which class and method executed each query, and how long the PHP took to generate the page and whether or not it was loaded from cache. The log lists actions slowest to fastest (execution time descending). Here’s a screenshot of what the profiler output looks like on the ThinkUp Dashboard: Particularly slow database queries (those which take 0.5 seconds or more to complete) have their execution time highlighted in red. How to Turn on the Page Profiler During Development To enable the page profiler on your installation, in ThinkUp’s config.inc.php file, set: $THINKUP_CFG[’enable_profiler’] = true; This value is set to false by default. The page profile is meant for development purposes only. Warning: Do not enable the page profiler on a ThinkUp installation that’s on the public internet. It exposes internal ThinkUp queries and parameters, and could pose a security risk. 144 Chapter 5. Troubleshoot ThinkUp Documentation, Release 2.0-beta.10 Direct Database Access If you have to make changes to your ThinkUp database manually, you can do so from the command line, or using an interface like phpMyAdmin. Access ThinkUp’s MySQL database via phpMyAdmin Many web hosts offer access to your MySQL databases via phpMyAdmin. If you have phpMyAdmin installed, here’s how to access your ThinkUp database using it. 1. Log in to phpMyAdmin with your username and password for your account. 2. Click on the thinkup database in the left hand column - whatever you named it during installation. 5.2. Common Problems 145 ThinkUp Documentation, Release 2.0-beta.10 3. From here you can choose any table to view and update its contents. 146 Chapter 5. Troubleshoot ThinkUp Documentation, Release 2.0-beta.10 Access ThinkUp’s MySQL database via the Command Line You will need your ThinkUp database user name and password, which you set when you installed ThinkUp. 1. Log in to your database at the command line. (Notice there should be no space between -p and your password.) mysql -u <database owner> -p<password> ***** Output ******************************** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 135 Server version: 5.1.41-3ubuntu12.10 (Ubuntu) Type ’help;’ or ’\h’ for help. Type ’\c’ to clear the current input statement. ********************************************* 2. Change to your ThinkUp database.: mysql> use <database name you created or the thinkup install created for you> Hint: if you don’t know the name then type this at the command line: mysql> show databases; If your database name is ‘thinkup’, enter: mysql> use thinkup; ***** Output ******************************** 5.2. Common Problems 147 ThinkUp Documentation, Release 2.0-beta.10 Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed ********************************************* 3. From here you can view the contents of tables using SELECT and update them using UPDATE. For example, to check the value of the is_activated column in the owners table, use this command. mysql> select id,full_name, is_activated from tu_owners; +----+---------------+--------------+ | id | full_name | is_activated | +----+---------------+--------------+ | 1 | Rick Ehlinger | 0 | +----+---------------+--------------+ 1 row in set (0.00 sec) To change the value of the is_activated column to 1, use this command. mysql> update tu_owners set is_activated=1 where id=<the id of the person you are activating>; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> commit; Query OK, 0 rows affected (0.00 sec) 4. When you’re done making your changes, exit to the command prompt. mysql> exit 5.3 How to Report a Bug or Make a Feature Request ThinkUp is an open source project mostly built by volunteers, who troubleshoot and discuss features in public community spaces. If you’ve found a ThinkUp bug or have an idea for a new feature, here’s what you can do to get help or feedback most efficiently. 5.3.1 Step 1: Search To avoid duplicate work, search ThinkUp’s documentation, mailing list archive and issue tracker to make sure your problem or idea hasn’t already been documented, discussed or reported. If it has, follow up on the existing mailing list thread thread or issue tracker comment thread to discuss further. If your problem or idea hasn’t been addressed before, continue to Step 2. 5.3.2 Step 2: Don’t File An Issue ThinkUp’s issue tracker is public, but you shouldn’t file a new issue unless the problem or feature request has been confirmed by the ThinkUp community. If you file a new issue without discussing it with the community, no one but Gina will receive the new issue notification. If she cannot reproduce the bug or isn’t sold on the feature pitch, she will close the issue. There’s a better chance someone in the community at large will be able to reproduce your problem or get excited about your feature. Instead of filing a new issue, discuss the problem/idea with the community first to confirm it is indeed a new issue and not a known bug, a rejected feature idea or an environmental problem versus an application code bug. 148 Chapter 5. Troubleshoot ThinkUp Documentation, Release 2.0-beta.10 5.3.3 Step 3: Contact the Community Send an email to the ThinkUp mailing list describing your problem or feature idea. Be specific. Write a Great Bug Report Help us help you! The more information about your problem you share, the more likely it is that the community can help you. In your bug report, include the following information: • Your ThinkUp hosting provider • The version of ThinkUp you are running • Whether or not you have any special setup details (i.e., a subdomain, desktop installation, modified code, etc) • What you did before the bug occurred • What the application message or log contents were when the bug occurred • What the expected behavior was • What version of PHP and MySQL your ThinkUp host is running While the core development team can’t respond to every bug report on the mailing list, volunteer community members help each other troubleshoot problems. Propose a New Feature If you’ve got an idea for a new ThinkUp feature, we invite you to pull the source code and start building! If you’re not a coder, the better you pitch your feature idea to the community, the more likely an interested developer will work on it. To pitch your feature idea, describe exactly how you think the new functionality should work, and include wireframes and screenshots. Sell your idea to the community by clearly explaining its benefits and use cases, and how you plan to help make the feature. We only build features which align with ThinkUp’s purpose. Thanks for helping us make ThinkUp a great application, and for respecting the community’s time and public spaces. 5.3. How to Report a Bug or Make a Feature Request 149 ThinkUp Documentation, Release 2.0-beta.10 150 Chapter 5. Troubleshoot CHAPTER 6 Contact Us The ThinkUp community is available to brainstorm, ask and answer questions, and offer support online 24 hours a day, 7 days a week. 6.1 Mailing Lists The community’s main hub of communication is our email list. Join in on user discussions on the ThinkUp General Mailing List. Developers, ask technical questions and help out other developers on the ThinkUp Developer Mailing List. 6.2 IRC Channel Chat live with ThinkUp community members in our IRC channel. Here are the connection details: • IRC Server: irc.freenode.net • Channel/Room: #thinkup • Port: 6667 (Default) For technical discussions, ThinkUp developers congregate in the #thinkup-dev channel. See also our community guide to IRC. 6.3 Blog, Facebook, and Twitter You can also find ThinkUp community members on various channels across the web: • On Twitter, follow @thinkup • Like ThinkUp’s Facebook Page • Follow the ThinkUp blog 6.4 Live Community Conference Call and Podcast Call into or listen to our monthly live podcast, ThinkUp Talks, hosted by community member Randulo. 151 ThinkUp Documentation, Release 2.0-beta.10 152 Chapter 6. Contact Us CHAPTER 7 Contribute At ThinkUp, we know that software development isn’t just about code. We’re looking for writers, designers, power users, and user experience experts to collaborate with us to make a world-class platform. All are welcome. 7.1 Where to Start The most frequently-asked question we get from potential contributors is “Where do I begin?” Our answer is always “What are your skills? What are you most interested in working on?” ThinkUp is just as much about community as it is about code, so if you’re brand new, the first step is contact us and introduce yourself. Tell us what your skills are and what you’re most excited about in ThinkUp, and how you’d like to help. The community can help point you in the right direction. 7.2 How You Can Help How you can contribute to a great open source project depends on your skillset. Click on the link that best describes what kind of ThinkUp user or developer you are. 7.2.1 Power User Power users have installed and upgraded ThinkUp and know its ins and outs. They can help with tech support on the mailing list and in IRC, issue tracker management, and documentation. Tech Support TODO Issue Tracker Management TODO 153 ThinkUp Documentation, Release 2.0-beta.10 7.2.2 Writer Not only does the ThinkUp community want to create a great software platform, we want to make it accessible to everyone with clear and thorough documentation. You’re reading the very beginning of that effort, but we’ve got a lot of work to do. If you’re a ThinkUp user and know how to write clear descriptions and tutorials on technical topics, we need your help. How to Contribute Documentation We write documentation in plain text files using a format called reStructuredText (RST). We store those source files in ThinkUp source code repository’s docs folder. Then, the HTML pages you are reading right now are generated by a tool called Sphinx. To see what the RST source of this page looks like, navigate to the file hosted on GitHub and click on the “Raw” button at the top of the file. To contribute new documentation, fork ThinkUp’s source code and issue a pull request for your changes. Alternately, edit an existing page without leaving your browser using GitHub’s new “Fork and edit this file” feature. See also: The reStructuredText primer is a good reference while you write rST. Also, this reStructuredText online editor lets you preview your work live on the web. If you’re not comfortable using Git but want to contribute documentation, author your pages in ThinkUp’s Community Wiki and then email them to the ThinkUp community mailing list for review and inclusion in this documentation. We want to make contributing documentation as easy as possible. Get in touch with your ideas. 7.2.3 Developer Welcome, developer! So glad you’re here. ThinkUp is one of the most fun, new open source projects you could spend your time hacking on. ThinkUp is written in PHP with a MySQL datastore by default, with plenty of JavaScript, CSS, and HTML thrown in via Smarty templates. We do test-driven development here, as well as document-driven development, so get ready to write your tests and docs first. Set Up Your Environment Every developer has a text editor or IDE of choice, and you should use what you’re most comfortable with while writing code for ThinkUp. If you’re on the lookout for a new PHP dev environment, Eclipse PDT (PHP Development Toolkit) is a free, cross-platform, full-featured PHP IDE that offers class browsing, code formatting, and method completion. If you’re using Eclipse, here’s how to set it up for ThinkUp development. Set up Eclipse PDT to work with ThinkUp • Set indentation to spaces: To easily generate code that complies with ThinkUp’s indentation-by-spaces style (as per the Code Style Guide), in your project’s preferences panel, under PHP > Code Style > Formatter, set the ‘Tab Style’ to spaces, and indentation size to 4. • Add word wrap: Insane but true: Eclipse does not support word wrap natively. Use this experimental add-on to enable it (via Stack Overflow). Once the plugin is installed and you’ve restarted, right-click on a file and select ‘Virtual word wrap’ to enable it. 154 Chapter 7. Contribute ThinkUp Documentation, Release 2.0-beta.10 • Show whitespace: See whether you’re using tabs or spaces; go to Window > Customize Perspective and under ‘Editor Presentation’, check off ‘Show Whitespace Characters.’ A button will appear on your toolbar that you can press to show spaces and tabs. • Set your author name: In Preferences... > PHP > Code Style > Code Templates, expand Comments and choose ‘Types.’ Click the edit button to set what the @author tag auto-fills when you’re commenting your code. • Show a max line length ruler: In Preferences > General > Editors > Text Editors, check ‘Show print margin’ and enter the maximum line length (currently 120 as per the style guide). • Run regression tests in Eclipse: Here’s how to install the SimpleTest plugin in Eclipse to run tests in the IDE. (Note from Gina: this plugin doesn’t work on my Mac or PC; when I choose ‘Run as > SimpleTest’ nothing happens.) • Install Mylyn plugin for GitHub: If you want to browse and update issues in Eclipse, install this plugin. – Server: http://github.com/ginatrapani/ThinkUp – Find your GitHub API Key in Applications under Account settings. Useful Keyboard Shortcuts • Ctrl+Shift+F to format your code • Ctrl+/ to comment a block of code (hit it again to uncomment) • Ctrl+O to hop to member • Ctrl+L to go to line number • Ctrl+Spacebar for method completion • More Eclipse keyboard shortcuts • Boosting your productivity in Eclipse using shortcuts Develop from Source If you’re a developer who wants to work on the ThinkUp source code and submit your changes for consideration to be merged into the master branch, here’s how. Quickfire Do’s and Don’t’s If you aren’t familiar with git and GitHub, try reading the ThinkUp Beginner’s Guide and the GitHub bootcamp documentation. If you’re familiar with git and GitHub, here’s the short version of what you need to know. Once you fork and download the ThinkUp code: • Don’t develop on the master branch. Always create a development branch specific to the issue you’re working on. Name it by issue # and description. For example, if you’re working on Issue #100, a retweet bugfix, your development branch should be called 100-retweet-bugfix. If you decide to work on another issue mid-stream, create a new branch for that issue-don’t work on both in one branch. • Do not merge the upstream master with your development branch; rebase your branch on top of the upstream master. • A single development branch should represent changes related to a single issue. If you decide to work on another issue, create another branch. 7.2. How You Can Help 155 ThinkUp Documentation, Release 2.0-beta.10 • Squash your commits. After you rebase your work on top of the upstream master, you can squash multiple commits into one. Say, for instance, you’ve got three commits in related to Issue #100. Squash all three into one with the message “Issue #100 Description of the issue here.” Gina won’t accept pull requests for multiple commits related to a single issue; it’s up to you to squash and clean your commit tree. (Remember, if you squash commits you’ve already pushed to GitHub, you won’t be able to push that same branch again. Create a new local branch, squash, and push the new squashed branch.) • Keep .gitignore clean. Don’t add test files to .gitignore that are specific to your ThinkUp setup. Only working config files, dot files, compiled view files, cache files, and logs should be listed in .gitignore. Workflow Diagram A visual representation of what a ThinkUp contributor’s GitHub/git workflow should look like. (Click to enlarge.) Step-by-step (the short version) 1. Fork on GitHub. (Click the Fork button.) 2. Clone to your server ($ git clone [email protected]:you/ThinkUp.git) 3. Set up remote upstream ($ git remote add upstream git://github.com/ginatrapani/ThinkUp.git) 4. Run any outstanding --with-new-sql) database migrations ($ cd install/cli/; php upgrade.php 5. Branch for new issue ($ git branch ###-description; git checkout ###-description) and develop on issue branch. 6. As time passes, the upstream ThinkUp repository accumulates new commits. Keep your working copy’s master branch and issue branch up to date by periodically rebasing: fetch upstream, rebase master, rebase issue branch. 7. When development is complete, rebase one more time, then branch from dev branch to release candidate branch. Squash all X commits that pertain to the issue into one clean, descriptive commit ($ git rebase -i HEAD-X) 8. Push release candidate branch to GitHub ($ git push origin ###-description-rc) 9. Issue pull request on GitHub. (Click the Pull Request button.) If you’re new to git and GitHub, here’s the longer version of these instructions. Fork the Repository to Contribute Code Here’s how to fork the ThinkUp repository to begin working on it. Create an account on GitHub and establish connectivity between your GitHub account and your hosting server. 1. Create a free account on GitHub. 2. Fork the project from ginatrapani/thinkup 3. Make sure you’ve got an SSH public key created on your server and recorded in your GitHub account. You can see your SSH Public Keys on the Account Overview section of your github account. Here’s a good guide. 4. To test the GitHub authentication run $ ssh [email protected] Clone your GitHub fork to your development server and install ThinkUp. 156 Chapter 7. Contribute ThinkUp Documentation, Release 2.0-beta.10 1. Create a directory on your development server outside your web root (probably one level up) called thinkup and cd into that directory. 2. Run a clone command against your github fork. It will look something like this except that it will use your GitHub account name in the place of dash30 $ git clone [email protected]:dash30/ThinkUp.git That will download all your forked GitHub files to a git repository on your development server. If you have problems, check the permissions on the newly created thinkup directory on your server. Install a running instance of ThinkUp on your development server using any of a number of installation guides. Running nightly code from ThinkUp’s git repository will require you to catch up on necessary database migrations. Create an Issue-Specific Development Branch Before you start working on a new feature or bugfix, create a new branch dedicated to that one change named by issue number and description. If you’re working on Issue #100, a retweet bugfix, create a new branch with the issue number and description, like this: $ git branch 100-retweet-bugfix $ git checkout 100-retweet-bugfix Edit and test the files on your development server. When you’ve got something the way you want and established that it works, commit the changes to your branch on your development server’s git repo. $ git add <filename> $ git commit -m ’Issue #100: Some kind of descriptive message’ You’ll need to use git add for each file that you created or modified. There are ways to add multiple files, but I highly recommend a more deliberate approach unless you know what you’re doing. Then, you can push your new branch to GitHub, like this (replace 100-retweet-bugfix with your branch name): $ git push origin 100-retweet-bugfix You should be able to log into your GitHub account, switch to the branch, and see that your changes have been committed. Then click the Pull button to request that your commits get merged into the ThinkUp development trunk. IMPORTANT: Before you issue a pull request, make sure it gets accepted by running through the [[Developer Guide: Pull Request Checklist]] first. Keep Your Repository Up to Date In order to get the latest updates from the development trunk do a one-time setup to establish the main GitHub repo as a remote by entering: $ git remote add upstream git://github.com/ginatrapani/ThinkUp.git Verify you’ve now got “origin” and “upstream” remotes by entering: $ git remote You’ll see upstream listed there. 7.2. How You Can Help 157 ThinkUp Documentation, Release 2.0-beta.10 Rebase Your Development Branch on the Latest Upstream To keep your development branch up to date, rebase your changes on top of the current state of the upstream master. See the What’s git-rebase? section below to learn more about rebasing. If you’ve set up an upstream branch as detailed above, and a development branch called 100-retweet-bugfix, you’d update upstream, update your local master, and rebase your branch from it like so: $ git $ git $ git $ git [make $ git fetch upstream checkout master rebase upstream/master checkout 100-retweet-bugfix sure all is committed as necessary in branch] rebase master You may need to resolve conflicts that occur when a file on the development trunk and one of your files have both been changed. Edit each file to resolve the differences, then commit the fixes to your development server repo and test. Each file will need to be “added” before running a “commit.” Conflicts are clearly marked in the code files. Make sure to take time in determining what version of the conflict you want to keep and what you want to discard. $ git add <filename> $ git commit To push the updates to your GitHub repo, replace 100-retweet-bugfix with your branch name and run: $ git push origin 100-retweet-bugfix Squash All Commits Related to a Single Issue into a Single Commit Once you have rebased your work on top of the latest state of the upstream master, you may have several commits related to the issue you were working on. Once everything is done, squash them into a single commit with a descriptive message, like “Issue #100: Retweet bugfix.” To squash four commits into one, do the following: $ git rebase -i HEAD-4 In the text editor that comes up, replace the words “pick” with “squash” next to the commits you want to squash into the commit before it. Save and close the editor, and git will combine the “squash“‘ed commits with the one before it. Git will then give you the opportunity to change your commit message to something like, “Issue #100: Fixed retweet bug.” Important: If you’ve already pushed commits to GitHub, and then squash them locally, you will not be able to push that same branch to GitHub again. Create a new branch-like 100-retweet-bug-squashed or 100-retweet-bug-rc1 (for release candidate 1)-and squash your commits there. Once everything is squashed and ready, push the new squashed branch to GitHub and send your pull request to Gina. Helpful hint: You can always edit your last commit message by using: $ git commit --amend Some gotchas Be careful not to commit any of your configuration files, logs, or throwaway test files to your GitHub repo. These files can contain information you wouldn’t want publicly viewable and they will make it impossible to merge your 158 Chapter 7. Contribute ThinkUp Documentation, Release 2.0-beta.10 contributions into the main development trunk of ThinkUp. Most of these special files are listed in the .gitignore file and won’t be included in any commit, but you should carefully review the files you have modified and added before staging them and committing them to your repo. The git status command will display detailed information about any new files, modifications and staged. $ git status One thing you do not want to do is to issue a git commit with the -a option. This automatically stages and commits every modified file that’s not expressly defined in .gitignore, including your crawler logs. $ git commit -a What’s git-rebase? Using git-rebase helps create clean commit trees and makes keeping your code up-to-date with the current state of the upstream master easy. Here’s how it works. Let’s say you’re working on Issue #212 a new plugin in your own branch and you start with something like this: 1---2---3 #212-my-new-plugin / A---B #master You keep coding for a few days and then pull the latest upstream stuff and you end up like this: 1---2---3 #212-my-new-plugin / A---B--C--D--E--F #master So all these new things (C,D,..F) have happened since you started. Normally you would just keep going (let’s say you’re not finished with the plugin yet) and then deal with a merge later on, which becomes a commit, which get moved upstream and ends up grafted on the tree forever. A cleaner way to do this is to use rebase to essentially rewrite your commits as if you had started at point F instead of point B. So just do: git rebase master 212-my-new-plugin git will rewrite your commits like this: 1---2---3 #212-my-new-plugin / A---B--C--D--E--F #master It’s as if you had just started your branch. One immediate advantage you get is that you can test your branch now to see if C, D, E, or F had any impact on your code (you don’t need to wait until you’re finished with your plugin and merge to find this out). And, since you can keep doing this over and over again as you develop your plugin, at the end your merge will just be a fast-forward (in other words no merge at all). So when you’re ready to send the new plugin upstream, you do one last rebase, test, and then merge (which is really no merge at all) and send out your pull request. Then in most cases, Gina has a simple fast forward on her end (or at worst a very small rebase or merge) and over time that adds up to a simpler tree. More info on the git man page here: Git rebase: man page TODO git pull reference how to upgrade/manually run db migrations 7.2. How You Can Help 159 ThinkUp Documentation, Release 2.0-beta.10 Run ThinkUp’s Test Suite All code submitted to the repository should have corresponding tests that pass. Here’s how to run and write tests. Configure Your Test Environment Copy tests/config.tests.sample.inc.php to tests/config.tests.inc.php and set the appropriate values. You will need a clean, empty database to run your tests. By default, name it thinkup_tests and set the $TEST_DATABASE config variable to that name. You will also need a local installation of ThinkUp; set the $TEST_SERVER_DOMAIN config variable equal to its URL–for example, http://localhost. In webapp/config.inc.php, in the DEVELOPER CONFIG section, set the name of your tests database, and the username and password to access it. This database name should match the one you just set in tests/config.tests.inc.php. Finally, set $THINKUP_CFG[’source_root_path’] to the full path of the thinkup source files. Test Assumptions In order for the tests to pass, you must: • Have a tests/config.tests.inc.php file with the correct values set • Setup the crawler, stream and sql log files in webapp/config.inc.php and make those files writable • Set the test database name to an empty tests database which the tests will destroy each run in webapp/config.inc.php • Set the test database user to a user with all privileges in the test database and global CREATE, DROP, and FILE privs • Set caching to false in webapp/config.inc.php • Have a local installation of ThinkUp using your test database • Have a working internet connection Running Tests To run a particular test suite, like the UserDAO suite, in the ThinkUp source code root folder, use this command: $ php tests/TestOfUserMySQLDAO.php To run all the test suites, use: $ php tests/all_tests.php To run a single test, use SimpleTest’s -t parameter. For example: $ php tests/TestOfPluginMySQLDAO.php -t testIsPluginActive To see all the available options, run: $ php tests/all_tests.php -help 160 Chapter 7. Contribute ThinkUp Documentation, Release 2.0-beta.10 Writing Tests The test suite assumes there is an empty tests database (like thinkup_tests) which the default ThinkUp database user can access. If your test needs to read and write to the ThinkUp database, extend ThinkUpUnitTestCase and run parent::setUp() in your setUp() method, and parent::tearDown() in your tearDown() method. These methods create an empty copy of the ThinkUp database structure to execute a test, then drop all the tables in it when the test is complete. After you call the parent setUp() method in your test’s setUp(), insert the data your test requires. Best practices for writing tests are still getting developed. In the meantime, use existing tests as examples. Model Tests (all_model_tests.php) See TestOfOwnerInstanceMySQLDAO.php as an example of a set of DAO tests. Use the FixtureBuilder class to create test data fixtures to test against. Controller Tests (all_controller_tests.php) See TestOfDashboardController.php as an example of a set of controller test cases. Plugin Tests (all_plugin_tests.php) All plugin-specific tests should live in the thinkup/webapp/plugins/plugin-name/tests/ directory. Write tests for the plugin’s model and controller objects. To test consumption of data from web services, mock up the appropriate classes and store test data to local files in the format the API would return them in. For example, the classes/mock.TwitterOAuth.php class reads Twitter data from the files in the testdata directory. See /thinkup/webapp/plugins/twitter/tests/ for examples of Twitter crawler plugin tests. Integration Tests (all_integration_tests.php) Add tests for particular pages inside the webapp WebTestOfChangePassword.php for an example. to an appropriately-named class. See Once your tests pass, add them to the appropriate all_tests.php file to run with the existing suites. For example, new model tests should go in all_model_tests.php, new controller tests should go in all_controller_tests.php, etc. How to Debug Tests To print variable values to the terminal while running tests, use the ThinkUpWebTestCase::debug method or ThinkUpBasicTestCase::debug method. For example, you can add a line like this to your test: $this->debug("This is my debugging statement which will print during my test run."); To print something other than a string in a debug statement, use the Utils::varDumpToString method, like this: $this->debug(Utils::varDumpToString($my_nonstring_object)); To see your debug statements, run your test like so: 7.2. How You Can Help 161 ThinkUp Documentation, Release 2.0-beta.10 TEST_DEBUG=1 php tests/yourtest.php How to Speed Up Test Runs You can see how much time test groups take by setting the TEST_TIMING variable like so: TEST_TIMING=1 php tests/all_tests.php There are a few ways to speed up the test runs: 1. Set the environment var SKIP_UPGRADE_TESTS. This will skip the installation upgrade test, and shave a few minutes off of the test run. SKIP_UPGRADE_TESTS=1 php tests/all_tests.php 2. On OS X, set up your test database to run in a RAM disk to speed up database I/O during testing. You will need to update the config.inc.php file to reflect the latest test override and test RAM disk option. Copy ./extras/dev/ramdisk/osx_make_ramdisk_db.conf.sample ./extras/dev/ramdisk/osx_make_ramdisk_db.conf and edit as necessary. to Finally, run the script to create the RAM disk and the RAM disk database: sudo sh ./extras/dev/ramdisk/osx_make_ramdisk_db create -v Run the tests with RD_MODE set to 1: RD_MODE=1 php tests/all_tests.php When you are done testing you can remove the RAM disk with this command: sudo sh extras/dev/ramdisk/osx_make_ramdisk_db delete -v 3. On Ubuntu, set up your test database to run in a RAM disk to speed up database I/O during testing. You will need to run: sudo ./extras/dev/ramdisk/ubuntu_make_ramdisk_db When you are done you MUST run: sudo ./extras/dev/ramdisk/ubuntu_remove_ramdisk_db Or your MySQL installation will be destroyed. I’m getting lots of test failures. Help! Possible reasons for getting a high number of test failures include: • An incorrect $TEST_SERVER_DOMAIN in tests/config.tests.inc.php. Please make sure that this points to the web root of your ThinkUp installation. Relevant thread • An incorrect value for any of the test database values. Please make sure that both config.inc.php and config.tests.inc.php point to an existing, empty database. • AppArmor which is installed on Ubuntu by default can prevent the ThinkUp test suite backup tests from writing to the files it needs to. To fix this add the following to your /etc/apparmor.d/usr.sbin.mysqld file: path_to_thinkup/webapp/data/backup/* rw, and then restart AppArmor with: sudo /etc/init.d/apparmor reload 162 Chapter 7. Contribute ThinkUp Documentation, Release 2.0-beta.10 If you have double-checked these and everything appears to be intact, send an email to the mailing list or pop into the IRC channel and we’ll see what we can do to help you out. Write Code Code Style Guides PHP Code Style Guide languages. This is ThinkUp’s Code Style guide for PHP. See the main page for guides specific to other Assume we’re using the Drupal PHP coding style unless otherwise noted here. Always use <?php to delimit PHP code, not the shorthand, <?, as this is the most used and supported across PHP setups and the one PHP will continue supporting in the future. Use PHP5 conventions When in doubt, use PHP5 (not PHP4) coding conventions. • Class constructors should be public function __construct (), not the PHP4-style class name. Use destructors when appropriate. • Explicitly declare visibility (public, private, protected) for member variables and methods. • Do NOT use PHP closing tags for files that contain only PHP code: The ?> at the end of code files is purposely omitted. Removing it eliminates the possibility of unwanted whitespace at the end of files which can cause header already sent errors, XHTML/XML validation issues, and other problems. Indentation Use an indent of 4 spaces, with no tabs. Braces Always use curly braces, even in situations where they are technically optional. Having them increases readability and decreases the likelihood of logic errors being introduced as the codebase continues to evolve. Opening curly braces should never be on their own new line. Closing curly braces should always be on their own new line. Avoid multiple blank lines Separating sections of code with a blank line is okay, but never more than 1 blank line at a time. Maximum line length: 120 characters The maximum length of any line of code is 120 characters, unless it contains a string that cannot have a break in it. (This differs from Drupal’s 80-character maximum length.) Tip: If you’re using Eclipse, add a ruler to the 120 mark to see where you should break to the next line. See Developer Guide: Setting Up Eclipse PDT for how. Include docblocks in all code ThinkUp uses PHPDocumentor to ease code maintenance and auto-generate class documentation. Include PHPDoc-style “docblocks” in all of your PHP code. When writing your documentation, please use PHPDocumentor’s syntax. Keyword case Drupal style guide states use of uppercase value keywords (TRUE, FALSE, NULL), ThinkUp user lowercase. 7.2. How You Can Help 163 ThinkUp Documentation, Release 2.0-beta.10 Same-line curly braces Unlike Drupal’s style guide, ThinkUp keeps opening and closing curly braces on the same line as the control keyword (if, else). Boolean operator at the beginning of the line Like the Drupal convention, when constructing multi line IFs, the boolean operator should be at the beginning of the line, not the end. MVC architecture ThinkUp implements the Model-View-Controller design pattern. All new PHP code should follow suit. Read more about ThinkUp’s MVC implementation. JavaScript Code Style Guide This is the Code Style guide for JavaScript. See the main main page page for other languages. Indentation Use an indent of 2 spaces, with no tabs. Names Functions and variables should be named using lowerCamelCase. Braces Always use curly braces, even in situations where they are technically optional. Having them increases readability and decreases the likelihood of logic errors being introduced as the codebase continues to evolve. Opening curly braces should never be on their own new line. Closing curly braces should always be on their own new line. Semicolons To avoid semicolon insertion (Q: What’s that? A: See Wikipedia, end all statements with a semicolon, except for for, function, if, switch, try, and while. For the same reason, a function’s return value expression must start on the same line as the return keyword. Semicolons must also follow functions declared in this manner: result = function (parameter) { // Statements. }; and do-while control statements: do { // Statements. } while (condition); Comments Non-documentation comments [STRIKEOUT:- that is, explanatory “what does this block of code do?”]type comments — are strongly encouraged. Concerned about performance? Don’t worry, comments can be removed by Javascript compression utilities for use on production servers. Comments should use capitalized sentences with punctuation. Comments should be on a separate line immediately before the code line or block they reference. // Unselect all checkboxes. result = unselectCheckboxes(myArray); If each line of a list needs a separate comment, the comments may be given on the same line and may be formatted to a uniform indent for readability. 164 Chapter 7. Contribute ThinkUp Documentation, Release 2.0-beta.10 var parameter1 = ’foo’; // Parameter 1 comment goes here. var parameter2 = ’barbaz’; // Parameter 2 comment goes here. var parameter3 = ’someothervalue’; // Parameter 3 comment goes here. C style comments (/* Comment goes here. */) and C++ style comments (// Comment goes here.) are both fine. Operators All binary operators (operators that come between two values), such as +, -, =, !=, ==, >, &&, ||, etc. should have a space before and after the operator, for readability. var string = ’Foo’ + bar; var string += ’Foo’; if ((someQty < otherQty) && (someBoolean == true)) { doStuff(); } Unary operators (operators that operate on only one value), such as ++, !, etc. should not have a space between the operator and the variable or number they are operating on. someInt++; if (!condition) { action(); } Javascript has one ternary operator (operators that operate on three values) called the conditional operator. The ternary operator should have a space on either side of the ? and the :. condition ? result1 : result2; Control Statements Control statements should be made with: * one space between the control keyword and opening parenthesis (to distinguish control statements from function calls); * no spaces between the opening parenthesis and the first condition; * spacing around any logical operators as previously described; * no spaces between the last condition and the closing parenthesis; and * one space between the closing parenthesis and the opening curly brace. An example if statement: if (condition1 || condition2) { action1(); } elseif (condition3 && condition4) { action2(); } else { defaultAction(); } An example switch statement: switch (condition) { case 1: action1(); break; case 2: action2(); break; default: 7.2. How You Can Help 165 ThinkUp Documentation, Release 2.0-beta.10 defaultAction(); } An example try statement: try { // Statements. } catch (variable) { // Error handling. } finally { // Statements. } Functions Functions should be called with: * no spaces between the function name, the opening parenthesis, and the first parameter; * spaces between commas and each parameter; and * no space between the last parameter, the closing parenthesis, and the semicolon. myVar = myFunction(parameter1, parameter2, parameter3); Functions should be defined using the same spacing as function calls, except that there should be a single space between the function name and the opening parenthesis. This avoids confusion when dealing with anonymous functions (function (e) {}). function myFunction (parameter1, parameter2) { alert("This JS file does fun message popups."); return false; } Arrays Arrays should be formatted with a space separating each element and assignment operator, if applicable. If the line spans longer than 80 characters, each element should be broken into its own line, and indented one level. var shortArray = [’hello’, ’world’]; var longArray = [ ’hello’, ’world’, ’foo’, ’bar’, ’baz’ ]; jQuery Snippet Formatting TODO (some of the above style rules for straight Javascript might not make sense for jQuery snippets.) CSS Code Style Guide This is the Code Style guide for CSS. See the main page for other languages. Indentation Use an indent of 2 spaces, with no tabs. Names & Capitalization ID names should be in lowerCamelCase. #pageContainer { 166 Chapter 7. Contribute ThinkUp Documentation, Release 2.0-beta.10 Class names should be in lowercase, with words separated by underscores. .my_class_name { HTML elements should be in lowercase. body, div { Use External Stylesheets Do not write inline styles or embedded styles unless unavoidable. Inlining or embedding styles is most likely avoidable — ask the ThinkUp mailing list if you’re not sure. For performance reasons (see Steve Souder’s blog, always link to external stylesheets using the <link> syntax rather than the import syntax. <link rel="stylesheet" href="a.css"> <!-- Okay --> <style type="text/css">@import url("a.css");</style> <!-- Not Okay --> Write Valid CSS ThinkUp’s CSS should be valid to the CSS 2.1 specification. CSS 3.0 rules are acceptable as long as they degrade gracefully. Run any CSS you write through the W3C validator and ensure it passes before submitting a pull request. Comments Comments are strongly encouraged. Concerned about performance? Don’t worry, comments can be removed by CSS minification utilities for use on production servers. Comments that refer to selector blocks should be on a separate line immediately before the block to which they refer. Short inline comments may be added after a property-value pair, preceded with a space. /* Comment about this selector block. */ selector { property: value; /* Comment about this property-value pair. */ } Only C style comments (/* Comment goes here. */) are valid for CSS code. Do not use C++ style comments (// Comment goes here.). Selectors Selectors should be on a single line, with a space after the last selector, followed by an opening brace. A selector block should end with a closing curly brace that is unindented and on a separate line. A blank line should be placed between each selector block. Selectors should never be indented. selector { } selector { } Multiple selectors should each be on a single line, with no space after each comma. selector1, selector2, selector3, selector4 { } When selecting HTML elements, write the selector in lowercase. 7.2. How You Can Help 167 ThinkUp Documentation, Release 2.0-beta.10 div { /* Okay */ DIV { /* Not okay */ Property-Value Pairs Property-value pairs should be listed starting on the line after the opening curly brace. Each pair should: * be on its own line; * be indented one level; * have a single space after the colon that separates the property name from the property value; and * end in a semicolon. selector { name: value; name: value; } Multiple property-value pairs should be listed in alphabetical order by property. /* Not okay */ body { font-weight: normal; width: 500px; background: #000; } /* Okay */ body { background: #000; font-weight: normal; width: 500px; } For properties with multiple values, separate each value with a single space following the comma (s). font-family: Helvetica, sans-serif; If a single value contains any spaces, that value must be enclosed within double quotation marks. font-family: "Lucida Grande", Helvetica, sans-serif; Colors When denoting color using hexadecimal notation, use all capital letters. Both three-digit and six-digit hexadecimal notation are acceptable; if it’s possible to specify the desired color using three-digit hexadecimal notation, do so as you’ll save the end-user a few bytes of download time. color: #FFF; /* Okay */ color: #FE9848; /* Okay */ color: #fff; /* Not okay */ Dimensions When denoting the dimensions - that is, the width or height - of an element or its margins, borders, or padding, specify the units in either em, px, or %. If the value of the width or height is 0, do not specify units. width: width: width: width: width: width: 168 12px; 12%; 12em; 12; 0; 0px; /* /* /* /* /* /* Okay */ Okay */ Okay */ Not okay */ Okay */ Not okay */ Chapter 7. Contribute ThinkUp Documentation, Release 2.0-beta.10 Add a New Feature Write Documentation First Write Tests Next Write Code Last Fix a Bug Write Your Test First How to Write Great Unit Tests ThinkUp contributors should use a test-driven development approach. ThinkUp uses the SimpleTest unit tester tool to create thorough and complete unit tests for all new and modified code. If your code doesn’t have corresponding tests, it won’t get merged into the ThinkUp master. ThinkUp tests are located in the /ThinkUp/tests/ folder. ThinkUp Testing Best Practices This list is a work in progress. • DAO Tests: When testing an insert or update to data, don’t rely on the DAO’s get method to verify the update. Instead, use raw SQL to retrieve the inserted/updated row and assert it works. Related mailing list thread. • Crawler plugin tests: When testing data returned by a web service API, do not query the live API in your tests. Instead, mock a class that returns all possible values that you expect from the API, and write tests against those values. For example, the mock TwitterOAuth class reads test Twitter data from files stored in the testdata directory, instead of hitting Twitter.com live. Plugins How to Build a ThinkUp Plugin First, run the script which will automatically generate the required folder structure and default files with some standard methods every plugin will need. Navigate to ThinkUp’s root directory in a terminal and type the following command: ./extras/dev/makeplugin/makeplugin NameOfYourPlugin Where NameOfYourPlugin is the name of the plugin you want to create, e.g. Twitter, Facebook etc. Once the script is done, navigate to the webapp/plugins/ folder, and you’ll see a newly-created folder there which contains all your new plugin’s files. If you load ThinkUp and go to the Settings area, you’ll see your plugin listed there with the default plugin icon. Activate your new plugin and click on its name to view its settings page. ThinkUps .gitignore file ignores all plugins by default to enable development of non core plugins. So you will need to add an exception of the form: !webapp/plugins/your_plugin_name 7.2. How You Can Help 169 ThinkUp Documentation, Release 2.0-beta.10 to the .gitignore file. Icons You will need to add two icons that represent the service you are making the plugin for to the plugins assets folders, these images are normally the same as the services favicon. Image 1 should be 48x48 pixels and called service_name_icon.png Image 2 should be 16x16 pixels and called favicon.png Setting Various Details You then need to edit plugin_name.php in the plugins controller file and set the description (line 5), this is what will appear below the plugin name on the settings page. This is normally 1 sentence describing what the plugin captures and displays for example: Capture and display YouTube videos. Then set the path to the icon (line 7) and author (line 9). In this file on line 44 you can specify if this plugin runs before or after the insight generator plugin by setting the second parameter of registerCrawlerPlugin() to true to run before the insight generator plugin and false to run after it. Then edit account.index.tpl in the plugins view folder and set the filename of the plugins icon on line 5. You then need to set the class descriptions in all of the autogenerated files. Retrieving OAuth Tokens The first class to write is the PluginConfigurationController. This presents a form to the user where they can enter any details needed to carry out authentication. Start by creating a file in the docs/source/userguide/settings/plugins/ folder called plugin_name.rst And then write a step by step guide for the user on how to configure the plugin and include information on what data the plugin captures. You can then link to this guide by editing the path on line 47 to: userguide/settings/plugins/plugin_name and you’ll probably want to remove the message on line 45. The HTML for the configuration page can be found in view/account.index.tpl, you’ll probably want to copy a template for this from one of the existing plugins. This page needs to tell the user what the plugin does and provide them with some basic instructions on how to configure it. The input boxes shown to the user are controlled by the authControl() function in the PluginConfigurationController. You should also add the names of any required parameters to the constructor of the [PluginName]Plugin.php class along with the name of the folder that this plugin lives in. With the ability for the user to enter the details you require to retrieve the OAuth tokens you then need to write the code to retrieve them, this is normally done in a function called setUpPluginNameInteractions() in the PluginConfigurationController class. 170 Chapter 7. Contribute ThinkUp Documentation, Release 2.0-beta.10 The first thing you need to do in this function is to retrieve the values of any form data the user has entered from the options array that it passed in. You should then create the redirect URI that the authenticating service will send the user back to and then build the link the user needs to go to in order to retrieve the OAuth tokens. You now need to handle the user being redirected back to ThinkUp with the OAuth tokens. When this happens you will need to exchange the client id, client secret and the code you get back from the service for an OAuth token and possibly also a refresh token. The function to do this should be located in the plugins crawler class. At this point you will need to start making requests to the services API, all API calls should be made through the APIAccessor class located in the model folder. This normally has 2 functions one which makes a GET request to the API and one which makes a POST request. With the tokens obtained you will need to get some basic information about the user so you can store the OAuth tokens in the database you should at least obtain a relevant user id, user name and full name for the user. Storing the access tokens is normally handled by the saveAccessTokens() function. In here you should check if an instance of this plugin already exists for the user ID and if so check if an owner instance exists or not and insert the required data accordingly. If an instance does not exist you will have to create one and well as an owner instance. Finally you will need to insert the user into the database if they don’t already exist. Getting the Data With the ability for the user to configure the plugin completed, it is now time to work on getting the data from the service. The first thing to consider is what data you want to collect and how this fits into ThinkUps current data model. You’ll probably want to discuss the data you want to collect and how you will store it on the developer mailing list before you start writing the code. With the data you will collect and how it will be stored decided you can begin writing the PluginNameCrawler class. First create some global variables in the constructor. You’ll want an instance, logger, access token and API Accessor. Next fill in the initializeInstanceUser method, this method will be called before every crawl and its main purposes are to verify that the OAuth tokens you have are still valid and if not refresh them and retrieve more detailed information about the instance user in the process. Then it is time to write the main method for your plugin, the one which actually goes out to the service and retrieves the data. This method is generally called fetchInstanceUserPosts/Videos/Images, which ever is appropriate for your plugin. This method will normally page through results from the API and store them in the database. If you are capturing comments / replies for a post, don’t forget that you will need to also store details of the user who made the comment / reply in the database. Tying It All Together You can now tie all of your work together with the final class to write the PluginNamePlugin class. This class has a function called crawl() that tells ThinkUp what to do when the user initiates a crawl. In this method you will need to get the plugin options so you have access to the OAuth tokens and then retrieve the logged in user from the database. 7.2. How You Can Help 171 ThinkUp Documentation, Release 2.0-beta.10 Next get the instances for this plugin for the logged in user and then crawl for each one of them. This normally involves first checking the OAuth tokens are still valid and then calling your main crawling method. Testing Your Plugin ThinkUp uses a test driven development approach and so you must write tests to prove the correctness of your code. All API calls should be intercepted and handled locally, you can do this by writing a mock APIAccessor, the basis for it can be found in the tests/classes folder. This will then need to be included in any test files which test a class that makes external API calls. Data that the real API would return should be stored in the /apidata folder. The file name should be the url that the real call would go out to with & replace by - and the prefix common to all calls removed. The easiest way to create these file is to set CREATE_FILES=1 the first time you run your tests. This will then create blank files with the appropriate names in your apidata folder. You then just need to place the create data the real API would return in these files. Setting TEST_DEBUG=1 can also be useful when running the tests as you will be able to see which local files are being read and print out debugging statements. When testing the plugin configuration controller it is important to note that your new plugin will not be registered automatically so in the buildPluginOptions() and buildController() functions you will need to register your plugin manually like so: $builder_plugin = FixtureBuilder::build(‘plugins’, array(‘name’ => ‘youtube’, ‘folder_name’ => ‘youtube’, ‘is_active’ => 1) ); // Set the plugin ID (the id of the last insert to the database (the call above) ) $plugin_id = $builder_plugin->columns[’last_insert_id’]; The test class for the PluginNamePlugin is normally quite short and tests that the constructor works correctly. You may encounter issues where the apidata files have names that are over 200 characters long, this limitation exists to enable people to run the test suite on Windows. To work around it you should 1) Try to reduce the filenames size, if you insert IDs into the filename from data obtained by previous API queries you can modify the data returned and shorten the values of parameters returned. 2) If the filenames are still too long you will need to hash them using something like MD5 which outputs 32 character strings. Detect if a call to a URL which is too long is about to be made in the mock API Accessor and then replace the URL with the hashed version of the filename, and rename the file to its hashed name. Another potential issue is that your API calls may use dynamically changing values based on things like the date. To work around this detect if a call to a URL which has dynamically changing values is about to be made in the mock API accessor and replace the dynamically changing value with a constant. Make sure to rename the APIdata file to have this constant value also. You will need to add the names of your new test files to the tests/all_plugin_tests.php file and the init.tests.php file . How to build an insight for ThinkUp First run the makeinsight script to generate the basic files required to create an insight: ./extras/dev/makeplugin/makeinsight NameOfInsight The crawler will call your insight’s generateInsight function to create and store your insight. In this function you get a week’s worth of posts and an instance object with data related to the user. You then need to use this data to determine interesting things about the user’s posts. 172 Chapter 7. Contribute ThinkUp Documentation, Release 2.0-beta.10 If you need access to more information from the database then you can query it using the standard data access objects. Also remember that in the count_history table you have access to more fine-grained data such as per day counts for various attributes such as follower counts on Twitter and Facebook and video statistics for YouTube. Each insight will need to have: 1. Headline - A short string describing the generic idea about your insight. 2. Text - A string describing what interesting insight you have noticed. E.g. “You tweeted 30 times less this week.” Read the the Insight Style Guide for a more detailed explanation of how insights should be written. Additionally, when thinking through your insight, refer to the new Insight template to get a sense of everything your insight will need. (Best practice is to submit a new ThinkUp issue with that template completed before developing your insight.) With your insight generated you will need to insert it into the database using the insertInsight() method of the insight data access object. This method requires the name of the insight, the instance id, the date, the headline, the text, the filename and the emphasis. Optionally you can insert related data as the final parameter, this could be something like the tweet the insight is about. The types of emphasis are: EMPHASIS_LOW EMPHASIS_MEDIUM EMPHASIS_HIGH You may also want to store some baselines such as averages to help determine if events are significant. Baselines should be calculated and stored in the database in a insight class that will use them, baselines can be retrieved using the getInsightBaseline() method in the InsightBaseLine and inserted using the insertInsightBaseline() method. To show the insight to the user you will need to edit the template in the view folder that will be called pluginname.tpl If you want to show a standard object to the user note that there are some templates you can include in the views folder such as _post.tpl and _users.tpl. You also need to test your insight and the template for this was generated in the insightsgenerator/tests folder under TestOfInsightName.php Here you will want to insert dummy data into the database and then run your insight and check that the expected insights were inserted into the database. Code Review At ThinkUp, we practice public, conspicuous code review. TODO: describe process and pull request notifications to developer mailing list Developer How-To Guides Contents: How to Modify ThinkUp’s Database Structure If you need to alter the structure of the ThinkUp database, you’ll need to take the following steps: 7.2. How You Can Help 173 ThinkUp Documentation, Release 2.0-beta.10 Step 1. Create Your Migration Script In the webapp/install/sql/mysql_migrations/ folder, create a new .sql file. The name should include the date, issue number, and a short description of what you’re doing. For example, if I’m altering the database for my work on issue #200 on May 3, 2010 and I want to add a field called my_field to the posts table, I’d create a file called: 2010-05-03_add-myfield-to-posts_issue200.sql. In that file, add the SQL alter statements. For example, ALTER TABLE tu_posts ADD myfield VARCHAR ( 255 ) NOT NULL;. Step 2. Regenerate the Database Creation Script Once you have confirmed that your migration script works, regenerate the sql/build-db_mysql-upcoming-release.sql file using the automated migratedb shell script. Never edit the build-db_mysql.sql file by hand. To do so, run the extras/scripts/migratedb script at the command line. First you’ll need to create and edit your configuration file. Check out the README for instructions on how to do that. Run ThinkUp’s tests to make sure the database creation script works. When you commit your work, make sure you add both the new migration file, and the auto-generated build-db_mysql-upcoming-release.sql file. Step 3. There is no step 3. How to Add CSRF Protection to Application Actions ThinkUp’s application code offers several helper methods for easily adding protection against Cross-site request forgery attacks. These methods add a unique token to all requests which modify the contents of the database. That token gets validated when ThinkUp receives the request, as per The Open Web Application Security Project’s recommendation. If you have added a controller which uses GET or POST variables to modify the database, you must use this CSRF token protection. Add a CSRF Token to a ThinkUp Request In your controller, enable CSRF token support by disabling caching (i.e., $this->disableCaching();) then calling $this->enableCSRFToken();. Then you must add the CSRF token to your view in one of two ways, depending on what kind of request it is. If you are using a web form, a Smarty modifier can generate a hidden input field with the name csrf_token in your form. Do so by adding this to your view template file inside the form: {insert name="csrf_token"} If you are simply making a request with $_GET window.csrf_token to your JavaScript-based request. URL parameters, add &csrf_token=" + See webapp/_lib/view/account.index.tpl as an example. Validate the Incoming CSRF Token In the controller’s block of code which validates the request inputs, call $this->validateCSRFToken(); to ensure the token is valid. If it isn’t, the controller will throw an InvalidCSRFTokenException. See webapp/_lib/controller/class.AccountConfigurationController.php as an example. 174 Chapter 7. Contribute ThinkUp Documentation, Release 2.0-beta.10 Test for Valid and Invalid CSRF Tokens When you write regression tests for code which employs CSRF tokens, include tests for both valid and invalid CSRF tokens. To test for requests with a CSRF token, add $_POST[’csrf_token’] = parent::CSRF_TOKEN; or $_GET[’csrf_token’] = parent::CSRF_TOKEN; to your test. To test for requests without it, omit that line. To simulate logging into ThinkUp with CSRF support enabled, call $this->simulateLogin(’[email protected]’, false, $use_csrf_token = true);. See TestOfAccountConfigurationController::testDeleteExistingInstanceNoCSRFToken and TestOfAccountConfigurationController::testDeleteExistingInstanceAsAdmin for examples of tests without and with CSRF tokens. How to Clean External Data Before Displaying It in Your View Any time you display data in ThinkUp which comes from an outside source–whether that’s Twitter.com or user input on the registration form–you must remove any HTML or JavaScript from that content. If you don’t, you make ThinkUp vulnerable to Cross-site scripting attacks (or XSS for short). ThinkUp’s application code includes a filter for cleaning data displayed in its views. To use it, pipe your view data through a Smarty filter called filter_xss. What Not To Do For example, to display the text of a post inside paragraph tags, the following Smarty template markup will include any JavaScript or HTML markup contained in that post text: <p>{$post->text}</p> DO NOT DO THIS. What To Do Instead, clean that post text and display it inside paragraph tags within your Smarty template file by using: <p>{$post->text|filter_xss}</p> How to Show User Messages on Application Pages ThinkUp’s application code defines three types of user messages with standard styles throughout the application: success, error, and informational messages. A developer can assign either a single page-level message, or multiple field-level messages. Here’s how. Page-level Messages To assign a page level message to a ThinkUp view, use the ThinkUpController’s addMessage methods. For example, if you’re working on the LogoutController (a child of ThinkUpController), and you want to add a “You have been logged out” success message to the view, inside LogoutController, call: $this->addSuccessMessage(’You have been logged out’); Then, to display that message, include the _usermessage.tpl template at the top of your Smarty template page file, like so: {include file="_usermessage.tpl"} A given page can only have a single message of any given type. So if you add a page success message, then add another, only the last one assigned will appear on-page. 7.2. How You Can Help 175 ThinkUp Documentation, Release 2.0-beta.10 Field-level Messages Sometimes you want to display an error, success, or informational message in a particular area of the page, near a relevant page element. For example, in the RegistrationController, you might want to display a “Password must be at least 5 characters” error message near the password field if the submitted password is only 3 characters. To add a field-level message to a view, in your controller, specify a field name as well as the message, like so: $this->addErrorMessage(’Password must be at least 5 characters’, ’password’); To display that error message near the password field, include the message template and pass it the appropriate field name (in this case, ‘password’), like so: {include file="_usermessage.tpl" field="password"} That will make the password-specific error message appear at that place in the page. You can assign multiple field-level messages of every type; they will only display in the view when you include the message template, passing it the field name as a parameter. How to use Grunt to process front-end templates Grunt is a task runner for front-end development. ThinkUp uses it for a few things. 1. Our Javascript is written in CoffeeScript. Grunt compiles theses files into JS. 2. Our CSS is written in LESS. Again, Grunt handles this compilation. 3. HTML emails require CSS to be included inline, not linked in the head. Grunt (and Premailer) do this for us. Below you’ll find instructions on installing Grunt and using it for these tasks. Installing Grunt and its dependencies In order to compile JS and CSS, you need to have NodeJS installed on your machine. If you’re compiling HTML emails, you’ll need Ruby too. This has been tested on a Mac, but should work on any machine that supports Ruby and Node. We’ll cover installation below, but these are the required packages. NodeJS modules • grunt-cli • grunt • grunt-contrib-watch • grunt-premailer Ruby gems • hpricot • premailer Install 1. If you haven’t done so already, install NodeJS via homebrew Homebrew (brew install node) or their installer. 2. Assuming you have Ruby on your system, install the two required gems with gem install hpricot premailer. (You can skip this step if you’re not compiling HTML emails). 176 Chapter 7. Contribute ThinkUp Documentation, Release 2.0-beta.10 3. Before we install the node modules, we need to create a directory for them and symlink to it from the ThinkUp root directory. This isn’t standard Node behavior, but it’s the only way our tests will work. So, anywhere you’d like (though we recommend in the directory adjacent to ThinkUp), create a directory called “thinkup_node_modules”. Create a “node_modules”symlink to that directory from the root directory of your ThinkUp repository. 4. Navigate to the root directory of your ThinkUp repo and run npm install. This should install all of the NodeJS modules we use in ThinkUp. 5. In order to run Grunt, you’ll need the command line interface. grunt-cli. Install that with npm install -g Inlining CSS for HTML emails HTML rendering in email clients is pretty poor, but it does pretty well if you use inline styles. Since it’s a pain to write your CSS rules inline, we don’t; we use software. The precompiled HTML email template for our insights lives at extras/dev/precompiledtemplates/email/_email.insi and is written to webapp/plugins/insightsgenerator/view/_email.insights_html.tpl. Once you’ve gotten through the installation, using the inliner is incredibly easy. 1. Make your changes to the precompiled template (location is listed above). 2. From the root directory of your repository, run grunt html_email. You can optionally run grunt watch and leave the process open as you work on your template. Everytime you save the source template, it will recompile. Compiling LESS to CSS and CoffeeScript to Javascript The key thing to understand is that ThinkUp CSS development is done in LESS, then compiled to CSS. This means working directly with ThinkUp CSS files means your changes might be overwritten. The same is true for CoffeeScript and Javascript. Our LESS files live in extras/dev/assets/less/ and get compiled to webapp/assets/css/. Similarly, our Coffeescript files live in extras/dev/assets/coffee/ and get compiled to webapp/assets/js/. Just like inlining CSS for emails, whenever you save a LESS or Coffeescript file, you can run grunt less or grunt coffee. You can also run grunt watch and it will compile the files automatically on save. Pull Request Checklist Now that you’ve mastered working with ThinkUp and git, you’ve made changes to the application code you want Gina to merge into the master development tree. Awesome! We’re thrilled to have you as a contributor. This page lists a few things you should know. To increase the chances of your contribution getting accepted into the master development tree quickly and easily, before you issue a pull request, make sure that: 1. Your changes adhere to the ThinkUp coding standards. Check out our Code Style Guide for specifics on what your code should look like. 2. Your code is thoroughly documented. We use PHPDoc to auto-generate class documentation. Make sure all your classes and methods are documented using PHPDoc standards. Here’s more on ThinkUp and PHPDoc. 3. All existing unit tests pass. Gina won’t merge any code into the master development trunk that makes existing tests in /thinkup/tests/ fail. Check out the tests README for more on how to set up, run, and write tests. 4. You’ve added regression tests for your new code. If you’ve fixed a bug, you should have added a test which fails in the current development tree, but passes in yours because of your fix. If you’ve added a new feature or new object methods or a new plugin, make sure you’ve also added thorough and complete tests that demonstrate that it works. 7.2. How You Can Help 177 ThinkUp Documentation, Release 2.0-beta.10 5. You’ve rebased your work on the current state of the master development tree. Help us keep ThinkUp’s commit trees clean. Use git-rebase to base your changes on the latest state of the development tree. This puts the onus of resolving conflicts that may have come up between the time you started your changes and the time you finished on you. This is a good thing, because you know better what your new code does as compared to the existing code than Gina does. Here’s how to use git-rebase before you issue a pull request. General Guidelines for Code Commits Help keep ThinkUp’s commit history clean and descriptive. A few general tips: • Each commit should represent one type of change. If you’re working on re-formatting ThinkUp code, for example, don’t commit the files you work on one at a time. Edit them all, then add them all to one commit, with the commit message “Code formatting.” • Make your commit message as descriptive as possible. Include as much information as you can. Explain anything that the file diffs themselves won’t make apparent. • Consolidate multiple commits into a single commit when you rebase. If you’ve got several commits in your local repository that all have to do with a single change, you can squash multiple commits into a single, clean, descriptive commit when using git-rebase. When you do, good karma is yours. Thanks for contributing to ThinkUp! ThinkUp and PHPDoc ThinkUp uses PHPdocumentor to keep track of the documentation for our code. Though it creates fairly clean documentation without any special intervention, it’s possible to create even better docs using some of the special features of PHPDoc. Basic commenting First thing to remember about PHPDoc is that all user comments need to be enclosed in C-style comments with two leading asterisks, like so: /** * Hi, these are my comments * . * . * . */ Any other user comments are ignored by PHPDoc. Secondly, your user comments must precede the code you’re adding comments to. For example, if you wanted to add some general comments to a class declaration, here’s what you’d do: /** * These are user generated comments * about the following class: */ class myClass { ... } 178 Chapter 7. Contribute ThinkUp Documentation, Release 2.0-beta.10 You can precede class declarations, function declarations, even variable declarations and PHPDoc will be able to organize your comments correctly. PHPDoc Tags (@) Sometimes you’ll want to add meta information to your comments. You can do this by using PHPDoc Tags, which start with an @ symbol, like this: @myMetaTag my meta information Here are a few useful tags: @package packagename The package that your code belongs to. In almost every case in our project, this will be ThinkUp @param datatype $paramname description As you’ve probably guessed, this tag allows you to document the parameters of your function. Say you have a string parameter named myParam in your function. Here’s what you’d enter in your documentation: @param string myParam This is the description of my parameter @return datatype description No surprise, the @return tag is used to document the return value of functions or methods. @author authorname The @author tag is used to document the author of any element that can be documented. Also, phpDocumentor will take any text between angle brackets (< and >) and try to parse it as an email address. If successful, it will be displayed with a mailto link in the page. For example: @author Generic Person <[email protected]> The style guide requires you to append a email address wit the @author tag, if you want to obscure it use gperson[at]fakedomain[dot]com Example Here’s a file that Gina’s already added PHPDocumentor comments to: https://github.com/ginatrapani/ThinkUp/blob/master/webapp/_lib/m This is what the documentation page http://www.thinkupapp.com/reference/ThinkUp/Post.html that PHPDoc created looks like: ThinkUp’s Model View Controller Implementation ThinkUp does not use an MVC framework, but it does employ the Model-View-Controller design pattern. The Wikipedia page makes the idea sound confusing to new comers so here’s a basic run down of what the MVC design pattern is and how ThinkUp uses it. 7.2. How You Can Help 179 ThinkUp Documentation, Release 2.0-beta.10 The idea behind the MVC design pattern is to separate programming logic from the presentation of an application. Ever embedded large amounts of HTML in strings concatenated with lots of variables? The MVC pattern is the solution to that problem. Under the MVC design pattern, an application will have 3 specific types of component: models, views and controllers. Models are designed to take data and process it, views are designed to take processed data and display it, and controllers are designed to decide what data gets processed by which model and which view is used to display it. In our case: • Model - ThinkUp’s model objects live in /thinkup/webapp/_lib/model/. Model object filenames start with the prefix class.. For example, the Post object is located in the class.Post.php file. • View - ThinkUp’s views are Smarty templates, files with the .tpl extension, located in the /thinkup/webapp/_lib/view/ directory. As a general rule, HTML markup should never appear in a PHP file, only in a template file. • Controller - ThinkUp’s controllers live in /thinkup/webapp/_lib/controller/. Each controller should extend either ThinkUpController or ThinkUpAuthController. Extend ThinkUpAuthController only if the user should be logged in to perform the desired action. PHP pages that are requested in the browser will instantiate a controller and echo its go () method. If you are trying to figure out how a page works, the PHP file of that page will tell you what controller is deciding how the page works. Understanding Controllers As mentioned before, all controllers in the ThinkUp application extend either ThinkUpController or ThinkUpAuthController. The reason for this is that both of those classes provide a lot of the nitty gritty code that goes into keeping the user interface consistent and secure so that you don’t have to. They also have a few cool tricks up their sleeves. If you extend the ThinkUpAuthController, for example, your user will need to be logged in to access the page. If they are not logged in, the page realises this and displays an appropriate, consistent error message. You, as the developer, do not need to worry about handling guest users trying to access your page. The ThinkUpController class also handles the template that you want to use. Setting a template and sending data to the template is all handled for you and abstracted into a handful of easy to use methods that I will explain in more detail in the next section. Remember those cool tricks I mentioned earlier? One of them is profiling. If you turn on profiling in your config file, the controllers are what handle that. All of the queries that you make get logged by the classes that access the database and the controller automatically displays them at the bottom of the page. Cool, right? Writing your own controller is really easy. All you need to do is extend either ThinkUpController or ThinkUpAuthController and override a method called control (). The control method is an abstract method inside ThinkUpController (ThinkUpAuthController extends ThinkUpController) that gets called as part of the go () method. So as the page is generated, the control () method is called to allow you to do all of the processing that you need to do, then the controller uses the data that you processed to generate the page that gets displayed to the user. Understanding Views We know that a view is what presents data to us in to a front end user interface, but how does it achieve this? Enter Smarty. ThinkUp uses a templating engine called Smarty. Smarty is a very versatile and very easy to use templating engine that allows a developer to send key=value pairs to a .tpl file that contains HTML code (and possibly some Smarty syntax that you can read about on their site). Let’s take a look at the UpdateNowController class. 180 Chapter 7. Contribute ThinkUp Documentation, Release 2.0-beta.10 The UpdateNowController class is quite small and will tell you just about everything you need to know about the basics of how controllers send data to views. You will see a line in this controller that looks like this: $this>setViewTemplate (‘crawler.updatenow.tpl’);. This is an important line of code and needs to be present in all of the controllers you write; it tells the controller which view to use. You will notice in the views folder that there is a file called crawler.updatenow.tpl. This is the view that the UpdateNowController uses. About half way down the crawler.updatenow.tpl file you will see this line of code <iframe width="850" height="500" src="run.php{if $log == ’full’}?log=full{/if}" style="border:solid b Notice the strange “if” statement in {curly braces}? That’s Smarty syntax. It’s telling the page that if the $log variable equals the string “full”, print ?log=full to the page. But where did the $log variable come from? Near the bottom of UpdateNowController you will see this line of code: $this->addToView (‘log’, ‘full’);. This is how controllers pass key=value pairs to Smarty templates. That just about covers the basics. If you have any further questions don’t hesitate to ping the mailing list or ask in the IRC channel. How ThinkUp Handles Timezones During installation, ThinkUp prompts the user to set their local timezone. The timezone value must be a valid PHP timezone. ThinkUp stores this timezone in the config.inc.php file in this line: $THINKUP_CFG[’timezone’] = ’America/Los_Angeles’; As of beta 14, on every connection to the database, ThinkUp explicitly sets the database timezone to that value. Any date/times information for a given table should be stored in UTC as a MySQL DATETIME field. ThinkUp adjusts for the user’s timezone by using the #gmt_offset# token in SQL queries on select statements. 7.2.4 Designer and User Experience Expert TODO Our goal is to make ThinkUp a beautiful, usable app. Help us get there by mocking up screenshots or devising wireframes that improve ThinkUp’s look and feel and user interface. We recommend Mockingbird for creating and sharing wireframes easily. We’re also looking for web security experts to pentest ThinkUp; MySQL experts to help optimize ThinkUp queries, and sysadmins to help make ThinkUp as easily-installable and upgradable as possible. If you’re interested in lending a hand, please do get in touch. 7.2. How You Can Help 181 ThinkUp Documentation, Release 2.0-beta.10 182 Chapter 7. Contribute CHAPTER 8 Development Team A core development team, in collaboration with community members, develops ThinkUp. 8.1 Core Team Gina Trapani started building ThinkUp in the summer of 2009 as a personal weekend project. She served as Project Director at ThinkUp’s incubator, Expert Labs, from February of 2010 until March of 2012. Since then, she has been the cofounder of ThinkUp LLC, leading application development. • ginatrapani on GitHub • ginatrapani’s ThinkUp Anil Dash founded ThinkUp’s incubator, Expert Labs, and cofounded ThinkUp LLC with Gina Trapani. See Anil’s ThinkUp contributions. • anildash on GitHub • anildash’s ThinkUp Mark Wilkie worked on ThinkUp through Expert Labs from May of 2010 until March 2012 as a lead developer and application architect, then in 2013 on internal systems for ThinkUp, LLC. See Mark’s ThinkUp contributions. • mwilkie on GitHub • mwilkie’s ThinkUp Chris Moyer started work on ThinkUp through ThinkUp, LLC in November 2013. See Chris’s ThinkUp contributions. • cdmoyer on GitHub • cdmoyer’s ThinkUp 8.2 Community At ThinkUp, our goal is to create the most inclusive and innovative open source projects in the world. Read more about how our community and culture is our best feature. The core team works with a growing community of volunteer and third-party contributors, some of whom are paid by their employer or through open source programs. See ThinkUp’s full list of contributors. 183 ThinkUp Documentation, Release 2.0-beta.10 184 Chapter 8. Development Team CHAPTER 9 Changelog Check out what’s new, fixed, and updated in each version release of ThinkUp. 9.1 2.0-beta.10 - 13 Jan 2014 9.1.1 Enhancements: • Add user-level timezone in Settings > Account. • Receive insight email notifications on a per-user timezone basis. 9.1.2 Bugfixes: • Fix broken links to insights in insight notification email. • Fix bug where insights disappeared on update (second generation). 9.2 2.0-beta.9 - 26 Dec 2013 9.2.1 New YouTube plugin: Connect your YouTube account to ThinkUp to get insights on your activity, including: • Videos with the most likes and views • How many minutes users watched your videos • The videos viewers watched longer on average • Changes to your channel subscriber count • Video likes versus dislikes 9.2.2 New insights: • New verified followers: Find out when a verified user follows you. • Fave/like/+1 spikes and highs: See when a post gets an unusually high number of likes. 185 ThinkUp Documentation, Release 2.0-beta.10 • Metweets: Keep track of how often you talk about yourself. • Interaction Graph: See who you talked to the most each week. • Weekly Bests: See your best posts of the week. • Reply Spike: See posts that received an usually high number of comments or replies. • Response Time: Know how fast your posts get replies or likes. • Favorited Links: See what posts you’ve liked which contained links. • Long-lost Contacts: Keep track of the contact you haven’t talked to in over a year. • Link Prompt: Don’t forget to post interesting links. • Local Followers: See when new followers are located where you are. • Outreach Punchcard: See what times of day your posts get responses. 9.2.3 New features: • Opt into daily and/or weekly insight email notifications. In Settings -> Account, choose Daily, Weekly, or No Email under Notification Frequency. • If your server cannot send email, ThinkUp (https://www.thinkup.com/docs/install/advancedconfig.html) can now send email • Format your insight email notifications with a custom HTML (https://www.thinkup.com/docs/userguide/settings/plugins/insightsgenerator.html) via Mandrill. Mandrill template. • Retrieve saved search posts via ThinkUp’s API. (https://www.thinkup.com/docs/userguide/api/posts/keyword_posts.html) 9.2.4 Enhancements: • See what days which insights appear in Settings > Plugins > Insights (http://blog.thinkup.com/post/57456822638/what-kind-of-insights-will-thinkup-give-you-when) Generator. • Get improved insight copy with localized terms by service (i.e., status update vs tweet versus post). • Expand URLs plugin: Get the title and description of each link on expansion. 9.2.5 Bugfixes: • Correctly capture tweets and mentions by since_id versus page. • Correctly capture Facebook comments using updated API pagination. • Correctly capture Facebook post likes using Oct 2013 updated API. • Correctly display Foursquare checkin photos. • Gracefully handle capturing Twitter followers who are 403 “not found” (i.e., deactivated/suspended). • Avoid “Data too long for column” error while expanding links. • Update Foursquare and Facebook connection instructions. • Fix broken saved search links in Twitter configuration. • Resolved several PHP warnings and notices. • Fixed typos and grammatical errors in insights and documentation. 186 Chapter 9. Changelog ThinkUp Documentation, Release 2.0-beta.10 9.3 2.0-beta.8 - 23 May 2013 Fix unresponsive upgrade button during web-based database upgrade process. 9.4 2.0-beta.7 - 20 May 2013 9.4.1 New features: • Save searches for a hashtag or keyword on Twitter. See daily search result totals in your insights stream, and search within results from the search box. • Get notified by your browser when new insights are available (you must enable browser notifications and have your browser tab open, supported in Chrome, Firefox, Safari). • See insights in your crawler RSS feed. 9.4.2 Developer improvements: • New Insights API exposes insights stream as JSON (available for use by things like the alpha ThinkUp Chrome extension - https://github.com/ginatrapani/ThinkUp-Notifier-for-Chrome). • makeplugin script upgrade generates stubs for latest data input source plugin architecture. • Easily build instance-specific configuration panels in plugin settings area. • Test suite upgrades enable it to pass when non-core plugins are installed. 9.4.3 Bugfixes: • Fix incorrect plural wording in All About You insight. • Fix Foursquare authorization error on installations using non-standard port. • Fix bug when searching for duplicate terms. • Correct List Membership insight miscount. • Avoid PHP Notice of Undefined indexes. • Reset password token when password has been changed. • Allow owner password field to contain special chars (not only letter and numbers). • Prevent multiple ThinkUp account activations. • Standardize password validation frontend across registration and change password screens. • During installation, remove SimpleXML check, require ZipArchive. • Fix application URL in account activation email for on installations with uppercase characters in the folder name. • Remove pause/start crawling buttons for non-admin users. • Fix broken username link in Twitter plugin settings. • Redesign documentation. • Clean up and streamline code. 9.3. 2.0-beta.8 - 23 May 2013 187 ThinkUp Documentation, Release 2.0-beta.10 9.5 2.0-beta.6 - 4 Apr 2013 When adding a Twitter account, fix “Twitter authorization did not complete successfully” error. 9.6 2.0-beta.5 - 1 Apr 2013 • Search improvements: Search dropdown fills in search options as you type, disabled autocomplete, show number of results on page • Redesigned installation: Installation, export, and backup pages all upgraded to latest 2.0 design • Faster page load: Reduced total insights per page to 20 • Streamlined Twitter authorization: Redirect directly to plugin settings page to avoid extra page/click Bugfixes: • Fix Older/Newer links in search results • Fix set private/set public button success messages in plugin settings • Don’t halt Twitter crawl if an Exception is thrown or if it encounters a 404 (user deleted/not found) • Fix broken register/forgot password links when redirected to log in • Fix “No insights to display” message/automatically activate Insights Generator plugin • Fix multiple PHP Notices 9.7 2.0-beta.4 - 25 Feb 2013 Fixed bug which rendered insights stream blank when user was logged out 9.8 2.0-beta.3 - 23 Feb 2013 • Search! Search your tweets, posts, checkins or Twitter follower bios and/or names from status bar • Upgrade Twitter plugin to Twitter API version 1.1 • Redesign insights stream to be even cleaner, simpler, and comply with Twitter display requirements • Upgrade jQuery and integrate FontAwesome icons throughout the app Bugfixes: • Fix ‘Error starting crawler; another crawl is already in progress’ bug • Fix verbose developer log setting on Update Data page • Fix missing insight charts in Firefox • Fix unstyled buttons and headers • Restore missing Foursquare avatar • Correct insight grammar (singular/plural in Post Style insight) • Fix mislaid-out Expand URLs settings area 188 Chapter 9. Changelog ThinkUp Documentation, Release 2.0-beta.10 • Display reshared post text in big reshare insight • Include username in Archived posts insight 9.9 2.0-beta.2 - 24 Jan 2013 • Added two new insights: All About You and Frequency • Improved responsive design and mobile browser visuals and functionality • Fixed insight copy grammar • Upgraded design: added new insight and plugin icons, simplified insight label colors, darkened footer • Fixed several minor bugs 9.10 2.0-beta.1 - 1 Jan 2013 ThinkUp 2.0 is a major functional and visual overhaul of the version 1.x application. An overview of changes includes: • Replaced the dashboard with a reverse chronological stream of insights into the user’s social data. Unlike the dashboard, this stream combines insights from all the service users set up on an installation in one view. Click on an insight’s permalink or the button on the far right to expand it and see more information. • Added a new Insights Generator plugin which calculates and inserts these insights on each crawl. View a list of the insights and what they do in Settings > Plugins > Insights Generator. Each insight is a plugin in and of itself. View individual insight plugins in plugins/insightsgenerator/insights/ folder. • Completely redesigned the login, registration, update data, and settings areas of the app using the Twitter Bootstrap framework. • Removed the ability to deactivate plugins. All plugins are activated by default to simplify the interface. 9.11 1.3.1 - 1 Mar 2013 • Fix Fatal error: Class ‘Reporter’ not found during Twitter crawl 9.12 1.3 - 24 Feb 2013 • Upgrade Twitter plugin to Twitter API 1.1 • Don’t link user’s email address in the status bar • During upgrade, include cURL error number in error message and fix misleading URL linkification • Improve installation SSL detection • Fix scale on Twitter Post types Dashboard chart • Check for writable session path during installation 9.9. 2.0-beta.2 - 24 Jan 2013 189 ThinkUp Documentation, Release 2.0-beta.10 9.13 1.2.1 - 28 Dec 2012 • Fixed bug where the account activation email message’s URL was missing the site root path on installation. • Fixed PHP error when fetching cached insight which was not yet precached. 9.14 1.2 - 26 Dec 2012 New feature: • During December and January, display a “Your Most Popular Tweets of 2012” module on the Twitter dashboard. View previous years’ most popular tweets by adjusting the value of the y= URL parameter. Bugfixes: • Facebook plugin: When adding a Facebook page, fix “avatar cannot be null” database error message. • Facebook plugin: Restore missing URL in expired token email message when crawler is run via cron or at the command line. • Facebook plugin: Restore “Pages you manage” in the pages dropdown. • Foursquare plugin: Restore missing or broken Foursquare user and venue icon images. • Foursquare plugin: Update Foursquare’s “Create an app” link in settings area. • Google+ plugin: Avoid “Undefined property” PHP notice during crawl when user has reshared a post without comment. • Page layout/CSS fixes. Minor improvements: • Don’t display Register link on login page if registration is closed. • Autofocus the email field on login page. • Facebook plugin: When Facebook’s authorization tokens expire, send an email notification once a week rather than once per crawl. • Add Post API date range calls for user_mentions, user_questions, user_replies, and post_replies. • Improve application messaging. 9.15 1.1.1 - 12 Sept 2012 • Fix “Incorrect table name” MySQL error during upgrades from version 1.0.8 on MySQL versions lower than 5.1.6. • Fix “Illegal offset type” PHP warning during Twitter crawl. • Activate Foursquare plugin by default on installation. 9.16 1.1 - 10 Sept 2012 • New feature! The Foursquare plugin captures checkins, photos, and comments. The dashboard includes a map of last week’s checkins, the rate of checkins by hour over the last week compared to all time, pie charts of the 190 Chapter 9. Changelog ThinkUp Documentation, Release 2.0-beta.10 types of places you check into, and a list of checkins on this day in years past. You can also export your checkins to a CSV file. • New Twitter, Facebook, Google+ “Time Machine” dashboard module: Posts published on this day in years past. • Bugfix: Fixed installation URL in Facebook reauthorization email notification text. • Bugfix: Check if service user is marked as public in ThinkUp before displaying individual post page data. • Bugfix: Improved error message when Twitter API endpoint is unreachable. • Bugfix: All DAO queries function when MySQL strict mode is enabled (no more “General error: 1364 Field ‘x’ doesn’t have a default value” message). • Bugfix: Fixed several bugs which resulted in PHP notices and errors. Developers: • All MySQL tables are now fully commented. • Moved DAO files into dedicated folder. • Added Polygon and Point support to FixtureBuilder library. • Added Travis PHP 5.4 testing in addition to PHP 5.2 and 5.3. • Fixed bug in the Plugin Maker which called deprecated code. • Several code style fixes; added missing DAO profiler calls. 9.17 1.0.8 - 5 Jul 2012 Changelog: • Optimization: Speed up dashboard rendering by caching results of chart queries in database during data capture • Expand URLs plugin: Prevent endless 302 redirect loops (which causes “Error starting crawler; another crawl is already in progress” message) • Expand URLs plugin: Don’t require both Flickr and Bitly API keys to save settings • Facebook Plugin: Alert user when Facebook’s tokens have expired via email and on the dashboard • Facebook Plugin: Update application setup instructions to match Facebook’s UI changes • Twitter plugin: Accommodate localhost installations in Twitter’s OAuth callback URL • Optimize images using pullcrusher Note: This release started storing the data displayed in dashboard charts like Response Rates, Clickthrough Rates, Followers by Day and Followers by Week, etc, during data capture. Therefore, when you first upgrade ThinkUp, these charts may appear blank. In order to restore them, run a data capture. 9.17.1 1.0.8.1 This bugfix-bugfix restores dashboard charts for Facebook and Google+ service users. 9.17. 1.0.8 - 5 Jul 2012 191 ThinkUp Documentation, Release 2.0-beta.10 9.18 1.0.7 - 7 Jun 2012 Changelog: • Twitter plugin: Fixed “error_text cannot be null” error during data capture • Facebook plugin: Restore “Pages You Manage” to page dropdown • Facebook plugin: Fixed bug in settings where site link included the 443 port when it shouldn’t • Fix broken image path references in jQuery CSS • Fix JavaScript error which broke dashboard charts when there wasn’t enough data • Updated Google+ icon to current red version 9.19 1.0.6 - 7 May 2012 Changelog: • Fixed bug that caused “Save Settings” button in plugin settings area to not save settings. 9.20 1.0.5 - 4 May 2012 Changelog: • Bugfix: Restore Export link on Facebook and Google+ All Posts list • Bugfix: Fix missing Followers and Post Types and Client Usage charts on the dashboard • Bugfix: Avoid file_exists basedir restriction error in init.php • Bugfix: On the Twitter Plugin setting screen, when the hostname is localhost, show 127.0.0.1 instead for Twitter.com compatibility • Bugfix: During Expand URLs capture, correctly handle relative redirects • Bugfix: During Google+ crawl, avoid Property of non-object PHP warning when object is not set • Bugfix: Remove unnecessary CSS, tweak look of buttons and alerts, fix unstyled views and buttons • Bugfix: Make web upgrader code compatible with PHPFog server restrictions • Improve commenting and default settings in sample config file • Rename status bar’s “Update Now” button to “Capture Data” • Developer bugfix: Make all test data files Windows compatible Note: This release fixed a bug in the Expand URLs plugin which incorrectly marked some short URLs as invalid. To force ThinkUp to retry expanding these URLs correctly, in your ThinkUp database run the following SQL: UPDATE tu_links SET error=” where error = ‘Invalid URL - relocates to nowhere’ 9.21 1.0.4 - 25 Mar 2012 Changelog: 192 Chapter 9. Changelog ThinkUp Documentation, Release 2.0-beta.10 • New feature: Ability to upgrade ThinkUp’s application code to its latest version in-app • New feature: Ability to opt into a beta channel for testers to preview new features before their stable release • Bugfix: Convert Google image charts to interactive charts for null value interpolation on line charts and dynamic rollovers • Bugfix: Avoid PHP Notice during Bitly link crawl • Bugfix: Restore Google+ post search • Bugfix: Avoid Database error while saving post errors • Bugfix: Avoid PHP Fatal Error during user data export • Bugfix: Don’t assume default database table prefix during short link processing • Bugfix: During installation, re-enable user ability to touch empty config file and proceed through installation • Bugfix: Restore Twitter app name and Facebook URL in plugin setup pages when they’re not configured • Bugfix: Update views using old design elements • Bugfix: Correctly obtain Facebook link final redirect destinations • Bugfix: Correct outdated instructions for obtaining a Google Maps API key for the Geoencoder plugin • Bugfix: Gracefully handle URLs which expand to empty strings in Expand URLs plugin • Bugfix: Add instructions on how to get clickthrough rates in Expand URLs 9.22 1.0.3 - 27 Feb 2012 Changelog: • Bugfix: Restore RSS feed crawl functionality. • Dashboard reorganization: Rename “Recent Activity” chart to “Response Rates.” Move “This Week’s Most Discerning Followers” further up the page. Remove “Hot Posts” module. • New feature: Preserve intermediate short links in a links_short table. For example, if a t.co link shortens a bit.ly link, the application saves both versions, instead of discarding the intermediary bit.ly version. • Bugfix/New chart: Reliably acquire click counts for bit.ly links. Display “Clickthrough Rates” chart on dashboard. Provide data structure and code for acquiring click stats from goo.gl and when Twitter makes the API available, t.co. • Bugfix: On Google+ Response Rates chart, scale horizontal bars correctly and display # of shares in addition to +1s and replies. • Bugfix: Avoid Undefined variable follower_count_dao PHP Notice during Facebook crawl. • Bugfix: Improve Twitter REST crawler efficiency and ensure no task is ever beyond the API call budget. • Fix typos, add documentation. 9.23 1.0.2 - 13 Feb 2012 Changelog: • Don’t assume application is installed in a folder called “thinkup” • Avoid Undefined index PHP notices in Facebook and Google+ crawlers 9.22. 1.0.3 - 27 Feb 2012 193 ThinkUp Documentation, Release 2.0-beta.10 • On new version notification, link to upgrade docs instead of to GitHub 9.24 1.0.1 - 09 Feb 2012 ThinkUp 1.0.1 is primarily a bugfix and developer release. Note: This release moved the location of ThinkUp’s writable data directory. As a result, when you upgrade you may receive the message “Oops! ThinkUp is unable to run because of incorrect folder permissions.” Follow the instructions to make the new data directory writable. Then, ensure you have deleted the old directory, _lib/view/compiled_view/ Changelog: • Interface improvement: In user registration and installation forms, validate user password (and repeat entry) as the user types with JavaScript widget instead of expecting user to submit the form and wait to get told if the password is not strong or long enough • Security improvement: Make writable directory configurable in config.inc.php’s datadir_path value for environments with stricter security settings like orchestra.io. Documentation: http://thinkupapp.com/docs/install/advancedconfig.html • Bugfix: Avoid “Cannot redeclare class OAuthException” fatal error in Twitter plugin • Bugfix: Fix Tweet button markup on post detail page which potentially broke page design for posts with certain characters in them • Bugfix: When saving plugin options using Internet Explorer 8, avoid “Please complete all required fields” error • Bugfix: Return the correct search results for posts and avoid Uncaught TypeError in JavaScript console • Bugfix: Avoid fatal error “Argument 2 passed to OwnerInstanceMySQLDAO::doesOwnerHaveAccessToInstance must be an instance of Instance, null given” when a username has an apostrophe in it • Bugfix: In Post API requests, return links associated with posts, respect both originating network AND ThinkUp’s user privacy setting, and don’t return blank JSON for Facebook data requests • Bugfix: More accurately extract user mentions from tweet text and store in mentions table during REST crawl • Bugfix: Detect and display application URL correctly when running on a non-standard port • Bugfix: Defensively avoid PHP Notice Undefined index/property errors during crawl in Facebook, Google+, and GeoEncoder plugins • Bugfix: In Twitter plugin Who You Follow view, rename “Deadbeats” to “Quietest” • Bugfix: In Twitter plugin settings, suggest an app name that’s more likely to be globally unique/server-specific, instead of just “ThinkUp” • Bugfix: Standardize date format on Group membership and Follower count Google charts to Jan 08 and Jan ‘12 • Bugfix: Prevent some instances from never being crawled by setting crawl process to run on instances on a per-owner basis • Bugfix: Remove unused app_title value in config.inc.php and replace it with app_title_prefix, which can be set and is now consistently used across page titles and email notifications. For example, to name your ThinkUp installation “My Awesome ThinkUp”, set app_title_prefix = “My Awesome ”. By default, it is an empty string. Documentation: http://thinkupapp.com/docs/install/advancedconfig.html • Bugfix: In Twitter plugin’s JSON parsing, use id_str rather than numeric type to avoid bad post ID’s from getting inserted into DB. (This function is currently used only by the FSMI, not the Twitter crawler by default.) 194 Chapter 9. Changelog ThinkUp Documentation, Release 2.0-beta.10 • Bugfix: In Twitter Realtime plugin, avoid timezone not set error • Developer tool: Plugin maker auto-stubs out all necessary plugin code. http://thinkupapp.com/docs/contribute/developers/plugins/buildplugin.html Documentation: • Developer improvement: Escape markup and JS in user info/error/success messages by default to avoid inadvertent bad injections & encourage restricting markup to view template • Developer improvement: Speed up unit test run bogged down by looping DNS resolution connection to a nonexistent host in PDODAO test • Developer improvement: Explicitly cast SimpleXML elements to primitive types when parsing Twitter XML from API • Developer improvement: Don’t assume the default database table prefix or working directory location in all unit tests • Developer improvement: Consolidate logic to generate app URL into a single function and remove redundant THINKUP_BASE_URL global variable • Developer improvement: Add ability to load extlib classes in Loader without using awkward require_once statement • Documentation: Fixed typos and broken links in user interface, added documentation, restyled documentation using Twitter Bootstrap 9.25 1.0 - 15 Nov 2011 ThinkUp is officially out of beta, with support for Twitter, Facebook, and Google+. Changes since beta 17 (our release candidate): • Extensive cosmetic adjustments and fixes, including Internet Explorer 8 compatibility • Added Tweet and +1 button to post detail page, under reply count • Fixed copy to clipboard button bug which added unnecessary whitespace on the clipboard • Collapsed “Embed This Thread” module into a link to show/hide it • Fixed X-axis of Follower and List count by week charts 9.26 Beta 0.17 - 08 Nov 2011 New features: • Completely redesigned application interface • Collapsed Dashboard sidebar menu into high level categories • Twitter Plugin: Added “This Week’s Most Discerning Followers” module on Followers page • Twitter Plugin: Capture and chart Twitter list membership totals (on Followers page) • Facebook Plugin: Capture Facebook wall posts from other users (Posts -> Posts On Your Wall) • Facebook Plugin: Add pages you manage (in addition to pages you “like”) to Add Facebook Page dropdown • Added ability for admins to “Promote” and “Demote” other ThinkUp users to administrators • Made post reply search available to non-logged in users 9.25. 1.0 - 15 Nov 2011 195 ThinkUp Documentation, Release 2.0-beta.10 Improvements: • Improved ThinkUp’s password policy (8 characters, alphanumeric) • Collapse plugin setup details once the plugin is successfully configured • Database Upgrader: Auto-detect database size and advise users backing up or upgrading large databases to use the command line option • Database Upgrader: Improved database upgrade process to avoid “table not found” error on DROP TABLE statements • Set MySQL timezone when possible to better handle Daylight Saving time • Redirect to application front page on login to avoid form resubmission prompt on refresh • Various user interface improvements (copy to clipboard buttons, better plugin setup instructions, simplified copy, standardized terminology) • Google+ Plugin: “Access not configured” and “undefined property” bugs fixed • Twitter Plugin: Tweets with multiple links in them no longer show up twice in post listings • Twitter Plugin: Update all Twitter username links to use Web Intents • Facebook Plugin: Fixed bug when adding a Facebook account from a ThinkUp installation running on https • Added ability to opt out of usage reporting (Settings > Application) 9.27 Beta 0.16 - 06 Oct 2011 New features: • Google + plugin: Capture the last 25 public posts for an authorized Google account, chart reply and +1 totals • Facebook plugin: Capture backposts, chart friend/page liker count over time, capture friend and page liker details • Dashboard: See hot posts at the top of the page (replaced most recent posts) Improvements: • Database upgrader: Track what migrations have run and which haven’t so in the event of a timeout, the upgrade process can resume and retry only the migrations which have not run • Facebook plugin: Optimize crawl for busy pages and profiles to use fewer API requests and get more data, added max crawl time option to end very lengthy crawls • Recent Activity chart: Replace post dates with post text to clearly see what posts have what totals • Settings->Plugin listing: Display alerts next to plugins missing required settings • Plugin settings page: Standardized layout, removed extraneous copy, added help links, set fields to the width of expected value • Smarter installation: Added more thorough system requirement checks, skip step 1 to reduce clicks when reqs are met • Twitter plugin: Added per-function API call budgeting for better failsafes in the event of greedy process • Follower Count charts: Switched to bar charts to see daily/weekly/monthly totals more clearly • Twitter plugin: Detect “MT”-style retweets • Image thumbnail support: Added Lockerz to list of detected image sources 196 Chapter 9. Changelog ThinkUp Documentation, Release 2.0-beta.10 • Facebook plugin: Removed API key setting field, which is no longer used by Facebook • Add Application-wide setting to see verbose crawler log on Update Now page • Move crawl RSS URL and cron command to Settings->Account page, added copy to clipboard button • Simplify “Switch user” dropdown: Reduce number of clicks to switch user from 3 to 2 • Improve crawl logging for Facebook and Twitter 9.28 Beta 0.15 - 30 Aug 2011 New features: • Capture Facebook media: Store and display Facebook post links titles, images, descriptions, and captions • Capture Facebook “likes”: Store and display Facebook post “likes” and sort posts by most-liked, this week and all time • Capture Facebook friends’ location (when permitted) so that the Geoencoder plugin can plot Facebook replies on a Google Map • Add “Recent Activity” dashboard chart: A post-by-post bar chart of replies and likes/retweets Improvements: • Upgrade Facebook plugin to OAuth 2.0 for more secure authorization flow • Improve login security: Enable database-stored per-user password salt (instead of hard-coded single salt) • Improve t.co support: The ExpandURLs plugin gracefully handles multiple-shortened URLs, like a t.co link which shortens a bit.ly or instagr.am link • On a fresh installation, enable the Twitter, Facebook, and Expand URLs plugins by default • Add configurable “cache_lifetime” value to the config.inc.php file to reduce database load on busy installations • Sped up dashboard render time by aggressively caching query output to file Fixes: • Smartly remove deleted tweets from ThinkUp’s datastore • Reduce failures during database upgrade process • Fix broken links to service user pages & restored post listings there • Fix missing image thumbnails for t.co-shortened image links • Fix RSS feed link for email addresses with a + sign in them • Fix broken Facebook post export • Simplified and consolidated Twitter dashboard menu • Fixed bug where locked user account didn’t get unlocked on password reset • Fix in-post HTML entities display bug (in an “I <3 NY” tweet, <3 displays as <3) • Various CSS/page layout fixes 9.28. Beta 0.15 - 30 Aug 2011 197 ThinkUp Documentation, Release 2.0-beta.10 9.29 Beta 0.14 - 09 Aug 2011 New Features: • Added missing pagination from user and post listings • Added ability to reset your RSS feed URL’s API key without having to change your ThinkUp password • Added realtime plugin support throughout core app (though not packaging Twitter Realtime with user distribution yet) • Added ability to deal with Twitter username changes gracefully Bugfixes: • Fixed: CSRF bug which prevented users from deleting Facebook accounts • Fixed: “No default value” MySQL errors on certain Windows-based server configurations • Fixed: “No plugin object defined for: pluginname” exception. ThinkUp now automatically deactivates nonexistent plugins if they’re marked as active in the data store • Fixed: Persistent “Updated 15 hours ago” timezone bug • Fixed: doesOwnerHaveAccess() error when you click on a Facebook user name from a reply list Improvements: • Security hardening: Added filter for cross-site scripting code in all data coming from external sources • Improved usability in installation timezone dropdown by adding client TZ auto-detection • Improved Instagr.am image embedding • Improved ExpandURLs process to avoid endless loop-checking malformed links • Improved GeoEncoder plugin settings area usability and documentation • Cleaned up and standardized post presentation across views • Optimized/sped up crawler SQL query for saving instance data • Converted all post publish_dates to UTC • Removed Standalone mentions data listing • Removed “Hello ThinkUp” developer example plugin from user distribution • Added ~3,000 words of application documentation 9.30 Beta 0.13 - 21 June 2011 New features: • In Settings > Application, added ability for an admin to export a given service user’s data for transfer to another ThinkUp installation • SlickGrid: Add notice if search limit of 5000 is reached and ability to override search limit • Added sidebar search input box on post replies page Bugfixes: • Valid invitation codes no longer result in “registration is closed” error • Display more accurate retweet counts (don’t get stuck at 100 ceiling) 198 Chapter 9. Changelog ThinkUp Documentation, Release 2.0-beta.10 • Expand URLs plugin: Extract URLs terminated by commas, periods, or smart-quotes • Prevent not-logged-in dead end during upgrade backup prompt • Fixed offline jQuery external request 404 • SlickGrid: Load all-tweets, all mentions and favorites search grid inline on page instead of popping lightbox • Fixed “Notice: Undefined variable: oid” error when re-adding an authorized Twitter account • Added support for field-level error, info, and success messages on any application page. App no longer displays invitation code success message / changed password success message on every Settings tab. Security hardening: • Added protection against Cross-site request forgery attacks throughout the application. 9.31 Beta 0.12 - 17 May 2011 New: • User invitation system: If registration is closed to the public, an admin can generate a user invitation link good for one user registration • When there’s a new version of ThinkUp available, a notification will appear in the status bar for a logged-in admin • Application setting to disable JSON API access (admins only) • Application setting to set default service user to display when visiting ThinkUp (admin-only) • Full support for servers running https:// • Improved interface for switching service user, running the crawler, and reorganized the settings tabs to make it easier/clearer what does what • Added links to help documentation throughout the application Fixed: • Invalid JSON returned by the Post API • SlickGrid export button no longer opens a new tab • Doesn’t show follower count history milestones unless they’re within 10 days, weeks, or months (i.e., no more “You will reach 1,000 followers in 954 weeks”) • Deprecated the Embed Thread plugin and made it core functionality, with the option to disable it in Settings > Application • Multiple embedded ThinkUp threads on a given web page no longer overwrite each other; Added permalinks to embedded threads • Removed Twitter plugin former friends/followers and not mutual data listings (which didn’t work anyway) IMPORTANT BACKWARD-COMPATIBILITY API CHANGE NOTICE Beta 12 will break any embedded ThinkUp threads from earlier versions. Please update any embed code you’ve published on the web from earlier versions of ThinkUp. 9.31. Beta 0.12 - 17 May 2011 199 ThinkUp Documentation, Release 2.0-beta.10 9.32 Beta 0.11 - 25 April 2011 Bugfix Release Beta 11 is a REQUIRED UPDATE for all installations of ThinkUp prior to April 25. • Fixes a potential information vulnerability in older versions of ThinkUp that could reveal private posts that are stored by the application. • Fixes a PHP Notice on ThinkUp API calls in some server environments and updates API documentation. • Adds Security and Data Privacy documentation. • Fixes bug where Dashboard menu links are incorrect after logout. 9.33 Beta 0.10 - 20 April 2011 New: • Dashboard, post, and user page redesign: Lefthand menu has a new active tab style; users include links to both their profile on the originating service (i.e., Twitter.com) and internal ThinkUp page. The user page is now in the app-wide ThinkUp template. • Post API: ThinkUp’s posts, replies, and retweets are now available in a JSON-based API. See the complete complete Post API documentation. • Top 20 words redesign: On a given post’s page, the top 20 most-frequently mentioned words display by default (you no longer have to click on “Top 20 words” in the menu, which has been removed). The Top 20 words have been redesigned to be more “tappable.” • Twitter Web Intents: Easily reply, retweet, or favorite any tweet you see in ThinkUp, directly from ThinkUp’s interface. More info: http://expertlabs.org/2011/04/twitters-web-intents.html • Sticky dashboard navigation: On multi-account installations, when viewing an individual post, clicking on the Dashboard link you will return you to the current instance (not the most recently updated instance). • Application documentation: Launched official application documentation which developers will submit along with each patch to the project. Eventually these docs will be hosted on thinkupapp.com, but the initial version is available at http://readthedocs.org/docs/thinkup/en/latest/. Background information: http://groups.google.com/group/thinkupapp/browse_thread/thread/aee02b16d968c8ed/656b0849117acd0b • (Developers) Error-level only logging: New config file value, $THINKUP_CFG[’log_verbosity’], lets you set the log to only log errors. Fixed: • Broken link in ThinkUp user activation email. • Inaccurate rendering of the Broadcaster/Conversationalist bar chart on the Dashboard. • Favorites search via SlickGrid. • Google Map display of post replies and retweets: Replies and retweets are no longer cut off on the page. • SlickGrid’s export button: This mostly works; but it’s still an open issue which needs a better solution. You can export posts from SlickGrid’s search results. Currently it opens a new tab; we’re working on making it work within the current tab/window. • Missing Zip library error message in Backup controller: The Backup controller now gracefully handles a server setup without the Zip library installed. • Follows table indexes optimized for faster retrieval. 200 Chapter 9. Changelog ThinkUp Documentation, Release 2.0-beta.10 • CrawlerLockedException on a server with multiple installs but different mutexes: Multiple crawls can now run side-by-side on a server with multiple installations if they talk to different databases. • Fixed “No plugin object defined” error when deactivating a plugin. • SlickGrid search results for Facebook; also added permalinks to both Twitter.com and inside ThinkUp to SlickGrid Twitter results. • Several potential security issues in ThinkUp’s WordPress plugin: Download the latest version at https://github.com/downloads/ginatrapani/ThinkUp/thinkup_for_wordpress_0.8.zip • Renamed Windows-hostile filenames. • Developers: Fixed several test failures; upgraded the testing framework to SimpleTest 1.1 alpha, which lets developers turn on E_STRICT error level reporting for bulletproof coding and testing. • Developers: More tests are now using the FixtureBuilder library instead of raw SQL inserts. 9.34 Beta 0.9 - 17 Mar 2011 9.34.1 Twitter plugin: • Reduced Twitter API 502 errors When you run beta 9, you’ll see a greatly reduced number of red Twitter API 502 errors in your crawler log. Turns out that if you request 200 tweets per Twitter API call, it often times out and issues a 502. Beta 9 only requests 100 tweets per call–which requires more calls, but results in fewer errors. The number of tweets your ThinkUp installation retrieves per API call is now configurable in the Twitter plugin’s Advanced Settings area (though it’s not something you should have to change unless you’re troubleshooting or developing). More info: https://groups.google.com/forum/?pli=1#!topic/twitter-development-talk/_0mDiNCbZ0o • Fixed Follower Count charts where there is missing data If there’s a gap in the follower count data (meaning, your crawler hasn’t run every day the chart represents), those gaps are now reflected properly on the X-axis of the follower count graphs on the Main Dashboard as well as on the Follower Count page. Screenshot: https://skitch.com/ginatrapani/rigsh/ginatrapani-on-twitter-thinkup • Added Follower Count milestones Wondering how long it will take to reach 1,000 followers? 5,000 followers? 100,0000 followers? Beta 9 adds a Follower count “next milestone” message that calculates how long it will take to reach the next level. Here’s a screenshot of that in action: https://skitch.com/ginatrapani/rigar/mathowiesdashboard-thinkup • Corrected Retweet count ceiling at 100 RTs Thanks to Amy, retweet counts are no longer capped at 100; if there are more than 100 retweets for a post, that’s reflected in the UI. • Resolved Twitter favorites crawler problem If you have no favorites or Twitter is reporting an inaccurate number, the crawler handles that more gracefully. • Fixed follower deactivation bug If a follower account has been deactivated, ThinkUp’s crawler doesn’t count that as an error; rather it deactivates the relationship and moves on. 9.34.2 Facebook plugin: • Fixed broken Facebook avatar images • Facebook plugin now pages back to capture all comments on a status update, doesn’t just get 25 9.34. Beta 0.9 - 17 Mar 2011 201 ThinkUp Documentation, Release 2.0-beta.10 9.34.3 Expand URLs plugin: • Folded the Flickr Thumbnails plugin into the Expand URLs plugin You now set your Flickr API key in the Expand URLs settings; the database migration for beta 9 takes care of that for you. https://skitch.com/ginatrapani/rig2n/configure-your-account-thinkup 9.34.4 ThinkUp application: • Simplified the plugins listing Before: https://skitch.com/ginatrapani/rig2a/configure-your-account-thinkup After: https://skitch.com/ginatrapani/rig2c/configure-your-account-thinkup • Improved indexes on tu_follows table to speed up queries Related mailing list thread: http://groups.google.com/group/thinkupapp/browse_thread/thread/78bbafc3e0efb754/738e61a3ad9f6833?hl=en&lnk=gst&q=tu_f • Fixed several broken/out-of-date links and bad markup throughout the app • Fixed base URL calculation logic which generated undefined index errors • Fixed Export to CSV file errors • Improved email and URL validation • Improved installation checks for the PHP and MySQL versions ThinkUp requires • Password reset bugfix • Corrected CSS file source order • SlickGrid reply search is now embedded in-page on a post page • Top 20 words now displays yes/no/maybe http://www.flickr.com/photos/ginatrapani/5413706109/ for polls. Screenshot: 9.34.5 Developer goodies: • The FixtureBuilder library now supports MySQL functions • Tests are now completely PHP 5.2 compatible • Fully deprecated and removed the Database class from tests, everything is PDO/FixtureBuilder-based • Added test environment check which prevents devs from accidentally wiping their TU data • Added nightly test runs to thinkupapp.com server with results emailed to the dev list 9.35 Beta 0.8 - 28 Jan 2011 New: • Top 20 words My absolute favorite new ThinkUp feature is courtesy of Mark Wilkie: on any post that has more than 20 replies, click on the “Top 20 words” link in the sidebar menu. ThinkUp will display a summary of most frequently-used words in a reply set. Click on one to see all the replies which contain the word. Here’s an example of Top 20 words in action: http://smarterware.org/thinkup/post/?t=25077429986&n=twitter Fun fact: This feature includes word stemming capabilities, so words like reply, replies, and replied all get grouped together. It uses the Snowball JavaScript library to do this. Fantastic work, Mark. Next up: phrase frequency, so the reply “Big Bang Theory” gets listed as one item in the example above. 202 Chapter 9. Changelog ThinkUp Documentation, Release 2.0-beta.10 • Embed Thread plugin Copy and paste a bit of JavaScript into any web page to embed a post and set of replies sourced from ThinkUp. Activate the Embed Thread plugin in the Settings > Plugins area. Then click on “Embed Thread” on any post page to get the embed code. This plugin is a work in progress, so give it a try and let us know how it goes. A screenshot: https://skitch.com/ginatrapani/rmkpm/post-details-thinkup • Web-based application-wide settings We’re continuing to move as many ThinkUp settings out of the config.inc.php file and into the database as possible. In ThinkUp’s Settings area, an admin can now click on the Settings tab to open or close the installation’s registration page, and set reCAPTCHA keys as well. Screenshot: https://skitch.com/ginatrapani/rm2tb/configure-your-account-thinkup IMPORTANT NOTE: This setting has registration closed by default on all new installations and upgraded installations. It overrides anything that is currently listed in your config.inc.php file, meaning, it deprecates the $THINKUP_CFG[’is_registration_open’] variable and reCAPTCHA keys set there. If registration is open on your ThinkUp installation right now, after you upgrade to beta 8, you MUST log in as an admin and check this box to explicitly reopen it and transfer your reCAPTCHA keys into the text fields there and save. Apologies for the aggressive change here, but we want everyone’s installation to be closed/more secure by default. • Instagr.am support Thanks to Amy, all new Instagr.am images that the crawler encounters in beta 8 show up as thumbnails inline in ThinkUp’s post listings. • Activate accounts from the web interface Thanks to Randi, if your installation’s new account activation email is getting spammed, you can now log in as an admin and activate new user account by pressing an “Activate” button in the web interface. (You can also deactivate accounts as well.) In Settings, you’ll see this button listed in the “All ThinkUp Accounts” tab. • Command line interface to backups and migrations Thanks to Mark, advanced users with large databases can now back up their ThinkUp installation and run potentially large/slow database migrations at the command line. (For example, one of beta 8’s migrations changes the width of the tu_posts.post_text field; on my 12M row table, this took over an hour.) To use the command line tools, SSH in your server and CD to ThinkUp’s install/cli/ folder. There you can run php backup.php or php upgrade.php. The Upgrade script will show you the total time elapsed at the end of the migration. If the crawler is running when you attempt the migration, the upgrade process will let you know and tell you to try again later when the crawl process is complete. Fixed: • Facebook posts no longer cut off Speaking of database migrations, Facebook posts, which can be up to 420 characters in length, are no longer cut off due to the too-small size of ThinkUp’s post_text field. • Twitter usernames linked correctly Thanks to suth’s ninja regex skills, ThinkUp more accurately links Twitter user names, and doesn’t do things like link a lone @ symbol mid-tweet. • Notification emails less likely to get spammed Thanks to Sam, email notifications from ThinkUp have the correct From: address set (using your web server’s domain name), which makes those messages less likely to get shuttled into the spam folder. • Invalid Google Maps key error When a post is not geoencoded, you will no longer see a JavaScript alert about an invalid Google Maps key error when you click on the Response Map item in the GeoEncoder plugin menu. • Several more little things “ThinkUp is in the process of an upgrade” page no longer gets “stuck” in cache, JavaScript errors in the switch user dropdown have been resolved, the “Your ThinkUp Password” text fields no longer scroll, no more error messages when authorizing a Twitter account, the Copyright notice is now 2011, lists of links (your own and your friends) included the expanded version and now paginate. 9.36 Beta 0.7 - 27 Dec 2010 New: 9.36. Beta 0.7 - 27 Dec 2010 203 ThinkUp Documentation, Release 2.0-beta.10 • Improved login security: To avoid the potential for brute-force password cracking attempts on ThinkUp’s login page, there is now a cap on the number of failed logins. After 10 failed login attempts, a ThinkUp user’s account gets deactivated. To reactivate, the user resets his/her password via email. (Look for more security-focused updates to the system in future releases.) • Better retweet crawling: Thanks to Amy, ThinkUp now captures the total of new-style retweets more accurately, and displays that number plus the number of old-style quoted retweets that ThinkUp detects. • Tweet reply links: Thanks to Sam, you can now easily reply to a given tweet from inside ThinkUp. Rollover any tweet and click on the “Reply” link to autofill Twitter’s update form with the user name and status ID. Screenshot: https://skitch.com/ginatrapani/rga5j/ginatrapani-on-twitter-thinkup • Picplz support: Thanks to Kyle, photos posted on Twitter from http://picplz.com now show up as inline thumbnails in ThinkUp. • Tweet photo thumbnails appear on post page: Speaking of image thumbnails, they now appear on individual post pages like this one: http://smarterware.org/thinkup/post/?t=13426333958807552&n=twitter • Configure number of links to expand per crawler run: Thanks to Sam, you can now set the number of links the Expand URLs plugin attempts per crawler run. This number is 1500 by default and normally won’t need to be changed. But, if your crawls are taking too long or if you’ve got too many links to expand that aren’t happening fast enough, you can now dial it up or down in the web interface. Screenshot: https://skitch.com/ginatrapani/rga5t/configure-your-account-thinkup • Followers/Who You Follow lists updated: Twitter’s Followers/Who You Follow lists have been simplified, and now display some interesting stats like how many multiples of followers a user has versus friends, and the average number of posts that user has published per day since they joined Twitter. Screenshot: https://skitch.com/ginatrapani/rga5a/ginatrapani-on-twitter-thinkup • New (for developers)! Logger debug mode: Thanks to Amy, developers who have debug=true in their config file can write debug statements to the log while developing the crawler. Fixed: • Gradients in design refresh: Thanks to Andy, everyone on every browser sees the new gradients in beta 6’s design refresh as we intended. • Upgrader: Mark fixed a bug that potentially caused problems upgrading to ThinkUp’s latest version from beta 2. We now have automated upgrade tests which run through every single possible upgrade path from beta 1 to beta 7 passing. • Several more little things: Application options have been moved to the generic options table to consolidate our data structure; Update your data links no longer throw a 404; Links to retweet listings from the Dashboard have been corrected; Plugin external libraries are now located in their own extlib folders. 9.37 Beta 0.6 - 13 Dec 2010 New: • Favorite tweets: Thanks to an incredible show of perseverance by Amy who has been shepherding along this branch since April, ThinkUp now captures your favorite tweets (the ones you have starred) and lists them under a new Favorites menu on the main dashboard. If you like to star tweets with links in them for reading later, you can filter your favorites list that way, too. Screenshot: https://skitch.com/ginatrapani/rrs81/ginatrapani-ontwitter-thinkup • Design refresh: Anil made a few design improvements in this release which consolidate the header and status bar, make the sidebar menu easier to see and use, remove lots of borders and other clutter, and make the replies and retweets buttons more button-like. See the new design in action: http://smarterware.org/thinkup/ 204 Chapter 9. Changelog ThinkUp Documentation, Release 2.0-beta.10 Note: there are rough spots and CSS/markup mistakes here; I modified several of Anil’s tweaks so anything that’s broken/weird is probably my fault. As always, we’ll be polishing as we go. CSS mavens, send me pull requests with fixes, please. (Please.) • Reorganized post page: The post detail page now has a sidebar menu just like the dashboard does, a one-stop shop for everything you can do with a post, like export replies, search and filter replies, list retweets, and see responses on a map. Like the dashboard, plugins generate this menu dynamically, which opens the door to conversation-specific visualizations and reply listings. Now that the stage is set for those kinds of plugins, expect to see more items appear in that menu in future releases. Screenshot: https://skitch.com/ginatrapani/rrs85/postdetails-thinkup • Expand/collapse advanced plugin options: A ThinkUp plugin can potentially have several settings, and many of them could have default values that most users don’t need to ever see or change. That’s why we’ve set up the ability to hide “advanced” plugin options to simplify setup. For example, the only options an admin sees by default for the Twitter plugin are the two required values, the rest are nestled away comfortably in a hidden div. Just click “Show Advanced Options” to reveal them. Screenshot: https://skitch.com/ginatrapani/rrs8b/configureyour-account-thinkup Fixed: • Twitter inquiries: Thanks to Andy, tweets which contain URLs that have question marks in them no longer show up in the Inquires list, because they’re not questions. • New developers tools! Developers can now output custom debugging lines while running tests, run an individual test in a given TestCase, and see details of a database access error when they set debug = true in the config.inc.php file. • More little things: Fixed a bug where under certain conditions, a user may not get saved to the database correctly. Fixed a bug where the web-based crawler page’s content-type was not set correctly. Fixed a bug where an instance may not get updated correctly after a crawl completes. Added a link to the IRC channel to the application footer. 9.38 Beta 0.5 - 22 Nov 2010 New: • Human readable crawler log: When you click on the “Update now” link to run the ThinkUp crawler, the activity log you’ll see has been totally revamped. You’ll have an easier time seeing errors, successes, and information about what’s working and what’s not. • Better data integrity: The latest database migration enforces some unique indexes which will make sure your datastore is cleaner and free of duplicate links and posts. (Related mailing list thread: http://groups.google.com/group/thinkupapp/browse_thread/thread/eac7e97f4f81265e) Fixed: • Reduced number of Twitter API errors: The order the ThinkUp crawler gathers your data from the Twitter API has been adjusted in a way that should result in fewer errors and faster data capture. In practice, your friends and followers lists will not stay empty for as long as they have been anymore. (One of several related mailing list threads: http://groups.google.com/group/thinkupapp/browse_thread/thread/cfb9735d6e2ada39/8902e1903b0974ac) • The database upgrader: The upgrader now supports custom table prefixes (Guillaume, you will be the true test of this fix), and it has more understandable messaging about what to do regarding the completion email and after the upgrade is complete. (Related mailing list messages: http://groups.google.com/group/thinkupapp/msg/021fb00f8f51881e http://groups.google.com/group/thinkupapp/msg/9d26ae8574a1b851) 9.38. Beta 0.5 - 22 Nov 2010 205 ThinkUp Documentation, Release 2.0-beta.10 • Expand URLs hanging bug: The ExpandURLsPlugin used to hang indefinitely when it hit a URL that didn’t respond quickly enough, causing some people to have to deactivate the plugin entirely. The timeout has been set so the plugin will move on after a set amount of time correctly now. • A few more little things: The grid search now works with posts which contain Unicode characters, and plugin option errors no longer have the endearing but completely uninformative “Sorry, but we are unable to process your request at this time” message–instead, you get specific details about what’s wrong. (Related mailing list thread: http://groups.google.com/group/thinkupapp/browse_thread/thread/d4455d0344c8dedd) 9.39 Beta 0.4 - 14 Nov 2010 New: • Web-based database upgrader: When you install the new version, you’ll experience the biggest new ThinkUp feature, our web-based database upgrader. Instead of running SQL by hand to update your ThinkUp datastore, the app will walk you through the process step by step, show you what changes it made, and even give you an option to back up your data first. Screenshots here: http://www.flickr.com/photos/ginatrapani/sets/72157625383770504/ This new feature is big and complicated and while we tried our best to test every possible scenario, we’re depending on you to let us know how it goes and report any problems you may have or make any UX suggestions. (Thanks in advance for that.) • Configurable Twitter API error tolerance: The Twitter API serves many fail whales. You can now configure the crawler to tolerate up to a certain number of whales–5 by default, but you can increase or reduce it now in the plugin settings. https://skitch.com/ginatrapani/ryj2n/configure-your-account-thinkup Fixed: • Crawler log updates as-it-runs: The “Update now” page updates in real-time, instead of spinning and spinning until an entire crawler run is complete. • Lots of little things: no more exec() PHP warning, the WordPress plugin instructions and DB calls are fixed, long URLs now wrap correctly, no more bug with deleted accounts because of caching, restored missing cache directory causing permissions error, added automatic tests for installation and upgrade process, ported several tests to the FixtureBuilder library. 9.40 Beta 0.3 - 19 Oct 2010 New: • Delete network accounts: If you’ve added a Twitter or Facebook account you want to delete, there’s now a handy “Delete” button to do so, as shown here: http://skitch.com/ginatrapani/dh8na/delete-accounts • User-selected timezone: When you install ThinkUp fresh, a dropdown of timezones is available for you to choose from, instead of the app just defaulting to America/Los_Angeles. This will fix the infamous “updated thousands of negative seconds ago” bug that appears in the status bar on new installations not located in Southern California. Existing users: you should enter your timezone correctly by hand into your config.inc.php. Warning: the timezone select in the installer is long and scary right now. There is an issue filed (#369) to simplify it. • Installer attempts to create database: When you install ThinkUp fresh, if you enter the name of a database which does not already exist, the installer will attempt to create it with the credentials you enter. Previously it required that the database already existed. Fixed: • Facebook Plugin: Fixed major bugs with new Facebook application setup; you can now authorize your FB account and add pages you like to ThinkUp with the correct permissions. 206 Chapter 9. Changelog ThinkUp Documentation, Release 2.0-beta.10 • E_STRICT warnings: If you’ve got PHP warning set to E_STRICT, ThinkUp no longer triggers warnings while developing. Refactored: • In preparation for Twitter’s new 64-bit “Snowflake” post IDs, we’ve expanded the capacity of ThinkUp’s post ID fields. • Ported several tests to use our FixtureBuilder library instead of raw SQL. The FixtureBuilder lets you create test data very easily and using it throughout our tests instead of straight SQL will enable us to swap in different DB types and test with custom table prefixes later. 9.41 Beta 0.2 - 4 Oct 2010 • Facebook Plugin: I gutted all the old Facebook Connect code and replaced it with shiny new Open Graph code. The account connection experience should be much less bewildering. Give it a try and let me know how it goes, especially all of you who have had trouble in beta 1. Important note for those of you who actually did manage to set up Facebook users and pages successfully: the new plugin requires that you enter the Facebook Application ID, as shown here: http://skitch.com/ginatrapani/d3wu7/configure-your-account-thinkup • Twitter plugin: The Twitter API throws a lot of 500 errors (fail whales). Amy added a plugin option that lets you set how many whales the crawler should tolerate during a given crawl. Also, the crawler will now retry a failed API call instead of just moving onto the next one. Hopefully this will result in more successful Twitter crawls faster. Here’s what the new option looks like: http://skitch.com/ginatrapani/d34x9/configureyour-account-thinkup • Inquiries: See only posts that you’ve asked an actual question in, which often prompts more replies. There’s no fancy natural language processing going on here, so it’s not always perfect, but the new “Inquiries” post listing only displays posts that contain question marks. An example in action: http://smarterware.org/thinkup/index.php%3Fv%3Dtweets-questions%26u%3Dginatrapani%26n%3Dtwitter Beta 2 also contains several minor bugfixes that restore broken links, tweak the design consistency, and remove a significant amount of code that was no longer being used. (This is why the .zip file is smaller than beta 1’s was.) 9.42 Beta 0.1 - 27 Sept 2010 This is the last “drop tables and reinstall” release. From now on, you will be able to upgrade your database smoothly from version to version. The major difference between the last alpha and first beta is the UI interface overhaul discussed here: http://groups.google.com/group/thinkupapp/browse_thread/thread/9f12e013ee2c4751 Otherwise, compared to the 0.008 alpha, beta 0.1 includes a very long laundry list of bugfixes and updates. You can see the complete changelog here: http://github.com/ginatrapani/thinkup/compare/v0.008...v0.1 9.41. Beta 0.2 - 4 Oct 2010 207
© Copyright 2024