Attention:

Support Rules and Guidelines
Before you post your support topic, please remember to:
  • Read the support forum rules.
  • Check the wiki and use search to see if your problem can be answered there first.
  • Link your board please, and make sure that the problem on your board is visible to guests or provide a test account.
  • Do not post Board Wrappers and CSS unless requested. With a board link, this is not necessary.
  • Be as descriptive as you can and use as many details as possible when describing your problem.
  • Please briefly mark any links to forums that may not be work-safe.
This will help ensure your support issue will be attended to in a quick and efficient manner.

  ClosedNew TopicNew Poll

 Parent_id and users without a parent account? [SOLVED]
#
I'm slowly working on building up a new skin, and want to use the parent_id variable to link to and send pms to parent accounts as I'll be disabling pms for character accounts.

As it is now, an account that does not have a parent account and uses that variable will default to 0. Is it possible to replace the parent_id with that account's own id, instead? There's probably a way to do this with js/jquery but if there is I'm having a brainfart.

Skin's an eyesore, you've been warned
Parent account - parent_id shows 0
Sub account - parent_id shows 1, which is correct
PM
#
So yes it can be done, first you'll need to make a group for all the parent accounts. Then you'll need to add the normal code to the profile and add the next conditional that will display only for the parent accounts, and use CSS to make the default (non parent accounts code) to hide.

Keep in mind the code you want to hide/show should be inside a div/span container with an unique class.

CODE
<script>if('<!-- |member_group| -->' == 'Parent') { document.write('code here'); } </script>


So, for example using your code:

CODE
<span class="parentinfo ifpacc_<!-- |parent_id| -->">
<b>Roleplayed by: </b>
<a href="index.php?showuser=&lt;!-- |field_3| --&gt;"><!-- |field_2| --></a>
(<a href="/index.php?act=Msg&amp;CODE=04&amp;MID=<!-- |parent_id| -->">PM</a>)
</span>



That should work normally and appear like so, and then for parent accounts:

CODE
<script>if('<!-- |member_group| -->' == 'Parent') { document.write('<span class="parentinfo"><b>Roleplayed by: </b><a href="index.php?showuser=&lt;!-- |field_3| --&gt;"><!-- |field_2| --></a>(<a href="/index.php?act=Msg&amp;CODE=04&amp;MID= <!-- |id| -->">PM</a>)</span>'); }</script>


And make the other part disappear like so:

CODE
.parentinfo {
display:none;
}

.parentinfo.ifpacc_0 {
display:block !important;
}
#
Hmm, it doesn't seem to be working. admin account is still giving 0 for the ID.
PM
#
I noticed a couple of mistakes in my copy + paste, as i was using an older version, this should work better, also i changed the Parent name to Admin so you can see if it works.

Keep in mind you should do a group named Parent or else duplicate the code for each group you want this to work.

CODE
<span class="parentinfo ifpacc_<!-- |parent_id| -->">
<b>Roleplayed by: </b>
<a href="/index.php?showuser=&<!-- |parent_id| -->"><!-- |field_2| --></a>
(<a href="/index.php?act=Msg&amp;CODE=04&amp;MID=<!-- |parent_id| -->">PM</a>)
</span>




CODE
<script>if('<!-- |group| -->' == 'Admin') { document.write('<span class="parentinfo"><b>Roleplayed by: </b><a href="/index.php?showuser=&<!-- |id| -->"><!-- |field_2| --></a>(<a href="/index.php?act=Msg&amp;CODE=04&amp;MID= <!-- |id| -->">PM</a>)</span>'); }</script>


I think the CSS should not change, but i am a little ill at the moment, my mind is slow.
#
That version works!

Just had to switch the CSS styles.

CODE
.parentinfo {
display:block;
}

.parentinfo.ifpacc_0 {
display:none!important;
}


Thank you so much, been wanting to do this for a while.
PM
#
In the event that it is not convenient to move all of your known parent accounts to a group, you could just check for '0' on parent_id and print author_id if it is zero.

CODE
<script>if('<!-- |parent_id| -->' == '0') { document.write('<!-- |id| -->'); } else {document.write('<!-- |parent_id| -->');}</script>

signature
email: admin@jcink.com :: blog: John C.
#
That works as well. Thank you both.
PM
#
This topic has been solved. If you need anymore help please post a new thread. Thanks for choosing Jcink services.

signature
email: admin@jcink.com :: blog: John C.
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Share this topic:
« Next Oldest | General Support | Next Newest »

Options ClosedNew TopicNew Poll