aboutsummaryrefslogtreecommitdiff
path: root/actions/flickrSetup.php
diff options
context:
space:
mode:
authorGreg Froese <greg.froese@gmail.com>2009-10-08 04:38:19 +0000
committerGreg Froese <greg.froese@gmail.com>2009-10-08 04:38:19 +0000
commit24f3f2f0d304254451c46a3b28a8e1f4678bc02f (patch)
treec95dc02130267e6c2d7053faf7546089c1c744b1 /actions/flickrSetup.php
parent6b00bdba17af611726eb950fb51758556694e80f (diff)
downloadelgg-24f3f2f0d304254451c46a3b28a8e1f4678bc02f.tar.gz
elgg-24f3f2f0d304254451c46a3b28a8e1f4678bc02f.tar.bz2
flickr integration
Diffstat (limited to 'actions/flickrSetup.php')
-rw-r--r--actions/flickrSetup.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/actions/flickrSetup.php b/actions/flickrSetup.php
new file mode 100644
index 000000000..e272ee141
--- /dev/null
+++ b/actions/flickrSetup.php
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Setup the user's flickr username and store it
+ */
+require_once dirname(dirname(__FILE__)) . "/lib/phpFlickr/phpFlickr.php";
+$f = new phpFlickr("26b2abba37182aca62fe0eb2c7782050");
+
+$flickr_username = get_input( "flickr_username" );
+$return_url = get_input( "return_url" );
+$user = get_loggedin_user();
+
+if( empty( $flickr_username )) {
+ register_error( "You must enter a username" );
+ forward( $return_url );
+ die; //just in case
+} else {
+ $flickr_user = $f->people_findByUsername( $flickr_username );
+ if( !empty( $flickr_user["id"] )) {
+ create_metadata( $user->guid, "flickr_username", $flickr_username, "text", $user->guid, ACCESS_PUBLIC );
+ create_metadata( $user->guid, "flickr_id", $flickr_user["id"], "text", $user->guid, ACCESS_PUBLIC );
+
+ system_message( "Successfully saved Flickr username of $flickr_username" );
+ system_message( "flickr user id: $flickr_user[id]" );
+ } else {
+ register_error( "Username $flickr_username not found on Flickr" );
+ }
+}
+
+forward($_SERVER['HTTP_REFERER']);
+//echo "<pre>"; var_dump( array($flickr_username, $return_url )); echo "</pre>";
+
+?> \ No newline at end of file