WordPress.org

Ready to get started?Download WordPress

Forums

Use as featured image link not working (33 posts)

  1. zagriyen
    Member
    Posted 3 years ago #

    in my post edit page, the "Use as featured image" link in "Set featured image" popup don't work,
    in firebug i get an error message :

    WPSetAsThumbnail is not defined
    onclick(event=click clientX=386, clientY=247)
    [Break On This Error] WPSetAsThumbnail("351", "2a280539a5");

  2. wphelpcenter
    Member
    Posted 3 years ago #

    Have you tried disabling your plugins (and possibly switching to the default theme)? It's possible that one of your plugins or themes is throwing another JavaScript error which is taking out the rest of the JavaScript on the page.

  3. zagriyen
    Member
    Posted 3 years ago #

    yes i tried disabling all plugins, re-upload the wordpress package, and back to the default theme :(
    the " use as featured image " link don't work

  4. infolock
    Member
    Posted 3 years ago #

    Confirmed. This is also happening to me (all plugins are disabled). (wordpress version 3.0.1)

  5. infolock
    Member
    Posted 3 years ago #

    So, I fixed the issue. The issue is that, in the media.php file (/wp-admin/includes/media.php), this is where Set as Featured Image function is being called. For whatever reason, WordPress cannot find the file that houses this function (it's located in /wp-admin/js/set-post-thumbnail.js).

    In order to just make this work, I updated the function get_media_item. There is an if block that looks like this:

    if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) {

    Inside this block, there is a variable called $thumbnail that sets the actual text/action of Set As Featured. I prefixed the definition of the variable to manually load the js file we need. IE, the update looks like this

    $thumbnail = "<script type=\"text/javascript\" src=\"/includes/wordpress/wp-admin/js/set-post-thumbnail.js\"></script><a class='wp-post-thumbnail' id='wp-post-thumbnail-" . $attachment_id . "' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\", \"$ajax_nonce\");return false;'>" . esc_html__( "Use as featured image" ) . "</a>";

    and now boom, it works.

  6. cardan
    Member
    Posted 3 years ago #

    @infolock: thank you for providing a solution. I am having the same problem and will try your solution right after this.

    Just to isolate the problem, when did this problem started to occur for you guys (infolog and zagriyen)? Mine was after I installed and activated bulletproof security plugin, hypercache and db-reloaded plugins. I was also do some backups but I really don't think that was it.

  7. crazywhistlepig
    Member
    Posted 3 years ago #

    I believe this is caused by the Bulletproof Security plugin. I removed the .htaccess in the root directory created by Bulletproof Security and returned the default WordPress .htaccess and all works fine. BTW, this was also breaking the YAPB (Yet Another Photoblog) post thumbmails in the "List Posts" table. This also returned to normal after restoring the original WordPress .htaccess.

  8. cardan
    Member
    Posted 3 years ago #

    @ crazywhistlepig: I thought it was Buletproof Security plugin as well, and I believe we both are right. I made another thread about this, you might want to check that out, especially my second post.

    http://wordpress.org/support/topic/plugin-bulletproof-security-a-possible-bug-on-wordpress-featured-image?replies=2

    I don't know if it is applicable to YAPB, but it works for thumbnail.

  9. infolock
    Member
    Posted 3 years ago #

    Cardan: I'm not really sure when it happened. I know I tried disabling every single plugin, but it did not help, which leads me to believe it happens (as you say happens with Buletproof) after installation. So disabling doesn't do anything since it already caused the damage.

    With that being said, I'm also not sure how many other features of WordPress (if any) are affected by this.

    Btw, did my solution work for you?

    Just to clarify (since my first message seems a bit misleading), the media.php file is in /wp-admin/media.php. This file calls the function get_media_item() which is in /wp-admin/includes/media.php. The line I changed (in my file anyways) was line 1294..

    Hope this helps.

  10. crazywhistlepig
    Member
    Posted 3 years ago #

    @infolock Bulletproof security leaves behind the .htaccess file even after disabling/removing the plugin. Yeah I wouldn't hack WordPress core files to achieve the solution. I'd just remove the bulletproof .htaccess and replace it with an .htaccess generated by WordPress. I'm assuming that either the wordpress core files (media.php) contain poorly written javascript that looks to bulletproof security like XSS, or bulletproof security contains poorly written .htaccess directives which break the Javascript. Either way I think the solution lies with one of them or using @cardan's method of commenting out each line of the BPS .htaccess until solved. Hopefully someone from WordPress or Bulletproof Security sees this thread and offers a final solution.

    Anyone try this out on WordPress 3.03 to see if it's been addressed?

  11. cardan
    Member
    Posted 3 years ago #

    @infolock: Unfortunately it wasn't work for me. Like crazywhistlepig said, Bulletproof security leaves behind .htaccess file, so if (and I am 99% sure) this was the problem for me, then I guess hacking the core wont change anything. Due to the nature of this problem (and of course, this is the public forum) let's just say Bulletproof security disabled user to change a certain file. While I am sure this is done in a good intention, it is also preventing user to change / use featured image.

    @crazywhistlepig: About a week ago, one of my problem is user (Author) can make changes and use other Authors' images (not text-posts) because they can access the same gallery. I managed to hide the "Gallery" featured in Author level, and **maybe** this is the last update is all about. I mean, it should be obvious isn't it? If an author can't even access other Author's text-post, why should they be able to access other's image?

    But, as I said, I have removed the gallery altogether before the update so.. although I have upgraded to the last version, I won't fix what's not broken hahaha.. When I have the time I would try to remove the code and see if 3.0.3 "fix" this issue, shouldn't take so long, but for now, I'll leave my code.

  12. cardan
    Member
    Posted 3 years ago #

    because they can access the same gallery

    *Media Library

  13. AITpro
    Member
    Posted 3 years ago #

    Yep came across this thread in my travels and will have a solution once I fully understand all the specifics that caused the problem. So far it appears the a simple solution would just be to add an htaccess skip rule for just the media.php file, which would just skip all the BPS filters if the media.php file is called. The issue of Admin vs Author roles is a new issue altogether so this interests me very much. Like I said I still need more details before I can make a final determination of what the best solution would be - I have some details and waiting on some more before I can make a full assessment of why the problem is occurring and then apply the best solution. I typically go searching for any posted comments outside of my website every 2-4 weeks. Answering comments and questions posted on my site takes priority of course. Thanks.
    Regards,
    Ed

  14. AITpro
    Member
    Posted 3 years ago #

    Also i see that there is an issue with YAPB Yet Another Photoblog plugin displaying images. I will create a skip rule for this plugin and test to make sure it works and post that here after testing is completed. A similar issue also exists with WordPress Themes using timthumb.php. A skip rule exists in the secure.htaccess file, but for whatever reason it does not work on every Theme - 50/50 depends on the Theme. There is a workaround fix for now until i can add a permanent solution that will work for 100/100. And actually it is not a matter of poor coding as far as i can tell. It just appears to be one of those things. Also htaccess directives are very straightforward / literal so it's just a matter of having the exactly correct rules for any particular website. I'm actually pretty amazed that with the thousands of Theme variations and other factors that BPS works right out of the box in about 99% of all cases. ;) I expected something more along the lines of 80% and then additional tweaking being required per site. Thanks.
    Ed

  15. AITpro
    Member
    Posted 3 years ago #

    YAPB htaccess permanent fix. htaccess filters skip the entire plugin folder. YAPB uses the phpThumb thumbnailing library, which is similar to timthumb. This htaccess skip rule skips applying filters to any files associated with the YAPB plugin. Tested working both in Admin on the post edit page the image is diplayed and on the post itself.

    # YAPB phpThumb image fix
    # If you have WordPress installed in a subfolder you will need to add the
    # subfolder name to the RewriteCond /blog/wp-content/plugins/yet-another-photoblog/ [NC]
    RewriteCond %{REQUEST_URI} ^/wp-content/plugins/yet-another-photoblog/ [NC]
    RewriteRule . - [S=15]

    Still waiting on more info for the media.php Author issue.
    Regards,
    Ed

  16. AITpro
    Member
    Posted 3 years ago #

    The featured image upload issue in Author Role turned out to be another problem altogether with actual ISP connectivity. The set-post-thumbnail.js jQuery script was not completing due to a connectivity problem. In general BPS should not affect WP Roles whatsoever because BPS is operating at the server root level via htaccess.
    Regards,
    Ed

  17. psheld
    Member
    Posted 3 years ago #

    Hi AITpro, I have the featured image upload problem (as in it won't work) running Neutica+ on top of Thematic with BPS. You write:

    So far it appears the a simple solution would just be to add an htaccess skip rule for just the media.php file, which would just skip all the BPS filters if the media.php file is called.

    ... except for .htaccess newbies like me it's not so simple :-)

    Could I trouble you for some quick instructions? Thanks in advance.

  18. AITpro
    Member
    Posted 3 years ago #

    Hi,
    The media.php skip thing was a mistake - i was tired at the time. So disregard that entirely. Now BPS may interfere with displaying images - one problem in that past was with timthumb, but a permanent fix has been included in BPS .45.8 for that. BPS should not interfere with image uploading whatsoever so I don't think it's BPS. To rule BPS out completely activate Default Mode for your Root folder and then see what happens. Default Mode is a basic generic WordPress .htaccess file. Image upload problems are commonly connectivity problems or corrupted cache problems. So clear your browser cache, clear your caching plugin cache and check your connection speed. Also it looks like this Theme works with IE, but just to be totally sure use FireFox to try an image upload. Since the Neutica+ child theme for Thematic is not free i am unable to take it for a test run. Thanks.

  19. psheld
    Member
    Posted 3 years ago #

    Thanks AITpro,
    Just activated Default Mode as you suggested, and I still can't assign a featured image. So guess BPS isn't the cause. I'll pop back here when I've found out what's causing it.

    BTW, I take it @crazywhistlepig saying:

    Bulletproof security leaves behind the .htaccess file even after disabling/removing the plugin

    isn't the case when I've activated Default Mode.

    Thanks again.

  20. AITpro
    Member
    Posted 3 years ago #

    No prob. Yeah I didn't think BPS was the problem on this one. BPS Default Mode is just activating a generic WordPress .htaccess file without any security filters, which only does a basic Rewrite and nothing else - no security and no filters. The filters are what can cause a conflict with a plugin.

    The way BPS .45.8 works is that when you activate a particular mode, a master file is copied and renamed from the BPS master htaccess folder to whatever folder you are activating the mode for. It's an overwrite deal. So whatever .htaccess file was there before is overwritten each time you activate a mode. Yep uninstalling or disabling BPS has no effect on the "active" .htaccess files. This is totally intentional because in Beta Testing we had both versions under testing. A complete uninstaller version and the version that survived beta testing to become BPS. What happened with the uninstaller version is 9 times out of 10 the test websites ended up being "down" mainly because no htaccess file existed at all any more, which equals 500 Errors. An htaccess file swap would be a very simple thing to code, but the problem is the variety of WordPress scenarios involved. So for now manually modifying the Root htaccess file using the built-in File Editor is the best way to ensure that a root htaccess file exists and is correct. Thanks.

  21. psheld
    Member
    Posted 3 years ago #

    Disabling other plugins makes no difference, and I was able to assign featured images previously, right up until I installed BPS.

    Here's something else a bit suspicious, making me reconsider .htaccess as the cause. I've been able to delete plugins before, but I've just tried now and I get this error for the very first time:

    403 Permission Denied
    You do not have permission for this request /wp-admin/plugins.php?

    This is after activating BPS Default Mode and then deactivating BPS. So just downloaded the .htaccess for the website in question (at /public_html/thesite) and found that it is indeed "# BULLETPROOF .45.8 >>>>>>> DEFAULT .HTACCESS".

    So the evidence strongly suggests that BPS caused the problem, given nothing else has changed bar adding some new editors, but I can't see how. Odder and odderer!

  22. AITpro
    Member
    Posted 3 years ago #

    hmm i wonder if the wp-admin .htaccess file filters are causing a problem somehow with this Theme. I don't think that is the issue. Is your WordPress installation in your Root folder or is WordPress intalled in a subfolder (ie /my-blog)? Try this. Delete the .htaccess file that is in your wp-admin folder. Activate default mode then go to the WordPress Settings Panel and update your Permalinks. You are using a custom permalink structure i assume? If not you should be. This will write to Your Current Root htaccess file. Now go back to BPS and take a look at the File Editor and look at Your Current Root htaccess file. You will see the .htaccess code that WordPress wrote to your active root .htaccess file. Now one thing that can block you from being able to delete plugins is if somehow the wp-admin .htaccess file has a "BEGIN WordPress...." Rewrite section of code in it. All that should be in that file is just the filters. Post the code that WordPress generates after you update your custom permalink structure. If you are not using a custom permalink structure then i recommend using either of these 2 below -
    /%post_id%/%postname%/
    or
    /%year%/%postname%/

    Also you didn't mention that you had tried to restore your original backed up .htaccess files. So that would also be another way to see if they are different from what you see with the BPS master files ie the RewriteBase is different...
    Thanks.

  23. psheld
    Member
    Posted 3 years ago #

    First, to answer your questions:

    1. My WordPress instance runs at an add-on domain in a folder called public-html/mywordpressTLD. Not sure then whether one considers this to be the root or subfolder
    2. I am indeed using a customer permalink structure, and simply reselected the same and saved

    So, a BIG THANK YOU. I followed your instructions (the main instructions, not the restore backup option mentioned towards the end of your comment) and problem solved. I can now delete plugins and assign featured images.

    FYI, the Your Current Root htaccess file does have a section as you describe. Specifically, the only part not commented out with hash / pound sign is:

    Options -Indexes
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    AITpro, thanks again for your help. If I can help you in anyway ascertain what went wrong here, please get in touch (philipsheldrake.com) or we can continue here. And perhaps I won't try implementing BPS again until we know what happened.

  24. AITpro
    Member
    Posted 3 years ago #

    Ok your add-on domain is aliased to your primary domain account then for your primary web hosting account so it is a Root installation - ie SiteA and SiteB are 2 different unique sites under one hosting plan. Not to be confused with a domain alias where SiteA and SiteB are the same site, but have two different names. Now if you had WordPress installed in a subfolder of that aliased domain >>> public-html/mywordpressTLD/my-blog >>> it would then be a subfolder WordPress site. ;)

    So it appears that one or more of the filters in BPS are not playing nice with that particular Theme then. There were a couple of Themes that had conflicts at one point or another with BPS, but they have all been resolved. I will contact the Theme author and see if he / she is willing to release a copy of the Theme to me for testing purposes. Also i will make a note on my plugin / Theme testing and conflicts page that this is the only WordPress Theme that does not work with BPS - pending testing confirmation.

    Just be aware that you website does not have any security protection at this point. If i were you i would at least try and add the SQL Injection filter manually. This is the most common attack method used. Out of well over 300,000 documented BPS hacking attempts about 270,000 of those are using SQL Injection hacking methods and are successfully blocked by the BPS SQL Injection filter.

    RewriteCond %{QUERY_STRING} ^.*(execute|exec|sp_executesql|request|select|insert|union|declare|drop|delete|create|alter|update|order|char|set|cast|convert|meta|script|truncate).* [NC]
    RewriteRule ^(.*)$ - [F,L]
  25. cscott5288
    Member
    Posted 3 years ago #

    I have had the same problem. Just after installing BPS I can't insert a featured image or delete plugins. I'm using a custom theme that I built myself.

    I really love the plugin AIT and want to use it. Have you found a workaround yet?

    Thanks!

  26. AITpro
    Member
    Posted 3 years ago #

    Hi,
    Have you set up your custom permalink structure yet? I would need more info in order to troubleshoot your particular issue further. Please post a comment on the AITpro site with your website URL so i can take a look at your source code. Thanks

  27. drinkliverpool
    Member
    Posted 3 years ago #

    I've got a similar problem, after selecting the Featured Image, instead of being able to see the image on the bottom right of the edit post page, all I see is -1 (minus one).

    I can add featured images no problem to sub-sites thought, just not this parent site.

  28. AITpro
    Member
    Posted 3 years ago #

    Hi,
    For anyone who has image issues with BPS I need to know a few things to figure out what the problem is. If you are using an image Thumbnailer then info can be found on the AITpro site regarding that known issue. email me at edward[at]ait-pro[dot]com with:
    1. Your website URL
    2. Your Theme name just in case it is not obvious from viewing your site.
    3. Folder where WordPress is installed in case it is not obvious from viewing your site.
    4. Your custom permalink structure just in case.

    Thanks,
    Ed

  29. chumtarou
    Member
    Posted 3 years ago #

    Hi Ed,

    I have am now experiencing this as well with installations that use the Featured Image function. Unfortunately, I've had to remove BPS for the time being to work around this and would be great to know if there is a way to keep BPS on all sites.

    I'll send you the web url by email in a moment.

    Thanks!

  30. benzingtech
    Member
    Posted 3 years ago #

    I Changed:

    RewriteCond %{QUERY_STRING} ^.*(execute|exec|sp_executesql|request|select|insert|union|declare|drop|delete|create|alter|update|order|char|set|cast|convert|meta|script|truncate).* [NC]

    To:

    RewriteCond %{QUERY_STRING} ^.*(execute|exec|sp_executesql|request|insert|union|declare|drop|delete|create|alter|update|order|char|set|cast|convert|meta|script|truncate).* [NC]

    Which I only removed the select from the condition and it now works perfectly. yay!

Topic Closed

This topic has been closed to new replies.

About this Topic