Created
July 13, 2011 17:30
-
-
Save baisong/1080809 to your computer and use it in GitHub Desktop.
A little jQuery hack to overcome a drupal views issue http://drupal.org/node/750172
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* See comments below for explanation | |
*/ | |
/* profile picture link rewrite */ | |
jQuery.ajax({ | |
url: 'index.php', | |
success: function () { | |
if ($('div.fix-link').length) { | |
//console.log('begin fixing user profile links.'); | |
$('div.fix-link .nid').each(function(){ | |
//console.log('fixing link for user profile node '+$nid); | |
var $nid = $(this).html(); | |
$(this).next().find('a').attr('href','/node/'+$nid); | |
}); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I didn't want to modify contributed module code (views),
and couldn't find a simple template.php workaround...
...so, here's a fun little script that expects any number
of incorrectly formatted user profile picture links like:
...and for each one, returns: