[ABD] Custom Code

Any abandoned Extensions will be moved to this forum.

WARNING: Extensions in this forum are not currently being supported or maintained by the original Extension author. Proceed at your own risk.
Forum rules
IMPORTANT: Extension Development Forum rules

WARNING: Extensions in this forum are not currently being supported nor updated by the original Extension author. Proceed at your own risk.
wrkalot
Registered User
Posts: 108
Joined: Tue Oct 02, 2012 10:07 pm

Re: [RC] Custom Code

Post by wrkalot »

Quick question. When creating a new template event, do I need to create that html file and upload it to the template>event directory?
Tutorial: How to add ads to your forum viewtopic.php?f=64&t=2417316
User avatar
Galixte de EzCom
Registered User
Posts: 1106
Joined: Mon Oct 04, 2004 11:14 pm
Location: France
Name: Raphaël M.

Re: [RC] Custom Code

Post by Galixte de EzCom »

Hi,

you could edit your previous post instead of post two messages. ;)

See this message from author: viewtopic.php?p=13893871#p13893871.
Communau EzCom
📖 « Traductions d’extensions & styles pour phpBB 3.2.x & 3.3.x ».
📋 Lists of all extensions identified for phpBB 3.1.x & 3.2.x.
📋 Lists of all styles identified for phpBB 3.1.x & 3.2.x.
Image Tu as un forum et tu veux aussi un site web ? Regarde par ici.
wrkalot
Registered User
Posts: 108
Joined: Tue Oct 02, 2012 10:07 pm

Re: [RC] Custom Code

Post by wrkalot »

Galixte de EzCom wrote:Hi,

you could edit your previous post instead of post two messages. ;)

See this message from author: viewtopic.php?p=13893871#p13893871.
Thanks for the link.

I could have edited it but didn't... guess we'll all have to live with my gross ineptness. :)
Tutorial: How to add ads to your forum viewtopic.php?f=64&t=2417316
User avatar
2600
I've Been Banned!
Posts: 2567
Joined: Fri Nov 14, 2014 5:14 pm
Location: Area-51

Re: [RC] Custom Code

Post by 2600 »

martti wrote:
It's a bit hacky, but you could select on the text A ban has been issued
I'm not sure how to code in HTML, etc. Tell me if this is what I use for audio. Thanks! My board is in English.

Edit:: overall_footer_after.html

Code: Select all

<!-- play audio for the banned ones -->

<!-- IF SCRIPT_NAME == 'ucp' and CUSTOMCODE_PARAM_MODE == 'login' -->

<script>

$(document).ready( function() {
  window.setTimeout( function() {
    if ($('div#message > div.inner > p > em').text().indexOf('A ban has been issued') >= 0){
      
      alert('<source src="https://mywebsite.com/images/siteaudio.mp3"  type="audio/mpeg">
<source src="https://https:/mywebsite.comimages/siteaudio.ogg"  type="audio/ogg">');

      }
  }, 100);
});

</script>

<!-- ENDIF -->

Indeed, the files with your custom code are in the store/customcode folder and are left intact if you don't click remove data.

Okay, that's what I thought. Will update. many thanks!
Morpheus: Unfortunately, no one can be told what The Matrix is. You'll have to see it for yourself.
Hack me.
Consider a canary token.
The nature of my chosen username
:ugeek:
User avatar
martti
Registered User
Posts: 914
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Custom Code

Post by martti »

John connor wrote: I'm not sure how to code in HTML, etc. Tell me if this is what I use for audio. Thanks! My board is in English.
You add an audio element on the login page and let it play with some javascript code when it sees the text A ban has been issued.
Suppose your audio file is banned.mp3 in the store/sound folder:

Edit:: overall_footer_after.html

Code: Select all

<!-- play requiem for the banned -->

<!-- IF SCRIPT_NAME == 'ucp' and CUSTOMCODE_PARAM_MODE == 'login' -->

<audio src="store/sound/banned.mp3"></audio>

<script>
$(document).ready( function() {
  window.setTimeout( function() {
    if ($('div#message > div.inner > p > em').text().indexOf('A ban has been issued') >= 0){
      $('audio')[0].play();
    }
  }, 100);
});

</script>

<!-- ENDIF -->
Last edited by martti on Wed Jun 10, 2015 4:17 am, edited 1 time in total.
User avatar
2600
I've Been Banned!
Posts: 2567
Joined: Fri Nov 14, 2014 5:14 pm
Location: Area-51

Re: [RC] Custom Code

Post by 2600 »

It works! Thanks! :D I just don't know enough about HTML to know where to place the audio code.
Morpheus: Unfortunately, no one can be told what The Matrix is. You'll have to see it for yourself.
Hack me.
Consider a canary token.
The nature of my chosen username
:ugeek:
User avatar
Meykota
Registered User
Posts: 30
Joined: Sat Aug 16, 2014 5:19 pm
Location: Leipzig, Germany

Re: [RC] Custom Code

Post by Meykota »

What a very nice extension :)
I want to use this for my adsense advertisement, but I've got a question. So is it's possible to hide my ads from my registered users? Only guests shall see those ads. Would be great :)
User avatar
thunderchero
Registered User
Posts: 129
Joined: Sun Nov 03, 2013 10:16 pm

