Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 09-30-2005, 02:49 PM
RustedBucket RustedBucket is offline
 
Join Date: Nov 2004
Location: Albemarle, NC
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Using profile field in forum display

Here's what I'm wanting to do and I realize this might require core modifications possibly.

Currently running: VB 3.5 Stable

I have usernames that are generic numbers (ie: R55555). That number corresponds to an employee name. I'm currently storing the users Real Name in a profile field (ie: field5). This obviously works fine in the post bit, but I also want to display the real name in the Last Post information. So on all the forum views, the Last Post By is not the username but actually the profile field. My problem is, figuring out where to do this. Is it a code mod or is there another method that can be used in the new system?

Thanks
Reply With Quote
  #2  
Old 09-30-2005, 02:58 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try

forumdata_presave and threaddata_presave
PHP Code:
if ($this->fetch_field('lastposter') == $this->registry->userinfo['username'])
{
    
$this->set('lastposter'$this->registry->userinfo['field5']);

Reply With Quote
  #3  
Old 09-30-2005, 03:15 PM
RustedBucket RustedBucket is offline
 
Join Date: Nov 2004
Location: Albemarle, NC
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Andreas, and sorry for posting that in the wrong section..
I'm assuming this goes in as a plugin, I've added it to as such to both the presave's and enabled the plugin sytem and each plugin is active.

Question: How do you now reference this in the template or is it a global thing? It didn't change anything that's why I ask.
Reply With Quote
  #4  
Old 09-30-2005, 03:22 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, it only effects new last posts.
Did you make one?
Reply With Quote
  #5  
Old 09-30-2005, 03:25 PM
RustedBucket RustedBucket is offline
 
Join Date: Nov 2004
Location: Albemarle, NC
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well DUH!! ok yeah, that worked great.
So next question.. anyway to force that to the existing posts? It's got to be stored somewhere I'm guess, I could write something if I knew where that was. Any ideas? or make it update when a post is edited?
Reply With Quote
  #6  
Old 09-30-2005, 03:29 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

*** Untested ***
(As well as above code was)

Assuming that your database is consistent, you are not using table prefixes and you are running at least mysql 4.0.4

[sql]update forum, user, userfield set forum.lastposter = userfield.field5 where userfield.userid=user.userid and user.username=forum.lastposter[/sql]

[sql]update thread, user, userfield set thread.lastposter = userfield.field5 where userfield.userid=user.userid and user.username=thread.lastposter[/sql]
Reply With Quote
  #7  
Old 09-30-2005, 04:32 PM
RustedBucket RustedBucket is offline
 
Join Date: Nov 2004
Location: Albemarle, NC
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you that worked perfectly.

Just a note to anyone that uses this though. If you rebuild the forum and thread information this will obviously get replaced with the standard id's but assuming nothing majors changed, you'd just need a script to run the 2 queries above afterwards.
Reply With Quote
  #8  
Old 11-21-2005, 05:16 AM
Saintless Saintless is offline
 
Join Date: Nov 2005
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hm how would you get this to work for first poster? or am i out of my mind
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 03:24 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.04551 seconds
  • Memory Usage 2,226KB
  • Queries Executed 13 (?)
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
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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_postinfo_query
  • fetch_postinfo
  • 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