vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Edit guest username on posts (https://vborg.vbsupport.ru/showthread.php?t=42148)

Paul 08-10-2002 10:00 PM

Edit guest username on posts
 
Hi,

It aggrevates me that this feature isn't a part of vBulletin, so I've gone and added it myself. Let me know on this thread if you have any problems with it. This hack will allow you to change the username value for any posts made by a guest on your forum. If you don't allow guests to post, don't bother with this hack. :D

I don't have the time to create a screenshot, so you'll have to use some imagination (unless someone else would like to provide one). Just imagine a Username: input box when a moderator with editpost permissions edits a post made by a guest. This will not appear otherwise.

Files to be edited: 1
Template addition: 1

In editpost.php:

Find:
PHP Code:

$foruminfo=getforuminfo($threadinfo[forumid]); 

ABOVE it, insert:
PHP Code:

// Edit username on post hack
if (ismoderator ($threadinfo["forumid"],"caneditposts")  && $postinfo[userid]==0) {
  if (!
$username) {
    
$postusername $postinfo["username"];
    
$postusername htmlspecialchars($postusername);
    eval(
"\$editusername = \"".gettemplate("editpost_editusername")."\";");
  } else {
    
$postusername "";
  }
}
// End edit username on post hack 

Find:
PHP Code:

if ($HTTP_POST_VARS['action']=="updatepost") { 

BELOW it, insert:
PHP Code:

  // Edit username of post hack
  
if ($postinfo[userid]==0) {
    
$username trim($username);
    
$username eregi_replace("( ){2,}"" "$username);

    if (!
$username) {
      eval(
"standarderror(\"".gettemplate("error_nousername")."\");");
    }
    if (
$userinfo=$DB_site->query_first("
            SELECT user.*,userfield.*
            FROM user,userfield
            WHERE     (username='"
.addslashes(htmlspecialchars($username))."' OR
                    username='"
.addslashes(eregi_replace("[^A-Za-z0-9]","",$username))."') AND
                    user.userid=userfield.userid"
)) {
      eval(
"standarderror(\"".gettemplate("error_usernametaken")."\");");
    } else {
      
$postusername htmlspecialchars($username);
    }
  }
  
// End edit username of post hack 

Find:
PHP Code:

    $DB_site->query("UPDATE thread SET title='".addslashes(htmlspecialchars($title))."', iconid=".intval($iconid)." WHERE threadid=$threadinfo[threadid]");
    
//$title="";
  


BELOW it, insert:
PHP Code:

  // Start edit username of post hack
  
if ($isfirst and $postinfo[userid]==and $postinfo[username]!=$postusername) {    
    
$DB_site->query("UPDATE thread SET postusername='".addslashes($postusername)."' WHERE threadid=$threadinfo[threadid]");
  }
  
// End edit username of post hack 

Find:
PHP Code:

  $DB_site->query("UPDATE post SET title='".addslashes(htmlspecialchars($title))."',pagetext='".addslashes($message)."',allowsmilie='$allowsmilie',showsignature='$signature',iconid='$iconid'$editedbysql$attachmentsql WHERE postid='$postid'"); 

BELOW it, insert:
PHP Code:

  // Start edit username of post hack
  
if ($postinfo[userid]==&& $postinfo[username]!=$postusername) {
    
$DB_site->query("UPDATE post SET username='".addslashes($postusername)."' WHERE postid='$postid'");
  }  
  
// End edit username of post hack 

Add a template called "editpost_editusername"

Paste the following into the new template and save it (remember to take out the spaces in { firstaltcolor }:
PHP Code:

<tr>
    <
td bgcolor="{ firstaltcolor }" nowrap><normalfont><b>Username:</b></normalfont></td>
    <
td bgcolor="{ firstaltcolor }"><normalfont><input type="text" class="bginput" name="username" value="$postinfo[username]size="25" tabindex="1"></normalfont></td>
</
tr

Save and upload editpost.php. All done! :D

wickedfate 06-23-2003 03:27 AM

nice, got any screenshots?

S.Shady 06-24-2003 07:01 AM

or use the vb intergrated funtion were a guest can enter a name of their own :)


All times are GMT. The time now is 01:58 PM.

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.01022 seconds
  • Memory Usage 1,751KB
  • 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
  • (9)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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