parse bbcode in Custom Profile Fields

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Suggested Hosts
Post Reply
User avatar
alex75
Registered User
Posts: 300
Joined: Sun Jun 10, 2012 9:09 am
Location: Italy
Name: Alessandro
Contact:

parse bbcode in Custom Profile Fields

Post by alex75 » Sun Jul 19, 2015 6:18 pm

Parse BBCode in Custom Profile Fields. In ViewTopic and ViewProfile

This mod: https://www.phpbb.com/customise/db/mod/ ... le_fields/

User avatar
alex75
Registered User
Posts: 300
Joined: Sun Jun 10, 2012 9:09 am
Location: Italy
Name: Alessandro
Contact:

Re: parse bbcode in Custom Profile Fields

Post by alex75 » Mon Jul 20, 2015 6:27 pm

this mod it's very simple:

Open: includes/functions_profile_fields.php
Find

Code: Select all

foreach ($field_data as $user_id => $row)
 {
Add after

Code: Select all

$uid = $bitfield = $options = '';
$allowed_bbcode = $allowed_smilies = $allowed_urls = true;

generate_text_for_storage($row['pf_' . $used_ident], $uid, $bitfield, $options, $allowed_bbcode, $allowed_smilies, $allowed_urls);
$row['pf_' . $used_ident] = generate_text_for_display($row['pf_' . $used_ident], $uid, $bitfield, $options);
but includes/functions_profile_fields.php don't exist in phpbb 3.1.x

I tryed and works in file phpbb\profilefields\manager.php

how to transform this mod in extension?

User avatar
javiexin
Code Contributor
Posts: 1157
Joined: Wed Oct 12, 2011 11:46 pm
Location: Madrid, Spain
Name: Javier
Contact:

Re: parse bbcode in Custom Profile Fields

Post by javiexin » Mon Jul 20, 2015 7:24 pm

Not so easy...

The existing events in profilefields/manager are not quite what is needed.

The real way to solve this would be to implement the change in the actual profilefields.

I guess you would only need this in the "string" and "text" types of profilefields. If that is the case, you could just change string_common, and that would do it, five lines of code.

However, to do it in an extension, you would have to do the following: create new profilefield types that do process bbcodes, one for strings and one for texts (at least), and then assign whatever profilefield you want to have processed to these new types.

I might include this function in my Advanced Profile Fields extension. However, it will not be immediately, it will have to wait for now. And what I will not include is a migration tool: you will have to do it manually.

Hope this helps,
-javiexin

User avatar
alex75
Registered User
Posts: 300
Joined: Sun Jun 10, 2012 9:09 am
Location: Italy
Name: Alessandro
Contact:

Re: parse bbcode in Custom Profile Fields

Post by alex75 » Mon Jul 20, 2015 8:11 pm

I understand.
I thank you for your interest.
it can help you, the previous version of this mod (1.0.5) still working in phpbb 3.1.x, was so:

Open: memberlist.php
Find

Code: Select all

include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
Add after

Code: Select all

include_once($phpbb_root_path . 'includes/functions_content.' . $phpEx);
Find

Code: Select all

foreach ($profile_fields['blockrow'] as $field_data)
{
Add after

Code: Select all

$uid = $bitfield = $options = '';
$allowed_bbcode = $allowed_smilies = $allowed_urls = true;

generate_text_for_storage($field_data["PROFILE_FIELD_VALUE"], $uid, $bitfield, $options, $allowed_bbcode, $allowed_smilies, $allowed_urls);
$field_data["PROFILE_FIELD_VALUE"] = generate_text_for_display($field_data["PROFILE_FIELD_VALUE"], $uid, $bitfield, $options);

Open: viewtopic.php
Find

Code: Select all

include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
Add after

Code: Select all

include_once($phpbb_root_path . 'includes/functions_content.' . $phpEx);
Find

Code: Select all

foreach ($cp_row['blockrow'] as $field_data)
{
Add after

Code: Select all

$uid = $bitfield = $options = '';
$allowed_bbcode = $allowed_smilies = $allowed_urls = true;

generate_text_for_storage($field_data["PROFILE_FIELD_VALUE"], $uid, $bitfield, $options, $allowed_bbcode, $allowed_smilies, $allowed_urls);
$field_data["PROFILE_FIELD_VALUE"] = generate_text_for_display($field_data["PROFILE_FIELD_VALUE"], $uid, $bitfield, $options);

Post Reply

Return to “Extension Requests”

Who is online

Users browsing this forum: No registered users and 11 guests