Re: [RC] Custom Code

Post by thunderchero »

Meykota wrote:What a very nice extension :)
I want to use this for my adsense advertisement, but I've got a question. So is it's possible to hide my ads from my registered users? Only guests shall see those ads. Would be great :)
you should be able to use something like this

Code: Select all

<!-- IF S_USER_LOGGED_IN -->
"your code"
<!-- ENDIF -->
thunderchero
User avatar
Galixte de EzCom
Registered User
Posts: 1106
Joined: Mon Oct 04, 2004 11:14 pm
Location: France
Name: Raphaël M.

Re: [RC] Custom Code

Post by Galixte de EzCom »

Hi,

more like this:

Code: Select all

<!-- IF not S_USER_LOGGED_IN and not S_IS_BOT -->
"your code"
<!-- ENDIF -->
To add Google Adsense, see this post (search in Use case: Google Adsense): viewtopic.php?f=456&t=2275361#p13809226.
Communau EzCom
📖 « Traductions d’extensions & styles pour phpBB 3.2.x & 3.3.x ».
📋 Lists of all extensions identified for phpBB 3.1.x & 3.2.x.
📋 Lists of all styles identified for phpBB 3.1.x & 3.2.x.
Image Tu as un forum et tu veux aussi un site web ? Regarde par ici.
User avatar
tahoebuff
Registered User
Posts: 1429
Joined: Tue Jul 20, 2004 12:33 am
Location: Nevada
Name: Michael

Re: [RC] Custom Code

Post by tahoebuff »

I tried out the welcome message example, adding the register button to it. It looks real good on the style used (Elegance). What should I add to the code in order to create padding between the content and border? You can see my problem below:
Image

Current Code:

overall_header_content_before.html

Code: Select all

<!-- Welcome message -->
<!-- IF not S_USER_LOGGED_IN and SCRIPT_NAME == 'index' -->
<div class="post welcome">
   <h2>My content</h2>
<p>More of my content</p>
   <!-- IF S_REGISTER_ENABLED -->
<a class="button" href="{U_REGISTER}">{L_REGISTER}</a>
   <!-- ENDIF -->
</div>
<!-- ENDIF -->
overall_header_stylesheets_after.html

Code: Select all

<!-- Welcome styling -->
<style>
div.welcome
{
   border: 1px solid #444466;
}
</style>
User avatar
Galixte de EzCom
Registered User
Posts: 1106
Joined: Mon Oct 04, 2004 11:14 pm
Location: France
Name: Raphaël M.

Re: [RC] Custom Code

Post by Galixte de EzCom »

tahoebuff wrote:...

overallheader_stylesheets_after.html

Code: Select all

<!-- Welcome styling -->
<style>
div.welcome
{
   border: 1px solid #444466;
   padding: 5px;
}
</style>
I guess that will be enough.

You can search yourself when you know the attribute name which you have to use in the CSS, see that: http://www.w3schools.com/cssref/pr_padding.asp.
Communau EzCom
📖 « Traductions d’extensions & styles pour phpBB 3.2.x & 3.3.x ».
📋 Lists of all extensions identified for phpBB 3.1.x & 3.2.x.
📋 Lists of all styles identified for phpBB 3.1.x & 3.2.x.
Image Tu as un forum et tu veux aussi un site web ? Regarde par ici.
User avatar
tahoebuff
Registered User
Posts: 1429
Joined: Tue Jul 20, 2004 12:33 am
Location: Nevada
Name: Michael

Re: [RC] Custom Code

Post by tahoebuff »

Galixte de EzCom wrote:
tahoebuff wrote:...

overallheader_stylesheets_after.html

Code: Select all

<!-- Welcome styling -->
<style>
div.welcome
{
   border: 1px solid #444466;
   padding: 5px;
}
</style>
I guess that will be enough.

You can search yourself when you know the attribute name which you have to use in the CSS, see that: http://www.w3schools.com/cssref/pr_padding.asp.
That did the trick. Thanks a bunch!
User avatar
Meykota
Registered User
Posts: 30
Joined: Sat Aug 16, 2014 5:19 pm
Location: Leipzig, Germany

Re: [ALPHA] Custom Code

Post by Meykota »

I have this message after editing viewtopic_body_postrow_post_after.html. I tried to put google adsense into my forum, but didn't work. While this message is active there are no other posts after the first one in topic. Also our pages from the pages-extension aren't shown.

What can I do to solve this problem? :)

Code: Select all

Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unexpected end of template in "../../../../../../store/customcode/viewtopic_body_postrow_post_after.html" at line 16' in /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/TokenStream.php:60 Stack trace: #0 /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/TokenParser/If.php(47): Twig_TokenStream->next() #1 /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/Parser.php(191): Twig_TokenParser_If->parse(Object(Twig_Token)) #2 /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/Parser.php(99): Twig_Parser->subparse(NULL, false) #3 /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/Environment.php(479): Twig_Parser->parse(Object(Twig_TokenStream)) #4 /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/Environment.php(529): Twig_Environment->parse(Object(Twig_TokenStream)) #5 /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/Environment.php(323): Twig_Environment->compileSource('<!-- Google ads...', '../../../../../...') #6 /www/htdocs/w011ec29/phpbb/template/twig/environment.php(151): Twig in /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/TokenStream.php on line 60
User avatar
javiexin
Code Contributor
Posts: 1157
Joined: Wed Oct 12, 2011 11:46 pm
Location: Madrid, Spain
Name: Javier

Re: [ALPHA] Custom Code

Post by javiexin »

Meykota wrote:What can I do to solve this problem? :)
Easy:
Meykota wrote:I have this message after editing viewtopic_body_postrow_post_after.html...
Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unexpected end of template in "../../../../../../store/customcode/viewtopic_body_postrow_post_after.html" at line 16' ...
Remove the code you just inserted, it will work again.
And before inserting it back, fix it. It might be some unclosed condition or something like that. Not seeing the code it is impossible to say more.
User avatar
martti
Registered User
Posts: 914
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [ALPHA] Custom Code

Post by martti »

Meykota wrote:I have this message after editing viewtopic_body_postrow_post_after.html. I tried to put google adsense into my forum, but didn't work. While this message is active there are no other posts after the first one in topic. Also our pages from the pages-extension aren't shown.

What can I do to solve this problem? :)

Code: Select all

Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unexpected end of template in "../../../../../../store/customcode/viewtopic_body_postrow_post_after.html" at line 16' in /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/TokenStream.php:60 Stack trace: #0 /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/TokenParser/If.php(47): Twig_TokenStream->next() #1 /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/Parser.php(191): Twig_TokenParser_If->parse(Object(Twig_Token)) #2 /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/Parser.php(99): Twig_Parser->subparse(NULL, false) #3 /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/Environment.php(479): Twig_Parser->parse(Object(Twig_TokenStream)) #4 /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/Environment.php(529): Twig_Environment->parse(Object(Twig_TokenStream)) #5 /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/Environment.php(323): Twig_Environment->compileSource('<!-- Google ads...', '../../../../../...') #6 /www/htdocs/w011ec29/phpbb/template/twig/environment.php(151): Twig in /www/htdocs/w011ec29/vendor/twig/twig/lib/Twig/TokenStream.php on line 60
You have an error in the code you inserted (maybe you didn't close the <script> tag). If you can not reach the ACP anymore, then you can edit the file customcode/viewtopic_body_postrow_post_after.html with your favourite text-editor (Notepad++, Geany, ...) directly.

Return to “Abandoned Extensions”