![]() |
Register link for guests, User CP link (or button) for members.
Oh my Kura, you're releasing small, simple hacks every day now, huh? What's this one about?
Rest assured, after this one I don't have anything to release for a while (only stuff that has no purpose outside my own board). Well, this hack. What it does is 'merge' the Register and User CP buttons. If a viewer is a guest or just not logged in, the link will display a Register button (or text link, whatever you want). If the viewer IS logged in, and therefore a member, it will display the User CP button instead. Click here for an example (where `register` is will be `user cp` when you're logged in). I mean, why have a Register button for members available, and a User CP button available for guests? :) Exactly, that makes no sense, therefore, this hack. :) Instructions Step 1: Open your global.php and find this line: PHP Code:
Make sure to remove the space between {imagesfolder and }!! PHP Code:
$reg_ucp somewhere in your Header, where you want the UserCP / Register button to appear. Make sure to remove the 'hardcoded' buttons that are already in there, of course. Save, and you're done. :) Note that if you aren't using the default vB templates and graphics (which is 99% likely? ;)) you'll have to adjust the code above to suit your needs. If you don't use images, just remove the image part there and replace it with text links. Extra feature that you can use with this hack: add Guest-only banners or something alike. In other words, only guests will see the banner (which could say something like "Want to get rid of this annoying banner? Then sign up now!") and users who are logged in won't see anything. :) To do so, use something like this: PHP Code:
Enjoy! |
No screenshots cos this is so simple your imagination should suffice. :p
Sorry about the side-scrolling btw, I always work with wrapping on :/ (oh and please note that "blablabla ...." should, of course, be replaced with what's in there, above. :p) |
I edited your post to make it not scroll. :)
|
Thanks, but it still scrolled on reso 1152x864 (and below) so I edited it even more. :)
(you beat me to it, I was still working on adding the hack to the DB before editing it myself to make it thinner, bah! :p :D) |
Nice hack KuraFire, shame I already added this to by board a few days ago ;)
None the less good job. |
Good hack, but I have a suggestion.. Why not replace the "new thread" and "new reply" buttons with a button that says "register to post" or "register". Then make it link to a page where you can choose to register, or log in (since some people just forget to log in, and log in when creating a new thread).
|
Works nicely, thanks alot ^_^
*continues to add small subtle hacks to her board* :bunny: |
Uh oh. you should note that in the php code box it doesnt escape the " in "Registration is free\"
or img src="https://vborg.vbsupport.ru/green/top_register.gif\" ". Plus it doesnt start the "s back in the else after the ". PHP Code:
|
For Template driven:
PHP Code:
Not sure if this works, but it looks like it should. |
Dark Odin, your code is backwards. It currently gives unreg-templates for members, and regged-templates for guests. :)
Takara, actually, my hack said { imagesfolder } but if I type it without the spaces, it gets parsed... o_O But it all looks commented out fine on _my_ screen, nonetheless.... o.o |
First attempt at posting anything. :D
|
I did mine an easyer way (find this out by looking around the template mod. forum ;) ) and here's how I did mine (2 different ways)....for the buttons (I used this on 2 template sets), I just added the following to the "phpinclude" template:
PHP Code:
Code:
<!-- toplinks --> or you can put this in the "phpinclude" template: PHP Code:
|
Quote:
Anyway ^-^ |
scsa20: sure, that works too, but it's totally not necessary on my board (how the hell you found that "an easier way" is beyond me, though. :p ).
I have my Admin Panel on my Personal Bookmark Folder, so I just have to click on one link to get there, no matter _what_ site or page I'm browsing (so I can be on this forum and still jump there with 1 click). As for the Mod panel, they don't have anything to do there on my board except ban users, and that's something they don't often have to do at all, and usually I'm the one doing it anyhow. But, thanks for the addition anyway, some other people might well appreciate it. :):up: |
Takara, as a suggestion: export images as .GIF if they don't use a lot of colors (ie. forum screenshots, for instance) - top quality and very small filesizes. Much better than these horrid, horrid .jpg's :)
|
Hi,
does somebody know how i can put these function in a javascript coded menu? I use the xmenu hack https://vborg.vbsupport.ru/showthrea...ighlight=xmenu and want to use this function? Thanks alot! |
I can't help you with that, if you still _need_ help, even.... :/
|
thanks, i found another solution, thanks!
|
Well for starters I'm using version 2.2.5, and nowhere in my global.php do I see the above mentioned reference. I tried putting this...
PHP Code:
|
Your root/global.php should have these two lines, somewhere around line 270-280:
PHP Code:
If you can't find that, try finding this: PHP Code:
PHP Code:
|
Well I'm using an official, English version of vBulletin [2.2.5] - yesterday I couldn't find that code in my global.php, but today I could. LOL. And rather than hardcoding it I used the template version I mentioned above and created the two relevant templates, all running great now. Thanks for the help anyway. :)
|
Hmmmm... But it doesn't work in my vBPortal on my test board. :(
|
Anyone have any knowledge on how I could go about making this work in non-vb pages, such as my vBPortal P_themeheader template? Would I need to include anything in the external files that the portal wouldn't do as default? All input is appreciated.
|
It'll work on any page where you include global.php
If you have non-vB pages, make sure to include global.php and it'll work. If you don't want to includ global.php, then there's no way for the page to know whether a user is a guest or a member. |
I get this error when I try to include it...
Code:
Fatal error: Cannot redeclare stripslashesarray() in /web/gamerforums/board/global.php on line 14 |
I think your version of PHP is just too old...
what version you running? |
I'm running version 4.1.2 [February 27 2002], which is only outdated by one more release - so it isn't that.
|
*Bump...*
|
Err, see one of the sticky threads in the Full Releases forum. I believe one of 'm contains a small fix on that problem.
|
I've had the replacement code variables fix installed for a long time.
|
Then I have no idea. Is it a vBPortal page you're trying to include this on, or a non-vb page of your own?
And in which directory is it? Different from where your vB itself is? |
It's the vBPortal pages, and it's in the web root, my forums are in root/forums.
|
Then it might be a problem with vBPortal, or you haven't properly hardcoded the real path to your admin/functions.php ?
|
I didn't realise I was supposed to hard code that path, any idea where I do it?
|
I believe you only have to do it in global.php
however, note that I am totally not sure whether this will have any effect on your vBPortal. With my old site, however, I had to hardcode the real path in global.php (at least) to make it all work a directory lower than my forums... |
I tried that and it didn't work. Thanks for trying anyway mate, it's appreciated. :)
|
sorry it didn't work, and no prob :)
|
I have a scrolling ticker box that I would like the guests to see but not the regular users. It is javascript. How could I call that with the banner option you have here? It uses a piece of code in the index.php and a .jar file that it calls.
Quote:
|
why the HELL did you quote my post there?!
That was totally not necessary and annoying :/ As to your question, uhm, just put the javascript in place where it now has the Banner stuff? |
Why don't you chill out a little bit. That whole quote was by accident. And I didn't quite understand the blahblah stuff you had in the code and I wasn't sure what was supposed to go there, so I thought I'd better quote it. Relax. :)
Quote:
|
All times are GMT. The time now is 04:44 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|