Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 12-23-2008, 05:32 AM
Hanoifishing Hanoifishing is offline
 
Join Date: Dec 2007
Location: Hanoi, Vietnam
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Ask about the hook!

Hi All!

I have written a products that manage my mark's member. I have a question about the plugin to delete user's mark when delete user in admincp. What's hook can I use? Sorry for my english isn't good.

Please help me.

Thanks in advance.
Reply With Quote
  #2  
Old 12-23-2008, 03:48 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can't really tell what you are talking about. But, when you delete a user via the admin cp, you are using the admincp/user.php file and there is a hook called 'useradmin_prune' that I use for when I delete members and have to do more stuff afterwards.
Reply With Quote
  #3  
Old 12-24-2008, 04:42 AM
Hanoifishing Hanoifishing is offline
 
Join Date: Dec 2007
Location: Hanoi, Vietnam
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi!

Thank you for your help, I want to write a plugin in my product to delete member's mark in usermarks table.

Now I have known hook name.

Thank in advance.
Reply With Quote
  #4  
Old 12-24-2008, 08:31 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There is no "usermarks" table in a default installation in vBulletin.
Reply With Quote
  #5  
Old 12-24-2008, 03:10 PM
Hanoifishing Hanoifishing is offline
 
Join Date: Dec 2007
Location: Hanoi, Vietnam
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi!

usermarks is my table that I add it to my db, I write new product work with it. Each member have some record in it, and I want to delete that records, I know that I must write plugin, please tell me how?

Thanks in advance.!
Reply With Quote
  #6  
Old 12-24-2008, 03:31 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Hanoifishing View Post
Hi!

usermarks is my table that I add it to my db, I write new product work with it. Each member have some record in it, and I want to delete that records, I know that I must write plugin, please tell me how?

Thanks in advance.!
Like I told you, I use the useradmin_prune hook to do a query of my own when deleting users. I have an added table called "users" (with the s on the end - vbulletin has the "user" table without the s) and I have this query in that hook location:
PHP Code:
$db->query_write("DELETE FROM " TABLE_PREFIX "users WHERE id IN ($userids)"); 
Reply With Quote
  #7  
Old 12-24-2008, 04:05 PM
Hanoifishing Hanoifishing is offline
 
Join Date: Dec 2007
Location: Hanoi, Vietnam
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi!

I add new plugin at useradmin_prune hook by add some code:

$db->query_write("DELETE FROM ".TABLE_PREFIX"usermarks WHERE userid in ($userids)

Now I go to my admincp then delete user but records in usermarks have existed.

How to delete it?

Thanks you very much!
Reply With Quote
  #8  
Old 12-24-2008, 04:35 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Whoops. Mine removes the user when you do a Mass Delete. You are looking to delete a single user from the admin cp, right? If so, you can't use a plugin, you actually have to modify the code under the 'kill' option. Go to around line 277 or so of admincp/user.php. Look for this code and add your query in where I have mine in red:

Code:
        $userdm =& datamanager_init('User', $vbulletin, ERRTYPE_CP);
        $userdm->set_existing($info);
        $userdm->delete();
        unset($userdm);

        $vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "users WHERE id=" . $vbulletin->GPC['userid'] . "");

        define('CP_REDIRECT', 'user.php?do=modify');
        print_stop_message('deleted_user_successfully');
Reply With Quote
  #9  
Old 12-25-2008, 05:51 AM
Hanoifishing Hanoifishing is offline
 
Join Date: Dec 2007
Location: Hanoi, Vietnam
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Lynne!

I don't want to modify orginal vbb code. I want to add a hack mod to delete it. Is there another way? Can I use another hook to delete data without join with user table. Example in global_start?

Thank in advance.

Merry Christmas & Happy new year!
Reply With Quote
  #10  
Old 12-25-2008, 07:56 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There should be a hook called userdata_delete.
Reply With Quote
Reply

Thread Tools
Display Modes

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 02:19 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.04080 seconds
  • Memory Usage 2,248KB
  • Queries Executed 11 (?)
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
  • (1)bbcode_code
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete