Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-27-2014, 03:02 PM
Gadget_Guy Gadget_Guy is offline
 
Join Date: Jun 2010
Posts: 271
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need query to strip character from titles

Hi,

I am running into an issue where any thread titles that have a "*" in them are causing me to get errors.

I would like a way to go through all thread titles and replace any instance of "*" with either another character or a blank space.

(and by "*", I actually mean the asterisk character)

Ideally, I would like to run a query to first show me them first... then I could delete manually in the forums, if there are not too many.

Or... if there turns out to be a lot, a query to then perform the search and replace automatically.

Thanks,

D.
Reply With Quote
  #2  
Old 11-27-2014, 03:07 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Find threads with * in the title:
PHP Code:
SELECT threadidtitle
FROM 
`thread
WHERE title LIKE '%*%'
ORDER BY lastpost DESC 
Replace * with nothing in the title:
PHP Code:
UPDATE thread 
SET title 
REPLACE(title'*'''
WHERE title LIKE '%*%'
Create backup before executing the UPDATE query in case it goes wrong.
Reply With Quote
  #3  
Old 11-27-2014, 03:17 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Writing a file for this would be quite a job. You can use phpMyAdmin to find all such threads and then delete or edit as necessary.

Go to your thread table and click "Search" at the top of the page then in the page you get after that put in the criterion

LIKE %*%

for the title field.

EDIT: Once you get your results you can double click on the thread title to get a little edit box. Click outside the box to submit.
Reply With Quote
  #4  
Old 11-27-2014, 03:25 PM
Gadget_Guy Gadget_Guy is offline
 
Join Date: Jun 2010
Posts: 271
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This worked perfectly... and helped me find the REAL cause of the issue.

I see that threads with "*" in them are fine and only a few are what is throwing the error.

It looks like deleted users who I think weren't deleted properly and turned into "Guests" is the real issue.

The "Chris G" posting you see is not in the system any more... it was deleted as part of a cleanup of users who haven't visited the forums in a long time.

See the attached screen shot.

All the threads that throw the error have users like the one here.

Now... how can I properly clean up these users..... or... find threads with users like this and clean those out?

D.
Attached Images
File Type: jpg cause of error.JPG (35.8 KB, 0 views)
Reply With Quote
  #5  
Old 11-27-2014, 03:34 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What does it show in the "postusername" field? "Guest" or the original name? And what is the value for "postuserid"?

--------------- Added [DATE]1417110248[/DATE] at [TIME]1417110248[/TIME] ---------------

You might not want to delete those from the thread table right away. You should also get rid of the posts associated with those threads and I'm not sure how to do that. Maybe someone else knows. If you delete those entries from the thread table you've lost the thread id values.
Reply With Quote
Reply


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 04:38 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.03742 seconds
  • Memory Usage 2,216KB
  • Queries Executed 12 (?)
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
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (1)postbit_attachment
  • (5)postbit_onlinestatus
  • (5)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_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
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete