Board url in BBCode?

Discussion forum for MOD Writers regarding MOD Development.
User avatar
CheeRees
Registered User
Posts: 92
Joined: Fri Jun 05, 2009 2:13 pm

Board url in BBCode?

Post by CheeRees »

Hello all, I need help with BBCode.
It is possible to generate full board url (generate_board_url();) in BBCode?

Thanks

C.
  • OurTube - YouTube clone for your phpBB !

User avatar
Erik Frèrejean
Former Team Member
Posts: 9899
Joined: Tue Oct 09, 2007 9:09 am
Location: The Netherlands, 3.0.x Support Forum
Name: Erik Frèrejean
Contact:

Re: Board url in BBCode?

Post by Erik Frèrejean »

Not without making an "hardcoded Custom BBCode", you'll have to go into `includes/message_parser.php` and `includes/bbcode.php` and add your custom BBCode to those files. In the custom BBCode system in the ACP you can't use php.
Support Toolkit | Support Request Template | Knowledge Base | phpBB 3.0.x documentation
I don't give support via PM or IM! (all unsolicited pms will be trashed!)

User avatar
CheeRees
Registered User
Posts: 92
Joined: Fri Jun 05, 2009 2:13 pm

Re: Board url in BBCode?

Post by CheeRees »

Erik thanks for fast reply. Or a second idea - maybe with UMIL?

e.g.
BBCode usage: {TEXT}
HTML replacement: http://site.com/phpBB (Already generated url after instalation is done with UMIL)

:?:
Thanks
  • OurTube - YouTube clone for your phpBB !

User avatar
Erik Frèrejean
Former Team Member
Posts: 9899
Joined: Tue Oct 09, 2007 9:09 am
Location: The Netherlands, 3.0.x Support Forum
Name: Erik Frèrejean
Contact:

Re: Board url in BBCode?

Post by Erik Frèrejean »

I've got no idea what UMIL has to do with this. UMIL is a framework that can be used to easily make changes to the database.
Support Toolkit | Support Request Template | Knowledge Base | phpBB 3.0.x documentation
I don't give support via PM or IM! (all unsolicited pms will be trashed!)

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: Board url in BBCode?

Post by 4_seven »

Simple,

make a BBCode

BBCode usage

Code: Select all

[board_url][/board_url] 
HTML replacement

Code: Select all

<span>{L_BOARD_URL}</span> 
then open

language/en/viewtopic.php

find

Code: Select all

$lang = array_merge($lang, array( 
after add

Code: Select all

    'BOARD_URL'         => generate_board_url(), 
thats it..

---------------------------------------------
ACP -> Posting -> BBCodes wrote:Within the HTML replacement you can also use any language string present in your language/ directory like this: {L_<STRINGNAME>} where <STRINGNAME> is the name of the translated string you want to add. For example, {L_WROTE} will be displayed as “wrote” or its translation according to user’s locale.

User avatar
CheeRees
Registered User
Posts: 92
Joined: Fri Jun 05, 2009 2:13 pm

Re: Board url in BBCode?

Post by CheeRees »

Thanks 4_seven, but it does not work. Simple language (L_WROTE) yes, but php not. Any ideas? Thanks :)
  • OurTube - YouTube clone for your phpBB !

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: Board url in BBCode?

Post by 4_seven »

shure it works, check the instruction again. may clear all board and browser-caches
also note, that it works this way only in viewtopic area (normally for posts)

topic demo: http://4seven.kilu.de/phpbb3/viewtopic. ... 1604#p1604

posting demo: http://4seven.kilu.de/phpbb3/posting.ph ... f=11&t=429 (click on [board_url] )

User avatar
CheeRees
Registered User
Posts: 92
Joined: Fri Jun 05, 2009 2:13 pm

Re: Board url in BBCode?

Post by CheeRees »

Sorry, it works fine. Thanks ;)
  • OurTube - YouTube clone for your phpBB !

User avatar
Erik Frèrejean
Former Team Member
Posts: 9899
Joined: Tue Oct 09, 2007 9:09 am
Location: The Netherlands, 3.0.x Support Forum
Name: Erik Frèrejean
Contact:

Re: Board url in BBCode?

Post by Erik Frèrejean »

4_seven wrote:Simple,

make a BBCode

BBCode usage

Code: Select all

[board_url][/board_url] 
HTML replacement

Code: Select all

<span>{L_BOARD_URL}</span> 
then open

language/en/viewtopic.php

find

Code: Select all

$lang = array_merge($lang, array( 
after add

Code: Select all

    'BOARD_URL'         => generate_board_url(), 
thats it..

---------------------------------------------
ACP -> Posting -> BBCodes wrote:Within the HTML replacement you can also use any language string present in your language/ directory like this: {L_<STRINGNAME>} where <STRINGNAME> is the name of the translated string you want to add. For example, {L_WROTE} will be displayed as “wrote” or its translation according to user’s locale.
You're correct, didn't think to that possibility. Only keep in mind that you make this change to all languages when you use multiple languages on your board.
Support Toolkit | Support Request Template | Knowledge Base | phpBB 3.0.x documentation
I don't give support via PM or IM! (all unsolicited pms will be trashed!)

cino10
Registered User
Posts: 3
Joined: Mon Nov 01, 2010 3:37 pm

Re: Board url in BBCode?

Post by cino10 »

how to do the same with username instead of board_url?
4_seven wrote:Simple,

make a BBCode

BBCode usage

Code: Select all

[board_url][/board_url] 
HTML replacement

Code: Select all

<span>{L_BOARD_URL}</span> 
then open

language/en/viewtopic.php

find

Code: Select all

$lang = array_merge($lang, array( 
after add

Code: Select all

    'BOARD_URL'         => generate_board_url(), 
thats it..

---------------------------------------------
ACP -> Posting -> BBCodes wrote:Within the HTML replacement you can also use any language string present in your language/ directory like this: {L_<STRINGNAME>} where <STRINGNAME> is the name of the translated string you want to add. For example, {L_WROTE} will be displayed as “wrote” or its translation according to user’s locale.

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: Board url in BBCode?

Post by 4_seven »

[Snippet] Username Button

with this solution you kill two flys with one clap:
- you need no bbcode
- the username txt is quotable
- also good for admin/mod edits in userpost (admin say: bla bla)

just click on the [Username] button and your name will be inserted.

Image

open

posting.php

find

Code: Select all

    'USERNAME'                => ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '', 
after add

Code: Select all

    'POSTNAME'                => (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : $user->lang['GUEST']), 
open

styles/prosilver/template/posting_buttons.html

find

Code: Select all

    <!-- END custom_tags --> 
after add

Code: Select all

    <input type="button" class="button2" name="{POSTNAME}" value="{L_USERNAME}" onclick="insert_text('{POSTNAME}')" title="" /> 
clear all caches

have fun
Current Mods | Mod Base | php(BB) programming | No help via PM

cino10
Registered User
Posts: 3
Joined: Mon Nov 01, 2010 3:37 pm

Re: Board url in BBCode?

Post by cino10 »

thx, but i mean the username or userID of the user who is currently viewing the post. Is it possible with a hidden bbcode? i want to post some affiliate links and use the userID as subid.

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: Board url in BBCode?

Post by 4_seven »

more concrete as in your first post..

here you go..

[Snippet] Topic Viewer BBCode

make a bbcode
BBCode usage

Code: Select all

[topic_viewer][/topic_viewer] 
HTML replacement

Code: Select all

{L_TOPIC_VIEWER} 
Help line

Code: Select all

[topic_viewer][/topic_viewer] =  Insert the username of topic_viewer
open

language/en/viewtopic.php

find

Code: Select all

$lang = array_merge($lang, array( 
before add

Code: Select all

global $user; 
find (again)

Code: Select all

$lang = array_merge($lang, array( 
after add

Code: Select all

    'TOPIC_VIEWER'      => (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : $user->lang['GUEST']), 
alternative with user_id

Code: Select all

    'TOPIC_VIEWER'      => $user->data['user_id'], 
clear all caches

notes:
- edit all available languages
- anonymous is 'Guest'

demo: http://4seven.kilu.de/phpbb3/viewtopic.php?p=1642#p1642
Current Mods | Mod Base | php(BB) programming | No help via PM

cino10
Registered User
Posts: 3
Joined: Mon Nov 01, 2010 3:37 pm

Re: Board url in BBCode?

Post by cino10 »

many thanks, it works fine :P
i added both bbcodes, topic_viewer and topic_viewerid

Code: Select all

global $user;
$lang = array_merge($lang, array(
	'TOPIC_VIEWER'      => (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : $user->lang['GUEST']), 
	'TOPIC_VIEWERID'      => $user->data['user_id'],

lqdmindz
Registered User
Posts: 226
Joined: Sat Apr 10, 2010 8:40 am

Re: Board url in BBCode?

Post by lqdmindz »

Hi seven,

Is it possible to make a button right next to the QUOTE button that reads @....And what it does, like the quote button, is it adds the user from that posts' ID to the reply text editor.

This way when replying to someone that posted in a while back that will know you are directing the post at them.

Locked

Return to “[3.0.x] MOD Writers Discussion”