Advertisement:

Author Topic: how can I send a pre filled PM to admin ?  (Read 2631 times)

Offline cretaceous

  • Semi-Newbie
  • *
  • Posts: 41
how can I send a pre filled PM to admin ?
« on: July 29, 2013, 11:00:21 AM »
Hi - Sorry to do this but I asked this query and got a reply (whih I appreciated- thanks Mr Phil) but the reply did not help me achieve what I needed  - so could anyone else look at it please: !

How would a user auto send via a single click, a pre filled PM to admin with a request to join a locked board?
I want to auto fill member's name and  the board they want to access.

I want this in two places -
a) on front of site
b) when user tries to access a locked board

How would I prepopulate the PM
How would  I auto send the PM
How would  I send it to admin specifically

I'd like to block it to guests but that is less important right now
Not a problem if it has to be done in 2 clicks
Seems like there should be a mod for this ?

Offline IchBin™

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,115
  • Gender: Male
  • I don't speak German.
Re: how can I send a pre filled PM to admin ?
« Reply #1 on: July 30, 2013, 12:52:12 AM »
I highly doubt anyone is going just write the code for you for this. You need a custom mod for this. I'd suggest posting in the help wanted board.
IchBin™        TinyPortal
Coding Guidelines       

Offline cretaceous

  • Semi-Newbie
  • *
  • Posts: 41
Re: how can I send a pre filled PM to admin ?
« Reply #2 on: July 30, 2013, 04:28:42 AM »
I'm not asking anyone to write  code - I'm trying to figure out what is needed to write the code. I'm an experienced PHP web developer but don't know SMF at all. I thought there might be a mod that would make a good starting point.
There isn't much on the wiki about the technicalities of PMs - or anything about the query you'd need to write to get the admin contact id.
I guess I will have to hand code some procedural PHP but seems a lot of work for something that I thought would have been covered already.

Plus I still don't really know where to start !

Offline IchBin™

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,115
  • Gender: Male
  • I don't speak German.
Re: how can I send a pre filled PM to admin ?
« Reply #3 on: July 30, 2013, 09:45:14 PM »
If you start by asking specific questions, you'll probably get some specific answers. Questions like "how do I prepopulate a pm" are too vague since we don't know what you want to populate.

Here's what I'd do.

Add a hook for a custom action using:
http://wiki.simplemachines.org/smf/Integration_hooks#integrate_actions

Inside your source file, you can then handle all the code for dealing with sending the PM to the admin. An admin is anyone with id_group = 0 in the members table.

You can get the current members id from $user_info['id'] or $context['user']['id'] so you know who is clicking the button.

From there you can just use the sendpm() function to handle the PM

That should get you started.
IchBin™        TinyPortal
Coding Guidelines