News:

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

Main Menu

Auto profile welcome message + add buddy

Started by runebergen, August 04, 2008, 05:31:50 PM

Previous topic - Next topic

runebergen


Hi..

Wonder if any of you smart coders could help me with a feature I really want...

I got Ultimate Profiles set up, and want to make more use of the great buddy and profile page system that mod provides.

So, for new registered members, my dream is to have a welcome post and auto request "add buddy" to this new user from the Admin.

New registered user feature
- Auto post a welcome message from Admin at the users profile page
- Auto request "add to buddy" to this new user from Admin



Hope anyone can help!:)

Much apreciated

[SiNaN]

For the first:

http://custom.simplemachines.org/mods/index.php?mod=387

For the second, I couldn't get what you meant. Do you want to automatically add the user registered as the admins buddy?
Former SMF Core Developer | My Mods | SimplePortal

runebergen

Quote from: [SiNaN] on August 05, 2008, 02:20:54 PM
For the first:

http://custom.simplemachines.org/mods/index.php?mod=387

For the second, I couldn't get what you meant. Do you want to automatically add the user registered as the admins buddy?

Hey thanx for the link ;) Almost what I wanted, but can do..


What I really wanted was this :
- Admin auto request buddy for new registered members
- Admin auto post a welcome message at their profile page (not PM)


If anyone have any tips or code for that, I'd love to see :)





[SiNaN]

Are you using a kind of a Ultimate Profile?
Former SMF Core Developer | My Mods | SimplePortal

runebergen



yes, exactly ;) Thats why I want to direct people to that page when they register...
To get them all to see the Ultimate Profile page, and to start using it...

Want to see if we can get this nice mod more active..




Adish - (F.L.A.M.E.R)

For the 1st one, Welcome Message on registration:- http://custom.simplemachines.org/mods/index.php?mod=789

I dont know about the second one, hope that info helps.

runebergen


Thanx flamer...

Both mods are pretty close... Both the auto welcome PM above , and yours that create auto TOPIC...

What I would love, is not PM/Topic, but a auto welcome message at their PROFILE page ;)


But I'll look into the code of both links posted in this thread, maybe I can figure out a way to change it to auto PROFILE post ;)

  O:)

Adish - (F.L.A.M.E.R)

That would be like settings up a default text that is to be shown to all the registered users in their profile.

Admin --> Features and Options --> Default personal text Text

That will be shown just under the avatar of the newly registered user. Thats how far i can think of.

You are asking for a message that would appear up when they would visit their profile 1st time, and next time they go to their profile the message is disappeared. Maybe that is what you are trying to explain. Is it ?

Hope my info helps you out.

runebergen

#8
Quote from: F.L.A.M.E.R on August 06, 2008, 07:59:53 PM

You are asking for a message that would appear up when they would visit their profile 1st time, and next time they go to their profile the message is disappeared. Maybe that is what you are trying to explain. Is it ?

Hope my info helps you out.


Yes, almost :) It doest have to disapear, or show first time they visit. Doesnt have to be that advanced. Rather just a simple auto welcome post at their profile page, when they register a new account. This post would show as posted from Admin, and function as a welcome message at their (ultimate) profile page....

"Welcome to the community, hope you enjoy the say. Please take time to fill out your profile into....etc"

That kinda welcome message.

Almost identical to the Auto PM welcome mod, but for profile page, instead of PM

I got Ultimate Profile running (Awesome mod), where people can post comments, add buddies, etc etc. In ways,  a bit "my space" ish...

And the idea with the auto welcome post at profile, is to direct new users to see this system (ultimate profile), and hopefully take it into use :)


hope that made sense :)

[SiNaN]

Trying asking this features in the Ultimate Profile mod support topic. May be I can have a look when I have some time.
Former SMF Core Developer | My Mods | SimplePortal

runebergen


Thanx, but I know you have great mods that you're working on, so I wouldnt want to take your time ;)

I'll try a bit myself, might figure it out. :)

[SiNaN]

Okay, anyway I did it for you;

../Sources/Register.php

Find:

$memberID = registerMember($regOptions);

Replace:

$memberID = registerMember($regOptions);

loadLanguage('UltimateProfile');

