Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
  #1  
Old 08-25-2010, 09:07 AM
DaRK mAN306's Avatar
DaRK mAN306 DaRK mAN306 is offline
 
Join Date: Aug 2008
Location: Bahrain
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How can I change the notifications menu place ?

Greeting everyone,

I'd like to know how to preregister the notifications menu variables(notifications_menubits & notifications_total) in the footer template..

I've read cellarius's article ([vB4] Rendering templates and registering variables - a short guide) but I was so stupid to understand the way to preregister the variables as I have no experience or what so ever in programming.!

So, can anyone point me on how to do that and could you please provide the code and where to place it if possible ?!

Thanks in advance ..

** You might want to read my thread on vBulletin.com found on this link: How can I change the notifications menu place ?
Reply With Quote
  #2  
Old 08-28-2010, 06:20 AM
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
Senior Member
 
Join Date: Sep 2008
Location: North Carolina
Posts: 5,844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DaRK mAN306 View Post
Greeting everyone,

I'd like to know how to preregister the notifications menu variables(notifications_menubits & notifications_total) in the footer template..

I've read cellarius's article ([vB4] Rendering templates and registering variables - a short guide) but I was so stupid to understand the way to preregister the variables as I have no experience or what so ever in programming.!

So, can anyone point me on how to do that and could you please provide the code and where to place it if possible ?!

Thanks in advance ..

** You might want to read my thread on vBulletin.com found on this link: How can I change the notifications menu place ?
I had a rather nice PM tonig... err this morning so here you go!
The Night Owl (Me ) Says: Early birds catch the worms rise and shine some of you .

1) Create a new plugin:

AdminCP > Plugins & Products > Add New Plugin

Product = vBulletin
Hook Location = parse_templates
Title = Notifications moved from header to footer template
Execution Order = 5
Plugin PHP Code = *See Below*
Plugin is Active = Yes

Code:
vB_Template::preRegister('footer', array('notifications_menubits' => $notifications_menubits));
2) Now Edit the Header template and remove (Copy it before you delete):

Code:
				<vb:if condition="$notifications_total">
				<li class="popupmenu notifications" id="notifications">
					<a class="popupctrl" href="usercp.php{vb:raw session.sessionurl_q}">{vb:rawphrase your_notifications}: <span class="notifications-number"><strong>{vb:raw notifications_total}</strong></span></a>
					<ul class="popupbody popuphover">
						{vb:raw notifications_menubits}
					</ul>
				</li>
				<vb:else />
				<li class="popupmenu nonotifications" id="nonotifications">
					<a class="popupctrl" href="usercp.php{vb:raw session.sessionurl_q}">{vb:rawphrase your_notifications}</a>
					<ul class="popupbody popuphover">
						<li>{vb:rawphrase no_new_messages}</li>
						<li><a href="private.php{vb:raw session.sessionurl_q}">{vb:rawphrase inbox}</a></li>
					</ul>
				</li>
				</vb:if>
And last but not least... Use that same code and add it to your bar where desired, if I remember correctly I've seen that bar/script before so most likely your pasting the code for it inside the footer template? *The plugin is based on that so if your bars code is not in the footer replace that name in the plugin with whatever template you are using, you seem to know by the screenshots so paste that code where desired and badda-bing

*I'm posting this for others in your thread(s) as well and credit goes to Lynne, I learned from her and many of the other greats we have around here . *Actually after sending you that PM I found this: http://www.vbulletin.com/forum/showt...avbar-template and I bet your search was one day off but it's the same concept so reference that for thinking outside the box and moving other things around a bit .

- Mike
Reply With Quote
  #3  
Old 08-28-2010, 01:30 PM
DaRK mAN306's Avatar
DaRK mAN306 DaRK mAN306 is offline
 
Join Date: Aug 2008
Location: Bahrain
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you very much mike and I mean very very very much for your reply ..
It was exactly what I was looking for .!

I followed your directions step-by-step but I couldn't get it to work .. At first, I thought that the problem is in my test forum, but when I tested Lynne's trick on the link you provided me with (Moving Facebook Connect out of the header template and into the navbar template) ... It worked like charm .. I also tried preregistering other variables based on both Lynne's directions and yours and I succeed in it, but every time I come back to preregistering the notifications_menubits variable I fail in it .!

I appreciate your help Mr. Miller and I'm 100% sure that your directions are correct .. But as I can see the problem is not with the way to preregister the variable as Lynne have told me on my thread on vBulletin.com, there gotta be something else to do in this particular case .!

Thanks again for your help Mr. Miller ..
I'll try speaking to Lynne seeking for help with this issue; because I don't want to bother you and to waste your time with me on such things .!

