Comment 3 for bug 1275481

Revision history for this message
Gregor Anželj (gregor-anzelj) wrote :

Tis is not quite easy and it has to be explained. I've created (well updated) "linkedinprofile" bolcktype to display LinkedIn basic or full profile or only contact information on Mahara webpage.

I've said that it is updated, since when I first created it, the LinkedIn didn't offer their API, so the plugin was basically a hack which connected to user's public profile, fetched the webpage and extracted the relevant part.

Now that LinkedIn offers developers to use their API, the plugin is "properly" coded so the user first has to authenticate againt LinkedIn API to allow access to their information, etc.

After that long introduction, let's get to the problem. In my LinkedIn profile I've entered fake address in three lines (see "nl2br-1.png"). When I want to display the address and other contact information on my Mahara page then the following happens. If I use the old markup in the template, e.g.: {$variable|nl2br} then everything is displayed in one line (see "nl2br-2,png"). If I use the new markup, e.g.: {nl2br($variable)} then the address is displayed in three lines as it should be (see "nl2br-3.png").

Below I'm attacing all three screenshots and the source code of the plugin (which wasn't released yet, but it is ready).

Installation instructions (to replicate the problem):
1. install the plugin in admin area
2. Set up the plugin (you'll have to create LinkedIn application in order to get API key and Secret key - then paste those keys into appropriate fields in the form)
3. Update your LinkedIn profile and enter address with more than one line
4. In Mahara create new page
5. Add LinkedIn profile block to that page
6. In LinkedIn profile block authenticate against LinkedIn API and allow access (you'll be redirected to mahara pages index)
7. Edit previously created page and edit LinkedIn block once more
8. Select "contact information" to display LinkedIn contact information

To test nl2br syntax, change it form new to old in the template file: htdocs/blocktype/linkedinprofile/theme/raw/contactinfo.tpl

PS:
* all three screenshots and plugin sourcecode are attached inside one zip file
* My environment: windows, xampp, php, mysql
* I've entered address in windows so maybe there are issues connected to different display of \r an \n characters in different OS-es (windows, linux, mac)?

HTH, Gregor