PDA

View Full Version : Issues with popup menus


Trek
12-27-2009, 12:44 AM
I'm trying to upgrade a mod of my own that I wrote and am having a couple of problems. Hopefully someone here can help me out a bit.

First I have this code located in the postbit_legacy template:

<vb:if condition="is_member_of($vbulletin->userinfo, $vboptions[gm_user_groups_allowed]">
<div id="GuildMate_{vb:raw post.postid}">
<a class="smallfont" href="#">{vb:phrase gm_postbit_text}</a>
<script type="text/javascript"> vbmenu_register("GuildMate_{vb:raw post.postid}", true); </script>
</div>

</vb:if>First problem with that is, the IF condition doesn't seem to work, I'm guessing it's something to do with $vbulletin->userinfo, but I'm not sure what to change it to.

So for now, I've removed the condition.

At this point, when some clicked on the link before, it would activate this code:

<!-- START: Guild Mate {vb:raw post.postid} popup menu -->
<div class="vbmenu_popup" id="GuildMate_{vb:raw post.postid}_menu" style="display:none">
<table cellpadding="4" cellspacing="1" border="0">
<tr>
<td class="thead" colspan="3" align="center">{vb:phrase gm_modtitle}: {vb:phrase gm_modheader} $post[username]{vb:phrase gm_modheader2}</td>
</tr>

{vb:raw gm_char_data}
</table>
</div>
<!-- END: Guild Mate $post[postid] popup menu -->Instead of going to the URL specified in the A HREF above which is my website root. In VB4, it seems to go to the URL instead of this popup code that is specified at the bottom of the template. I'm not sure what else to try, but I'm still working at it.

Any help would be appreciated!

--------------- Added 26 Dec 2009 at 19:30 ---------------

I did want to say that everything appears to be generating as it should. The only problem is when clicking the link, the popup does not appear and it goes to the root level page.

Checking the source, the menus are generated as they should be, everything LOOKs like it should work.

I would like to add that I have in fact read all of the posts I can find on the popup menus and well.. still can't see what I'm doing wrong.

Lynne
12-27-2009, 02:00 AM
When you say it LOOKs correct, do you mean the page source is correct? If so, and you click on it and aren't going to the correct place, perhaps you have some .htaccess on your site that is redirecting you to the wrong place.

And you forgot a parenthesis:
<vb:if condition="is_member_of($bbuserinfo, $vboptions[gm_user_groups_allowed])">

Also, I don't think vbmenu_register is usedin the postbit any longer. You may need to see if the function is available there now.

Trek
12-27-2009, 02:01 AM
When you say it LOOKs correct, do you mean the page source is correct? If so, and you click on it and aren't going to the correct place, perhaps you have some .htaccess on your site that is redirecting you to the wrong place.

Well, I mean that what is rendered appears to be correct. I just don't think that the popup is ever happening. If I set the A HREF to "#", I can click it forever, no popups (at which point I don't to go any other page either), just nothing happens at all.

Lynne
12-27-2009, 02:14 AM
Then, like I said, maybe the function isn't available on that page any longer. If you notice, it isn't used anywhere else in the postbit, so perhaps you need to include the function in a plugin for your mod.

Trek
12-27-2009, 02:39 AM
Ok, I have the usergroup issue fixed (thanks Lynne).

I still can't get the popup menu to show. I checked and that function is located in vbulletin-core.js. I checked the source of the page and that file is included.

I'm still looking... just not sure what to look for. =)

Lynne
12-27-2009, 02:48 AM
If I recall correctly from vb3, your initial link (the first code you posted) needs to be in a td tag. Take a look at the vb3 article regarding dropdowns in the navbar. All the requirements are spelled out there.

Trek
12-27-2009, 03:11 AM
Tried the TD tag stuff, still no go.

Searched for and found several articles that probably fit the ones you mentioned (read them all), found this one specifically: https://vborg.vbsupport.ru/showthread.php?t=126649

Can't see what they are doing there that I'm not. Like I said, this code is running perfectly in vB3.8, just not in 4.0.

After taking a closer look at it the vbmenu_register function, in VB4 the location is in vbulletin-core.js and in VB3 it's in vbulletin_global.js. However both functions are identical:

function vbmenu_register(B,A,C){if(typeof (vBmenu)=="object"){return vBmenu.register(B,A)}else{return false}}

I'm still lost, but I'm also still looking. Thanks!

--------------- Added 1261891833 at 1261891833 ---------------

Ok, I think I got this figured out. Took me a while to find how the new popups are getting rendered but it looks like you have to use a UL/LI type setup and can't use the table/TD type of syntax any longer.

Not sure if that statement is 100% true, I just know what is and isn't working. heh

--------------- Added 1261896290 at 1261896290 ---------------

Ok, so I was wrong (go figure), you can use tables just fine.

The link you click on has to have the class of popupctrl and then you have to wrap what you want in the popup in a UL with the class popupbody.

Anyway, I'm sure I don't fully understand how this works, but... I'm get'n there, thanks for your patience. =)