Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi, to moderate only ads posted by registered users you can add the code below in your theme functions.php file

    
    add_filter( "shortcode_atts_adverts_add", "moderate_loggedin", 10, 3 );
    function moderate_loggedin( $out, $pairs, $atts ) {
        // 1. check if user is logged in, if not return $out;
        if( get_current_user_id() < 1 ) {
            $out["moderate"] = 0;
        } else {
            $out["moderate"] = 1;
        }
        return $out;
    }
    
    Thread Starter pismma

    (@pismma)

    somehow, I have no moderation for all users …
    add-save.php

    <?php adverts_flash( $adverts_flash ) ?>
    <div>
        <?php if($moderate == "1"): ?>
        <p><?php _e("Your ad has been put into moderation, please wait for admin to approve it.", "adverts") ?></p>
        <?php else: ?>
        <p><?php printf(__('Your ad has been published. You can view it here "<a href="%1$s">%2$s</a>".', 'adverts'), get_post_permalink( $post_id ), get_post( $post_id )->post_title ) ?></p>
        <?php endif; ?>
    </div>

    Have to use the plugin Restrict Content by Role, but it is not convenient.
    What should I fix to moderation for all users?
    site

    Thread Starter pismma

    (@pismma)

    still no moderation…

    Plugin Author Greg Winiarski

    (@gwin)

    It is not clear to me what you are trying to do? Do you want to enable moderation for ALL ads posted in the frontend? If so then use the [adverts_add] shortcode as [adverts_add moderate=”1″], see https://wpadverts.com/documentation/allow-users-to-post-ads-adverts_add/ for more details.

    Thread Starter pismma

    (@pismma)

    I’ve done it. this time I changed the quotes and it worked. Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘moderation of ads from registered users’ is closed to new replies.