FG Joomla to WordPress
[resolved] Some improvements (5 posts)

  1. elCHAVALdelaWEB
    Posted 3 years ago #

    I have made some changes in your plugin code so now it supports:
    * WordPress 3.0 version,
    * Attachments files download with cURL and no with copy, because in some servers in is does not work.
    * PHP 5.1 support - because error_get_last function does not exist before PHP 5.2

    I think you can include these changes into the code of plugin.

    replace this code:
    copy($old_filename, $new_filename)
    download($old_filename, $new_filename)
    Insert this functions in any part of your plugin:

    if (!function_exists('error_get_last')) {
    	function error_get_last(){
    		$__error_get_last_retval__ = array(
    			'type'        => 'simulated',
    			'message'       => 'simulated',
    			'file'        => 'simulated',
    			'line'        => 'simulated'
    		return $__error_get_last_retval__;
    function download($url,$path){
    	$fp = fopen($path, 'w');
    	$ch = curl_init($url);
    	curl_setopt($ch, CURLOPT_FILE, $fp);
    	$return = curl_exec($ch);
    	return $return;
    if (!function_exists('set_post_thumbnail')){
    	function set_post_thumbnail( $post, $thumbnail_id ) {
    		$post = get_post( $post );
    		$thumbnail_id = absint( $thumbnail_id );
    		if ( $post && $thumbnail_id && get_post( $thumbnail_id ) ) {
    			$thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' );
    			if ( ! empty( $thumbnail_html ) ) {
    				return update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id );
    		return false;


  2. Kerfred
    Plugin Author

    Posted 3 years ago #

    Thank you very much.
    I have included your changes in version 1.8.0.

  3. elCHAVALdelaWEB
    Posted 3 years ago #

    I glad that I can help !

  4. Kerfred
    Plugin Author

    Posted 3 years ago #

    For information, in version 1.8.2, I have used the WordPress HTTP API instead of the curl call to improve the media files download.

  5. elCHAVALdelaWEB
    Posted 3 years ago #

    I think this is even better ! I have never used it but I need to read something about.
    Also in error_get_last function I put "simlated" just to put something - if you want it to work propertly - you will need to simulate this function like this: http://www.php.net/manual/es/function.error-get-last.php#103539
    This example does not worked for me and I have had no time to search solution so I desided to put some random text.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • FG Joomla to WordPress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic