Warning: The author of this contribution does not provide support for it anymore.

Parse BBCode in Custom Profile Fields

How to update for 3.1.x - Parse BBCode in Custom Profile Fields

How to update for 3.1.x

by Sequor » Wed Sep 30, 2015 6:02 am

UPDATE - It seems that the code is conflicting with the 'phpbb_website' profile field. I'm checking into this now, but in the meantime, you can simply uncheck the 'Display profile field as a contact field' checkbox and it'll display fine, albeit in a new area.

NOTE:
  • This has been tested on 3.1.6; I cannot guarantee that it'll work on later versions.
  • Should this file be updated in a later version, the code may be removed; you may have to reapply it after updating.
  • The code snipit seems to be affecting the 'website' profile field. I'm looking into this to see where it conflicts.


The original 3.0.x modification can work on 3.1.x, but it requires you to manually edit
the file (there's only one to edit).

I've sent trefex a message about attempting to compile this into an extension,
but until then, here's how you can utilize this.



1. Open: phpbb/profilefields/manager.php

2. Find:

Code: Select all

foreach ($field_data as $user_id => $row)


3. Add after (on a new line):

Code: Select all

/**
* BEGIN CUSTOM PROFILE FIELD BBCODE SNIPIT
*/
         
         $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);
         
/**
* END CUSTOM PROFILE FIELD BBCODE SNIPIT
*/         


4. Save file.

5. Purge the cache.

It should now be successfully installed. If you have any problems with this,
simply reply below.
User avatar
Sequor
Registered User
Posts: 67
Joined: Sat Nov 14, 2009 8:21 pm
Location: USA
Contact:

Re: How to update for 3.1.x

by Talk19Zehn » Wed Sep 30, 2015 11:37 am

My first TEST(!) phpBB-3.1.6

Hi Sequor, I get this error into the profil-display after I have made your adaptation:

parsebbcodecpfmanagerphp.jpg


Can you help again?

Best regards
Currently occasionally online .. ♪ ♫ Best regards
Talk19Zehn
Registered User
Posts: 249
Joined: Tue Aug 09, 2011 1:10 pm

Re: How to update for 3.1.x

by alex75 » Mon Oct 05, 2015 7:35 pm

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

Re: How to update for 3.1.x

by Sequor » Sat Oct 10, 2015 2:59 am

Talk19Zehn wrote:My first TEST(!) phpBB-3.1.6

Hi Sequor, I get this error into the profil-display after I have made your adaptation:

parsebbcodecpfmanagerphp.jpg


Can you help again?

Best regards


As I said in the first post, it conflicts with the website field being in the contacts area.
To fix this, visit the Custom Profile Fields section in the ACP, open the 'phpbb_website' field,
and deselect the 'Display field in contacts field' checkbox. Save and it should move it to the middle
field, and be displayed properly.
User avatar
Sequor
Registered User
Posts: 67
Joined: Sat Nov 14, 2009 8:21 pm
Location: USA
Contact:

Re: How to update for 3.1.x

by Sequor » Sat Oct 10, 2015 3:33 am



I'm going to give this a try, and if it does work, I'll attempt to incorporate the method
into the extension I'm developing. I appreciate you pointing it out!

Edit: Method works perfectly. Looks like I'll be working on this, then.
User avatar
Sequor
Registered User
Posts: 67
Joined: Sat Nov 14, 2009 8:21 pm
Location: USA
Contact:

Re: How to update for 3.1.x

by potku » Thu Sep 01, 2016 2:06 pm

Okay, that's a good fix. :)

It worked on localhost, but on our live board, the profile fields that have BBCode in them, do not show up in viewtopic. They can be seen in userprofile, though.

Localhost and live board have the same EXTs.

What could be causing this?
Potku.net

"Before I speak, I have something important to say."

- Groucho Marx
User avatar
potku
Registered User
Posts: 705
Joined: Wed Dec 22, 2004 10:26 pm
Location: Tampere, Finland
Contact:

Re: How to update for 3.1.x

by Sequor » Mon Sep 12, 2016 11:24 pm

I'm not exactly sure. As far as I'm aware, this was originally designed for the user's profile only. It wasn't mean to be used in viewtopic. I'm sorry for not getting back to you earlier, and I wish I could be of more help.
User avatar
Sequor
Registered User
Posts: 67
Joined: Sat Nov 14, 2009 8:21 pm
Location: USA
Contact:

Re: How to update for 3.1.x

by IndiferenteJack » Wed Nov 08, 2017 1:43 am

Hi, after trying a lot of times I deleted allowed_smilies and allowed_urls and there is no more conflict with 'phpbb_website', urls are working fine without the bbcode but smilies dont. This was my little solution and it works for me, thanks :)

Find

Code: Select all

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

Code: Select all

/**
* BEGIN CUSTOM PROFILE FIELD BBCODE SNIPIT
*/
      	$uid = $bitfield = $options = '';
        $allowed_bbcode = true;

        generate_text_for_storage($row['pf_' . $used_ident], $uid, $bitfield, $options, $allowed_bbcode);
        $row['pf_' . $used_ident] = generate_text_for_display($row['pf_' . $used_ident], $uid, $bitfield, $options);
        
/**
* END CUSTOM PROFILE FIELD BBCODE SNIPIT
*/
IndiferenteJack
Registered User
Posts: 2
Joined: Thu May 25, 2017 12:22 am
Contact: