Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adsense on activity stream?

  • I search again and again, but I found nothing more than codes that not working anymore. I have to say that buddypress is sophisticated, but missing a lot of simple functionalities. I mean whats the point if you cant make money? Another missing thing is that no active members are not showing until they login, but lets stick on how to have ads on activity steam for now. Any clear explanation it will be nice.

Viewing 21 replies - 1 through 21 (of 21 total)

  • shanebp
    Moderator

    @shanebp

    A lot, maybe most BP sites are not commercial.

    You may want to create a template overload of this file:
    buddypress\bp-templates\bp-legacy\buddypress\activity\entry.php

    To add content to the entries in the activity stream, use this hook in that file:
    do_action( 'bp_activity_entry_content' );

    If you need access to the activity content as part of your ad display decision chain, use the filter hook in buddypress/bp-activity/bp-activity-template/ :
    apply_filters_ref_array( 'bp_get_activity_content_body', array( $activities_template->activity->content, &$activities_template->activity ) );

    Its amazing how a simple code like this is working: do_action( ‘bp_activity_entry_content’ );
    But I have another issue here. I see the code working strait on the buddypress\bp-templates\bp-legacy\buddypress\activity\entry.php. But I dont know how to create a template overload. I try to follow the info here: https://codex.buddypress.org/themes/theme-compatibility-1-7/a-quick-look-at-1-7-theme-compatibility/#how-is-this-useful

    So what I dit was to copy the whole buddypress plugin on my theme directory, than I changed the entry.php and add it on my theme/buddypress\bp-templates\bp-legacy\buddypress\activity\entry.php
    But is not working…For sute I miss something!


    Henry Wright
    Moderator

    @henrywright

    It looks like you could have the path wrong. Instead of your_theme/buddypress/bp-templates/bp-legacy/buddypress/activity/entry.php, try:

    your_theme/buddypress/activity/entry.php

    Correct!!! Thanks Henry, but I dont get it. What about the rest of the files like bp-activity, bp-blogs and so on? I keep them in my theme or I delete them. Also if I need to modify another template do I have to make the same, at the same location?

    another problem is that I can see this lines of code in activity:

    do_action( ‘ ‘ );

    ok its working without the do_action( ‘ ‘ ); so i just delete the code. Only I want to know about the rest of the files…


    shanebp
    Moderator

    @shanebp

    Delete the rest of the files.
    Only use overloads of the template files you want to change.
    Follow the directory structure used in bp-templates/bp-legacy/

    Thanks!!!

    Ok because it is show 3 times I think is mess with my theme. How can make it show only 2 times or something…

    It shows many times not only 3 as I said before. I fix my Theme issue as it was from the adsense code (push) … But I want the ads to show only 2 times, otherwise it will cause Google penalty!

    Thats the last thing I need now, to set up how many times the ads will display

    Unfortunately I think I will never get an answer about that…


    Henry Wright
    Moderator

    @henrywright

    How are you adding the ad to the stream?

    I just paste the adsense code at the entry.php on my template overload. I try with this code do_action( ‘bp_activity_entry_content’ ); too, but is the same results. Plus you can see a part of the code in activity timeline.


    hwansi
    Participant

    @hwansi

    I’ve tried doing this in both entry.php and the activity loop but I am not having any success. Has anyone made any progress with the latest version of BP 2.0?


    Henry Wright
    Moderator

    @henrywright

    entry.php is the code that displays a member in the loop. If you have 300 members and you paste the ad code into entry.php then the ad will display 300 times.

    Lol if I knew this I will never add the adsenese code there. But you guys tell as to add the code there. Sorry are we play here? Is any real solution about this or is a top secret? maybe that’s why the most of BP sites are not commercial. If the entry.php is not the place to add adsense than where is and how we can make it show only 2 times…?

    Ok I finaly did it!!


    Henry Wright
    Moderator

    @henrywright

    Ok I finaly did it!!

    Great 🙂


    wowrameezali
    Participant

    @wowrameezali

    @mlao Can you please help me. I am in the same situation. Can you please share the code where to put the sponsored code in <?php do_action( ‘bp_activity_entry_content’ ); ?> ?

    Have you used any loop or something? I would be very greatful if you can share those information..

    I just add the adsense code in the activity-loop.php
    That’s all… I hope it helps many others.

Viewing 21 replies - 1 through 21 (of 21 total)
  • You must be logged in to reply to this topic.