• Resolved zonepluss

    (@zonepluss)


    Greg, I have a few more questions:
    1) Is it possible to transform the name of the author of the ad into a clickable link so that when clicked it would be redirected to his profile page?

    2) Is it possible to set up so that the user can post a free ad only once? For example, I have two pricing types, Free and Premium, a user puts out a free ad and after that he can no longer post an ad for free, only at the Premium type.
    Thanks!

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

    (@gwin)

    Hi,
    1. you can do that using either the Authors extension https://wpadverts.com/extensions/authors/ or the free Ads By Author snippet https://github.com/simpliko/wpadverts-snippets/blob/master/ads-by-author/ads-by-author.php.

    How to install the snippet you can read here https://github.com/simpliko/wpadverts-snippets/ at the bottom of the page.

    2. we have a Limit Listings snippet https://github.com/simpliko/wpadverts-snippets/blob/master/limit-listings/limit-listings.php which should be doing what you would like to do.

    After installing it (as explained above), edit the Free pricing from wp-admin / Classifieds / Options / Payments / Pricing panel, you should see two fields:
    – Max Listings – enter here “1”
    – Interval – enter here “36000”

    What this will do is that the users will be able to post only “1” free ad every 360000 days (100 years).

    Note that this will work only for users who are logged in while posting an Ad from [adverts_add], for unregistered users it is not really possible to check how many Ads the user already posted, so you would need to make the [adverts_add] shortcode available for logged in users only.

    Thread Starter zonepluss

    (@zonepluss)

    Thanks, Greg!
    Limit listings work perfectly!
    But i have a problem with Ads by author, when i clicking the link appear this error:
    Warning: Illegal string offset ‘search_bar’ in /data01/virt81062/domeenid/www.nedia.eu/htdocs/wp-content/plugins/ads-by-author/ads-by-author.php on line 51

    And is it possible when clicking the link then redirect to the author s profile page(Ultimate Member plugin), not to show author s ads?
    Thank You!

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    1. this is just a notice it does not actually break the site, but in order to fix it open the ads-by-author.php file and on the line 51 before $params["search_bar"] = "disabled"; add

    
    if( ! is_array( $params ) ) {
      $params = array();
    }
    

    2. if you would like the author link to point to the UM plugin user profile, then also in ads-by-author.php file you would need to replace on line 150 the code $link . $glue . "posted_by=" . $post->post_author with a UM link which will point to user UM profile.

    I am not familiar with UM code, so it would be best to ask UM support: how to get a user profile link based on user id.

    Thread Starter zonepluss

    (@zonepluss)

    Thanks, Greg, i will try to find out about the UM link, the first problem is solved.

    Thread Starter zonepluss

    (@zonepluss)

    Hi Greg!
    From UM support forum i got this snippet:
    <?php
    if ( class_exists( ‘UM’ ) ) {
    $user_id = get_current_user_id();
    echo um_user_profile_url( $user_id );
    }
    ?>
    What do you think about this code and where it must be placed, functions.php or ads-by-author.php?
    Thanks

    Plugin Author Greg Winiarski

    (@gwin)

    In ads-by-author.php try replacing $link . $glue . "posted_by=" . $post->post_author with um_user_profile_url( $post->post_author ).

    Thread Starter zonepluss

    (@zonepluss)

    Thanks a lot Greg, it work fine!!!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Link and pricing’ is closed to new replies.