vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Using profile field in forum display (https://vborg.vbsupport.ru/showthread.php?t=97231)

RustedBucket 09-30-2005 02:49 PM

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

Andreas 09-30-2005 02:58 PM

Try

forumdata_presave and threaddata_presave
PHP Code:

if ($this->fetch_field('lastposter') == $this->registry->userinfo['username'])
{
    
$this->set('lastposter'$this->registry->userinfo['field5']);



RustedBucket 09-30-2005 03:15 PM

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.

Andreas 09-30-2005 03:22 PM

Well, it only effects new last posts.
Did you make one?

RustedBucket 09-30-2005 03:25 PM

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?

Andreas 09-30-2005 03:29 PM

*** 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]

RustedBucket 09-30-2005 04:32 PM

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.

Saintless 11-21-2005 05:16 AM

Hm how would you get this to work for first poster? or am i out of my mind :)


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

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01047 seconds
  • Memory Usage 1,722KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete