Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
[How-To] Use API for Private Messages
harmor19
Join Date: Apr 2005
Posts: 1,324

by harmor19 harmor19 is offline 03 Jul 2006
Rating: (1 vote - 5.00 average)

Have you ever wanted to create a hack that'll private message users when they reach a certain point in the script?
For instance say you wanted to private message user "abc" when he or she reaches the end of the form.

The first thing you'll need to do is require "includes/class_dm.php" along with "global.php".

I have put the Private Message API into a function. I decided to do this in my own script due to the repetiveness.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Now that you have the function you'll need to create a method to use with it.
Let's say you owned a auction type forum and wanted to private message an user after they've entered their product's information into the form.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

To put it all together

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Last edited by harmor19; 03 Jul 2006 at 14:44..
Views: 7644
Reply With Quote
Comments
  #2  
Old 03 Jul 2006, 03:12
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Real name: Anton Kanevsky
I believe this article was already posted.
__________________
I can no longer support any of my hacks. Please do not contact me for that. Feel free to create and post new versions of my hacks, as long as you give me credit for the original work.
Reply With Quote
  #3  
Old 03 Jul 2006, 04:30
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Real name: Andrew Harmor
I searched for "private message api" and only my thread came up.

Last edited by harmor19; 03 Jul 2006 at 04:36.
Reply With Quote
  #4  
Old 03 Jul 2006, 05:41
Code Monkey's Avatar
Code Monkey Code Monkey is offline
 
Join Date: May 2004
http://www.vbulletin.org/forum/showthread.php?t=82786

From over a year ago. It is listed in the summary of How To's that is stickied in this forum.
__________________
Gaming Forums
Reply With Quote
  #5  
Old 03 Jul 2006, 09:32
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Real name: Andrew Harmor
Well that sucks, well I explain another approach to do it.
Reply With Quote
  #6  
Old 03 Jul 2006, 14:42
pyro.699 pyro.699 is offline
 
Join Date: Sep 2005
Real name: Cody Woolaver
No, thankyou!
I dont know how, but you solved my Pm Counters not updating problem! When no-one else wanted to answer it!

Thanks a ton!
~Cody Woolaver
__________________
:ninja:Ninja's 4 Life:ninja:
Reply With Quote
  #7  
Old 03 Jul 2006, 14:46
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Real name: Andrew Harmor
Originally Posted by pyro.699
No, thankyou!
I dont know how, but you solved my Pm Counters not updating problem! When no-one else wanted to answer it!

Thanks a ton!
~Cody Woolaver
You're Welcome.

Honestly I don't know where it would update the counters. Perhaps the 'save()' function?

I'm glad you found my tutorial useful.
Reply With Quote
  #8  
Old 03 Jul 2006, 14:53
pyro.699 pyro.699 is offline
 
Join Date: Sep 2005
Real name: Cody Woolaver
nope, i had a save ^^; its actchually still puzzling, because all you had wa puting it in a function, and adding return and unset.... which shouldent have made any differance! but, whats with the global at the top? i never had that...
(my guess is that its because it is in a function)
__________________
:ninja:Ninja's 4 Life:ninja:
Reply With Quote
  #9  
Old 03 Jul 2006, 15:34
Code Monkey's Avatar
Code Monkey Code Monkey is offline
 
Join Date: May 2004
No need to return a value.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Gaming Forums
Reply With Quote
  #10  
Old 03 Jul 2006, 15:59
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Real name: Andrew Harmor
Originally Posted by pyro.699
nope, i had a save ^^; its actchually still puzzling, because all you had wa puting it in a function, and adding return and unset.... which shouldent have made any differance! but, whats with the global at the top? i never had that...
(my guess is that its because it is in a function)
The reason I globalize "$vbulletin" and "$botpermissions" is to carry the value of those two variables into the function (I think that's how to explain it).
If I haven't have globalized those two the API would be rendered useless.



Originally Posted by JumpD
No need to return a value.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
I can remove those two tidbits?
It's been a while but I think I tried to use the function without returning the value and it didn't work. I could be wrong though.

Last edited by harmor19; 03 Jul 2006 at 16:01. Reason: Automerged Doublepost
Reply With Quote
  #11  
Old 03 Jul 2006, 17:07
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Yeah you can remove them ... in this case it doesn't matter, because you are deleting the variable, then returning it (null)... no point.
Reply With Quote
  #12  
Old 03 Jul 2006, 17:15
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Real name: Andrew Harmor
Oh Ok.
And to think I'm a coder. :shrugs:
Reply With Quote
  #13  
Old 30 Apr 2007, 20:38
brandondrury brandondrury is offline
 
Join Date: Oct 2005
I see this article is nearly a year old, but I figured I'd ask anyway.

I'm using vBulletin 3.6.5.

Any idea why this isn't updating the user that they have a private message?

For example, this is what I see at the top right of my forum even though I have about 10 PMs sent using this script.
Welcome, brandondrury.
You last visited: Today at 07:14 PM
Private Messages: Unread 0, Total 0.
Thanks,
Brandon Drury
__________________
Home Recording Forum

Brandon
Reply With Quote
  #14  
Old 03 Jun 2007, 16:13
brandondrury brandondrury is offline
 
Join Date: Oct 2005

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

This took care of it.

Brandon
__________________
Home Recording Forum

Brandon
Reply With Quote
  #15  
Old 03 Feb 2008, 14:31
liquidx liquidx is offline
 
Join Date: Nov 2002
I know this is an old thread but does anyone have a proper solution for the problem brandon described in #13?

His fix doesn't work properly.
It does make the PM appear in the upper-right as unread and total.. but it does not allow for the new PM popup to appear.
__________________
- LiQUiD_X -
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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


New To Site? Need Help?

All times are GMT. The time now is 01:59.

Layout Options | Width: Wide Color: