ThistleProse 8 Share Posted September 23, 2019 On 5/23/2019 at 1:05 AM, Kit the Human said: 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. 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> <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! I'm going to start by saying I have nooo idea about any of this type of thing. I'm very literally learning as I break things xD But what I would like to know, is if it is possible to do: <if $userfields['fid45'] != $yes then> <template member_customPF> <else> <div style="background: white; color: red"> <template member_customOOC> </div> </if> You see, I've already made an individual profile for the character accounts (member_customPF) which is pulled by using the template conditionals. Getting it to pull a completely different template if its an OOC account would save me so much time and effort! my problem currently is: 1. if I don't include the '$' before the 'yes' it pops up with errors on the main page: The following warnings occurred: Warning [2] Use of undefined constant yes - assumed 'yes' (this will throw an Error in a future version of PHP) - Line: 57 - File: member.php(2953) : eval()'d code PHP 7.2.22 (Linux) File Line Function /member.php(2953) : eval()'d code 57 errorHandler->error /member.php 2953 eval 2. Regardless of the inclusion of the $ or not, its automatically only pulling the if template, not the else template. I tried using the membergroup method you listed first, but it does the opposite. Parks everything as an OOC account @.@ <if (($memprofile['usergroup'] == 9 || $memprofile['usergroup'] == 10 || $memprofile['usergroup'] == 11 || $memprofile['usergroup'] == 12 || $memprofile['usergroup'] == 13 || $memprofile['usergroup'] == 14)) then> <template member_customPF> <else> <div style="background: white; color: red"> <template member_customOOC> </div> </if> Usergroups 9-14 are the IC accounts; but it has the OOC custom template being shown on them all. Additionally, all the actual OOC accounts also have the OOC custom template being drawn. Please can you tell me where I'm going wrong? lmao. I'm doing something wrong somewhere XD Link to comment Share on other sites More sharing options...
ThistleProse 8 Author Share Posted September 23, 2019 (edited) Update: The membergroup one works! I just had to change everyone's *primary* membergroup away from 'pending'. Is there any way to allow the User to choose their primary membergroup from the offered 'Group Membership' list? Like, members can choose their appropriate character type, which will alter the profile fields available for them to fill in. But they can't say "This is my primary group" they're stuck with the Pending group. I want them to stay in the Pending group, but be able to say "Okay. Group B is my Primary Group" <s>EDIT: Nvm, I found the dumb tiny hidden checkbox 😛</s> Edit Again: Nevermind again; that just changes the display group, not the primary grouping. Is there a way to let them choose their primary group? Edited September 23, 2019 by ThistleProse Link to comment Share on other sites More sharing options...
Kit the Human 757 Share Posted September 23, 2019 There doesn't appear to be! PSI: an Occult Investigations RP Roleplay Architects: Grab a friend (or many friends!) and just write. You can also find me at: Link to comment Share on other sites More sharing options...
ThistleProse 8 Author Share Posted September 24, 2019 Awe, that sucks :( Do you know what I was doing wrong with the Yes/No option to determine what profile to show? If I can get that working, it won’t matter what the primary group is, but with it hardcoded in, the primary group is kind of important, since it determines character vs player. Thanks :D 😮 or is it possible to tell the ‘if member group = group id’ that non-primary groups are also applicable? xD I gotta get back to work. Sorry I’m so all over the place lol. Link to comment Share on other sites More sharing options...
Kit the Human 757 Share Posted September 24, 2019 @Arceus @Morrigan Any ideas why this code: <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"> <template hello> </div> </if> Would work for me but @ThistleProse's version: <if $userfields['fid45'] != $yes then> <template member_customPF> <else> <div style="background: white; color: red"> <template member_customOOC> </div> </if> gives an error if there is no $ in front of the yes? Warning [2] Use of undefined constant yes - assumed 'yes' (this will throw an Error in a future version of PHP) - Line: 57 - File: member.php(2953) : eval()'d code PHP 7.2.22 (Linux) File Line Function /member.php(2953) : eval()'d code 57 errorHandler->error /member.php 2953 eval Could it be related to this? PSI: an Occult Investigations RP Roleplay Architects: Grab a friend (or many friends!) and just write. You can also find me at: Link to comment Share on other sites More sharing options...
Admin Morrigan 1,825 Admin Share Posted September 24, 2019 Well the error is just a warning, advising that probably version 8 it won't work. It shouldn't mean that it's broken but $yes was never defined and PHP likes defined constants. you would need to either wrap the "yes" in double or single quotes so that the PHP knows it's not a constant (or a variable as it were) otherwise $yes needs to be defined. Profile set made by myself and original Artwork by Fae Merriman, my daughter. Link to comment Share on other sites More sharing options...
ThistleProse 8 Author Share Posted September 24, 2019 Okay, so if it’s just “yes” (including quotes) it thinks every account is an OOC one if its “$yes” (including quotes) it thinks every account is an IC one, regardless of which radio button is chosen. How is can I define it, so the php stops having kittens? Link to comment Share on other sites More sharing options...
Kit the Human 757 Share Posted September 24, 2019 there shouldn't be a variable other than $userfields['fid45'] we don't need anymore variables. so no, $yes will never be a solution because we are not defining a variable here. We are just comparing $userfields['fid45'] to 'yes' All I can think of is to double check your radio button options. It absolutely does run through the if's and else's correctly for me. 1 PSI: an Occult Investigations RP Roleplay Architects: Grab a friend (or many friends!) and just write. You can also find me at: Link to comment Share on other sites More sharing options...
Admin Morrigan 1,825 Admin Share Posted September 24, 2019 Also.... php is often case sensitive. So be sure that you're using the proper case. Yes =/= yes in the case of php. Yes=Yes and yes=yes there is no getting around it. 1 Profile set made by myself and original Artwork by Fae Merriman, my daughter. Link to comment Share on other sites More sharing options...
ThistleProse 8 Author Share Posted September 24, 2019 Okay, sooo, I don't know why it works now. But I swapped the two templates around (so if is now else and else is now if), and swapped the 'yes' and 'no' in the radio button choices... and ahh, it works now? <if $userfields['fid45'] != "yes" then> <template member_customOOC> <else> <template member_customPF> </div> </if> I got NFI. But you know. Its working so not going to knock it xD Link to comment Share on other sites More sharing options...
Kit the Human 757 Share Posted September 24, 2019 1 PSI: an Occult Investigations RP Roleplay Architects: Grab a friend (or many friends!) and just write. You can also find me at: Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now