PDA

View Full Version : Change threadbit if user is deleted


mightyudis
09-22-2014, 03:27 PM
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)
{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
Started by Username, 31.12.2014 23:59

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


So i tried to get the username from {vb:raw post.username}
{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.
Started by Deletedusername[marked as link to root dir /], 31.12.2014 23:59


I tried hard-linking the variables, which works too
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
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
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)

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
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
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
fetch_musername($fetch_userinfo)

So i modified it to use
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.