The MU forums have moved to WordPress.org

WordPress MU Flickr Photo Album (25 posts)

  1. AttenOke
    Member
    Posted 16 years ago #

    I am wondering if it is at all possible to use the WordPress FLickr Photo Album in WordPress MU... and if so how...

    You'll have to bear with me as WordPress MU is very very new for me (having come over from LifeType).

    Thanks for any help...

  2. andrea_r
    Moderator
    Posted 16 years ago #

    Did you try it?

    If it's a regular WP plugin, sometimes it'll work right off the bat in MU. You just have to try and see. When/if you get erros, *then* we can be more helpful. :D

  3. AttenOke
    Member
    Posted 16 years ago #

    I did try it yes... however when its set up with say my account... all other users also automatically have it set up for my account.

    It seems it is only possible to have one account set up and that one account is used for everyone in MU.

    Thats what I'm wondering about the difficult of changing???

  4. dsader
    Member
    Posted 16 years ago #

    I use http://www.tantannoodles.com/toolkit/photo-album/.

    Every user has separate options in the database. Each user must have their own API key.

    Use it as a user plugin NOT mu-plugin.

    It plays poorly with inline-uploading.

    Only the admin can "flush" the cache.

  5. AttenOke
    Member
    Posted 16 years ago #

    Now I'm confused. That is the exact plugin I tried earlier...

    So it IS possible to have it work within WordPress MU, and if so how did you set it up to enable MU support?

    When I installed it (following the instructions) I was able to set it up with an API key for a single user. If I then logged out and logged into another account, it was automatically set up with the same API key.

    Lead me to believe that only a single user was able to use this plugin at any given time?

  6. dsader
    Member
    Posted 16 years ago #

    I'll clarify. I use photo album plugin out of the box. Dropped it into plugins, that's all to install. I hacked nothing and it worked. It does not automagically enable my Flickr account on a new blog or user, even a new blog of mine.

    API and Secret is stored in wp_#_options tables tied to each blog. Multiple blogs don't share the same wp_#_options tables. I looked, there are zillions of "silas_flickr" rows in wp_#_options tables. There is no way for two blogs to have same silas_flickr options unless I type them in.

    Logging into a blog that has the API key enabled, every user in that blog will see Flickr admin enabled.

    However, log into a completely different blog. Flickr must be reconfigured.

    One user could have a separate API key in each of his blogs.

    In my WPMU, I have a user with 9 different blogs, four have flickr enabled, three with unique API and secret.

  7. AttenOke
    Member
    Posted 16 years ago #

    Ok I got it to work... have no clue what I did last time but it seems to be working perfect now.

    Except for one thing... I think its completely unrelated but I have no clue why this would happen. When I go to the created link for my album in Firefox it works perfect, the exact same url in IE reports a page not found.

    Any thoughts???

  8. dsader
    Member
    Posted 16 years ago #

    Empty cache in IE. or Force a page reload.

  9. AttenOke
    Member
    Posted 16 years ago #

    This works for me occasionally...

    However it seems intermitant. This plugin works at ALL times in Firefox, however from IE it seems to only work occasionally and randomly. When it doesn't I recieve a 404 page not found error.

    On those occasions that it doesn't work forcing a refresh several times will eventually cause the page to appear.

    This is the case from multiple machines...

  10. dsader
    Member
    Posted 16 years ago #

    Server/Proxy/Firewall caching, too?

  11. dsader
    Member
    Posted 16 years ago #

    UPDATE for wpmu1.0(latest)

    Will NOT work "out of the box". Mu doesn't use "inline-uploading.php" the same way anymore.

    Solution:
    Make a copy of mu's new "upload.php" files and drop into flickr folder.
    Several edits later, it will work. I'll share mine if interested.

  12. kprimdal
    Member
    Posted 16 years ago #

    dsader:

    Could you please share yours ? I can get it working and since you will be so kind there is no reason for me to continu editing.

  13. kprimdal
    Member
    Posted 16 years ago #

    And it is upload.php i mean, everythings els is working.

  14. deltakid
    Member
    Posted 16 years ago #

    just change the require_once statements that they match with the inline-uploading.php

    thats the upper part that got to be changed in your copied upload.php

    if (!defined('ABSPATH')) define('ABSPATH', dirname(__FILE__).'/../../../../');
    require_once(dirname(__FILE__).'/../../../../wp-admin/admin.php');

    @header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));

    if (!current_user_can('upload_files'))
    wp_die(__('You do not have permission to upload files.'));

    wp_reset_vars(array('action', 'tab', 'from_tab', 'style', 'post_id', 'ID', 'paged', 'post_title', 'post_content', 'delete'));

    require_once(dirname(__FILE__).'/../../../../wp-admin/upload-functions.php');

  15. dsader
    Member
    Posted 16 years ago #

    I added //Silas Partners
    function wp_upload_tab_photos() {
    include(dirname(__FILE__).'/inline-photos.php');
    include(dirname(__FILE__).'/inline-photos.html');
    }
    to upload-functions.php as well.

    and here's upload.php

    <?php
    // this file is just a copy of the standard wordpress upload.php, since there are no action hooks to modify this file's behavior

    // Silas Partners
    if (!defined('ABSPATH')) define('ABSPATH', '/your/domain/public_html/blog/');
    require_once('/your/domain/public_html/blog/wp-admin/admin.php');
    //

    @header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));

    if (!current_user_can('upload_files'))
    wp_die(__('You do not have permission to upload files.'));

    wp_reset_vars(array('action', 'tab', 'from_tab', 'style', 'post_id', 'ID', 'paged', 'post_title', 'post_content', 'delete'));

    require_once('upload-functions.php');
    if ( !$tab )
    $tab = 'browse-all';

    do_action( "upload_files_$tab" );

    add_action( 'admin_head', 'wp_upload_admin_head' );

    $pid = 0;
    if ( $post_id < 0 )
    $pid = $post_id;
    elseif ( get_post( $post_id ) )
    $pid = $post_id;
    $wp_upload_tabs = array();
    $all_atts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment'");
    $post_atts = 0;

    if ( $pid ) {
    // 0 => tab display name, 1 => required cap, 2 => function that produces tab content, 3 => total number objects OR array(total, objects per page), 4 => add_query_args
    $wp_upload_tabs['upload'] = array(__('Upload'), 'upload_files', 'wp_upload_tab_upload', 0);
    if ( $all_atts && $post_atts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = '$post_id'") )
    $wp_upload_tabs['browse'] = array(__('Browse'), 'upload_files', "wp_upload_tab_browse", $action ? 0 : $post_atts);
    if ( $post_atts < $all_atts )

    $wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse', $action ? 0 : $all_atts);
    } else
    $wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse', $action ? 0 : $all_atts);
    //Silas Partners
    $wp_upload_tabs['attwrap left'] = array(__('Flickr Photos'), 'upload_files', 'wp_upload_tab_photos', $action ? 0 : $all_atts);

    $wp_upload_tabs = array_merge($wp_upload_tabs, apply_filters( 'wp_upload_tabs', array() ));

    if ( !function_exists($wp_upload_tabs[$tab][2]) ) {
    $to_tab = isset($wp_upload_tabs['upload']) ? 'upload' : 'browse-all';
    wp_redirect( add_query_arg( 'tab', $to_tab ) );
    exit;
    }

    foreach ( $wp_upload_tabs as $t => $tab_array ) {
    if ( !current_user_can( $tab_array[1] ) ) {
    unset($wp_upload_tabs[$t]);
    if ( $tab == $t )
    wp_die(__("You are not allowed to be here"));
    }
    }

    if ( 'inline' == $style ) : ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    <head>
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
    <title><?php bloginfo('name') ?> › <?php _e('Uploads'); ?> — WordPress</title>
    <link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" />
    <?php if ( ('rtl' == $wp_locale->text_direction) ) : ?>
    <link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/rtl.css?version=<?php bloginfo('version'); ?>" type="text/css" />
    <?php endif; ?>
    <script type="text/javascript">
    //<![CDATA[
    function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
    //]]>
    </script>
    <script type="text/javascript">

    // <![CDATA[

    /* Define any variables we'll need, such as alternate URLs. */

    <?php echo $script; ?>

    function htmldecode(st) {

    o = document.getElementById('htmldecode');

    if (! o) {

    o = document.createElement("A");

    o.id = "htmldecode"

    }

    o.innerHTML = st;

    r = o.innerHTML;

    return r;

    }

    function cancelUpload() {

    o = document.getElementById('uploadForm');

    o.method = 'GET';

    o.action.value = 'view';

    o.submit();

    }

    function doPopup(i) {

    if ( popup )

    popup.style.display = 'none';

    target = document.getElementById('target'+i);

    popup = document.getElementById('popup'+i);

    popup.style.left = (target.offsetLeft) + 'px';

    popup.style.top = (target.offsetTop) + 'px';

    popup.style.display = 'block';

    }

    popup = false;

    function selectLink(n) {

    o=document.getElementById('div'+n);

    if ( typeof document.body.createTextRange == 'undefined' || typeof win.tinyMCE == 'undefined' || win.tinyMCE.configs.length < 1 )

    return;

    r = document.body.createTextRange();

    if ( typeof r != 'undefined' ) {

    r.moveToElementText(o);

    r.select();

    }

    }

    function toggleLink(n) {

    ol=document.getElementById('L'+n);

    if ( ol.innerHTML == htmldecode(notlinked) ) {

    ol.innerHTML = linkedtoimage;

    } else if ( ol.innerHTML == htmldecode(linkedtoimage) ) {

    ol.innerHTML = linkedtopage;

    } else {

    ol.innerHTML = notlinked;

    }

    updateImage(n);

    }

    function toggleOtherLink(n) {

    ol=document.getElementById('L'+n);

    if ( ol.innerHTML == htmldecode(linkedtofile) ) {

    ol.innerHTML = linkedtopage;

    } else {

    ol.innerHTML = linkedtofile;

    }

    updateOtherIcon(n);

    }

    function toggleImage(n) {

    oi = document.getElementById('I'+n);

    if ( oi.innerHTML == htmldecode(usingthumbnail) ) {

    oi.innerHTML = usingoriginal;

    } else {

    oi.innerHTML = usingthumbnail;

    }

    updateImage(n);

    }

    function toggleOtherIcon(n) {

    od = document.getElementById('div'+n);

    oi = document.getElementById('I'+n);

    if ( oi.innerHTML == htmldecode(usingtitle) ) {

    oi.innerHTML = usingfilename;

    od.className = 'otherwrap usingtext';

    } else if ( oi.innerHTML == htmldecode(usingfilename) && icon[n] != '' ) {

    oi.innerHTML = usingicon;

    od.className = 'otherwrap usingicon';

    } else {

    oi.innerHTML = usingtitle;

    od.className = 'otherwrap usingtext';

    }

    updateOtherIcon(n);

    }

    function updateImage(n) {

    od=document.getElementById('div'+n);

    ol=document.getElementById('L'+n);

    oi=document.getElementById('I'+n);

    if ( oi.innerHTML == htmldecode(usingthumbnail) ) {

    img = imga[n];

    } else {

    img = imgb[n];

    }

    if ( ol.innerHTML == htmldecode(linkedtoimage) ) {

    od.innerHTML = ab[n]+img+'';

    } else if ( ol.innerHTML == htmldecode(linkedtopage) ) {

    od.innerHTML = aa[n]+img+'';

    } else {

    od.innerHTML = img;

    }

    }

    function updateOtherIcon(n) {

    od=document.getElementById('div'+n);

    ol=document.getElementById('L'+n);

    oi=document.getElementById('I'+n);

    if ( oi.innerHTML == htmldecode(usingfilename) ) {

    txt = filename[n];

    } else if ( oi.innerHTML == htmldecode(usingicon) ) {

    txt = icon[n];

    } else {

    txt = title[n];

    }

    if ( ol.innerHTML == htmldecode(linkedtofile) ) {

    od.innerHTML = ab[n]+txt+'';

    } else if ( ol.innerHTML == htmldecode(linkedtopage) ) {

    od.innerHTML = aa[n]+txt+'';

    } else {

    od.innerHTML = txt;

    }

    }

    var win = window.opener ? window.opener : window.dialogArguments;

    if (!win) win = top;

    tinyMCE = win.tinyMCE;

    richedit = ( typeof tinyMCE == 'object' && tinyMCE.configs.length > 0 );

    function sendToEditor(n) {

    o = document.getElementById('div'+n);

    h = o.innerHTML.replace(new RegExp('^\\s*(.*?)\\s*$', ''), '$1'); // Trim

    h = h.replace(new RegExp(' (class|title|width|height|id|onclick|onmousedown)=([^\'"][^ ]*)( |/|>)', 'g'), ' $1="$2"$3'); // Enclose attribs in quotes

    h = h.replace(new RegExp(' (width|height)=".*?"', 'g'), ''); // Drop size constraints

    h = h.replace(new RegExp(' on(click|mousedown)="[^"]*"', 'g'), ''); // Drop menu events

    h = h.replace(new RegExp('<(/?)A', 'g'), '<$1a'); // Lowercase tagnames

    h = h.replace(new RegExp('<IMG', 'g'), '<img'); // Lowercase again

    h = h.replace(new RegExp('(<img .+?")>', 'g'), '$1 />'); // XHTML

    if ( richedit )

    win.tinyMCE.execCommand('mceInsertContent', false, h);

    else

    win.edInsertContent(win.edCanvas, h);

    }

    // ]]>

    </script>
    <?php do_action('admin_print_scripts'); wp_upload_admin_head(); ?>
    </head>
    <body>
    <?php
    else :
    echo "<div class='wrap'>";
    endif;

    echo "<ul id='upload-menu'>\n";
    foreach ( $wp_upload_tabs as $t => $tab_array ) { // We've already done the current_user_can check
    $class = 'upload-tab';
    $href = add_query_arg( array('tab' => $t, 'ID' => '', 'action' => '', 'paged' => '') );
    if ( isset($tab_array[4]) && is_array($tab_array[4]) )
    add_query_arg( $tab_array[4], $href );
    $_href = wp_specialchars( $href, 1 );
    $page_links = '';
    if ( $tab == $t ) {
    $class .= ' current';
    if ( $tab_array[3] ) {
    if ( is_array($tab_array[3]) ) {
    $total = $tab_array[3][0];
    $per = $tab_array[3][1];
    } else {
    $total = $tab_array[3];
    $per = 10;
    }
    $page_links = paginate_links( array(
    'base' => add_query_arg( 'paged', '%#%' ),
    'format' => '',
    'total' => ceil($total / $per),
    'current' => $paged ? $paged : 1,
    'prev_text' => '«',
    'next_text' => '»'
    ));
    if ( $page_links )
    $page_links = "<span id='current-tab-nav'>: $page_links</span>";

    }
    }

    echo "\t<li class='$class alignleft'><div>{$tab_array[0]}$page_links</div>\n";
    }
    unset($t, $tab_array, $href, $_href, $page_links, $total, $per, $class);
    echo "\n\n";

    echo "<div id='upload-content' class='$tab'>\n";

    call_user_func( $wp_upload_tabs[$tab][2] );

    echo "</div>\n";

    if ( 'inline' != $style ) :
    echo "<div class='clear'></div>";?>

    <?php echo "</div>";
    else : ?>
    <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
    </html>
    <?php endif; ?>

  16. kprimdal
    Member
    Posted 16 years ago #

    I still can't get i working. After trying both of yours modif.

    When i upload upload.php to flick directory and copy/paste what deltakid says the normal upload bar is there, like nothing els was installed.

    When i try doing hvad dsader write there is also something wrong have maked a screenshot off it:

    http://www.kprimdal.dk/photo.JPG

  17. wccw75
    Member
    Posted 16 years ago #

    that is what i'm getting as well. still need some work out to do. would love to have this plugin running.

  18. dsader
    Member
    Posted 16 years ago #

    Ah yes, I forget about the scroll bars on my FlickrUpload.

    Compare this from my end of upload-functions.php to the original

    "flickerized":
    if ( 'inline' == @$_GET['style'] ) {
    echo "<style type='text/css'>\n";
    echo "\tbody { height: 15em; }\n";
    echo "\t#upload-content { overflow-y: auto; }\n";
    echo "\t#upload-file { position: absolute; }\n";
    echo "</style>";

    "Original":
    if ( 'inline' == @$_GET['style'] ) {
    echo "<style type='text/css'>\n";
    echo "\tbody { height: 15em; overflow: hidden; }\n";
    echo "\t#upload-content { overflow-y: auto; }\n";
    echo "\t#upload-file { position: absolute; }\n";
    echo "</style>";

    Sorry, I forgot.

  19. SteveAtty
    Member
    Posted 15 years ago #

    Is this actually working for anyone on the latest version of MU?

    Failing that can anyone recommend a plugin for Flickr that works with MU?

  20. andrea_r
    Moderator
    Posted 15 years ago #

    the flickr post bar works with MU.

  21. lunabyte
    Member
    Posted 15 years ago #

    Yeah, that's what I use. Well, the whole plugin instead of just the bar. It DID need some tweaking, but I couldn't tell you off the top of my head everything I had to change.

    I do remember it was in the DB department, and disk cache as well. (Both for the plugin).

  22. andrea_r
    Moderator
    Posted 15 years ago #

    I thought it might have needed soem tweaking, but it was so far back I installed it, plus I'm not on my usual computer (with a backup) and you KNOW my memory ain't what it used ta be.(which wasn't that great in the first place) ;)

  23. SteveAtty
    Member
    Posted 15 years ago #

    I've got the flickr post bar working (I used the copy andrea_r has for download) and I suspect I might stick with that for the time being and maybe add the full flickr album plugin at a later date.

  24. andrea_r
    Moderator
    Posted 15 years ago #

    I hate to dig up an old thread...

    but I'm having spotty issues with this not finding some users. Oddly enough, when I go to flickr and search for the user, it can't find it anywhere. Even if I use the info from their photostream in another tab (so clearly, I am looking at them on Flickr)

    Anyone else have this issue?

  25. isatzky
    Member
    Posted 15 years ago #

About this Topic

  • Started 16 years ago by AttenOke
  • Latest reply from isatzky