Best Regards,
ME
Reply With Quote
  #4  
Old 08-28-2010, 02:14 PM
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
Senior Member
 
Join Date: Sep 2008
Location: North Carolina
Posts: 5,844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DaRK mAN306 View Post
Thank you very much mike and I mean very very very much for your reply ..
It was exactly what I was looking for .!

I followed your directions step-by-step but I couldn't get it to work .. At first, I thought that the problem is in my test forum, but when I tested Lynne's trick on the link you provided me with (Moving Facebook Connect out of the header template and into the navbar template) ... It worked like charm .. I also tried preregistering other variables based on both Lynne's directions and yours and I succeed in it, but every time I come back to preregistering the notifications_menubits variable I fail in it .!

I appreciate your help Mr. Miller and I'm 100% sure that your directions are correct .. But as I can see the problem is not with the way to preregister the variable as Lynne have told me on my thread on vBulletin.com, there gotta be something else to do in this particular case .!

Thanks again for your help Mr. Miller ..
I'll try speaking to Lynne seeking for help with this issue; because I don't want to bother you and to waste your time with me on such things .!

Best Regards,
ME
Hmm it has to be the template your putting it in... like I said for example if your custom bar code is pasted into the footer template it will work, if not in the plugin code where it says 'footer' replace with 'your_template_the_bars_code_is_in' and I mean replace with the actual template name.

Basically you can use my info or Lynne's as you had success with that and simply change the code to pre-register what you need but remember you need to remove the old code from the header or it won't work in the footer!! - copy the header and footer template into a empty notepad etc before you start so you can quickly paste back in or simply revert the template if it was not previously customized in case you make a mistake .
Reply With Quote
  #5  
Old 08-28-2010, 07:33 PM
DaRK mAN306's Avatar
DaRK mAN306 DaRK mAN306 is offline
 
Join Date: Aug 2008
Location: Bahrain
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi again Mr.Miller,

Yeah, I'm aware of that
- I mean that I have to change the template's name in the plugin to correspond with where I place the bar code - .!

First, I tested the code on the default vBulletin skin; I added a new plugin that is identical to what you posted before in Post #2, then I went to the header template and had the notification code simply cut (Ctrl+X) and then saved the template, after that I went to the footer template and pasted the notification code after the last line, saved the template and then went to the test forum homepage and pressed (Ctrl+F5) to make a full refresh - aka unconditional refresh -, then I went downstairs to check the footer and guess what? the notification menu was sitting there but it was deactivated - didn't display the number of notifications I had even though I had 2 new pms -!!

I tried placing the code in several places in the footer template itself and when it all failed, I tried placing it in the FORUMHOME template after changing the template name in the plugin code and it also didn't work .!

I even tried adding the notifications_total variable to the array in the plugin's code but it didn't help .!

Again, please don't waste your time on me .! I'll try to solve this in every possible way and once I succeed I'll post the solution here for others to benefit from it ..

Thanks again for your - big time - help and wish you all the best .!


--------------- Added 29 Aug 2010 at 20:56 ---------------

Greetings guys,

Thanks to both Mike and Lynne for their sincere help - if this is the right word to describe it - ..

At least, now I know how to preregister variables in case I needed to preregister something in the future ..

My problem is that it's refusing to work with me every time I try to preregister the notifications_menubits variable and I think that there is something wrong with this variable in particular because when I preregistered the facebook button to work in the navbar as Lynne has explained on this thread, it worked like charm ..

This problem is causing me all type of headaches and because of that I had to to fix it "in the old school way" .. It's true that it's a cheap way, but as long as it works I don't care .! I'll be waiting for vBulletin developers to make a useful tool that makes it easy for users to preregister such variables .!

What I did was this:
  1. Copied the bottom bar code from the footer template ..
  2. Removed the bottom bar code from the footer template ..
  3. Pasted the bottom bar code in the Header template ..
  4. To make the bottom bar on top of the forums list - because once I place the code in the header it goes beneath the forum list -, I added some CSS code to my bottom bar container as shown below:
    HTML Code:
    position:absolute;
    z-index:100;
It works even without the position attribute and with the z-index set to 1 .! But, I feel safe like this for a reason or another ..

Just to point out, this fix is in BETA stage .. I'll be testing it in the few couple of days to make sure that it works as it is supposed to !!

This means that I don't need to know how to fix this issue anymore unless someone wanted to provide us with a reasonable fix .!

Thanks again to Mike for his outstanding help, thanks to Lynne for her corresponding on vBulletin.com and thanks in advance for those who might provide something clean as a fix for this issue .!

Kind Regrads,
ME
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:33 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05215 seconds
  • Memory Usage 2,223KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_html
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete