[3.3][BETA] Custom Code

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Get Involved
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
Lumpy Burgertushie
Registered User
Posts: 68181
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: [RC] Custom Code

Post by Lumpy Burgertushie »

Code: Select all

<!-- IF not S_GROUP_7 --> adsense code here <!-- ENDIF -->
look in your admin panel, manage groups, in the list will be the VIP group. hover your mouse over the settings link. you will see something like this;
XXXXXX/adm/index.php?i=acp_groups&sid=2791ec501fbb28af326d82ddcde8a25a&icat=12&mode=manage&action=edit&g=7

notice the g=7

7 is the group ID #

edit your switch with ID # of whatever group you do NOT want to see the code and surround your adsense code with the switch.

it will not show the code within the switch to people in the group with that ID#

also, I believe that you may have to make sure that the VIP group is the default group for all its members, but I am not sure if that is required or not.



robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

Lumpy Burgertushie wrote:

Code: Select all

<!-- IF not S_GROUP_7 --> adsense code here <!-- ENDIF -->
look in your admin panel, manage groups, in the list will be the VIP group. hover your mouse over the settings link. you will see something like this;
XXXXXX/adm/index.php?i=acp_groups&sid=2791ec501fbb28af326d82ddcde8a25a&icat=12&mode=manage&action=edit&g=7

notice the g=7

7 is the group ID #

edit your switch with ID # of whatever group you do NOT want to see the code and surround your adsense code with the switch.

it will not show the code within the switch to people in the group with that ID#




You beat me by a few seconds.

also, I believe that you may have to make sure that the VIP group is the default group for all its members, but I am not sure if that is required or not.
It doesn't have to be the default group. For every group there is a template variable.

Here is the adapted version of the viewtopic-case that was quoted:

Edit :: viewtopic_body_postrow_post_after.html

Code: Select all

<!-- Google adsense -->
<!-- IF not S_GROUP_9 and (postrow.S_FIRST_ROW or postrow.S_ROW_COUNT == 5 or postrow.S_ROW_COUNT == 10) -->

Your Google adsense code here...

<!-- ENDIF -->
kooljp
Registered User
Posts: 29
Joined: Thu Feb 14, 2013 11:52 pm

Re: [RC] Custom Code

Post by kooljp »

martti wrote:
Here is the adapted version of the viewtopic-case that was quoted:

Edit :: viewtopic_body_postrow_post_after.html

Code: Select all

<!-- Google adsense -->
<!-- IF not S_GROUP_5 and (postrow.S_FIRST_ROW or postrow.S_ROW_COUNT == 5 or postrow.S_ROW_COUNT == 10) -->

My Google adsense code here...

<!-- ENDIF -->
I have followed the steps but it's not removing the Adsense Ads for VIP group "5" with the above edited code.

I have done the Extension install into: marttiphpbb/grouptempvars in the ext directory. ext/marttiphpbb already existed because I have marttiphpbb/customcode

It's not showing up in the ACP under Module management to enable the extension.

Cheers
JP
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

kooljp wrote:
I have followed the steps but it's not removing the Adsense Ads for VIP group "5" with the above edited code.

I have done the Extension install into: marttiphpbb/grouptempvars in the ext directory. ext/marttiphpbb already existed because I have marttiphpbb/customcode

It's not showing up in the ACP under Module management to enable the extension.

Cheers
JP
Do you have the file composer.json directly under ext/marttiphpbb/grouptempvars ?
kooljp
Registered User
Posts: 29
Joined: Thu Feb 14, 2013 11:52 pm

Re: [RC] Custom Code

Post by kooljp »

Fixed, I was looking to enable under ACP->System->Acp->Extensions

Should have been:ACP->Customise->Manage Extensions

All good now and performing as expected.

Thanks!
crf
Registered User
Posts: 11
Joined: Fri Jul 10, 2015 12:19 pm

Re: [RC] Custom Code

Post by crf »

Really great extension!!!

Is there any way to randomly display some content. Like for example, show an ad 1 out of 10 times.

Thank you!
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

crf wrote:Really great extension!!!

Is there any way to randomly display some content. Like for example, show an ad 1 out of 10 times.

Thank you!
That would be possible with Javascript or by configuration of your ad server.
With Google Adsense you would violate the TOC by using Javascript. The Adsense must be in the page unaltered.
crf
Registered User
Posts: 11
Joined: Fri Jul 10, 2015 12:19 pm

Re: [RC] Custom Code

Post by crf »

Thank you! I will work around that somehow.

Another thing.
Why is topiclist_row_append.html located inside the topic, and not between the topics.

I would like to position my ads between two topics in a list. Any idea?
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

crf wrote: Another thing.
Why is topiclist_row_append.html located inside the topic, and not between the topics.

I would like to position my ads between two topics in a list. Any idea?
It seems only possible with Javascript to move something there.

Edit : overall_footer_after.html

Code: Select all

<!-- content in between first and second topic -->

<!-- IF SCRIPT_NAME == 'viewforum'  -->
<ul >
  <li id="my-content" class="row bg1">
    <div>

        <h2>Your content ... </h2>

    </div>
  </li>
</ul>

<script>
$(document).ready( function() {
  window.setTimeout( function() {
    $('div.forumbg ul.topics li.row').eq(0).after($('#my-content'));
  }, 100);
});
</script>

<!-- ENDIF -->
Change the eq(0) (1, 2 , 3, ... ) to select after which topic your code must go.

Image
crf
Registered User
Posts: 11
Joined: Fri Jul 10, 2015 12:19 pm

Re: [RC] Custom Code

Post by crf »

That works great! You are the BEST! Thank you!
crf
Registered User
Posts: 11
Joined: Fri Jul 10, 2015 12:19 pm

Re: [RC] Custom Code

Post by crf »

Ups, Ijust found a small problem with the above code...

On forums vith less than...X topics, the "my code section" is displayed at total bottom of the page... How could this be fixed?

Thanx!
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

crf wrote:Ups, Ijust found a small problem with the above code...

On forums vith less than...X topics, the "my code section" is displayed at total bottom of the page... How could this be fixed?

Thanx!
You could wrap your code in <div style="display:none;"> :

Code: Select all

<div style="display:none;">
   <div id="#my-content" class="row bg1">
    Your content ...
  </div>
</div>
Take care when using Google Adsense, hiding an advert is probably against their TOC.
crf
Registered User
Posts: 11
Joined: Fri Jul 10, 2015 12:19 pm

Re: [RC] Custom Code

Post by crf »

Thank you... Yes, you are probably right about the TOC. I'll just keep it displayed at the bottom.
User avatar
Meykota
Registered User
Posts: 30
Joined: Sat Aug 16, 2014 5:19 pm
Location: Leipzig, Germany
Contact:

Re: [RC] Custom Code

Post by Meykota »

The EU has this wonderful new Cookie-thing, where you have to ask your visitors for allowance to use Cookies... I've got a code from Silktide and want to know, if and where I can implement this code with Custom Code. Is this possible? And which file do I have to use for this? :)

Here's the code:

Code: Select all

<!-- Begin Cookie Consent plugin by Silktide - http://silktide.com/cookieconsent -->
<script type="text/javascript">
    window.cookieconsent_options = {"message":"Wir verwenden Cookies, um dir eine bessere Benutzerfahrung mit personalisierten Anzeigen und Funktionen bieten zu können.","dismiss":"Verstanden!","learnMore":"Weitere Informationen","link":"http://gamers-palace.de/ucp.php?mode=privacy","theme":"dark-top"};
</script>

<script type="text/javascript" src="//s3.amazonaws.com/cc.silktide.com/cookieconsent.latest.min.js"></script>
<!-- End Cookie Consent plugin -->
User avatar
david63
Registered User
Posts: 18444
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: [RC] Custom Code

Post by david63 »

Meykota wrote:The EU has this wonderful new Cookie-thing, where you have to ask your visitors for allowance to use Cookies... I've got a code from Silktide and want to know, if and where I can implement this code with Custom Code. Is this possible? And which file do I have to use for this?
Or you could use the Cookie Policy extension which is designed for that purpose.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
Post Reply

Return to “Extensions in Development”