• justchapman

    (@justchapman)


    Ideally, I’m looking for a way to implement ads that display in relation to the author of the current page. Meaning an author/user of the page can setup their own ads. When logged in as a user, I have the ability to upload ads and assign them to groups. But there seems to be no mechanism to separate one user from another, leading to the ability for users to place ads on another user’s page.

    I realize this is most likely out of the scope of this plugin.

    So, in lieu of that, is there a way to limit the Ads plugin options to only admins? I’d like for the ads option to not show up for authors/users.

    https://wordpress.org/plugins/ads-by-datafeedrcom/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author datafeedr

    (@datafeedrcom)

    Hi,

    Sorry, that’s not possible.

    Eric

    Thread Starter justchapman

    (@justchapman)

    Just fyi – support for per-author advertising was very simple to add, once I dug into it. Only a couple small mods to the dfads.class.php file.

    around line 29:
    $ads = $this->query($this->args['author']);

    then added this to the args defaults:

    'author' => '',

    Pass an author id default to the query :
    function query($author='')

    Then I added an if in the query to include in the where clause if not empty:

    if(!empty($author)) {
      $sql .= " AND p.post_author = $author ";
     }

    So now if you pass the author id in the shortcode in a template, you will get per-author ads.

    echo dfads( 'author=' . get_the_author_meta('ID') . '&groups=1' );

    Hopefully this helps someone looking for the same functionality.

    Cheers,

    Chapman

    Plugin Author datafeedr

    (@datafeedrcom)

    Nice job!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘user/author ads’ is closed to new replies.