trouble with the add form advert
-
Hello,
I can’t add an advert any more since 10 days.When I click on “preview “, The script loops and nothing happens. Then I have the following message :
The page you are looking for is temporarily unavailable.
Please try again later.
52c2381281b1e0c6cb94cb32fbf2bfb9 5d2910425059acb18ad114a5eaf76a50 5bd2ad6f3c07d705d563c3b8f7af5538The page I need help with: [log in to see the link]
-
1. what WPAdverts version are you using?
2. the last page you see most likely generated an error which was saved in the error_log file on your server, can you check it (or ask your hosting tech support to do that) and paste it here?
Alternatively, you can try opening file wp-config.php adding there line
define( "WP_DEBUG", true );
and try posting Ad again the error should show on screen when the page will finish loading.Here is the errors messages !
concerning the page https://www.info-collection.fr/poster-une-annonce.htmlDeprecated: Function create_function() is deprecated in /homepages/0/d364303345/htdocs/wp-content/plugins/LayerSlider/wp/widgets.php on line 4
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Genio_Adsense_Widget has a deprecated constructor in /homepages/0/d364303345/htdocs/wp-content/plugins/genio-adsense-widget/genio-adsense-widget.php on line 16
Deprecated: Function create_function() is deprecated in /homepages/0/d364303345/htdocs/wp-content/plugins/revslider/includes/framework/functions-wordpress.class.php on line 258
Notice: La méthode du constructeur appelée pour WP_Widget dans Genio_Adsense_Widget est obsolète depuis la version 4.3.0 ! Utilisez
__construct()
à la place. in /homepages/0/d364303345/htdocs/wp-includes/functions.php on line 3951Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /homepages/0/d364303345/htdocs/wp-content/plugins/js_composer/include/classes/core/class-vc-mapper.php on line 111
Warning: session_start(): Cannot start session when headers already sent in /homepages/0/d364303345/htdocs/wp-content/plugins/unyson/framework/includes/hooks.php on line 258
Warning: Cannot modify header information – headers already sent by (output started at /homepages/0/d364303345/htdocs/wp-content/plugins/LayerSlider/wp/widgets.php:4) in /homepages/0/d364303345/htdocs/wp-includes/pluggable.php on line 1219
here is my wp-advert version
=== WPAdverts – Classifieds Plugin ===
Plugin URI: https://wpadverts.com/
Contributors: gwin
Tags: classifieds, classified, classified ads, classified script, classifieds script, wp classified, wp classifieds
Requires PHP: 5.3
Requires at least: 4.0
Tested up to: 5.2
Stable tag: 1.3.3
License: GNU Version 2 or Any Later VersionThere seem to be only “deprecated” messages they would not cause an error which would prevent Ad posting.
BTW at the end of the “The page you are looking for is temporarily unavailable.
Please try again later.” message there is an error code which i suppose you can copy and send to your hosting tech support and they should be able to tell what caused the error.The admin of the serveur says it is the proxy that doesn’t want to wait too long.
It seems that the process doesn’t end on this page
OK I disabled Yoast plugin and the page loads correctly
But I have this message
Warning: array_diff(): Argument #2 is not an array in /homepages/0/d364303345/htdocs/wp-content/plugins/wpadverts/includes/functions.php on line 1720
And
Warning: filesize(): stat failed for /homepages/0/d364303345/htdocs/wp-content/uploads/2018/11/20180617_111349.jpg in /homepages/0/d364303345/htdocs/wp-content/plugins/wpadverts/includes/gallery.php on line 584
Have you removed the WP_DEBUG or changed it to ‘false’ in the wp-config.php? If not then doing so should hide the warnings.
Yes the WP_DEBUG of my wp-config.php is removed.
I still have trouble with this page please take a look to https://www.info-collection.fr/poster-une-annonce.html fill the form and clic on preview
Instead of removing it’s best to set the WP_DEBUG to false.
1. The first two errors you should be able to fix by opening file wpadverts/includes/functions.php and on line about 1713 to 1730 replace the function
function adverts_save_multi( $post_id, $key, $value ) { if( !is_array( $value ) ) { $value = array( $value ); } $post_meta = get_post_meta( $post_id, $key, false); if( empty( $post_meta ) ) { $post_meta = array(); } else if( ! is_array( $post_meta ) ) { $post_meta = array( $post_meta ); } $to_insert = array_diff($value, $post_meta); $to_delete = array_diff($post_meta, $value); foreach( $to_delete as $meta_value ) { delete_post_meta( $post_id, $key, $meta_value ); } foreach( $to_insert as $meta_value ) { add_post_meta( $post_id, $key, $meta_value ); } }
with
function adverts_save_multi( $post_id, $key, $value ) { if( !is_array( $value ) ) { $value = array( $value ); } $post_meta = get_post_meta( $post_id, $key, false); $to_insert = array_diff($value, $post_meta); $to_delete = array_diff($post_meta, $value); foreach( $to_delete as $meta_value ) { delete_post_meta( $post_id, $key, $meta_value ); } foreach( $to_insert as $meta_value ) { add_post_meta( $post_id, $key, $meta_value ); } }
A similar update will be in next WPAdverts release.
2. The all other errors seem to be occurring because you have media files deleted from wp-content/uploads folder but the entries for this attachments are still in the wp_posts table (with post_type = attachment).
You would need to remove the attachments which does not have files. You can do that by going to wp-admin / Media Library panel and deleting permanently all files which have an empty preview or for which the preview link returns a 404 error.
ok
Thank you for your answers
1.define( ‘WP_DEBUG’, false ); has bee changed on my wp-config
2.all media files with no attachement have been deleted
3.I have changed the lines 1713 to 1730 in the functions file of wp-adwert I still have the same error messageWarning: array_diff(): Argument #2 is not an array in /homepages/0/d364303345/htdocs/wp-content/plugins/wpadverts/includes/functions.php on line 1720
Warning: array_diff(): Argument #1 is not an array in /homepages/0/d364303345/htdocs/wp-content/plugins/wpadverts/includes/functions.php on line 1721
Warning: Invalid argument supplied for foreach() in /homepages/0/d364303345/htdocs/wp-content/plugins/wpadverts/includes/functions.php on line 1723
Warning: Invalid argument supplied for foreach() in /homepages/0/d364303345/htdocs/wp-content/plugins/wpadverts/includes/functions.php on line 1726
Please, tell me if something wrong
thank you
RodolpheAre you sure you have it modified correctly? If you did then the warning would not be triggered on line 1720 but on 1726 since some lines above were added.
Yes I am sure. I did it again with your piece of code
Here is the resultWarning: array_diff(): Argument #2 is not an array in /homepages/0/d364303345/htdocs/wp-content/plugins/wpadverts/includes/functions.php on line 1720
Warning: array_diff(): Argument #1 is not an array in /homepages/0/d364303345/htdocs/wp-content/plugins/wpadverts/includes/functions.php on line 1721
Warning: Invalid argument supplied for foreach() in /homepages/0/d364303345/htdocs/wp-content/plugins/wpadverts/includes/functions.php on line 1723
Warning: Invalid argument supplied for foreach() in /homepages/0/d364303345/htdocs/wp-content/plugins/wpadverts/includes/functions.php on line 1726
I noticed i have the code snippets mixed in my message, the original code is
function adverts_save_multi( $post_id, $key, $value ) { if( !is_array( $value ) ) { $value = array( $value ); } $post_meta = get_post_meta( $post_id, $key, false); $to_insert = array_diff($value, $post_meta); $to_delete = array_diff($post_meta, $value); foreach( $to_delete as $meta_value ) { delete_post_meta( $post_id, $key, $meta_value ); } foreach( $to_insert as $meta_value ) { add_post_meta( $post_id, $key, $meta_value ); } }
and the one you need to insert is
function adverts_save_multi( $post_id, $key, $value ) { if( !is_array( $value ) ) { $value = array( $value ); } $post_meta = get_post_meta( $post_id, $key, false); if( empty( $post_meta ) ) { $post_meta = array(); } else if( ! is_array( $post_meta ) ) { $post_meta = array( $post_meta ); } $to_insert = array_diff($value, $post_meta); $to_delete = array_diff($post_meta, $value); foreach( $to_delete as $meta_value ) { delete_post_meta( $post_id, $key, $meta_value ); } foreach( $to_insert as $meta_value ) { add_post_meta( $post_id, $key, $meta_value ); } }
Thank you
I do not have errors messages any more but I have the following shortcode
[adverts_add moderate=”1″]
instead of the review of the post
Any ideas?
When going from [adverts_add] form to preview the data is saved as WP_Post, but in your case for some reason, the wp_post is not being created (as the post_id is set to 0 in the code).
Did it work properly (that is correct description was shown) when you had the old adverts_save_multi() function?
One other change in the code you might want to do to reveal the error message is to open wpadverts/includes/class-post.php go to line about 120 and replace
$post_id = wp_insert_post( apply_filters( "adverts_insert_post", $data ) );
with
$post_id = wp_insert_post( apply_filters( "adverts_insert_post", $data ), true );
and
$post_id = wp_update_post( apply_filters( "adverts_update_post", $data ) );
with
$post_id = wp_update_post( apply_filters( "adverts_update_post", $data ), true );
- The topic ‘trouble with the add form advert’ is closed to new replies.