New members: after-join tips and tricks [7.1]

Today I've made several changes to the join process in my site. Two of these changes are based on posts I found in the forums, and one will be newly introduced here after I successfully implemented it myself.

I've decided to gather them all together for easier access. Here goes:

 

Redirect after join:

Based on Deano's post in this topic, I've implemented a redirect to the account (dashboard) page after a new member join, instead of to the avatar page.

 

This is the solution I used:

Edit inc/classes/BxDolJoinProcessor.php

Near the end of the file look for this.

        if ('EXIT' == BxDolService::call('avatar', 'join', array ($iMemID, $sStatusText))) {
            exit;
        }


Comment out those lines and/or replace with this.

        bx_login ((int)$iMemID);
        header("Location: " . BX_DOL_URL_ROOT . getNickName($iMemID));
        exit;


If you prefer to redirect to the dashboard then use this.

        bx_login ((int)$iMemID);
        header("Location: " . BX_DOL_URL_ROOT . "member.php");
        exit;

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

Auto-friend with admin:

Based on Prolaznik's post in this topic, I made every new member a friend with admin by default.

 

This is the solution I used:

 /inc/classes/BxDolJoinProcessor.php 

around line 250 (before "check for couple profile"), add this code:

$dump = db_res("INSERT INTO sys_friend_list SET `ID` = '{$iId1}', `Profile` = 1, `Check` = 1");

1 is the id of your first registered member that would be your admin account.


-----------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

Auto welcome private message to a new member (after join):

 

This one I couldn't find anywhere, so I worked it myself. This trick creates an automatic new message from the admin, for every newly joined member.

It helps especially if your new members are redirected to the account page, where you can place a box displaying new messages. This way, the new auto message is one of the first things a new user sees, and in it you can greet, instruct and supply information and help to new users. That's how you accomplish that:

 

in inc/classes/BxDolJoinProcessor.php, in function showFinishPage (at the end of the file, as for now):

if you don't have a new user redirect, then before these lines:

 if ('EXIT' == BxDolService::call('avatar', 'join', array ($iMemID, $sStatusText))) {

            exit;

 

Insert these:

// send auto welcome message

        $msg = "<p>"._t( '_Join complete' )."<br/>" ._t($sStatusText)."<br/>"._t('_Join_msg_auto_welcome')."</p>";

        $subject = _t( 'Join_msg_auto_welcome_subject' );  

        $dump = db_res("INSERT INTO `sys_messages`(`Date`, `Sender`, `Recipient`, `Text`, `Subject`) VALUES (NOW(),'1','{$iMemID}','{$msg}','{$subject}')");

 

 

If you implemented a redirect-after-join, then place the same above lines inside the redirect block, before the "exit", like this:

 

if($iMemID) {

        bx_login ((int)$iMemID);

        header("Location: " . BX_DOL_URL_ROOT . "member.php");

       

        // send auto welcome message

        $msg = "<p>"._t( '_Join complete' )."<br/>" ._t($sStatusText)."<br/>"._t('_Join_msg_auto_welcome')."</p>";

        $subject = _t( 'Join_msg_auto_welcome_subject' );  

        $dump = db_res("INSERT INTO `sys_messages`(`Date`, `Sender`, `Recipient`, `Text`, `Subject`) VALUES (NOW(),'1','{$iMemID}','{$msg}','{$subject}')");

        

        exit;

        }


You may change the $msg and $subject vars to whatever you want them to be (they set the message subject and body).
In my example, the message body contains the join process status + a pre-defined content, and the subject is also pre-defined in the language file. 

 

If you choose to keep my solution as is, note that you have to add 2 new language keys in order for this to work: 
_Join_msg_auto_welcome , and _Join_msg_auto_welcome_subject

 

[These 3 solutions were implemented and tested on Dolphin 7.1.1]

Quote · 15 Apr 2013

Very nice! Thanks for sharing.

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 15 Apr 2013

Thanks for supplying these tips.

Geeks, making the world a better place
Quote · 15 Apr 2013

Great post, thanks.  If we want to change the welcome subject and message I assume we put that in the language keys that we create?

Quote · 27 Apr 2013

Thank you.

Yes, in order to change the subject, in the example I gave, you change the language key "Join_msg_auto_welcome_subject".

In order to change the message body, you change language key "_Join_msg_auto_welcome", and you may also want to change the declaration of the $msg var.

In the example:

$msg = _t( '_Join complete' )._t($sStatusText)._t('_Join_msg_auto_welcome');

makes the message body to begin with with the "join complete" header and status, and then the language key content. You may wish to change it to a simple: 

$msg = _t('_Join_msg_auto_welcome');

and create the entire message body in the language file.

 

Please note that the language keys "Join_msg_auto_welcome_subject" and "Join_msg_auto_welcome" do not exist by default, you need to add them (or equivalent to them) before you use them.

Quote · 27 Apr 2013

Very useful post. Thank you!

Quote · 2 Dec 2014
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.