Skip to content
This repository has been archived by the owner on Nov 21, 2020. It is now read-only.

Permission based ads #6

Open
Paddidox opened this issue Apr 26, 2017 · 13 comments
Open

Permission based ads #6

Paddidox opened this issue Apr 26, 2017 · 13 comments

Comments

@Paddidox
Copy link

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
Copy link
Contributor

luceos commented Apr 28, 2017

great thought

@jrock17
Copy link

jrock17 commented Oct 4, 2017

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

@noriods
Copy link

noriods commented Oct 10, 2017

+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
Copy link

jrock17 commented Oct 21, 2017

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
Copy link
Contributor

luceos commented Oct 22, 2017

@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
Copy link

jrock17 commented Oct 23, 2017

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

@JCKodel
Copy link

JCKodel commented Dec 1, 2019

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

@luceos
Copy link
Contributor

luceos commented Dec 1, 2019

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
Copy link

Hello, how is this process going?

@clarkwinkelmann
Copy link
Contributor

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
Copy link

JCKodel commented Jun 23, 2020

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
Copy link
Contributor

PRs are welcome 🤗

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

@jesusmoreno24
Copy link

Thanks! @JCKodel

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants