MyBB Community Forums

Full Version: Modified Member Profile - BBC Not Working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello!

I am using the Template Conditionals to create multiple member profiles, depending on membergroup and options selected etc.

The problem that I have run into is that BBC doesn't work in the modified profiles, regardless of the permission being turned 'on' in the custom profile field option.

If I turn on the HTML, and change it to html code instead, it does work. However I do not want to turn on HTML, as I want to have the members using the BBC they're familiar with. Additionally, I don't know if it is part of the impact, but i have YOURCODE installed.

HTML turned on; (the id=# is custom BBC to link to profiles)
[Image: ac0d74e2674243ab2763a8be7457f2bd.png]

BBC turned on;
[Image: 3c3d0ae0ccaf11f0a6f4af6c03977df2.png]


This is what is in my member_profile (amongst some other general prettying code) -:
<if $userfields['fid65'] == "OOC" then>
  <template member_customOOC>
<elseif $userfields['fid65'] == "Dragonrider" then>
<template member_customDragonrider>
<elseif $userfields['fid65'] == "Holderfolk" then>
<template member_customHolderfolk>
<elseif $userfields['fid65'] == "Hallfolk" then>
<template member_customHallfolk> 
<else> 
  <template member_customCandidate>
</if>

Profile in example - scroll about 3/4 of the way down to 'History' wherein you will see the box from the screenshot.

I can provide dumps of the codes in full, from the custom templates or the member_profile. I'm not sure what might be needed and didn't want to flood the topic with unneeded info.

Thank you kindly for your time and any assistance you can offer!

Cheers!
The $userfields array fields remain non parsed, thus you trying to simply use it within your templates won't output what you expect.

HTML will be parsed as it is expected of HTML code inside tempaltes but not BBCode.

Keep the $customfields in your member_profile template and work in the member_profile_customfields* templates instead.
Hello Omar, thanks for your help.

I think I'm misunderstanding you or overall doing something wrong, because even when I work in the member_profile_customfield templates, as soon as I try ot indicate a particular field so I can make the member's profile look the way I want, it loses the ability to parse the BBC.

Is there any way I can tell the $userfields to parse the BBC whenever it is there?
Try using {$customfieldval} in the member_profile_customfield template.

To make $userfields to parse the BBCode where it doesn't by default you will require to either edit some core file, the PHP In Templates version of Template Conditionals to make PHP work directly inside templates or some plugin.
(2020-01-19, 08:24 PM)Omar G. Wrote: [ -> ]Try using {$customfieldval} in the member_profile_customfield template.
Thanks for the suggestion; using this results in the following error:

{$customfieldval['fid30']}
Warning [2] Illegal string offset 'fid30' - Line: 7 - File: member.php(2753) : eval()'d code PHP 7.2.26 (Linux)

Quote:To make $userfields to parse the BBCode where it doesn't by default you will require to either edit some core file, the PHP In Templates version of Template Conditionals to make PHP work directly inside templates or some plugin.

I think editing the PHP Template Conditionals would be best, but i have no idea how to do so. I don't have the monies to pay for someone to make a plugin for me.
Lets see, first of all make sure {$profilefields} is within your member_profile template as it is by default, You will have your normal table. Now, edit member_profile_customfields_field for each field, like so:
<if $customfield['fid'] == '30' then>
<tr>
<td class="{$bgcolor}"><strong>Field #30 name {$customfield['name']}:</strong></td>
<td class="{$bgcolor} scaleimages">Field #30 content {$customfieldval}</td>
</tr>
<else>
<tr>
<td class="{$bgcolor}"><strong>{$customfield['name']}:</strong></td>
<td class="{$bgcolor} scaleimages">{$customfieldval}</td>
</tr>
</if>

Please clarify if this is not what you intend because I'm frankly quite confused by now of exactly what you want to achieve.
I'm very sorry for causing confusion! I likely have done a bad job of explaining myself! I appreciate your attempts to help me, though!!

What I have set up is thus (please let me know if you need further information):

member_profile
The important bit of code in here is the if statement, that determines what template is drawn forth; begins line 108.
<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->profile}</title>
{$headerinclude}
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/report.js?ver=1800"></script>
</head>
<body>
{$header}
	
	<!-- BEGIN PROFILE -->
	<table width="100%" class="tborder" cellpadding="0" cellspacing="0">
		<tr>
			<td valign="center" align="center" class="thead" colspan="2">
				{$formattedname}
			</td>
		</tr>
		<tr class="trow1">
			<td valign="top" align="top" width="250">
				
<!-- BEING MINI-PROFILE AREA-->
<div class="pb_holder" style="margin: 10px;">
<div class="pb_container">
<div class="pb_content"> 

<div class="pb_avatar" style="background:url({$useravatar['image']});"></div>
	
	<div class="pb_info">
<!-- THIS IS THE MINI-AVATAR -->		
	<img src="{$userfields['fid4']}" width="199">
<!-- END OF MINI-AVATAR -->

<center><span class="usertitle">
		
		<!-- USERTITLE- THIS IS THE TEXT THAT
			   APPEARS DIRECTLY BENEATH
		       THE MINI-AVATAR -->
					{$usertitle}
		<!-- END USERTITLE -->
		
</span></center>

<!-- THIS IS THE LINE BREAK -->
		<h1></h1>
<!-- END OF LINE BREAK -->

<div style="padding-left: 10px;">
	
		<!-- PROFILE FIELDS - USE pb_full
			   FOR A FIELD THAT SPANS THE
			   WIDTH OF THE ENTIRE PROFILE,
			   USE pb_half FOR A FIELD THAT 
			   SPANS ONLY HALF -->
					<div class="pb_half">{$memprofile['postnum']} Posts</div>
					<div class="pb_half" style="margin-left: -3px;">{$memprofile['threadnum']} Threads</div>
					<div class="pb_full">{$userfields['fid3']}</div>
					<div class="pb_full">Registered: {$memregdate}</div>
		<!-- END OF PROFILE FIELDS -->
	
</div>

<!-- THIS IS THE LINE BREAK -->
		<h1></h1>
<!-- END OF LINE BREAK -->

<div style="padding-left: 10px;">
	
		<!-- PROFILE LINKS -->
			{$userfields['fid2']}
		<!-- END PROFILE LINKS -->
	
</div>

<!-- THIS IS THE LINE BREAK -->
		<h1></h1>
<!-- END OF LINE BREAK -->

<div class="pb_player">
	
	<!-- PLAYER NAME -->
		{$userfields['fid1']}
	<!-- END PLAYER NAME -->
	
</div>
</div>
</div>
</div>				
<!-- END MINI-PROFILE AREA -->
					
			</td>
			<td valign="top" align="top">
				
				<!-- BEGIN BIOGRAPHY AND ACCOUNT INFORMATION AREA -->
					<table width="98.5%" cellpadding="5" cellspacing="0" style="margin: 10px 10px 10px 0px; height: 400px;">
						<tr>
							<td valign="top" align="top" height="18" class="tcat">
								Biography
							</td>
							<td valign="top" align="top" height="18" class="tcat" width="250">
								Account Information
							</td>
						</tr>
						<tr class="forum_container">
							<td valign="top" align="top">
								<div style="padding-right: 5px; min-height: 310px; text-align: justify;">
									
									<!-- BIOGRAPHY -->
									
									<if $userfields['fid65'] == "OOC" then>
  													<template member_customOOC>
									<elseif $userfields['fid65'] == "Dragonrider" then>
													<template member_customDragonrider>
									<elseif $userfields['fid65'] == "Holderfolk" then>
													<template member_customHolderfolk>
									<elseif $userfields['fid65'] == "Hallfolk" then>
													<template member_customHallfolk>														
									<else>	
		  											<template member_customCandidate>
									</if>
									<!-- END BIOGRAPHY -->
									
								</div>
							</td>
							<td valign="top" align="top">
								
								<!-- ACCOUNT INFORMATION,
									   EACH SEGMENT NEEDS TO HAVE
								       <div class="profile_right"></div>
									   SURROUNDING IT -->
									<div class="profile_right">
										{$online_status}
									</div>
									<div class="profile_right">
										Last seen {$memlastvisitdate}.
									</div>
									<div class="profile_right">
										Local time is {$localtime}.
									</div>
									<div class="profile_right">
										{$formattedname} has written {$memprofile['postnum']} posts. ({$lang->ppd_percent_total}) (<a href="search.php?action=finduser&amp;uid={$uid}">{$lang->find_posts}</a>)
									</div>
									<div class="profile_right">
										{$formattedname} has made {$memprofile['threadnum']} threads. ({$lang->tpd_percent_total}) (<a href="search.php?action=finduserthreads&amp;uid={$uid}">{$lang->find_threads}</a>)
									</div>
									<div class="profile_right">
										Birthday: {$membday} {$membdayage}
									</div>
									<div class="profile_right">
										<a href="private.php?action=send&amp;uid={$memprofile['uid']}">{$lang->send_pm}</a>
									</div>
									<div class="profile_right">
										<a href="member.php?action=emailuser&amp;uid={$memprofile['uid']}">{$lang->send_user_email}</a>
									</div>
								</td>
							</tr>
							<tr>
							<td valign="top" align="top" colspan="2" height="18" class="tfoot">
								<span style="float: right;">
									
									<!-- LINKED ACCOUNTS -->
										<i>Linked Accounts:</i> {$profile_attached}
									<!-- END LINKED ACCOUNTS -->
									
								</span>
							</td>
						</tr>
				</table>
			<!-- END BIOGRAPHY AND ACCOUNT INFORMATION -->
				
			</td>
		</tr>
	</table>
	<!-- END PROFILE -->
	<p>
			{$modoptions}
			{$adminoptions}
			<div style="text-align: center">{$buddy_options}{$ignore_options}{$report_options}</div>
		</td>
	</tr>
</table>
{$footer}
</body>
</html>

member_customCandidate
This is one of the custom templates, called when the if statement applies. This is where the BBC isn't showing up properly, as each individual custom field is called forth, which causes the BBC to not work.
<if $userfields['fid66'] == "No" then>
  													<template member_customDefaultCss>														
									<else>	
														<template member_customCss>
									</if>


<div class="ProfileOutside"><div class="ProfileInside"><div class="ProfileSection">
        <div class="top">
            <div class="ProfileName">{$userfields['fid7']}</div><br />
            <div class="ProfileRank">
                <if $userfields['fid30'] then>
                    <func htmlspecialchars_uni>{$userfields['fid30']} {$userfields['fid4']}</func>
                <elseif $userfields['fid31'] then><func htmlspecialchars_uni>{$userfields['fid31']} {$userfields['fid4']}</func>
                <else />{$userfields['fid4']}</if>
            </div>
        </div>
        <div class="columns picture-left">
            <div class="ProfileImageBox">
                <img src="{$userfields['fid38']}" class="ProfileImage">
                <div class="ProfileImageDesc"><i>{$userfields['fid27']}</i></div>
            </div>
            <div class="col1">
                <div class="ProfileTitle">Full Name:</div><div class="singleheight">{$userfields['fid67']}</div>
				<div class="ProfileTitle">Nicknames:</div><div class="singleheight"> {$userfields['fid68']}</div>
                <div class="ProfileTitle">Date of Birth:</div><div class="singleheight"> {$userfields['fid10']}</div>
                <div class="ProfileTitle">Place of Birth:</div><div class="singleheight"> {$userfields['fid69']}</div>
				<div class="ProfileTitle">Searched By:</div><div class="singleheight"> {$userfields['fid70']}</div>
                <div class="ProfileTitle">Player:</div><div class="singleheight"> {$masteraccount}</div>
            </div>
            <div class="col2">
				<div class="ProfileTitle">Pronounced:</div><div class="singleheight"> {$userfields['fid71']}</div>
                <div class="ProfileTitle">Rank:</div><div class="singleheight"> {$userfields['fid14']}</div>
				<div class="ProfileTitle">Primary Home:</div><div class="singleheight"> {$userfields['fid72']}</div>
                <div class="ProfileTitle">Searched Date:</div><div class="singleheight"> {$userfields['fid73']}</div>
                <div class="ProfileTitle">Inactivity Preference:</div><div class="singleheight"> {$userfields['fid6']}</div>
            </div>
        </div>
    </div><div class="ProfileSection"><div class="top">
	<div class="ProfileTitleMain">Appearance</div>
        </div>
        <div class="columns picture-right">
            <div class="col1">
                <div class="ProfileTitle">Eye Colour:</div><div class="singleheight"> {$userfields['fid23']}</div>
                <div class="ProfileTitle">Height:</div><div class="singleheight"> {$userfields['fid24']}</div>
            </div>
            <div class="col2">
                <div class="ProfileTitle">Hair Colour:</div><div class="singleheight"> {$userfields['fid74']}</div>  
                <div class="ProfileTitle">Build:</div><div class="singleheight"> {$userfields['fid75']}</div>   
            </div>
            <div class="colBoth">
                <div><div class="ProfileTitle">General Description:</div> {$userfields['fid76']}</div>
                </div>
            <div class="colAll">
                <div><div class="ProfileTitle">General Dressing Style:</div> {$userfields['fid77']}</div>
            </div>
            <div class="ProfileImageBox">
                <img src="{$userfields['fid39']}" class="ProfileImage">
                <div class="ProfileImageDesc"><i>{$userfields['fid27']}</i></div>
            </div>
        </div>
    </div>
	
<div class="ProfileSection"><div class="top">
            <div class="ProfileTitleMain">Personality</div>
        </div>
        <div class="columns picture-left">
            <div class="col1">
                <div class="ProfileTitle">Likes:</div><div class="miniheight"> {$userfields['fid78']}</div>
                <div class="ProfileTitle">Strengths:</div><div class="miniheight"> {$userfields['fid79']}</div>
            </div>
            <div class="col2">
                <div class="ProfileTitle">Dislikes:</div><div class="miniheight"> {$userfields['fid81']}</div>  
                <div class="ProfileTitle">Flaws:</div><div class="miniheight"> {$userfields['fid82']}</div>
            </div>
			<div class="colBoth">
			<div><div class="ProfileTitle">Habits & Mannerisms:</div> {$userfields['fid80']}</div>
			</div>
			<div class="colAll2">
                <div><div class="ProfileTitle">General Personality:</div> {$userfields['fid83']}</div>
             </div>
						 <div class="ProfileImageBox">
                <img src="{$userfields['fid40']}" class="ProfileImage">
                <div class="ProfileImageDesc"><i>{$userfields['fid27']}</i></div>
            </div>
        </div>
    </div>
    
    
            <div class="ProfileSection">
        <div class="top">
            <div class="ProfileTitleMain">History</div>
        </div>
        <div class="columns picture-right">
            <div class="col1">
                <div class="ProfileTitle">Parents:</div><div class="miniheight"> {$userfields['fid84']}</div>
                <div class="ProfileTitle">Siblings:</div><div class="miniheight"> {$userfields['fid85']}</div>
                <div class="ProfileTitle">Secrets:</div><div class="miniheight"> {$userfields['fid86']}</div>
                
            </div>
            <div class="col2">
                <div class="ProfileTitle">Relationships:</div><div class="miniheight"> {$userfields['fid87']}</div>  
                <div class="ProfileTitle">Offspring:</div><div class="miniheight"> {$userfields['fid88']}</div> 
                <div class="ProfileTitle">Known:</div><div class="miniheight"> {$userfields['fid89']}</div>
            </div>
            <div class="colAll">
                <div><div class="ProfileTitle">Important History:</div> {$userfields['fid90']}</div>
                
            </div>
            <div class="ProfileImageBox">
                <img src="{$userfields['fid47']}" class="ProfileImage">
                <div class="ProfileImageDesc"><i>{$userfields['fid27']}</i></div>
            </div>
        </div>
    </div>

	<div class="ProfileSection"><div class="top">
            <div class="ProfileTitleMain">Education</div>
        </div>
        <div class="columns picture-left">
            <if $userfields['fid91'] == "Yes" then>
  			<div class="col1">
                <div><div class="ProfileTitle">Craft:</div> {$userfields['fid15']}</div>
                <div><div class="ProfileTitle">Apprenticed:</div> {$userfields['fid17']}</div>
				<div><div class="ProfileTitle">Journeyman:</div> {$userfields['fid17']}</div>
				<div><div class="ProfileTitle">Mastership:</div> {$userfields['fid17']}</div>
            </div>
            <div class="col2">
                <div><div class="ProfileTitle">Specialty:</div> {$userfields['fid16']}</div>  
                <div><div class="ProfileTitle">Strengths:</div> {$userfields['fid18']}</div>
				<div><div class="ProfileTitle">Weaknesses:</div> {$userfields['fid17']}</div>
            </div>
			<div class="colAll2">
                <div><div class="ProfileTitle">Additional Information:</div> {$userfields['fid14']}</div>
             </div>
												<else>	
														<div class="colBoth">
                <div><div class="ProfileTitle">Details:</div> {$userfields['fid14']}</div>
             </div>
									</if>
														
						 <div class="ProfileImageBox">
                <img src="{$userfields['fid40']}" class="ProfileImage">
                <div class="ProfileImageDesc"><i>{$userfields['fid27']}</i></div>
            </div>
        </div>
    </div>
	
	            <div class="ProfileSection">
        <div class="top">
            <div class="ProfileTitleMain">Creator Credits</div>
        </div>
        <div class="columns picture-right">
            <div class="col1">
                <div><div class="ProfileTitle">Character By:</div> {$userfields['fid20']}</div>
                <div><div class="ProfileTitle">Dragon By:</div> {$userfields['fid22']}</div>                
            </div>
            <div class="col2">
                <div><div class="ProfileTitle">Character Artist(s):</div> {$userfields['fid123']}</div>  
                <div><div class="ProfileTitle">Dragon Artist(s):</div> {$userfields['fid24']}</div> 
            </div>
            <div class="ProfileImageBox">
                <img src="{$userfields['fid47']}" class="ProfileImage">
                <div class="ProfileImageDesc"><i>{$userfields['fid27']}</i></div>
            </div>
        </div>
    </div>
	
</div></div>

This is an example of the member_customCandidate template in action, with the failing BBC (the broken image is because I haven't inserted a URL for that one. That works fine when set up). It is using the additional template 'member_customDefaultCss' as I haven't set up the individual userfields for inputting custom hex codes.

[Image: 25d422fb743efff179326fe6afd2a25c.png]
Oh, I see, so you want to use different fields within different areas within the member_profile template. What I told you in my last post would be the best (imo).

I have checked and you can hide fields from profile only.

You are trying to achieve something simple by a complicate way. Get {$profilefields} back to the member_profile template as already suggested, hide fields you don't want to be displayed in profiles and work from there.

What you are trying to achieve I do it to change the forum logo on a per profile basis and I have no issues, it should work. The user logo url is not displayed within their fields but the logo changes anyways.
Hello Omar!

I've tried to use the else-if in the member_profile_customfields_field, but it isn't working properly;

If I turn 'Display on profile? *' on, it put the answer in ALL the {customfieldval} displays, and then repeats the profile multiple times - once for every additional field that is turned 'on' - so one profile of field97, and one profile of field90 etc. If I turn everything 'off', nothing shows up. Everything was turned 'off' by default, because it was showing when I hacked apart the profile in member_profile template, but prevented it from showing up twice when '{$profilefields} was left in.

Here is an example of the codes I tried - I only changed the one to test it.

<div class="ProfileTitle">Relationships:</div><div class="miniheight"> {$userfields['fid87']}</div>
This is the one that works, but doesn't parse BBC

<div class="ProfileTitle">Relationships:</div><div class="miniheight"> <if $customfield['fid'] == "87" then>{$customfieldval}<else>Details Will Go Here</if></div>
<div class="ProfileTitle">Relationships:</div><div class="miniheight"> <if $userfields['fid87'] then>{$customfieldval}<else>Details Will Go Here</if></div>
Both of these ones work, but they also cause the {$profilefields} to repeat, creating multiple chunks of profiles; I've attached a GIF to show you how turning 'on' two 'Display on Profile' has caused said profile to repeat. If I turn more fields on, I get more repeats.

GIF Link

Profile One --- Profile Two:
[Image: 8dae84e073758dd0c57273532b2e4906.png][Image: 816a9cd1089cfa596813d01b61ae1c39.png]
I'm still sure you are going the complicate way and quite don't know how to provide the assistance you need.

Another path, download and install the following plugin:
https://github.com/Sama34/Additional-Set...fields.php

Make sure to remove any default or custom calls to profile fields from your profile template. Now use {$xtpf['fid1']} instead for each field. Did it work? The plugin hasn't been updated since quite some time.