Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 20 Dec 2010, 23:57
iDCamps iDCamps is offline
 
Join Date: Oct 2009
Use Profile Field Values in Templates

I'm trying to use a custom profile field (specifically, field5) in various places throughout templates. In some places it works just fine (for example, in memberaction_dropdown when it is referenced by postbit). However, other times it doesn't work because the information wasn't passed along to it (for example, in memberaction_dropdown when it is reference by forumbit).

What is the least intrusive way I can get this information passed to the various places I need?

Thanks.
Reply With Quote
  #2  
Old 21 Dec 2010, 00:56
ry215's Avatar
ry215 ry215 is offline
 
Join Date: May 2006
Real name: Nelson
in template postbit (or postbit_legacy) it called

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

but in another templates it called

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
My Mods & Styles

Contace me now for more details!
Reply With Quote
  #3  
Old 21 Dec 2010, 05:25
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
It actually depends on if you are trying to get the field of the viewer ($bbuserinfo) or the person who's post/profile/whatever you are viewing ($post, $userinfo, $prepared, etc).
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #4  
Old 04 Jan 2011, 16:06
iDCamps iDCamps is offline
 
Join Date: Oct 2009
Yeah, that's what I thought.

And that's also the problem: I want to use the value for the person that did the posting in most cases. I also want it to update itself if the person changes that value.

Thus it seems like it isn't available in most places by default. Is there any way that I can drop the in? Could I do it with some form of plugin?

--------------- Added 04 Jan 2011 at 17:36 ---------------

Okay, so I've made a bit of progress.

I've figured out I can make a plugin which will preRegister the values I need. I can then go in to each template and make it use the value.

Now, the tricky part which I could use some guidance on. Obviously each thing needs a different variable converted. Is there any way to get that variable out of the template into my plugin?

For example, forumhome_forumbit_level2_post has a variable forum.lastpostinfo which contains the username. I'd like to get this variable and then either replace it by preRegistering another variable, or even better, just replacing the value in this variable.

I tried creating a new template for this (using vB_Template::create), but it had no registered variables.

Is there a way to do this? The alternative would be to figure out the query for each thing and put in the proper data, but that would be quite a hassle.

Thanks.

Last edited by iDCamps; 04 Jan 2011 at 17:36. Reason: Auto-Merged DoublePost
Reply With Quote
  #5  
Old 04 Jan 2011, 18:57
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
I'm sorry, but you have totally lost me as far as what you need help with right now.

If you create a new template, then you can register variables in it just before you render it:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #6  
Old 04 Jan 2011, 19:06
iDCamps iDCamps is offline
 
Join Date: Oct 2009
I know that much, thanks though.

Let me try to rephrase.

Basically what I want to do is go through and anywhere that a username is shown (in last posts, in post headers, etc), I want to replace that value with a profile field.

I've accomplished this in one place, in memberaction_dropdown. However, it only takes affect when viewing an actual thread, because apparently that's the only place that the field variables are caught (elsewhere it uses the username still because I have it show that using a conditional that checks if the field is set).

So, what I -think- is my problem is I need a way of injecting variables into the various templates I need.

That much I can accomplish using a plugin which is currently hooked to global_start which preRegisters the values I need for each template. I can then go into each template and put those variables into use.

The tricky part is obviously I need to do these changes based on some other value. For example, in some places I'll need to determine what the current value is. This is where I'm stuck... how can I figure out what that value would be.

I know PHP forwards and backwards, but I'm still confused how vB passes variables around between the various template bits, and more importantly, how I can intercept those.

Any help you can provide would be greatly appreciated. If I'm approaching this from the wrong angle, please let me know. The only requirement I'm trying to maintain for this goal is to not have to edit any core code.

Thanks.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 19:28.

Layout Options | Width: Wide Color: