MyBB Community Forums

Full Version: Make a link to direct to a link that has their UID
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I know this sounds very weird, but essentially I want a drop down menu that will be able to link to a members threads, posts, etc. So for example, the option in the profile where it says "Find all threads" or "Find all posts", I want that to be able to be linked in the drop down menu. The only problem is, each of those URLs has the UID of the member to search for. So how can I make it that it will redirect them to the link using their UID?
I did this by making a new template postbit_profile_menu:


<a href="dummy" id="profile_menu_{$post['uid']}_{$post['pid']}" class="author_information" >{$post['username_formatted']}</a>
<div id="profile_menu_{$post['uid']}_{$post['pid']}_popup" class="popup_menu" style="display: none;">
	<div class="smalltext" style="font-weight: normal;">
		<a href="member.php?action=profile&amp;uid={$post['uid']}" class="popup_item">{$lang->menu_profile}{$post['username']}</a>
	</div>
	<div class="smalltext" style="font-weight: normal;">
		<a href="search.php?action=finduser&amp;uid={$post['uid']}" class="popup_item">{$lang->menu_posts}{$post['username']}</a>
	</div>
	<div class="smalltext" style="font-weight: normal;">
		<a href="search.php?action=finduserthreads&amp;uid={$post['uid']}" class="popup_item">{$lang->menu_threads}{$post['username']}</a>
	</div>
	<div class="smalltext" style="font-weight: normal;">
		{$post['button_email']}
	</div>
	<div class="smalltext" style="font-weight: normal;">
		{$post['button_pm']}
	</div>
</div>
<script type="text/javascript">
// <!--
	if(use_xmlhttprequest == "1")
	{
		$("#profile_menu_{$post['uid']}_{$post['pid']}").popupMenu();
	}
// -->
</script>

and have this evaluated at 4 places in the build_postbit function (inc/functions_post.php).

This menu contains:

  1. link to profile
  2. link to all posts
  3. link to all threads
  4. link to sent an email
  5. link to send a PM
For this, also templates postbit_pm and postbit_email had to be changed, but they can also be dropped of course.
(07-08-2015, 11:36 AM)Ad Bakker Wrote: [ -> ]I did this by making a new template postbit_profile_menu:


<a href="dummy" id="profile_menu_{$post['uid']}_{$post['pid']}" class="author_information" >{$post['username_formatted']}</a>
<div id="profile_menu_{$post['uid']}_{$post['pid']}_popup" class="popup_menu" style="display: none;">
 <div class="smalltext" style="font-weight: normal;">
 <a href="member.php?action=profile&amp;uid={$post['uid']}" class="popup_item">{$lang->menu_profile}{$post['username']}</a>
 </div>
 <div class="smalltext" style="font-weight: normal;">
 <a href="search.php?action=finduser&amp;uid={$post['uid']}" class="popup_item">{$lang->menu_posts}{$post['username']}</a>
 </div>
 <div class="smalltext" style="font-weight: normal;">
 <a href="search.php?action=finduserthreads&amp;uid={$post['uid']}" class="popup_item">{$lang->menu_threads}{$post['username']}</a>
 </div>
 <div class="smalltext" style="font-weight: normal;">
 {$post['button_email']}
 </div>
 <div class="smalltext" style="font-weight: normal;">
 {$post['button_pm']}
 </div>
</div>
<script type="text/javascript">
// <!--
 if(use_xmlhttprequest == "1")
 {
 $("#profile_menu_{$post['uid']}_{$post['pid']}").popupMenu();
 }
// -->
</script>

and have this evaluated at 4 places in the build_postbit function (inc/functions_post.php).

This menu contains:

  1. link to profile
  2. link to all posts
  3. link to all threads
  4. link to sent an email
  5. link to send a PM
For this, also templates postbit_pm and postbit_email had to be changed, but they can also be dropped of course.

So I am confused. How would I use this in terms of getting the links for my drop down menu?
If you want I can make a small plugin for that.
(07-08-2015, 02:19 PM)Ad Bakker Wrote: [ -> ]If you want I can make a small plugin for that.

I would love that if you could!
(07-08-2015, 02:24 PM)SilentThief Wrote: [ -> ]I would love that if you could!

OK, late this evening (it's almost 5 pm here, and I smell that dinner is coming soon Wink ) or tomorrow.

Do you want the menu including links for sending PM and e-mail, or without. I did this because I removed the buttons for this from the bottomline of postbit and postbit_classic.
If you could add it that would be great. Thank you so much!
The plugin is ready and attached. Unzip the file and copy the two files to the right destination (one to inc/plugins and one to inc/languages/english).
When you use another language, copy the language file also to your language directory. After that you can translate it.

Go to AdminCP -> Home -> Plugins and click "Install and Activate" of plugin profileMenu