Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

Show current user's name and link to profile?

Aloittaja samborabora, kesäkuu 15, 2014, 02:30:59 IP

« edellinen - seuraava »

samborabora

I need to display the current logged-in user's name with it linked to their profile. What is the correct code to use, and does it need surrounding in any specific code? I'm putting it into Display.template.php.

Sir Osis of Liver

When in Emor, do as the Snamors.
                              - D. Lister

samborabora

Thanks, i figured that much from:

echo '
', $message['member']['link'] , ($message['member']['id'] == $context['topic_starter_id'] && !$message['member']['is_guest']) ? '


But I'm trying to place this into a div, and I get syntax error. Is there some other way I need to wrap this string?

Sir Osis of Liver

When in Emor, do as the Snamors.
                              - D. Lister

samborabora

<div id="quickReplyOptions"', $options['display_quick_reply'] == 2 ? '' : ' style="display: none"', '>
<div class="roundframe">
<div id="replyleft">
NEED THE CODE HERE
</div>
<div id="replyright">
<p class="smalltext lefttext">', $txt['quick_reply_desc'], '</p>
', $context['is_locked'] ? '<p class="alert smalltext">' . $txt['quick_reply_warning'] . '</p>' : '',
$context['oldTopicError'] ? '<p class="alert smalltext">' . sprintf($txt['error_old_topic'], $modSettings['oldTopicDays']) . '</p>' : '', '
', $context['can_reply_approved'] ? '' : '<em>' . $txt['wait_for_approval'] . '</em>', '
', !$context['can_reply_approved'] && $context['require_verification'] ? '<br />' : '', '
<form action="', $scripturl, '?board=', $context['current_board'], ';action=post2" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);" style="margin: 0;">
<input type="hidden" name="topic" value="', $context['current_topic'], '" />
<input type="hidden" name="subject" value="', $context['response_prefix'], $context['subject'], '" />
<input type="hidden" name="icon" value="xx" />
<input type="hidden" name="from_qr" value="1" />
<input type="hidden" name="notify" value="', $context['is_marked_notify'] || !empty($options['auto_notify']) ? '1' : '0', '" />
<input type="hidden" name="not_approved" value="', !$context['can_reply_approved'], '" />
<input type="hidden" name="goback" value="', empty($options['return_to_post']) ? '0' : '1', '" />
<input type="hidden" name="last_msg" value="', $context['topic_last_message'], '" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />';

if ($context['can_lock'])
                    echo'<input type="checkbox" name="lock" value="',(empty($context['is_locked'])) ? '1' : '0','" /> ',(empty($context['is_locked'])) ? $txt['set_lock'] : $txt['set_unlock'] ,'';
                    if ($context['can_sticky'])
                    echo'&nbsp;&nbsp;<input type="checkbox" name="sticky" value="',(empty($context['is_sticky'])) ? '1' : '0','" /> ',(empty($context['is_sticky'])) ? $txt['set_sticky'] : $txt['set_nonsticky'] ,'';

// Guests just need more.
if ($context['user']['is_guest'])
echo '
<strong>', $txt['name'], ':</strong> <input type="text" name="guestname" value="', $context['name'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" />
<strong>', $txt['email'], ':</strong> <input type="text" name="email" value="', $context['email'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" /><br />';

// Is visual verification enabled?
if ($context['require_verification'])
echo '
<strong>', $txt['verification'], ':</strong>', template_control_verification($context['visual_verification_id'], 'quick_reply'), '<br />';

echo '
<div class="quickReplyContent">
<textarea cols="600" rows="7" name="message" tabindex="', $context['tabindex']++, '"></textarea>
</div>
<div class="righttext padding">
<input type="submit" name="post" value="', $txt['post'], '" onclick="return submitThisOnce(this);" accesskey="s" tabindex="', $context['tabindex']++, '" class="button_submit" />
<input type="submit" name="preview" value="', $txt['preview'], '" onclick="return submitThisOnce(this);" accesskey="p" tabindex="', $context['tabindex']++, '" class="button_submit" />';

if ($context['show_spellchecking'])
echo '
<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'postmodify\', \'message\');" tabindex="', $context['tabindex']++, '" class="button_submit" />';

echo '
</div>
</form>
</div>
</div>
<div style="clear:both;"></div>
<span class="lowerframe"><span></span></span>
</div>
</div>';
}
else
echo '
<br class="clear" />';

Antechinus

This should work:

<a href="', $scripturl, '?action=profile;u=', $context['user']['id'], '">', $context['user']['name'], '</a>

samborabora


Antechinus

Funnily enough, I was just wanting that stuff yesterday for something else (linking the avatar up in the default theme header) so I had looked it up anyway. ;)

Advertisement: