Custom Profile Fields Not Working

Started by NextLevelSMF, November 29, 2015, 05:45:38 AM

Previous topic - Next topic

NextLevelSMF

I want custom profile fields to be required on register and to remain in the profile, and I wanted to display these in the ticket details box (pictured). For some reason, despite setting these up, no one has access to the custom profile fields.

Also your uploads directory is not writable for attachments here or for avatars so I cannot actually show you what I mean.
Next Level SMF - Managed SMF Hosting

tfs

SMF Custom Profile Fields were never designed to show up in SimpleDesk. I've done it before, and somewhere on this forum is a how-to. Let me see if I can locate.

Found it here: https://www.simpledesk.net/community/index.php?topic=1141.msg10852#msg10852

I won't be able to give you much support with it though, as it's been years since I've been into that code.
A good tree cannot bring forth evil fruit, neither can an evil tree bring forth good fruit.

NextLevelSMF

Thank you! Unfortunately I don't have access to that topic.

What sort of alternative is there? I mean I have to know what site the member is talking about and I'd rather they didn't have to enter it each time :). I'm going to have a look at dev versions and if they are using curve instead of core type of templates I'm going to switch to the latest.
Next Level SMF - Managed SMF Hosting

tfs

Quote from: NextLevelSMF on November 30, 2015, 05:09:15 AM
Thank you! Unfortunately I don't have access to that topic.

Oops, sorry. Let me quote the important parts here.

Quote from: tfs on September 03, 2011, 11:28:21 PM
Quote from: SleePy on September 03, 2011, 07:10:25 PM
So you are looking to see the SMF custom profile fields display on tickets?

Yessir!  I'm looking to display fields 1, 2, 8 & 9.

SELECT id_field, col_name, field_name FROM `smf_custom_fields` where I_WANT!

id_field, col_name, field_name
1, cust_organi, Organization Name
2, cust_jobtit, Job Title
8, cust_08, Phone
9, cust_09, Mobile Phone


Quote from: cσσкιє мσηѕтєя on September 06, 2011, 12:11:35 PM
It's never actually sent to the template in that sense but it's there. Just need to be lazy and globalize $memberContext and it's right there.

In SimpleDesk-Display.template.php:

global $memberContext;
print_r($memberContext[$context['ticket']['member']['id']]);


That array will contain cust_organi, cust_jobtit and the rest of them. So you then just need to add them where you want them to be in the template. And of course remove the print_r() line. So to add them right below the username in the ticket details column:

Code (Find) Select
<li id="item_userstarted">
<dl>
<dt><img src="', $settings['default_images_url'], '/simpledesk/user.png" alt="" class="shd_smallicon" /> ', $txt['shd_ticket_user'], ':</dt>
<dd>', $context['ticket']['member']['link'], '</dd>
</dl>
</li>

Code (Add after) Select
<li id="item_organi">
<dl>
<dt><img src="', $settings['default_images_url'], '/simpledesk/user.png" alt="" class="shd_smallicon" />Organization name:</dt>
<dd>', $memberContext[$context['ticket']['member']['id']]['options']['cust_organi'], '</dd>
</dl>
</li>


And so on. As you can see you have to edit each "label" yourself since it doesn't fetch that itself. If that's a problem you need another query to find them, unless I'm being stupid. You also may want to give each of them their own icon instead of user.png.

Quote from: tfs on September 07, 2011, 02:49:21 AM
Looks like the template has a glitch in it.  It looks OK on the screen, in that the custom fields are displayed.

https://www.x.com/helpdesk/index.php?action=helpdesk;sa=ticket;ticket=1454.msg12839
8: Undefined index: cust_09
File: /x/helpdesk/Themes/default/sd_template/SimpleDesk-Display.template.php
Line: 103

https://www.x.com/helpdesk/index.php?action=helpdesk;sa=ticket;ticket=1454.msg12839
8: Undefined index: cust_08
File: /x/helpdesk/Themes/default/sd_template/SimpleDesk-Display.template.php
Line: 96

https://www.x.com/helpdesk/index.php?action=helpdesk;sa=ticket;ticket=1454.msg12839
8: Undefined index: cust_organi
File: /x/helpdesk/Themes/default/sd_template/SimpleDesk-Display.template.php
Line: 89

Quote from: cσσкιє мσηѕтєя on September 07, 2011, 09:47:05 AM
Ah, that's stupid of me. You'll want to make sure they actually have a value first:

',!empty($memberContext[$context['ticket']['member']['id']]['options']['cust_organi']) ? $memberContext[$context['ticket']['member']['id']]['options']['cust_organi'] : '','

That makes sure it only shows if there's something to show, if not it'll just be empty. You can of also put the entire thing in an if statement so it doesn't show the icon and the label either if the field is empty.
A good tree cannot bring forth evil fruit, neither can an evil tree bring forth good fruit.

NextLevelSMF

I just want to let you know this is brilliant, thank you!

I will be implementing it tomorrow and let you know how I go!! Thanks so much for your help!!
Next Level SMF - Managed SMF Hosting

tfs

A good tree cannot bring forth evil fruit, neither can an evil tree bring forth good fruit.