WordPress.org

Forums

125

Alex King's Share-This (136 posts)

  1. zaque
    Member
    Posted 8 years ago #

    I've tried installing the plugin, but I can't seem to get past a javascript error:

    Error: akst_share is not defined
    Source File: javascript:void(akst_share('22'));
    Line: 1

    Prototype is where it should be...however, I don't think the plugin is injecting the proper head statements to make the plugin work.

  2. icd10
    Member
    Posted 8 years ago #

    Do you have an url?

  3. Alex King
    Member
    Posted 8 years ago #

    Let me ask you to run through some standard debugging steps, then we can better identify where the problem is and fix it:

    It's a good idea to do the following:

    1. deactivate all other plugins
    2. activate a copy of the default theme
    3. enable the plugin with the copy of the default theme

    If the plugin works properly on the default theme with no other plugins enabled, then it is likely mis-behaving on your site due to a conflict with your theme or other plugins you have enabled.

    Enable your plugins again, one by one, and see if their activation creates the breakage.

    If all works with the plugins enabled, then the problem is likely in the theme itself.

  4. zaque
    Member
    Posted 8 years ago #

    oh yeah. sorry. This is the url. Click on any post, scroll down to the bottom of the post and click the "share this" link.

  5. piginzen
    Member
    Posted 8 years ago #

    All my links look like this:

    http://furl.net/storeIt.jsp?u=undefined&t==undefined

    Also, when you Email This, the page reads:
    OK
    The document has moved here.

    Apache/1.3.37 Server at http://www.------.com/com Port 80

    Is this normal? Or is is supposed to go to the home page automatically?

    I've been waiting for this plugin for a long while! I appreciate all your efforts in this!

    Way to go! Alex, you write the most useful plugins...

    Thanks!

  6. JeffA
    Member
    Posted 8 years ago #

    I am having the same error with the undefined url.

  7. ulyssesr
    Member
    Posted 8 years ago #

    First of all, thanks to Alex for the plugin.

    Second, when I use email-this, I'm getting the same thing the gentleman above is experiencing. I get this message:

    OK
    The document has moved here.

    I tried looking at code, but I can't figure it out.

    My URL is http://ulyssesonline.com

    Any help is appreciated. Thanks.

  8. vkaryl
    Member
    Posted 8 years ago #

    Alex has been by to reply, so it's probable that he's looking into the problem....

  9. Alex King
    Member
    Posted 8 years ago #

    I've not seen anyone yet report going through the debugging steps I took the time to outline above. I don't think it's unreasonable to ask for a little legwork to get some from me in return. :)

    Share This expects there to be proper IDs on post title elements, as in the default theme:

    h2 id="post-2484"...

    This is likely the reason for the 'undefined' errors.

    The wp_head and wp_footer calls also need to be present in the theme (I think I noted the wp_footer one in the README, but at least one person here seems to be missing wp_head as well).

    Perhaps this is an unreasonable expectation of themes to include these calls and the IDs in a standard way. However, it is how Share This is currently written, so I guess you've got a choice of "fixing" your theme or "fixing" the plugin to get it working.

  10. cesaracardoso
    Member
    Posted 8 years ago #

    Only to second: got the same problem as pigizen and JeffA. Send-by-email works.

  11. lstelie
    Member
    Posted 8 years ago #

    Hello,

    Firefox and Safari (on Mac OS X) throw an error on line :

    var url = encodeURIComponent($('post-' + id).firstChild.href);

    The error is : $('post-' + id) has no properties

    It seems to be a strange javascript problem because the javascript links shows a id number....
    Its like id was not propagated in the js function.

    As I'm french the "share this" text is translated to "Partager ce texte (ou cette vidéo) ne fonctionne pas encore"

    In case you wonder the problem is the same with the original english file.

    Luc (see here)

  12. JeffA
    Member
    Posted 8 years ago #

    I have tried disabling everything and it is still not working right. I can't figure it out. I do know that I have a theme and another plug-in that use prototype.js but they store the javascript in their own folders, which is a bad idea. It is creating quite the chaos.

  13. lstelie
    Member
    Posted 8 years ago #

    Hllo,

    I discover a source of problem for the thmes.

    The main entry div must have id="post-<?php the_ID(); ?>"
    it was not the case with simpla thm I'm using and it's the reason why the js failed.

    Now I have the infamous "document moved here" problem when using email (but it works) but social link have an empty url value (undefined)

  14. lstelie
    Member
    Posted 8 years ago #

    Hello guys,

    I found the problem source for the social links.

    Each post must have at the H level of th title :

    id="post-<?php the_ID(); ?>"

    The problem lies in the templates.

    Some doen't use a id="post-<?php the_ID(); ?>" at all
    Some use it in the surrounding div.

    In fact each post must be of the form :


    <div....
    <h2(or whatever value) id="post-<?php the_ID(); ?>">
    <a href="<?php the_permalink() ?>"
    rel="bookmark"
    title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?>
    </a>
    </h2>
    This doesn't solve the <em> document moved </em> problem but social links now work.

  15. JeffA
    Member
    Posted 8 years ago #

    Excellent, thanks Luc, one down one to go!

  16. Alex King
    Member
    Posted 8 years ago #

    I can't reproduce the "document moved" problem on a clean 2.0.5 install (and it doesn't happen on my site) - can you when you go through the debugging steps?

  17. Richard5
    Member
    Posted 8 years ago #

    Hi, new problem, I added the post_Id to the theme and get the following error using Firefox 2 on Mac OSX:

    Error: $("akst_delicious") has no properties
    Source File: http://test.richard5.net/wp-content/plugins/share-this/share-this.php?akst_action=js
    Line: 8

    You can see it in action on my development blog: test.richard5.net

    Don't quite understand the why yet...

  18. Alex King
    Member
    Posted 8 years ago #

    Richard5 - see the README, you may need to add the wp_footer call to your theme. This is also noted in my previous post.

  19. Richard5
    Member
    Posted 8 years ago #

    Alex, thanks for pointing out this very silly mistake !
    It now works perfectly and will install it on my production site. Thanks !

  20. jewishhigh
    Member
    Posted 8 years ago #

    Alex, great plugin!

    I had the same problem, but Luc up there helped me out. Now it all works fine except for the 'Digg' submit button which send the URL like this 'http%3A%2F%2Fwww' instead of like this 'http://www'

    Anyone else come across this?

  21. lstelie
    Member
    Posted 8 years ago #

    hello,

    The "document moved here" seems related to the plug in status inside WP install.

    I tried with a test php page containing the email lines ending by the header command, and it works

    inside the plug in the server retruns a 200K document moved, I failed to find why.

  22. harl
    Member
    Posted 8 years ago #

    Unfortunately, even after following lstelie's hints, the plugin doesn't work for me.

    I got a wp_head() and wp_footer() call and disabled every single plugin (except akismet). Even with the default theme it's not working.

    I also tried changing the AKST_ADDTOCONTENT and AKST_ADDTOFOOTER from "true" to "false".

    My Blog is at http://www.marsmenschen.com/blog/
    user/pass htaccess: wordpress/baustelle

    Could anyone please have a look?

    Thanks in advance!

    PS.: At least "send via email" works for me ;-)

  23. lstelie
    Member
    Posted 8 years ago #

    Harl

    Have a lok at the code your wp produces.

    You have twice post-id

    for example :

    <div class="post" id="post-53">
    <h2 id="post-53">

    In your template delete the id (or change its name) in <div class="post"

    Javascript is confused by these two id (and by the way I think it's not standard)

    Hope this helps

  24. harl
    Member
    Posted 8 years ago #

    Hello again ;-)

    Thanks for your advice, but still no luck for me.

    I changed the the source:

    <div class="post">

    <h2 id="post-<?php the_ID(); ?>">
    <a>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
    </h2>

    The end result looks like expected:

    <div class="post">

    <h2 id="post-53">
    <a href="http://www.marsmenschen.com/blog/index.php/2006/11/13/free-java-a-reality-2/" rel="bookmark" title="Permanent Link to Free Java a reality">Free Java a reality</a>
    </h2>

    Any clues?

    EDIT: Changed in Plugin

    @define('AKST_ADDTOCONTENT', true);
    @define('AKST_ADDTOFOOTER', true);

    and set Theme to wordpress default, still not working.

  25. lstelie
    Member
    Posted 8 years ago #

    Harl

    This can't work wih default theme. I had a look at your page and it is :

    <div class="post" id="post-53">
    <h2>

    This plug in relies (for the social links part) on the fact the theme has an post-id value in the title tag.

    In your case your page must be
    <div class="post">
    <h2 id="post-53">

    Its because line 137 - 138

    var url = encodeURIComponent($('post-' + id).firstChild.href);
    var title = encodeURIComponent($('post-' + id).firstChild.innerHTML);

    The plug in javascript calculates the url and the title as javascript dom elements of the page elements which id is 'post-thevalue'

  26. harl
    Member
    Posted 8 years ago #

    Thanks for the explanation, got that now ;-)

    I switched back to the 'orange' theme for my tests. According to your explanation, this should be working, but isn't:

    <div class="post">

    <h2 id="post-53">
    <a href="http://www.marsmenschen.com/blog/index.php/2006/11/13/free-java-a-reality-2/" rel="bookmark" title="Permanent Link to Free Java a reality">Free Java a reality</a>
    </h2>

  27. lstelie
    Member
    Posted 8 years ago #

    Harl

    Sorry it was the only solution I had :-(

    For the document moved problem, WP seems prone to that :

    http://comox.textdrive.com/pipermail/wp-hackers/2006-September/008695.html

    or

    http://wordpress.org/support/topic/77094?replies=1

  28. lstelie
    Member
    Posted 8 years ago #

    DON'T DO THIS, SEE BELOW, THIS IS THE CAUSE, NOT THE SOUTION

    Hello all,

    a temporary solution (hacking core files cant' be a definitive solution) for the infamous 200 ok document moved here syndrom

    1- open wp-includes/classes.php

    2- look for the following function line 1706 :

    function handle_404() {
    global $wp_query;
    // Issue a 404 if a permalink request doesn't match any posts. Don't
    // issue a 404 if one was already issued, if the request was a search,
    // or if the request was a regular query string request rather than a
    // permalink request.
    if ( (0 == count($wp_query->posts)) && !is_404() && !is_search() && ( $this->did_permalink || (!empty($_SERVER['QUERY_STRING']) && (false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) {
    $wp_query->set_404();
    status_header( 404 );
    nocache_headers();
    } elseif( is_404() != true ) {
    status_header( 200 );
    }
    }

    3 in the function locate the ligne :
    status_header( 200 );

    4- comment it

    It works..

    Luc

  29. lstelie
    Member
    Posted 8 years ago #

    Better solution !!!

    DON'T TOUCH CORE FILE (as I wrote just before) this is EVIL, BAD, BAD, BAD :-)

    In share-this.php (near line 379) search :

    header("Location: $url");
    die();
    break;

    and add

    header("Location: $url");
    status_header('302'); // => ADD THIS
    die();
    break;

    I might work, if it doesn't eat you cat

    Luc

  30. harl
    Member
    Posted 8 years ago #

    lstelie,

    is http://demo.ifelse.co.uk/index.php?wptheme=Simpla the theme you are using? I think if i get the plugin work with 'simpla', it would definitely help ;-)

    Thanks a lot for your efforts!

125

Topic Closed

This topic has been closed to new replies.

About this Topic