Jump to content

[Solved] Different OOC and Character Profiles


Kyra
 Share

Recommended Posts

I've been trying to figure out how to have different profiles for OOC Accounts versus character accounts. I know this requires If/Else statements and the template conditions plugin (which I have). I'm not quite savvy enough to figure it out though from just those details, and I'm hoping someone can help or point me in the direction of tutorial (I have search the internet, but I am failing to find one). In the same vein as this, I'm also hoping for some direction on how to make it so empty profile fields don't display (we have a lot of custom coding, so the default behavior of mybb no longer works to do this for me).

 

Thanks! 

Discord: Kyra#4524

Link to comment
Share on other sites

How are you differentiating between OOC accounts and IC ones? Are you using two different member groups? (OOC and Character?) Or is it a bunch of different groups for OOC accounts and IC ones? It just helps me work out what the best way to tackle it would be.

Edited by Kit the Human

 

sig.png.30b42565d04d922988370bf14e1447bc.png

PSI: an Occult Investigations RP

Roleplay Architects: Grab a friend (or many friends!) and just write.

You can also find me at:

static-historicalrp.jpg  B8CB4x.png rpabutton.png

Link to comment
Share on other sites

There's a bunch of different user groups for each. For OOC Accounts it's OOC Accounts, banned, no pm, etc; for IC accounts it's all based on where they live and if they need moderator permissions. 

  • Thank you 1

Discord: Kyra#4524

Link to comment
Share on other sites

This code could get ridiculously long but:

 

<if (($memprofile['usergroup'] == 4 || $memprofile['usergroup'] == 9)) then>
  <div style="background: black; color: #efefef">
    <h1>I'm an OOC account</h1>
  </div>
<else>
  <div style="background: white; color: red">
    I'm an IC Account
  </div>
</if>

Basically, you need to add $memprofile['usergroup'] == X for every display group. Where X is the group ID. Make sure to include the or ( || ), so:

 

<if (($memprofile['usergroup'] == 4 || $memprofile['usergroup'] == 9 || $memprofile['usergroup'] == 10 || $memprofile['usergroup'] == 5)) then>

 

It might just be easier to use a custom profile field (assuming your forum hasn't got heaps of members!)

 

So I make a custom profile field that is called "Is this a Character?" and is a radio button with yes and no as the options.

 

Capture.PNG.16de3dcf2afc768cb3cfb946245e2951.PNG

 

And then the code becomes:

 

<if $userfields['fid6'] != yes then>
  <div style="background: black; color: #efefef">
    <h1>Custom Field: I'm an OOC account</h1>
  </div>
  <else>
    <div style="background: white; color: red">
      Custom Field:  I'm an IC Account
    </div>
</if>

 

I'm assuming you're familiar with comparison operators! Give me a yell if you need a more detailed example of what to do. An example of what you would like to achieve would be great!

 

sig.png.30b42565d04d922988370bf14e1447bc.png

PSI: an Occult Investigations RP

Roleplay Architects: Grab a friend (or many friends!) and just write.

You can also find me at:

static-historicalrp.jpg  B8CB4x.png rpabutton.png

Link to comment
Share on other sites

  • 1 month later...

Awesome, this works! We actually have an "Account Type" dropdown of either "OOC Account" or "Horse Account" that I forget about, so this was pretty easy. 

 

Follow up question though, if I want to go make custom profile fields for the OOC Account's, is there a way for me to limit what people see when actually editing their profile? So say they choose "OOC Account" in the initial setup, and then I want them to just see OOC Account related fields - can I do that? 

 

Thanks! 

Edited by Kyra

Discord: Kyra#4524

Link to comment
Share on other sites

Absolutely!

 

I think it'd be easier to do this by display block/none rather than conditional logic and with group IDs rather than through your OOC/Horse Account thing, just because of the way the templates work and to avoid you needing to completely rebuild the edit profile page.

 

Find usercp_profile_profilefields and add the usergroup variable to the fieldset class:

<br />
<fieldset class="trow2 group{$mybb->user['usergroup']}">
<legend><strong>{$lang->additional_information}</strong></legend>
<table cellspacing="0" cellpadding="{$theme['tablespace']}" width="100%">
{$customfields}
</table>
</fieldset>

Save and then go to usercp_profile_customfield and add the custom id field as a class to the table row:

<tr class="ucpfield field{$profilefield['fid']}">
<td>
<span>{$profilefield['name']}</span>:
<br />
<span class="smalltext">{$profilefield['description']}</span>
</td>
</tr>
<tr class="ucpfield field{$profilefield['fid']}">
<td>{$code}</td>
</tr>

Save this.

 

If you have any required fields, or anything you want to keep (like custom titles, away information and so on) go to usercp_profile. Find the fieldset that holds any information that you want to keep and add required to the class:

<fieldset class="trow2 required">
<legend><strong>{$lang->profile_required}</strong></legend>
<table cellspacing="0" cellpadding="{$theme['tablespace']}">
<tr>
<td colspan="2"><span class="smalltext"><strong>{$lang->change_email_notice}</strong></span></td>
</tr>
{$requiredfields}
</table>
</fieldset>

<!---------------------------------- or ------------------------------------------->

<tr class="required">
<td colspan="3"><span class="smalltext">{$lang->birthday}</span></td>
</tr>
<tr>
<td>
<select name="bday1">
<option value="">&nbsp;</option>
{$bdaydaysel}
</select>
</td>
<td>
<select name="bday2">
<option value="">&nbsp;</option>
<option value="1" {$bdaymonthsel['1']}>{$lang->month_1}</option>
<option value="2" {$bdaymonthsel['2']}>{$lang->month_2}</option>
<option value="3" {$bdaymonthsel['3']}>{$lang->month_3}</option>
<option value="4" {$bdaymonthsel['4']}>{$lang->month_4}</option>
<option value="5" {$bdaymonthsel['5']}>{$lang->month_5}</option>
<option value="6" {$bdaymonthsel['6']}>{$lang->month_6}</option>
<option value="7" {$bdaymonthsel['7']}>{$lang->month_7}</option>
<option value="8" {$bdaymonthsel['8']}>{$lang->month_8}</option>
<option value="9" {$bdaymonthsel['9']}>{$lang->month_9}</option>
<option value="10" {$bdaymonthsel['10']}>{$lang->month_10}</option>
<option value="11" {$bdaymonthsel['11']}>{$lang->month_11}</option>
<option value="12" {$bdaymonthsel['12']}>{$lang->month_12}</option>
</select>
</td>
<td>
<input type="text" class="textbox" size="4" maxlength="4" name="bday3" value="{$bday['2']}" />
</td>
</tr>

<!---------------------------------- or -------------------------------->
<td class="required" width="50%" class="trow1" valign="top">
{$customtitle}
{$contactfields}
{$awaysection}
</td>

 

The group bit is just to give us the ability to do a kind of group check and the second is just so we can target the profile field name and descriptions with ease. Without these edits, we could target the actual field with [name="profile_fields[fid2]"] but we'd still be left with the heading and description.

 

Now in your CSS you might do something like this:

/* hide all the fields */

.ucpfield {
  display: none
}

/* but we might want to keep some fields, irregardless of group! */

.required .ucpfield {
  display: block
}

/* display the right fields for the member group */

.group4 .field1 {
  	display: block
}

/* display the right fields for the character group */

.group6 .field2 {
  	display: block
}

Replacing the group number and field IDs with the appropriate numbers, as I'm sure you know!

 

Hope that helps! Let me know if you run into any troubles.

Edited by Kit the Human

 

sig.png.30b42565d04d922988370bf14e1447bc.png

PSI: an Occult Investigations RP

Roleplay Architects: Grab a friend (or many friends!) and just write.

You can also find me at:

static-historicalrp.jpg  B8CB4x.png rpabutton.png

Link to comment
Share on other sites

  • 4 months later...

Took me a little while to sit down and play with this, but I got it all working as expected. Thank you for the help! 

Discord: Kyra#4524

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Guidelines and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.