Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-14726

Custom profile field URL is not parsed if there is no %s in the URL

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.1.9
    • None
    • None

      If a cpf is set to be a "contact" field, then the URL part of it will be ignored if it does not contain %s.

      This is caused by the following lines in phpbb/profilefields/manager.php:

      if (strpos($ident_ary['data']['field_contact_url'], '%s') !== false)
      				{
      					$contact_url = sprintf($ident_ary['data']['field_contact_url'], $value);
      				}
      

      I suggest fixing it like this:

      if (strpos($ident_ary['data']['field_contact_url'], '%s') !== false)
      				{
      					$contact_url = sprintf($ident_ary['data']['field_contact_url'], $value);
      				}
      else
      					$contact_url = $ident_ary['data']['field_contact_url'];
      

      Workaround while the fix is not accepted - just add any junk parameter to the URL and set it to %s. For example, if you want your URL to be example.com/foo, use example.com/foo?bar=%s (just make sure that target site ignores the "bar" parameter).

      Use case:
      A custom profile field that links to user's profile and Sony Playstation Network can no longer point directly to the profile due to changes at Sony's site. Therefore an admin could like to display the PSN account name and link to the search at Sony's site: https://www.playstation.com/en-us/my/public-trophies/. Currently, in this situation one has to use https://www.playstation.com/en-us/my/public-trophies/?u=%s instead.

            Unassigned Unassigned
            BioLogIn BioLogIn [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: