[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
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

alhitary wrote:
martti wrote: That depends on your setup. Most people have a MySQL database and use Phpmyadmin (for a remote server as it seems you have.)
Backup your data first. I hope you're not trying extensions in development on your live forum?
Yes i have MySQL database and use Phpmyadmin.
But i don't know how to delete manually.

I had extensions in development for test/check and then disabled and deleted them.
Now i have only some released extensions.
With only one in development which is ( upload extensions )
Well, it is as simple as opening the phpbb_modules table and then search for the row (near the end) with ACP_CUSTOMCODE_CREATE_DELETE and when you find it, click the link delete in this row and you'll be asked for confirmation.
User avatar
GoBieN
Registered User
Posts: 546
Joined: Fri Mar 05, 2004 5:22 pm
Location: Belgium
Contact:

Re: [RC] Custom Code

Post by GoBieN »

A little extra hint for the Adsense code, if you're using responsive ad blocks you could see that the first DIV with ads is not showing any but the second one on the page is. This is because the adsense script is trying to fill the block before the page is loaded. To fix this:
change:

Code: Select all

(adsbygoogle = window.adsbygoogle || []).push({});
to:

Code: Select all

window.setTimeout(function(){
  (adsbygoogle = window.adsbygoogle || []).push({});
}, 200);

Use case:

Add a warning when adblockers are disabling ads on your site. This is roughly coded, please change as you want.

1) overall_header_content_before.html

Code: Select all

<!-- Adblock warning message -->
<div id="pleasedisableadb" class="post adbwarning"><h3>Please disable your adblocker on this website!<br />The website costs are covered by using ads that are non-intrusive. Please whitelist this domain in your adblocker software or plugin. Thank you.</h3><h3>Schakel alstublieft de adblocker uit!<br />De kosten van het hosten van de website worden betaald met advertentie-inkomsten. Voeg alstublieft een uitzondering toe voor dit domein in de software of plugin.</h3></div>
2) overall_header_stylesheets_after.html

Code: Select all

<style>
div.adbwarning
{
   background-color: #ffeeee;
}
</style>
3) overall_footer_after.html

Code: Select all

<!-- Adblockdetect -->
<div id="bottomAd" style="font-size: 2px; style="display: none;">&nbsp;</div>
<script>
$(document).ready( function() {
  window.setTimeout( function() {
    var bottomad = $('#bottomAd');
    if (bottomad.length == 1) {
      if (bottomad.height() == 0) {
      //Ads are being blocked      
        $("#pleasedisableadb").css( "display", "block" );
        $("#pleasedisableadb").show;
      //This line will also fill the empty class adsense DIVs with the warning in addition to the warning at the top of the page.
	$(".adsense").html('<div class="post adbwarning"><h3>Please disable your adblocker on this website!<br />The website costs are covered by using ads that are non-intrusive. Please whitelist this domain in your adblocker software or plugin. Thank you.</h3><h3>Schakel alstublieft de adblocker uit!<br />De kosten van het hosten van de website worden betaald met advertentie-inkomsten. Voeg alstublieft een uitzondering toe voor dit domein in de software or plugin.</h3></div>');        
      } else {
      //Ads are not blocked
        $("#pleasedisableadb").css( "display", "none" );
        $("#pleasedisableadb").html("");
      }
    }      
  }, 100);
});
</script>
The system relies on the fact that the most popular adblocker (adblock plus) will always block a div with the id bottomAd. The script will check, after a timeout, for the block being present. If not than enable and show the DIV at the top of the page with the predefined text. Additionally fill the now empty DIVs with class adsense also with the warning text. If ads are not being blocked, make sure the top DIV is disabled, and deleted the text inside it just to be sure.
User avatar
alhitary
Registered User
Posts: 868
Joined: Wed Jan 17, 2007 7:51 am
Location: ROY
Name: Basil Taha Alhitary
Contact:

Re: [RC] Custom Code

Post by alhitary »

martti wrote:
alhitary wrote: Well, it is as simple as opening the phpbb_modules table and then search for the row (near the end) with ACP_CUSTOMCODE_CREATE_DELETE and when you find it, click the link delete in this row and you'll be asked for confirmation.
Finally it works.
I deleted the row and now it works.
Thanks Brother
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

alhitary wrote: Finally it works.
I deleted the row and now it works.
Thanks Brother
Great!
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

GoBieN wrote:A little extra hint for the Adsense code, if you're using responsive ad blocks you could see that the first DIV with ads is not showing any but the second one on the page is. This is because the adsense script is trying to fill the block before the page is loaded. To fix this:
change:

Code: Select all

(adsbygoogle = window.adsbygoogle || []).push({});
to:

Code: Select all

window.setTimeout(function(){
  (adsbygoogle = window.adsbygoogle || []).push({});
}, 200);

Use case:

Add a warning when adblockers are disabling ads on your site. This is roughly coded, please change as you want.

1) overall_header_content_before.html

Code: Select all

<!-- Adblock warning message -->
<div id="pleasedisableadb" class="post adbwarning"><h3>Please disable your adblocker on this website!<br />The website costs are covered by using ads that are non-intrusive. Please whitelist this domain in your adblocker software or plugin. Thank you.</h3><h3>Schakel alstublieft de adblocker uit!<br />De kosten van het hosten van de website worden betaald met advertentie-inkomsten. Voeg alstublieft een uitzondering toe voor dit domein in de software of plugin.</h3></div>
2) overall_header_stylesheets_after.html

Code: Select all

<style>
div.adbwarning
{
   background-color: #ffeeee;
}
</style>
3) overall_footer_after.html

Code: Select all

<!-- Adblockdetect -->
<div id="bottomAd" style="font-size: 2px; style="display: none;">&nbsp;</div>
<script>
$(document).ready( function() {
  window.setTimeout( function() {
    var bottomad = $('#bottomAd');
    if (bottomad.length == 1) {
      if (bottomad.height() == 0) {
      //Ads are being blocked      
        $("#pleasedisableadb").css( "display", "block" );
        $("#pleasedisableadb").show;
      //This line will also fill the empty class adsense DIVs with the warning in addition to the warning at the top of the page.
	$(".adsense").html('<div class="post adbwarning"><h3>Please disable your adblocker on this website!<br />The website costs are covered by using ads that are non-intrusive. Please whitelist this domain in your adblocker software or plugin. Thank you.</h3><h3>Schakel alstublieft de adblocker uit!<br />De kosten van het hosten van de website worden betaald met advertentie-inkomsten. Voeg alstublieft een uitzondering toe voor dit domein in de software or plugin.</h3></div>');        
      } else {
      //Ads are not blocked
        $("#pleasedisableadb").css( "display", "none" );
        $("#pleasedisableadb").html("");
      }
    }      
  }, 100);
});
</script>
The system relies on the fact that the most popular adblocker (adblock plus) will always block a div with the id bottomAd. The script will check, after a timeout, for the block being present. If not than enable and show the DIV at the top of the page with the predefined text. Additionally fill the now empty DIVs with class adsense also with the warning text. If ads are not being blocked, make sure the top DIV is disabled, and deleted the text inside it just to be sure.
Thank you. I don't have any experience with Adsense myself. If the extension would get accepted in the extension database, the use cases can be presented and ordered in a better way in multiple topics. Now there's the risk the ideas will get lost in this single thread.
User avatar
GhostfaceTJW
Registered User
Posts: 253
Joined: Sat Sep 13, 2008 12:32 am
Contact:

Re: [RC] Custom Code

Post by GhostfaceTJW »

I actually installed this 'extensions' package as it said in the original post and on enabling it in the ACP i got the Extensions tab appearing no problem, i clicked it and was taken to a full white screen with a load of jumbled black text appearing... numerous errors listed.... do we have to have this 'pikwik' too for it to all work??

All i wanted to do was get a default avatar working and the 'move to top' add on, and maybe whatever came about in future that was also good to have...
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

GhostfaceTJW wrote:I actually installed this 'extensions' package as it said in the original post and on enabling it in the ACP i got the Extensions tab appearing no problem, i clicked it and was taken to a full white screen with a load of jumbled black text appearing... numerous errors listed.... do we have to have this 'pikwik' too for it to all work??

All i wanted to do was get a default avatar working and the 'move to top' add on, and maybe whatever came about in future that was also good to have...
It would help if you copy paste here the error messages. Otherwise nobody can help you on this.

Piwik is a use case of this extension. You don't need it.
User avatar
GhostfaceTJW
Registered User
Posts: 253
Joined: Sat Sep 13, 2008 12:32 am
Contact:

Re: [RC] Custom Code

Post by GhostfaceTJW »

it wasnt a few different codes.. it was a mass jumble of text.. ill see if i can get a screen grab..
User avatar
GhostfaceTJW
Registered User
Posts: 253
Joined: Sat Sep 13, 2008 12:32 am
Contact:

Re: [RC] Custom Code

Post by GhostfaceTJW »

User avatar
RMcGirr83
Former Team Member
Posts: 21613
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [RC] Custom Code

Post by RMcGirr83 »

Code: Select all

$(document).ready( function() {
Does not wait for everything to load on the page (Images, frames, page contents, etc). Maybe

$(window).load(function() {

would work better.
Appreciate the extensions/mods/support then buy me a beerImage
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

GhostfaceTJW wrote:Sorry for the long image, but you wanted to see the error i get.. so here we are..

Image

https://camo.phpbb.com/3e27bbf645c41154826a928dee8b91abcd38d8b8/687474703a2f2f6935382e74696e797069632e636f6d2f33306c6d647a362e706e67
Twig cannot find the file /adm/style/files.html (in the extension). Is it present and has the server read access to it?
User avatar
GhostfaceTJW
Registered User
Posts: 253
Joined: Sat Sep 13, 2008 12:32 am
Contact:

Re: [RC] Custom Code

Post by GhostfaceTJW »

Thankfully its sorted now... for some reason, even though i selected the full folders to upload it totally missed the ADM file.. i deleted and uploaded the whole file again and thankfully it worked this time.. GoDady has had many problems lately with it file manager, with an error message about API not responding, i can only assume it went iffy during first upload..

thanks for the help.. much appreciated.
User avatar
Lumpy Burgertushie
Registered User
Posts: 68191
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: [RC] Custom Code

Post by Lumpy Burgertushie »

you really should not be using the file manager of any host , especially godaddy. get a real ftp program and set it up and it will only take a few seconds to upload /download and you have full control of everything.

actually, you really shouldn't be using godaddy at all but that is another rant.

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
alhitary
Registered User
Posts: 868
Joined: Wed Jan 17, 2007 7:51 am
Location: ROY
Name: Basil Taha Alhitary
Contact:

Re: [RC] Custom Code

Post by alhitary »

Can you help me plz to customize the logo and avatar ?

I edit and add the bellow code in : overall_header_stylesheets_after.html

1/ i try to customize the logo as bellow , but it dosn't work :

Code: Select all

<style>
/** Change the Logo **/
.imageset.site_logo {
background-image: url("./images/logo.gif");
width: 250px,
height: 200px;
}
</style>
2/ i try to center the avatar in topic page, as bellow, also it dosn't work :

Code: Select all

<style>
/** center the avatar **/
.postprofile dt, .avatar img {
   margin: auto;
}

.postprofile .avatar {
   float: none;
}
</style>
I missed something and wish you can help me in this
User avatar
martti
Registered User
Posts: 867
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

alhitary wrote:Can you help me plz to customize the logo and avatar ?

I edit and add the bellow code in : overall_header_stylesheets_after.html

1/ i try to customize the logo as bellow , but it dosn't work :

Code: Select all

<style>
/** Change the Logo **/
.imageset.site_logo {
background-image: url("./images/logo.gif");
width: 250px,
height: 200px;
}
</style>
Use ROOT_PATH like background-image: url('{ROOT_PATH}/images/logo.gif');
2/ i try to center the avatar in topic page, as bellow, also it dosn't work :

Code: Select all

<style>
/** center the avatar **/
.postprofile dt, .avatar img {
   margin: auto;
}

.postprofile .avatar {
   float: none;
}
</style>
I missed something and wish you can help me in this
Sorry, at the moment I don't have time for digging into this (I also don't understand what you're trying to accomplish). Maybe someone else can help?
Post Reply

Return to “Extensions in Development”