converting code from wp to phpbb

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
greenwingmacaws2
Registered User
Posts: 14
Joined: Mon May 16, 2022 2:18 pm

Re: converting code from wp to phpbb

Post by greenwingmacaws2 »

thanks for your help guys
<a href="mailto:?subject={TOPIC_TITLE}&body={CURRENT_URL}" target="_blank"> this works
just added a line to functions,php

Code: Select all

'CURRENT_URL'	                 	=> generate_board_url(true) . '/' . $user->page['page'],
User avatar
warmweer
Jr. Extension Validator
Posts: 11268
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Re: converting code from wp to phpbb

Post by warmweer »

With custom coding:
ALWAYS keep track of what you've done since the recommended update/grade will overwrite your edits, so you'll have to reapply those.
Also be aware that custom code may or may not function as intended/expected in the next version(s). (in this case it probably will).
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
AmigoJack
Registered User
Posts: 6113
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: converting code from wp to phpbb

Post by AmigoJack »

Kailey wrote: Tue May 17, 2022 1:49 pm

Code: Select all

append_sid
Adding a SID to a URI that will land in an email which most likely is sent to a different person than the sender makes no sense at all. It's more like weakening security.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
greenwingmacaws2
Registered User
Posts: 14
Joined: Mon May 16, 2022 2:18 pm

Re: converting code from wp to phpbb

Post by greenwingmacaws2 »

this enables anyone to share any post from my website by email, the email is sent from the users own email and not my website. so im not seeing a security issue here and i am not enabling spammers to access my sites email.
If anyone would likw to check this out in just a few simple steps
open /styles/prosilver/template/viewtopic_body.html and find this

Code: Select all

<!-- END postrow -->
and then add this

Code: Select all

<div class="panel">a href="mailto:?subject={TOPIC_TITLE}&body={CURRENT_URL} " target="_blank"> 
<img src="/email.png" border="0" alt="Email" width="40" height="40"></div>
you will need to upload an email image to the root of your server or modify the image src section above
then go open /includes/functions.php and around line 4000 add the following

Code: Select all

'CURRENT_URL'	                 	=> generate_board_url(true) . '/' . $user->page['page'],
Save these file and upload them , purge the cache from ACP.
and go to any post on your site you will find the email link underneath the post
User avatar
Steve
Registered User
Posts: 1481
Joined: Tue Apr 07, 2009 7:48 pm
Name: Steven Clark
Contact:

Re: converting code from wp to phpbb

Post by Steve »

Wrong post. Sorry :oops:
@ The Chief Medical Officers guideline for men is that: You are safest not to drink regularly more than 14 units per week.
- I drank that today++ :lol: 🍺
User avatar
Steve
Registered User
Posts: 1481
Joined: Tue Apr 07, 2009 7:48 pm
Name: Steven Clark
Contact:

Re: converting code from wp to phpbb

Post by Steve »

I done a big of digging, you could copy root/phpbb/message/topic_forum.php and convert it to email posts quite easily.
@ The Chief Medical Officers guideline for men is that: You are safest not to drink regularly more than 14 units per week.
- I drank that today++ :lol: 🍺
greenwingmacaws2
Registered User
Posts: 14
Joined: Mon May 16, 2022 2:18 pm

Re: converting code from wp to phpbb

Post by greenwingmacaws2 »

a slight addition ;)
just in case anyone is using gmail on an android phone or tablet , gmail does not like the =number in automated urls
my work around for this is

Code: Select all

<a href="mailto:?subject={TOPIC_TITLE}&amp;body='.rawurlencode({CURRENT_URL}).' title="{TOPIC_TITLE}" target="_blank">
<img src="/email.png" border="0" alt="Email" width="40" height="40" >
now the link is sent successfully in gmail.
User avatar
AmigoJack
Registered User
Posts: 6113
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: converting code from wp to phpbb

Post by AmigoJack »

greenwingmacaws2 wrote: Tue May 24, 2022 3:08 pmgmail does not like the =number
I'm pretty sure it's the &, which is neither the entity it needs to be in the HTML context (&amp;), nor being percent-encoded in the URI parameter value context (%25).

greenwingmacaws2 wrote: Tue May 24, 2022 3:08 pm

Code: Select all

<a href="mailto:?subject={TOPIC_TITLE}&amp;body='.rawurlencode({CURRENT_URL}).' title="
Guys, you need to concentrate:
  1. This is invalid HTML: the attribute href begins with a quotation (") but doesn't end with one - its content includes title=.
  2. What if the topic title itself contains &amp;? That will suddenly end your email subject right there and afterwards begin a different URI parameter. Expect an URI that becomes mailto:?subject=Laurel &amp; Hardy=funny&amp;body=https%3A%2F%2Fboard.net%2Fviewtopic.php%3Ft=2620891%26start=15 to see what "encoding" means in each parameter.
  3. You have to mind that you put URI parameters into an URI - if you cannot tell apart parameters from an URI then you're just pushing your luck.
You need to
  1. URL encode any parameter, not just the one for body. Also for subject.
  2. Preferably do that in your extension or PHP file, not the style's generated PHP file, or
  3. as per Twig use {{ TOPIC_TITLE | url_encode(true) }} in your template file instead of {TOPIC_TITLE}.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
Post Reply

Return to “phpBB Custom Coding”