vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Change threadbit if user is deleted (https://vborg.vbsupport.ru/showthread.php?t=314467)

mightyudis 09-22-2014 03:27 PM

Change threadbit if user is deleted
 
Hey,

i am trying to change the content of the author div in threadbit, base on whether the user is deleted or not.

This is the default threadbit author div of the template i use (and also the default vbulletin4 i belive)
Code:

{vb:rawphrase started_by_x_y_z_a, {vb:link member, {vb:raw thread}, null, 'postuserid', 'postusername'}, {vb:raw thread.postusername}, {vb:raw thread.startdate}, {vb:raw thread.starttime}, {vb:stylevar dirmark}}
This results in
Quote:

Started by Username, 31.12.2014 23:59
Which is fine for existing users, but if the user is deleted the query results in
Quote:

Started by , 31.12.2014 23:59
So i tried to get the username from {vb:raw post.username}
Code:

{vb:rawphrase started_by_x_y_z_a, {vb:raw post.username}, {vb:raw thread.postusername}, {vb:raw thread.startdate}, {vb:raw thread.starttime}, {vb:stylevar dirmark}}
Which works fine, but there is no markup for the usernames and vbulletin is making the username linking to root dir.
Quote:

Started by Deletedusername[marked as link to root dir /], 31.12.2014 23:59
I tried hard-linking the variables, which works too
Code:

Started by {vb:raw thread.postusername}, {vb:raw thread.startdate} {vb:raw thread.starttime}
but has no phrase support for non-english users and i still lack the if condition.

My questions are:
- How can i test in the template whether the user still exists or not with some <vb:if> (or something else)

IF user exists
Started by Username with markup and all
ELSE
Started by Deletedusername just plain text

- and how can i then use phrase replacements without vbulletin marking the deleted usernames as links?

Any suggestions?

Regards

ozzy47 09-22-2014 03:49 PM

Why not just try this mod, https://vborg.vbsupport.ru/showthread.php?t=245183

mightyudis 09-22-2014 04:01 PM

I found this too while searching for a solution, but i don't want to have to do it for manually every thread of a user i delete/that gets deleted in a cleanup process.

(Also i am pretty sure that the query would still return empty since the username doesn't exist anymore, but can be accessed via {vb:raw post.username})

So changing the template query seems the better solution to me. (And i don't have to install another mod that may or may not interfer with other mods/custom modifications)

Max Taxable 09-22-2014 04:05 PM

Quote:

Originally Posted by mightyudis (Post 2516159)
I found this too while searching for a solution, but i don't want to have to do it for manually every thread of a user i delete/that gets deleted in a cleanup process.

Search up "One touch ban and clean" here.

Lynne 09-22-2014 04:07 PM

For your condition, you can look to see of $post[userid] > 0. Basically, deleted users no longer have a userid.

mightyudis 09-22-2014 04:14 PM

Quote:

Originally Posted by Max Taxable (Post 2516164)
Search up "One touch ban and clean" here.

Thanks, but that still does not display the deleted username in the threadbit of forumdisplay.

(Which is probably not the main goal for the modification to begin with)

Quote:

Originally Posted by Lynne (Post 2516165)
For your condition, you can look to see of $post[userid] > 0. Basically, deleted users no longer have a userid.

Okay, i will try that.

Max Taxable 09-22-2014 04:18 PM

Quote:

Originally Posted by mightyudis (Post 2516168)
Thanks, but that still does not display the deleted username in the threadbit of forumdisplay.

Right, because once you use the one touch ban and clean there is nothing to display.

Maybe I don't understand the problem or the circumstances. My post was about how to avoid this issue in the future.

mightyudis 09-22-2014 08:25 PM

I solved a part of my problem. Somebody had installed the e360 markup mod. As i deactivated the mod all thread creator names were shown.

e360 uses
PHP Code:

fetch_musername($fetch_userinfo); 

to get the marked up name, but on a deleted user this of course returns empty, so there is no data for
PHP Code:

fetch_musername($fetch_userinfo

So i modified it to use
PHP Code:

if (empty($thread['post_musername'])){
        
$thread['post_musername']  = "<strike>".$thread['postusername']."</strike>";


in the threadbit_display.php hook to get the username from $thread and striking it through.

That solves the first part of my problem.

Now vbulletin just has to stop to link to non-existing profiles and everything is flowers. :)

Thanks for the help so far.


All times are GMT. The time now is 09:00 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.01345 seconds
  • Memory Usage 1,741KB
  • 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
  • (3)bbcode_code_printable
  • (3)bbcode_php_printable
  • (7)bbcode_quote_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