MyBB Hacks

Full Version: What's wrong with this
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I changed the postbit_find button so when clicked, it opens a popup to choose user's posts or threads (much the same way as clicking the edit button and choosing quick or full edit). I thought it was working great, but just noticed it only works on the first two posts of a thread. Anyone know what I am doing wrong?

Here is the code i am using for postbit_find:

Code:
<a href="search.php?action=finduser&amp;uid={$post['uid']}" id="find" style="text-decoration:none;"><img src="{$theme['imglangdir']}/postbit_find.gif" alt="{$lang->postbit_find}" title="{$lang->postbit_find}" /></a>
<div id="find_popup" class="popup_menu" style="display: none;"><div class="popup_item_container"><a href="search.php?action=finduserthreads&amp;uid={$post['uid']}" class="popup_item">Find All Threads</a></div><div class="popup_item_container"><a href="search.php?action=finduser&amp;uid={$post['uid']}" class="popup_item">Find All Posts</a></div></div>
<script type="text/javascript">
// <!--
    if(use_xmlhttprequest == "1")
    {
        new PopupMenu("find");
    }
// -->
</script>


nvm...I see my mistake now
If I read right your code, you need to make all javascript with a unique ID, so that it will work in all posts.

I think were it says:

Code:
new PopupMenu("find");


and:

Code:
id="find"


It should be:

Code:
new PopupMenu("find{$post['pid']}");


and:

Code:
id="find{$post['pid']}"


That will make it unique for each post.

Reference URL's