MyBB Hacks

Full Version: vB style profile link
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I think it would be nice to have a vB style profile link, the one that's in a post.

So basicly that when you click my profile in this post (on my username) a dropdown menu appears with the same links as in vBulletin.

Go here, go to a post and click on a profile to see what I mean: http://www.vbulletin.com/forum/
Hi Kikkerking,
This can be mostly done with template edits.

I'm not going to bother with the fancy popup effect, but here's how to use MyBB's popup menu to achieve a similar effect.  Modify the following templates like follows:

postbit
Find:

HTML Code
{$post['user_details']}

Add under:

HTML Code
<div id="profilelink_{$post['uid']}_popup" class="popup_menu" style="display: none;">
<div class="popup_item_container">
<a href="{$mybb->settings['bburl']}/member.php?action=profile&amp;uid={$post['uid']}" class="popup_item">View this user's public profile</a>
</div>
{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}
</div>
<script language="javascript" type="text/javascript">
new PopupMenu("profilelink_{$post['uid']}");
</script>

Also find:

HTML Code
<span class="smalltext">{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}</span>

Replace with:

HTML Code
&nbsp;


postbit_pm
Replace entire template with:

HTML Code
<div class="popup_item_container">
<a href="{$mybb->settings['bburl']}/private.php?action=send&amp;uid={$post['uid']}" class="popup_item">{$lang->postbit_pm}</a>
</div>


postbit_www
Replace entire template with:

HTML Code
<div class="popup_item_container">
<a href="{$post['website']}" class="popup_item">{$lang->postbit_website}</a>
</div>


postbit_find
Replace entire template with:

HTML Code
<div class="popup_item_container">
<a href="{$mybb->settings['bburl']}/search.php?action=finduser&amp;uid={$post['uid']}" class="popup_item">{$lang->postbit_find}</a>
</div>


postbit_email
Replace template with:

HTML Code
<div class="popup_item_container">
<a href="{$mybb->settings['bburl']}/member.php?action=emailuser&amp;uid={$post['uid']}" class="popup_item">{$lang->postbit_email}</a>
</div>


Also, open up /inc/functions_post.php,
Find:

PHP Code:
$post['profilelink'] = "<a href=\"".str_replace("{uid}", $post['uid'], PROFILE_URL)."\">".format_name($post['username'], $post['usergroup'], $post['displaygroup'])."</a>";

Replace with:

PHP Code:
		$post['profilelink'] = "<a href=\"".str_replace("{uid}", $post['uid'], PROFILE_URL)."\" id=\"profilelink_{$post['uid']}\">".format_name($post['username'], $post['usergroup'], $post['displaygroup'])."</a>";



That's pretty much it.
If you have MyPlaza installed, and want a fade effect, in the above code for postbit, replace:

Javascript Code
new PopupMenu

with

Javascript Code
new MyPlazaPopupMenu



Note that, since this removes the buttons from the bottom of the post, it has the side effect that if a user has Javascript disabled, they can't directly access the links from the post.  Meh, vBulletin does that anyway, so it shouldn't be an issue Tongue
Hope that helps.

Wow, thank you so much. It worked great. You're awesome at coding I must say. Shocked Incredibly. Wink
No worries - glad to help Smile
Thanks this is real cool hack .. Does this works with the coming MyBB 1.4 also?
I haven't tried this with MyBB 1.4.

However, it'll still have a similar principle - ie, mostly a template edit.
anyway to add this feature to the toplinks?
Depends what you want and how you want it implemented...

Guest

Wheres inc/functions?

Guest

It doesn't work... Here's a example:
http://forum.spotendo.uni.cc/showthread....http://forum.spotendo.uni.cc/showthread.php?tid=1&
This is my postbit template code:

Code:
<tr>
<td class="{$altbg}" width="15%" valign="top" style="white-space: nowrap; text-align: center;"><a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
<div id="profilelink_{$post['uid']}_popup" class="popup_menu" style="display: none;">
<div class="popup_item_container">
<a href="{$mybb->settings['bburl']}/member.php?action=profile&amp;uid={$post['uid']}" class="popup_item">View this user's public profile</a>
</div>
{$post['button_email']}{$post['button_pm']}{$post['button_find']}
</div>
<script language="javascript" type="text/javascript">
new MyPlazaPopupMenu("profilelink_{$post['uid']}");
</script>
<span class="smalltext"><a href="{$mybb->settings['bburl']}/plaza.php">{$lang->money}</a>: <span id="postmoney_{$post['pid']}">{$post[MYPLAZA_MONEY_COLUMN]}{$post['donate_postbit']}</span></span><br />{$post['invitems']}{$post['fws_w_level']}
</td>
<td class="{$altbg}" width="85%" valign="top">
<table width="100%">
<tr><td>{$post['posturl']}{$post['icon']}<span class="smalltext"><strong> {$post['subject']}</strong></span>
<br />
<div id="pid_{$post['pid']}">
<p>
{$post['message']}
</p>
</div>
{$post['attachments']}
{$post['signature']}
<div style="text-align: right; vertical-align: bottom;">
{$post['editedmsg']}
{$post['iplogged']}
</div>
</td></tr>
</table>
</td>
</tr>
<tr>
<td class="{$altbg}" height="18" style="white-space: nowrap; text-align: center;"><span class="smalltext">{$post['postdate']} {$post['posttime']}</span></td>
<td class="{$altbg}" width="100%" valign="middle" height="18">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr valign="bottom">
		<td align="left" >&nbsp;</td>
		<td align="right"><span class="smalltext">{$post['button_edit']}{$post['button_quickdelete']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['fws_warnlink']}</span></td>
	</tr>
	</table>
</td>
</tr>
{$seperator}

I can't even see my name now...

Pages: 1 2
Reference URL's