Moodle

Add link code to the text profile field type

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Other
  • Labels:
    None
  • Difficulty:
    Easy
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

Add an extra field when defining a text type user profile field that contains link information to be used when data is displayed in a user's profile. Use a "$" wildcard to be replaced with the user data.

eg Admin sets up link as "http://google.com/search?q=$"
User enters data into this field such as "rabbit"
Then the relevant field on their profile page will be rendered as <a href="http://google.com/search?q=rabbit" target="_blank">rabbit</a>

Issue Links

Activity

Hide
Shane Elliott added a comment -

Code commited to head.

Changed placeholder to $$ as $ is actually a valid URL character - $$ is unlikely to appear. But will that clash with anything else? Filters?

Data that's included in the link is cleaned via format_text( ... , FORMAT_MOODLE) and then urlencode(). AFAIK that should sufficiently get rid of any potential nasty code that could be entered but someone else may like to comment on that.

Show
Shane Elliott added a comment - Code commited to head. Changed placeholder to $$ as $ is actually a valid URL character - $$ is unlikely to appear. But will that clash with anything else? Filters? Data that's included in the link is cleaned via format_text( ... , FORMAT_MOODLE) and then urlencode(). AFAIK that should sufficiently get rid of any potential nasty code that could be entered but someone else may like to comment on that.
Hide
Shane Elliott added a comment -

Resolving. Only outstanding issue was if "$$" clashed with anything. As there have been no comments assume all is ok.

Show
Shane Elliott added a comment - Resolving. Only outstanding issue was if "$$" clashed with anything. As there have been no comments assume all is ok.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: