Hi,
1. you do not need a code to enable moderation when user updates an Ad from the page with [adverts_manage] shortcode, there is an option for that in the wp-admin / Classifieds / Options / Core panel.
2. to send an email when the Ad changes status to pending you can add the code below in your theme functions.php file
function on_advert_pending( $ID, $post ) {
$to = get_option( "admin_email" );
$subject = "Ad Pending Moderation";
$url = admin_url( sprintf( 'post.php?post=%d&action=edit', $ID ) );
$m = sprintf( "Ad %s is waiting for approval.", $url );
wp_mail( $to, $subject, $m );
}
add_action( 'pending_advert', 'on_advert_pending', 10, 2 );
Note that this will trigger a message for both publishings an Ad (if it goes to preview) and editing it, so if you have the moderation email enabled in the Emails Module then you can disable it to avoid having the moderation email sent twice.
Thank you very much, it works
Last question, in ads core settings i set redirect expired ads URL to https://kurortov.com/poisk-zhilja and it works well for expired ads. But when old ad that waiting moderetion (was edited by user), his URL at moment of pending moderation shows 404 page “Not found” Tell me please, how to redirect it to https://kurortov.com/poisk-zhilja I know there are plugins of redirection, but i am affraid that they will broke something.
Hi,
i had a similar question a while ago, unfortunately, it is not really possible right now.
This is because the pending ads are using the default WP “pending” status, so in order to allow all users to view pending ads I would need to make all posts (including the default posts and pages) with the status Pending visible to all users which is a potential security risk.
Most likely in the next release, I will just disable the Preview button in the [adverts_manage] for the pending ads so the users will not see a link pointing to a 404 page, and in the future, some other way to preview the ads will be implemented.
Hi,i mean URL of old ad that is pending moderation. This URL indexed in google from the first moment ad was published. And now this ad is pending moderation after changes again. And at this moment other users from google see by following this ad URL link – page 404 I just want them to see page of my site until this ad passes moderation. If I understood correctly, if i somehow set global redirect from page 404 to https://kurortov.com/poisk-zhilja so this wont help?
-
This reply was modified 4 years, 4 months ago by
vasian4515.
-
This reply was modified 4 years, 4 months ago by
vasian4515.
Hi,
ohh i see, i agree that would be good to show some other content while the page is in moderation, however in this case there is actually the same problem as with the new ads that are pending moderation since updating an Ad also changes the status to the default WP “pending”.
I will add this to our issue tracker, it should be resolved in one of next releases.