News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Autopost "Welcome"-Thread

Started by playas-palace, February 01, 2006, 07:20:44 AM

Previous topic - Next topic

playas-palace

Hello!
I'm a php-noob and just wanted to ask, if there's a easy way to welcome a new registered user, by posting a welcome thread automatically. ???
Everybody understands what I mean?
Thanx

playas-palace


L.G.S

That would be quite helpful actually, I hope this begins to develop :)
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


playas-palace

I really need that feature, is nobody there who can help?

RyanJones

I will see if I can come up with something - no promises thouugh, still new to SMF and modding it :)

Cheers,

Ryan Jones
RyanJ (Ryan Jones)

Support Web Standards!

Currently working On: Additions to the Karma system.

RyanJones

#5
Can't you just put something like this in the registerMember sub?


$Query 
"INSERT INTO " $db_prefix "messages (ID_BOARD, ID_MSG, posterTime, ID_MEMBER, ID_MSG_MODIFIED, subject, posterName, posterEmail, posterName, modifiedName, body, icon) ";
$Query .= "VALUES ('', '', '1', NOW(), '1', '0', 'Welcome Bot', '[email protected]', '', '1', '0', 'Welcome to the forums " $regOptions['username'] . "!', 'xx')";
db_query($Query__FILE____LINE__);


Not shure but something along those lines would work for a simple solution :)

Cheers,

Ryan Jones
RyanJ (Ryan Jones)

Support Web Standards!

Currently working On: Additions to the Karma system.

L.G.S

FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


RyanJones

Quote from: L.G.S on February 26, 2006, 01:31:58 PM
place it anywhere?

I don't think that will actuall work as it is. I think it needs to be modified to work properly.

If I can get a test board set up I'll see what I can do :)

Cheers,

Ryan Jones
RyanJ (Ryan Jones)

Support Web Standards!

Currently working On: Additions to the Karma system.

RyanJones

#8
Sorry it took so long, been busy :)

This may not work perfectly but here is what works for me:

Open: Register.php (Subs folder)

Find:


	
$memberID registerMember($regOptions);


After, add:


	
require_once(
$sourcedir '/Subs-Post.php');
	
$msgOptions = array();
	
  
$msgOptions['id'] = 0;
	
  
$msgOptions['subject'] = 'Welcome to the forums ' $_POST['user'] . '!';
	
  
$msgOptions['body']   = 'We would like to welcome ' $_POST['user'] . ' too our forums!';
	
  
$msgOptions['icon'] = 'thumbup';
	
  
$msgOptions['smileys_enabled'] = true;
	
  
$msgOptions['attachments'] = array();

	
$topicOptions = array();
	
  
$topicOptions['id'] = 0;
	
  
$topicOptions['board'] = 12;
	
  
$topicOptions['poll'] = null;
	
  
$topicOptions['lock_mode'] = null;
	
  
$topicOptions['sticky_mode'] = null;
	
  
$topicOptions['mark_as_read'] = false;

	
$posterOptions = array();
	
  
$posterOptions['id'] = 0;
	
  
$posterOptions['name'] = 'Welcome Bot';
	
  
$posterOptions['email'] = '[email protected]';
	
  
$posterOptions['update_post_count'] = false;

	
createPost($msgOptions$topicOptions$posterOptions);



Configuring:

Message Options:

$msgOptions['id'] - 0 for a new topic else topic ID in which to reply.
$msgOptions['subject'] - Subject of the reply / new topic.
$msgOptions['body'] - Body of the message, the actual topic message.
$msgOptions['icon'] - Icon name (xx for none?).
$msgOptions['smileys_enabled'] - Pretty obvious.
$msgOptions['attachments'] - Probably null otherwise an array of valid attatchment ID's.

Board Options:

$topicOptions['id'] 0 or a valid topic ID.
$topicOptions['board'] - Board ID in which to post.
$topicOptions['poll'] - Proably null otherwise valid poll ID.
$topicOptions['lock_mode'] - Obvious, true or false.
$topicOptions['sticky_mode'] - Obvious, true or false.
$topicOptions['mark_as_read'] - Obvious, true or false.

Member Options:

$posterOptions['id'] - Member ID for "who posted", 0 if guest.
$posterOptions['name'] - Member Name.
$posterOptions['email'] - Member E-mail.
$posterOptions['update_post_count'] - True to increase post count, false otherwise.

SORRY! broke the code earlier, fixed now

Cheers,

Ryan Jones
RyanJ (Ryan Jones)

Support Web Standards!

Currently working On: Additions to the Karma system.

L.G.S

Awwww have you tested this?

I tried it but got some kind of T_String error around the line of

  $topicOptions['lock_mode'] => null;
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


RyanJones

Quote from: L.G.S on February 27, 2006, 11:17:32 AM
Awwww have you tested this?

I tried it but got some kind of T_String error around the line of

  $topicOptions['lock_mode'] => null;

Ah, crap I knew I forgot something.

The code if fixed now. he teason was I changed it from an array(list here) format to the more clear formatI havenow... the problem was I forgot to change => too = :)

One again, sorry for the errors.

Cheers,

Ryan Jones
RyanJ (Ryan Jones)

Support Web Standards!

Currently working On: Additions to the Karma system.

L.G.S

Man it works, thanks a lot!!

One last thing,

how would I make it so that instead of the body message being one line until it breaks, I can make it seperate lines for things I want?

Do I just add a simple BR?

edit:

ahh one more thing, no matter if mark read is yes or no, the topic does not appear new :(
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


RyanJones

Quote from: L.G.S on February 27, 2006, 11:35:21 AM
Man it works, thanks a lot!!

One last thing,

how would I make it so that instead of the body message being one line until it breaks, I can make it seperate lines for things I want?

Do I just add a simple BR?

As far as I now you can use line breaks in it (HTML or other) :)

Quote from: L.G.S on February 27, 2006, 11:35:21 AM
ahh one more thing, no matter if mark read is yes or no, the topic does not appear new :(

Hmm... I have no idea why it would not be set as new... Anyone have any insight?

Cheers,

Ryan Jones
RyanJ (Ryan Jones)

Support Web Standards!

Currently working On: Additions to the Karma system.

dpmagyari

Is this not showing New to anyone or just to yourself? It wouldnt appear as new if it is being posted by the admin account and you are the admin your post do not show as new to you. Check and see if this is isolated to the admin account or if it is not showing as new to users other than admin.
[nofollow]

playas-palace

 :D
Thank you so much man! Everthings working great!
:-*

L.G.S

Quote from: dpmagyari on February 27, 2006, 12:35:39 PM
Is this not showing New to anyone or just to yourself? It wouldnt appear as new if it is being posted by the admin account and you are the admin your post do not show as new to you. Check and see if this is isolated to the admin account or if it is not showing as new to users other than admin.

The userid is 0, and it posts as Welcome Bot,

I tried with other accounts but still nothing
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


big_boss1313


RyanJones

Quote from: big_boss1313 on March 11, 2006, 01:13:52 PM

Thank You RyanJones

NICE :)

No problem. As soonas I get some time free (School ;)) I'll see if I can make some ACP configurations for it :)

Cheers,

Ryan Jones
RyanJ (Ryan Jones)

Support Web Standards!

Currently working On: Additions to the Karma system.

H

Does the script make the post before or after the user has been activated?
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

TechnoDragon

Awesome mod...love it...now I don't have to spend so much time making all of those welcome topics.  Works perfectly.
Don't tell me to get into shape...I have a shape...It is round!


Advertisement: