Page 1 of 1

Custom Profile Field value as BBcode

PostPosted: 01 Feb 2013, 14:12
by Mess
4seven, a few years ago you made a snippet for posting CPFs as bbcode. And posted it on phpbb.com. I stubled across it while searching on google.
I need it to insert the posters CPF instead of the readers. Is that something you can fix, and is willing to? :)

Here is the post: https://www.phpbb.com/community/viewtop ... &t=2122964

4_seven wrote:Example: Here you can see, what a viewer set in his CPF "Car"
http://4seven.kilu.de/phpbb3/viewtopic. ... 1845#p1845
- un: utest / pw: testtest
- change the CPF "Car" in UCP.
Guests see: "You have no car"

---------------------

make a bbcode

bbcode
Code: Select all
[customer_id][/customer_id]


replacement
Code: Select all
<a href="http://www.xyz.com/support?{L_CUSTOMER_ID}">www.xyz.com/support?{L_CUSTOMER_ID}</a>


open

language/en/viewtopic.php

find

Code: Select all
$lang = array_merge($lang, array(


replace with

Code: Select all
// Display CPF Value of Topic-Viewer via BBCode / 4seven / 2011
global $db, $user;
$sql = 'SELECT pf_customer_id
        FROM '
 . PROFILE_FIELDS_DATA_TABLE . '
        WHERE user_id = '
 . (int) $user->data['user_id'];
        $result = $db->sql_query($sql, 3600);
        $row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);   
     
$customer_id 
= (isset($row['pf_customer_id'])) ? $row['pf_customer_id'] : false;        
// Display CPF Value of Topic-Viewer via BBCode / 4seven / 2011

$lang = array_merge($lang, array(

     // Display CPF Value of Topic-Viewer via BBCode / 4seven / 2011
     'CUSTOMER_ID'        => ($customer_id) ? $customer_id : 0,
     // Display CPF Value of Topic-Viewer via BBCode / 4seven / 2011                   


change all instances of pf_customer_id to your tablefield name

-------------------------------------

note:
- if you want to have a preview in posting-box, make the same change to language/en/posting.php
- if you have more languages, make this change to all relevant language files

Re: Custom Profile Field value as BBcode

PostPosted: 03 Feb 2013, 01:43
by 4seven
    May a prototype

  • Go to your profile, fill out the CPF "Test".
  • Make a testpost here: viewtopic.php?f=14&t=265
    (Use the BBCode button >> [custom]).
  • Use the normal [Preview] Button, not the new jQ Preview Engine*
    *because jQ Preview needs a customizing for that

Re: Custom Profile Field value as BBcode

PostPosted: 04 Feb 2013, 20:12
by 4seven
The CPF "Test" you find here

cpf_test.png

Re: Custom Profile Field value as BBcode

PostPosted: 06 Feb 2013, 00:45
by Mess
CPF not visible to me. :(

Re: Custom Profile Field value as BBcode

PostPosted: 06 Feb 2013, 02:07
by 4seven
I dont noticed that, because as mod/admin i saw all fields

Code: Select all
ACP > CPF > Visibility options >
Display in user control panel
The user is able to change this profile field within the user control panel [x]

Now you should see it.

Re: Custom Profile Field value as BBcode

PostPosted: 06 Feb 2013, 14:53
by Mess
Works! :D

Re: Custom Profile Field value as BBcode

PostPosted: 25 Feb 2013, 12:33
by Mess
Crossing my fingers this will get released. :)

Re: Custom Profile Field value as BBcode

PostPosted: 25 Feb 2013, 15:05
by 4seven
You ask, if this is possible and not, if i can build a mod for you. So its currently a proof of concept.