db_query("
INSERT INTO {$db_prefix}profile_comments
(ID_MEMBER, comment, time, COMMENT_MEMBER_ID)
VALUES (1453, 'Welcome to our forum!', '" . time() . "', $memberID)", __FILE__, __LINE__);

db_query("
INSERT INTO {$db_prefix}buddies
(ID_MEMBER, BUDDY_ID, approved, position, time_updated, requested)
VALUES (1453, $memberID, 0, 1, '" . time() . "', 1453)", __FILE__, __LINE__);

require_once $sourcedir . '/Subs-Post.php';
sendpm (array('to' => array($memberID), 'bcc' => array()), sprintf ($txt['buddy_notif_new_subject'], $_POST['user']), sprintf ($txt['buddy_notif_new_body'], $_POST['user'], $scripturl . '?action=buddies'), false, array ('id' => 0, 'name' => $txt['profile_notif_com_user'], 'username' => $txt['profile_notif_com_user']));


Chanage 1453 as the ID of the admin.

Note that only works with Ultimate Profile mod. For further requests ask in the mod's support topic.
Former SMF Core Developer | My Mods | SimplePortal

runebergen

#12

Wow, thanks a bunch, you're an angel!  :D

Worked like a charm, except that the PM to the new users (about Admin wanting to be buddy),
The request is sent from Admin (as should), but the request to the new user is about adding himself to his own buddy list, and not the Admin. In other words, the new user is requested to add himself to be his own buddy, by Forum Admin;)

But I'll try figure out why, in last part of the code...


The auto welcome post on the profile page worked fantastic though! Thanx a million  :D :D

[SiNaN]

Let's solve the problem and then I'll accept the "thanks". :P

I never used this mod, so I'm not too familiar with codes but let's try this:

In codes,

Find:

      VALUES (1453, $memberID, 0, 1, '" . time() . "', 1453)", __FILE__, __LINE__);

Replace:

      VALUES ($memberID, 1453, 0, 1, '" . time() . "', 1453)", __FILE__, __LINE__);

If doesn't work, try replacing with this:

      VALUES ($memberID, $memberID, 0, 1, '" . time() . "', 1453)", __FILE__, __LINE__);
Former SMF Core Developer | My Mods | SimplePortal

runebergen

#14
Quote from: [SiNaN] on August 10, 2008, 11:07:22 PM


Find:

      VALUES (1453, $memberID, 0, 1, '" . time() . "', 1453)", __FILE__, __LINE__);

Replace:

      VALUES ($memberID, 1453, 0, 1, '" . time() . "', 1453)", __FILE__, __LINE__);



That worked  :D :D 

Fantastic! Thanx a bunch..   :)

Really apreciated, awesome help




Sabre™

#15
Which worked for you?
Cause neither had any result for me   ????

Could you quickly look at my template please [SiNaN]??

I tried both probably 3 times each to no success.

Thank You

EDIT: The member number is 1
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


[SiNaN]

Former SMF Core Developer | My Mods | SimplePortal

Sabre™

It still displays the user wanting to add himself as a buddy.

Say I reg as  Test 1, it will state that Test 1 wants to be my buddy, instead of the prescribed user.
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


[SiNaN]

#18
I had to set up a local, install the mod, change the original Register.php with the one you attached.

Result: It works perfect.


Sorry, you mean the name is wrong. Just replace the $_POST['user'] with 'YOUR_NAME'.

'YOUR_NAME' is the username of the admin account.

Note: If you want we can code a new query and get the username of the admin automatically but I don't think we really need that.
Former SMF Core Developer | My Mods | SimplePortal

runebergen

#19
yes, I changed that part..... I forgot to mention. The actual PM text was wrong too :) Here is the complete code that I use that works fantastic, with fixed PM text

Thanx a lot to [SiNaN]....   :)



// Auto Post at profile mod
loadLanguage('UltimateProfile');

   db_query("
      INSERT INTO {$db_prefix}profile_comments
         (ID_MEMBER, comment, time, COMMENT_MEMBER_ID)
      VALUES (2, 'Hi there<br>Welcome to our forum!<br>Hope you enjoy the stay, and come back often :)', '" . time() . "', $memberID)", __FILE__, __LINE__);

   db_query("
      INSERT INTO {$db_prefix}buddies
         (ID_MEMBER, BUDDY_ID, approved, position, time_updated, requested)
      VALUES ($memberID, 2, 0, 1, '" . time() . "', 2)", __FILE__, __LINE__);

   // Post a PM about the Buddy request too
  require_once $sourcedir . '/Subs-Post.php';

   // Set up the PM message array
   $pmfrom = array(
      'id' => 2, // change to correct ID for PM to be sent FROM
      'name' => 'Forum Admin name', // change to the NAME for PM to be sent from

   );

    // send the PM :)   
   sendpm (array('to' => array($memberID), 'bcc' => array()), sprintf ($txt['buddy_notif_new_subject'], $pmfrom['name']), sprintf ($txt['buddy_notif_new_body'], $pmfrom['name'], $scripturl . '?action=buddies'), false, array ('id' => 2, 'name' => $txt['profile_notif_com_user'], 'username' => $txt['profile_notif_com_user']));

   // end of auto post on profile



NOTE : The ID on MY forum for Admin, is 2. Change to your correct ID for your Admin (or user you want to be doing the auto message & PM)


:)

Advertisement: