PDA

View Full Version : Two questions


squidsk
01-31-2013, 04:32 AM
Two questions:

1) I'm trying to add a link to a nav item and have it point at a tab on the members profile page, now in a template I'd use {vb:link member, {vb:raw userinfo}}&tab=mytab, but what can I use in the navigation manager.

2) I can't get the check version bit of code to work, for whatever of reasons it refuses to work, are there any characters that can't be used as part of a product id?

kh99
01-31-2013, 12:35 PM
There is no way to have any kind of variables in the url for the navigation manager. Maybe you could do something like create a plugin using hook member_start and code like:

if ($vbulletin->GPC['userid'] == 0)
{
$vbulletin->GPC['userid'] = $vbulletin->userinfo['userid'];
}


then if you use a url that's just "member.php", it will go to the current user.


This version check url seems to work:
https://vborg.vbsupport.ru/misc.php?do=productcheck&pid=YaAS4-40

squidsk
01-31-2013, 04:30 PM
There is no way to have any kind of variables in the url for the navigation manager. Maybe you could do something like create a plugin using hook member_start and code like:

if ($vbulletin->GPC['userid'] == 0)
{
$vbulletin->GPC['userid'] = $vbulletin->userinfo['userid'];
}


then if you use a url that's just "member.php", it will go to the current user.



That works, but what code can I add so that it only redirects the user to their own page if they've clicked on the link in the navbar (i.e. when that nav tab has been selected)?


This version check url seems to work:
https://vborg.vbsupport.ru/misc.php?do=productcheck&pid=YaAS4-40

Today it does, yesterday it didn't. The problem still comes when I use that url in the version check entry for the product. When I select check version from the product dropdown I get the following message from vbulletin:

Version check failed. No version number was found at this location. The URL for the version check may be incorrect, or the server may be experiencing problems. Please try again later.

If I manually enter the url into a browser I get the expected result of 4.0.5.

kh99
01-31-2013, 05:27 PM
That works, but what code can I add so that it only redirects the user to their own page if they've clicked on the link in the navbar (i.e. when that nav tab has been selected)?

Does it affect something else the way it is (not that it matters, I'm just curious). Anyway, I suppose you could make the url member.php?self=1, then check for that, like:

if ($vbulletin->GPC['userid'] == 0 && $_GET['self'])
{
$vbulletin->GPC['userid'] = $vbulletin->userinfo['userid'];
}




If I manually enter the url into a browser I get the expected result of 4.0.5.

I was trying a few of my own mods, and most work but one did the same thing you described. I finally figured out that it was just because the productid I have when I edit the product in the admincp (the one in the <version>..</version> tags <product productid="..."> tag in the xml) doesn't match the id I put on the url (and in the mod post), because at some point I changed it (but not everywhere, apparently). So I guess make sure that yours matches everywhere.

squidsk
02-01-2013, 04:09 AM
Does it affect something else the way it is (not that it matters, I'm just curious). Anyway, I suppose you could make the url member.php?self=1, then check for that, like:

if ($vbulletin->GPC['userid'] == 0 && $_GET['self'])
{
$vbulletin->GPC['userid'] = $vbulletin->userinfo['userid'];
}



No it doesn't affect anything else, but I want to try and avoid changing default vbulletin behaviour wherever possible.




I was trying a few of my own mods, and most work but one did the same thing you described. I finally figured out that it was just because the productid I have when I edit the product in the admincp (the one in the <version>..</version> tags in the xml) doesn't match the id I put on the url (and in the mod post), because at some point I changed it (but not everywhere, apparently). So I guess make sure that yours matches everywhere.
Alright, so what's the easiest way to change it, if I change it only in the xml for the file then all the people who have it installed will have multiple plugin listings. Would I need to manually edit all the tables (i.e. template, plugin, phrase, etc, etc)?

kh99
02-01-2013, 12:38 PM
No it doesn't affect anything else, but I want to try and avoid changing default vbulletin behaviour wherever possible.

Right, that makes a lot of sense. I forgot for a moment that it's for a mod.


Alright, so what's the easiest way to change it, if I change it only in the xml for the file then all the people who have it installed will have multiple plugin listings. Would I need to manually edit all the tables (i.e. template, plugin, phrase, etc, etc)?

I guess what you'd want to do is keep whatever id is in the xml file (which is the same thing that shows up when you edit the product in the Product Manager), and if necessary change the pid on your product and version urls, and on vbulletin.org use "Edit Settings" to change the id if necessary.

Also, I of course misspoke above - it's not the <version>...</version> tags, it's the <product productid="..."> at the top.

squidsk
02-01-2013, 05:44 PM
I guess what you'd want to do is keep whatever id is in the xml file (which is the same thing that shows up when you edit the product in the Product Manager), and if necessary change the pid on your product and version urls, and on vbulletin.org use "Edit Settings" to change the id if necessary.

I'm not sure that would work as it would conflict with the pid for the vb3 version of the mod, which I do not have control over. I believe that the pid was changed on vbulletin.org for the vb4 version to allow separate current versions of the mod, even though the internal pid was the same for upgarding the product without having to make a bunch of changes to the db.

Also, I of course misspoke above - it's not the <version>...</version> tags, it's the <product productid="..."> at the top.

As I understand it, if I change the <product productid="..."> bit won't that count as a separate install if someone were to upgrade from a current version?

kh99
02-01-2013, 05:57 PM
I see. Well, I'm afraid I'm not sure what you can do (which doesn't mean there's no way around it, only that I don't know). I think there may be no choice but to change the id or do without the version check (or implement your own check url on your server, and return the productid you're using).

Edit: ..or write install code that copies any data that you need from the 'other' product. I'm assuming there's data and/or settings you're concerned about, or of course you could just ask users to uninstall the old version.