Support » Plugin: Easy Comment Uploads » [Plugin: Easy Comment Uploads] Display the file name only instead of the path in the comment view.

  • Resolved redone975

    (@redone975)


    Great plugin.

    Upon uploading a file with a comment submission, the link to the file appears as a complete path within the comment:
    <a href="http://www.site.com/files/2011/01/Name of file.pdf">http://www.site.com/files/2011/01/Name of file.pdf</a>

    Instead of displaying the entire path, I would just like to display the file name to the user. Desired HTML would look like this:
    <a href="http://www.site.com/files/2011/01/Name of file.pdf">Name of file.pdf</a>

    Any insights on how to make this possible would be appreciated.

    Thanks,
    Mike

Viewing 6 replies - 1 through 6 (of 6 total)
  • I found the spot to make the necessary change, just trying to figure out what’s the best approach. Within the main.php (on line 18), I have updated the code to this (so far) to make improvements on the display of files:

    $s = preg_replace('/\[file\](.*?)\[\/file\]/', '<p class="comment-attachment"><strong>Attachment:</strong><br><a href="$1">$1</a></p>', $s);

    Plugin Author Thomas Wright

    (@tomdwright)

    Hello, that is indeed the right place. Probably the easiest thing to do is use two capture groups for the url/file name and join them up as appropriate.

    I will certainly be adding this feature in the next version.

    Will give that a go. More of a designer than programmer, so might ask for more specifics, in terms of code.

    One other feature that would be cool, is to place an icon in front of link according to the file extension. For example, place an Adobe Acrobat icon in front of a PDF document. This would be something you could have the option of turning on via the admin. Just a thought.

    Thanks.

    Plugin Author Thomas Wright

    (@tomdwright)

    This is not the first time someone has asked about filetype icons but the best way to do this is not within the plugin but via some more general rules in CSS. There is actually already a plugin to add this functionality for all linked files, including those uploaded using the plugin.

    Plugin Author Thomas Wright

    (@tomdwright)

    I have now set this as the default behaviour in version 0.60.

    Are you able to add images directly to the media gallery? Currently the images uploaded cannot be seen from WordPress, I have to access them with a FTP client.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Easy Comment Uploads] Display the file name only instead of the path in the comment view.’ is closed to new replies.