Snickerdoodle 51 Share Posted February 16, 2019 So I've got the character vs. user name thing working everywhere except this one place (except one annoying place that looks better without names anyway xD). It isn't integral, and I know how to remove the names if I have to, but I thought I'd throw it on here before giving up. It's in the particular theme's display.template.php. I'll attach the whole thing, but here's the main bit of code that needs to be altered: echo'<div class="threadthis"> <div class="content"> ', $ava, ' <div class="threadthis_details"> <h3 class="for_title"> ', $context['subject'], ' </h3> <div class="detailS"><i class="fas fa-user"></i> ', (!empty($context['topic_starter_id']) && $context['topic_starter_id']!=0) ? '<a href="'.$scripturl.'?action=profile;u='.$memberContext[$memCommID55]['id'].'">'.$memberContext[$memCommID55]['name'].'</a>' : $txt['guest'], ' · <i class="fas fa-comments"></i> ', $context['total_visible_posts'], ' · <i class="fas fa-eye"></i> ', $context['num_views'], '<div class="nextlinks">', $context['previous_next'], '</div></div> </div> </div> </div>'; Display.template.php We're on Discord! Come say hello! Link to comment Share on other sites More sharing options...
Arceus 1,081 Share Posted February 16, 2019 Okay, so that does a memberContext call to get the username and junk, but memberContext only works on member accounts. To replace it with character accounts, you'd have to do an entirely different code and would probably need about two more in addition to that first one, because you'll first need the starting post's id_character value. Blah blah, this code is not going to play nice with ACM because of how it works. If you want though, I do have one of these set up on my own site, and you can use the code for that and just transpose it into this arrangement or something. I am the darkness, always watching, always listening, ALWAYS THERE. (If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.) Link to comment Share on other sites More sharing options...
Snickerdoodle 51 Author Share Posted February 16, 2019 I was afraid of that. lol Sure, I'll give transposing your code into it a shot. Couldn't hurt to try. No rush, at all. I know you're busy with Gaia 🙂 We're on Discord! Come say hello! Link to comment Share on other sites More sharing options...
Arceus 1,081 Share Posted February 16, 2019 function arcLoadStarter($id_member, $id_topic) { global $smcFunc, $boardurl, $modSettings, $scripturl; $request = $smcFunc['db_query']('',' SELECT t.id_first_msg, m.poster_name, m.poster_time, mem.id_member, mem.real_name, mem.avatar, a.filename, a.id_attach, mg.group_name, mg.online_color, m.id_character, ch.name_first, ch.name_last, ch.image, al.alliance_color, dp.department_color FROM {db_prefix}topics as t LEFT JOIN {db_prefix}messages AS m ON (t.id_first_msg = m.id_msg) LEFT JOIN {db_prefix}members AS mem ON (m.id_member = mem.id_member) LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member) LEFT JOIN {db_prefix}membergroups AS mg ON (mem.id_group = mg.id_group) LEFT JOIN {db_prefix}acm_characters AS ch ON (m.id_character = ch.id_character) LEFT JOIN {db_prefix}acm_alliances AS al ON (ch.id_alliance = al.id_alliance) LEFT JOIN {db_prefix}acm_departments AS dp ON (ch.id_department = dp.id_department) WHERE t.id_topic = {int:current_topic}', array( 'current_topic' => $id_topic, 'current_member' => $id_member ) ); $topic_starter = array(); while($row = $smcFunc['db_fetch_assoc']($request)) { $topic_starter = array( 'id' => (!empty($row['id_character']) ? $row['id_character'] : (!empty($row['id_member']) ? $row['id_member'] : 0)), 'name' => $row['poster_name'], 'href' => !empty($row['id_character']) ? $scripturl.'?action=characters;area=profile;id='.$row['id_character'] : (!empty($row['id_member']) ? $scripturl.'?action=profile;u='.$row['id_member'] : ''), 'link' => !empty($row['id_character']) ? '<a href="'.$scripturl.'?action=characters;area=profile;id='.$row['id_character'].'"'.(!empty($row['department_color']) ? ' style="color: '.$row['department_color'].';"' : (!empty($row['alliance_color']) ? ' style="color: '.$row['alliance_color'].';"' : '')).'>'.$row['name_first']. (!empty($row['name_last']) ? ' '.$row['name_last'] : '').'</a>' : (!empty($row['id_member']) ? '<a href="'.$scripturl.'?action=profile;u='.$row['id_member'].'"'.(!empty($row['online_color']) ? ' style="color: '.$row['online_color'].';"' : '').'>'.$row['real_name'].'</a>' : $row['poster_name']), 'avatar' => array( 'name' => !empty($row['image']) ? $row['image'] : (!empty($row['filename']) ? $row['filename'] : ''), 'href' => !empty($row['image']) ? $boardurl.'/character_images/'.$row['image'] : (!empty($row['avatar']) ? $row['avatar'] : (!empty($row['filename']) ? (!empty($modSettings['custom_avatar_url']) ? $modSettings['custom_avatar_url'].'/'.$row['filename'] : $scripturl.'?action=dlattach;attach='.$row['id_attach'].';type=avatar') : '')), 'image' => !empty($row['image']) ? '<img src="'.$boardurl.'/character_images/'.$row['image'].'">' : (!empty($row['avatar']) ? '<img src="'.$row['avatar'].'">' : (!empty($row['filename']) ? (!empty($modSettings['custom_avatar_url']) ? '<img src="'.$modSettings['custom_avatar_url'].'/'.$row['filename'].'">' : '<img src="'.$scripturl.'?action=dlattach;attach='.$row['id_attach'].';type=avatar">') : '')), ), 'time' => timeformat($row['poster_time']), 'color' => !empty($row['department_color']) ? $row['department_color'] : (!empty($row['alliance_color']) ? $row['alliance_color'] : (!empty($row['online_color']) ? $row['online_color'] : '')), ); } $smcFunc['db_free_result']($request); return $topic_starter; } You'll need that at the end or very top of display.template - before the first function or after the last before the ending ?> - this does load a user's info if there is no id_character marker and will auto-colour character names according to their group colours, but I don't... thhhiiiink it'll do that to user names... oh wait yes it will. Um, it's also set up for First Last order and won't change unless you manually change it here. <div class="topic_header"> <div class="topic_header_avatar nomobile"',(!empty($context['topic_starter']['color']) ? ' style="background-color: '.$context['topic_starter']['color'].';"' : ''),'> ',!empty($context['topic_starter']['avatar']['image']) ? $context['topic_starter']['avatar']['image'] : '<img src="https://placehold.it/250">',' </div> <div class="topic_header_left"> <span>',$context['subject'],'</span> <div>Started By ',$context['topic_starter']['link'],'</div> </div> <div class="topic_header_right"> <div>Posted ',$context['topic_starter']['time'],'</div> <div>',$context['previous_next'],'</div> </div> </div> And then this is my topic header code thing. Uh you do have to call it somewhere. $context['topic_starter'] = null; $context['topic_starter'] = arcLoadStarter($context['topic_starter_id'], $context['current_topic']); I have this for that up above it. What you put where $context['topic_starter_id'] is may be different, I can't remember off-hand if that's supposed to be a different variable by default (I change back-end shit all the time willy-nilly so). 1 I am the darkness, always watching, always listening, ALWAYS THERE. (If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.) Link to comment Share on other sites More sharing options...
Snickerdoodle 51 Author Share Posted February 17, 2019 Got it! Thanks bunches! We're on Discord! Come say hello! Link to comment Share on other sites More sharing options...
Recommended Posts