How To Auto-Add Friends to Member Profiles
by Pete
Automatically friending new members of your community is a great way to make them feel welcome. Here's a bit of JavaScript that you can use to auto-add one or more friends to the profile of every new member of your community. Just copy it into the <head></head> section of your Global Page Template(in the Affiliate Center under Configure > Pages) and put in the value(s) for the friend(s) that you would like to auto-add. The comments tell you how:
<script type="text/javascript">
// auto-add friend code
if ( Ka.Info.USERID != '' && Ka.Info.PAGE == 'pages/myPlace.jsp' && (document.referrer.indexOf('displayUserRegisterPage') != -1) ){
/* replace the second parameter of this call (195738) with the u= parameter from your profile page url: */
KickAppsBizComponent.addFavoriteUserAsFriend(Ka.Info.USERID, 195738, Ka.Info.AFFILIATESITEID);
}
</script>
Once you add this script to your Global Page Template, all new members will automatically have whatever friends you specify in the code. Please keep in mind that this will only work for new members, not existing members. To auto-add multiple friends, simply duplicate the last line of the script and fill in the "u=" number from the URLs of the profile pages of the members that you want to be automatically added as friends. You can add as many as you like:
<script type="text/javascript">
// auto-add friend code
if ( Ka.Info.USERID != '' && Ka.Info.PAGE == 'pages/myPlace.jsp' && (document.referrer.indexOf('displayUserRegisterPage') != -1) ){
/* replace the second parameter of this call (195738) with the u= parameter from your profile page url: */
KickAppsBizComponent.addFavoriteUserAsFriend(Ka.Info.USERID, 195738, Ka.Info.AFFILIATESITEID);
KickAppsBizComponent.addFavoriteUserAsFriend(Ka.Info.USERID, {insert 2nd u= number}, Ka.Info.AFFILIATESITEID);
KickAppsBizComponent.addFavoriteUserAsFriend(Ka.Info.USERID, {insert 3rd u= number}, Ka.Info.AFFILIATESITEID);
}
</script>
Did you enjoy this tutorial? Have questions, comments, or want to submit one of your own? Contact us at support@kickapps.com.