flagrow / ads

Allows you to configure ads in several locations
https://discuss.flarum.org/d/4785-flagrow-ads-bombarding-your-users-with-ads-everywhere-if-you-want
MIT License
18 stars 9 forks source link

Permission based ads #6

Open Paddidox opened 7 years ago

Paddidox commented 7 years ago

An enhancement would be to show ads only to guests. It would be also interesting to set specific ad areas to a specific group/s only.

For example: Guest -> All ad areas, Donators -> only sidebar, Members -> only in between posts

luceos commented 7 years ago

great thought

jrock17 commented 7 years ago

I 👍 this idea (and I may have made a duplicate request in #12).

noriods commented 7 years ago

+1 for this one. I'm re-launching my forum in Flarum (was SMF) this week and I would LOVE to give my volunteer members an ad-free experience.

jrock17 commented 6 years ago

Launching membership soon and wanting to hide some/all of ads for paid membership. Would be great to be able to assign ad blocks to user groups in Flarum.

luceos commented 6 years ago

@jrock17 we would be more than happy to push such a feature forward in priority if there was something in it for us. Become a patron over at https://patreon.com/flagrow or chat us up on discord to have us built this for you specifically.

In any other case, please have patience, we're doing our best to move all our projects forward at a steady pace.

jrock17 commented 6 years ago

@luceos of course, happy to support all your efforts. I just signed up as a patron.

JCKodel commented 4 years ago

2 years late and patreon link is dead. Is this project dead as well?

luceos commented 4 years ago

This extension moved to friends of flarum. Flagrow as a developer team folded as all of these joined the core team. Friends of flarum can still benefit from your donation and support on open collective, check the donate button on this repository.

jesusmoreno24 commented 4 years ago

Hello, how is this process going?

clarkwinkelmann commented 4 years ago

FriendsOfFlarum is not actively working on this feature as we focus primarily on maintenance and not new features.

You could get the feature commissioned for a fee by contacting one of our members directly.

JCKodel commented 4 years ago

FriendsOfFlarum is not actively working on this feature as we focus primarily on maintenance and not new features.

You could get the feature commissioned for a fee by contacting one of our members directly.

Seems like Apple doing open source. I'll do, but I'll charge for it. Not nice.

@jesusmoreno24 I did this by hand, pretty much hardcoded (I don't have experience in PHP to develop the admin interface, etc. to do a proper contribution).

What I did was to check for a specific group in the JS and then don't display the ads for them:

import { extend } from 'flarum/extend';
import app from 'flarum/app';
import PostStream from 'flarum/components/PostStream';

export default function() {
    extend(PostStream.prototype, 'view', function(component) {
        const advertisement = app.forum.attribute('flagrow.ads.between-posts');

        if(app.session && app.session.user && app.session.user.data && app.session.user.data.relationships && app.session.user.data.relationships.groups && app.session.user.data.re$
                for(const group of app.session.user.data.relationships.groups.data) {
                        if(group.type === "groups" && group.id === "5") {
                                console.warn("Premium user");
                                return;
                        }
                }
        }

I did that for all JS files (addAdBetweenPosts, addAdUnderHeader and addAdUnderNavItems). My premium group is id 5, so, if the authenticated user belongs to that group, it just returns.

Definitely not the right way to do but, again, I don't know Flarum api or PHP to contribute more.

clarkwinkelmann commented 4 years ago

PRs are welcome :hugs:

You can read more about FriendsOfFlarum mission at https://friendsofflarum.org/about

jesusmoreno24 commented 4 years ago

Thanks! @JCKodel