NP_Friends.php

NP_Friends is a plugin to add a friends network to community blogs. Site members can designate each other as friends (it must be mutual). Member pages can include lists of a member's friends with links to the friend's member page, the friend's avatar (using NP_Profile) and the friend's online status (using NP_Online).

General Plugin info
Author: Wesley Luyten and Frank Truscott
Current Version: 1.04
Download: NP_Friends.zip, format: zip, size: 15KB, 8 files
Code: N/A
Forum Thread: discuss

Before Installing

Though NP_Friends can work as a stand-alone plugin, its full features can only be realized in conjunction with NP_Profile (version 2.1 or higher recommended) and NP_Online. If you do not have these plugins installed, please consider doing so. If you have these plugins installed already, please be sure to upgrade them to the latest versions, then proceed with the installation of NP_Friends.

NP_Profile allows the use of avatars in friend lists, and the ability to restrict viewing of friends list to members or friends. NP_Online allows the friend list to designate which of the firends are currently online.

For information on downloading and installing thee plugins, see their respective wiki pages, NP_Profile and NP_Online

Installing

  1. Unzip the file and upload the contents to your plugin directory
  2. Install the plugin…
  3. Set the options according to your preferences. The options are described in the “Options” section below.
  4. Follow the instructions in the “How to use the plugin” section below

How to use the plugin

After setting the options, all you need to do is add two or three skinvar tags to your Member Details skin part. The skinvars are described below, but an example would be as follows:

<h2>Friends (<%Friends(count)%>)</h2>
<br />
<%Friends(add)%><br />
<br />
<%Friends(show)%><br />

If you intend to allow the members to restrict viewing of their friend list to site members or their own friends, you will need to make sure this NP_Profile skinvar tag is included in the edit form of the NP_Profile plugin:

<%Profile(privacylevel,label)%>: <%Profile(privacylevel)%>

Members can invite other members to be their friend by visiting the other member's profile page and clicking an invite button. The invited member will receive an email invitation including a link to activate the “friendship”. Members can be designated into three levels which are, by default, “friend”, “best friend”, and “special friend”. When a member views his entire list of friends, he can manage this list by activating pending invitations, deleting unwanted friends, and changing the friend level.

All words displayed can be customized by changing options or by modifying the nucleus/plugins/friends/english.php file. If your site uses a language other than english, you should copy the english.php file to yourlanguage.php in the firends directory. The filename should be the same as that used in the nucleus/language/ directory. In this file, translate the english into your language. Please, consider submitting any translated files to the forum thread for inclusion in the distribution.

To control the look of the friend list when avatars from NP_Profile are used, you should add this css to your skin's css file:

/*************************************************************
 *                                                           *
 *  Copy the following into your skin's css file to make     *
 *  the mini-list of friends on the member page look like    *
 *  the allfriends page format.                              *
 *                                                           *
 *************************************************************/
.friendcell {
	width: 120px;
	text-align: center;
}

.friendtitle {
	text-align:right;
}

.avatar img {
	padding: 2px;
	border: 1px solid #333333;
}

.avataronline img {
	padding: 2px;
	border: 2px solid #00CC00;
}

.onlineimg {
	position: relative;
	top:10px;
	border:none;
	z-index:10;
	/*display:none;*/
}

.no_onlineimg {
	height: 19px;
}

.avatarimg {
	height:80px;
	width:80px;
	position: relative;
}
/******************************************************
 * end section to copy into your css file             *
 ******************************************************/

Available SkinVars and/or TemplateVars

There are three skinvars made available by this plugin. These skinvars are valid only in the Member Details skin part. These are dewscribed below:

  • <%Friends(count)%> - This will display the number of friends the viewed member has.
  • <%Friends(add)%> - This will display a button, as appropriate, to invite the viewed member to be a friend, revoke an invitation to the viewed member, accept an invitation from the viewed member, or to delete the viewed member from a friend list. Only visible to logged in members.
  • <%Friends(show)%> - This will show a list, or a three-column table, of the first X number of friends as set by the plugin option described below. In the case where avatars are displayed, there will only be three friends listed per row. This will include a link to the member's “all friends” page

Options

  • How many friends do you want to show on the memberpage? - Integer. Default: 6. Number of friends to show on member page where <%Friends(show)%> is used.
  • Do you want to show an avatar below the membername? - yesno. Default: yes. Whether you will be using NP_Profile to display avatars of friends.
  • Delete the data table when uninstalled? - yesno. Deafult: no. Whether to delete the NP_Friends data table when the plugin is uninstalled. This should only be changed to yes if you will deleting the plugin for good.
  • Show short member names instead of real member names? - yesno. Default: yes. Whether the member's display names should be used instead of real names in friend lists.
  • Full URL to the css file for All Friends display page - Text. Default: a full URL to the allfriends.css file distributed with this plugin. Change this if you create a different css file to customize the display of the All Friends page. If you choose to edit the allfriends.css file distributed with this plugin, be aware that future verisons of this plugin may override your customizations. An example would be http://host.domain.tld/nucleus/plugins/friends/allfriends.css
  • Template for the subject of invitation email - Text. Default: 'An invitation from <%fromname%> of <%sitename%>'. This will be the subject line of the invitation emails when a member invites another to be a friend. The default value would parse to be something like this, if the member issuing the invitation is called fredmertz and the site is called We Love Lucy: ''An invitation from fredmertz of We Love Lucy' . The available tags are described below:
  • Template for the body of invitation email - Textarea. Default: See below. This will be the body of the invitation email. The available tags are described below.

Default body of invitation email:

Hi <%toname%>, I am <%fromname%> from the <%sitename%> site. My real name is <%fromrealname%>. I would like to add you to my friends list. See <a href="<%fromurl%>">my profile here</a>. If you would like to add me to your friend list, click this link: <a href="<%activateurl%>"><%activateurl%></a>

Tags for the invitation email subject and body templates:

  • <%fromname%> - display name of the member sending the invitation
  • <%fromrealname%> - real name of the member sending the invitation
  • <%fromurl%> - url to sending member's member page
  • <%toname%> - display name of the member receiving the invitation
  • <%sitename%> - name of the site
  • <%siteurl%> - url to the site's main page
  • <%activateurl%> - the very important link used to accept the invitation (activation)

Tips and Tricks

Wishlist

Please post feature suggestions to the discuss.

Bugs

  • default avatar not being displayed properly. Fixed in 1.01.
  • existing friends (older than 30 days) being deleted when new friend activates. Bug in house cleaning script. Fixed in 1.04.

Please report bugs to the discuss.

History

  • Version 1.0, 01-16-2007, Initial Release
  • Version 1.01, 01-29-2007, fix bug displaying default avatar.
  • Version 1.02, 02-21-2007, fix bug to make compatible with mysql < 4.1
  • Version 1.03, 03-23-2007, Fix how member page links created in allfriends.php, and fix charset issue on allfriends.php
  • Version 1.04, 05-14-2007, Fix bug in house cleaning script that was deleting existing friends (older than 30 days) when a new friend activated.

Plugin Review

NP_Friends version 1.04 works with Nucleus CMS version 3.31 - 2007-11-04 kg

friends.txt · Last modified: 2009/03/19 21:13 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki