@usernames: Twitter Style Mentions - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: @usernames: Twitter Style Mentions (/showthread.php?tid=52877) |
@usernames: Twitter Style Mentions - El Forum - 06-30-2012 [eluser]nitrammit[/eluser] I'm trying to to build a Twitter style notification system that alerts users when their username has been mentioned on the site by another user. For example, user1 wants to draw user2's attention a comment of his. He would post: "You should ask @user2, he knows how to do it!" I've worked out how to convert these mentions to links through the following function: Code: if ( ! function_exists('at_usernames')) Which basically just turns the mention into a link, linking to the user's profile page. But I'm not sure how to take the ACTUAL USERNAME mentioned and use it to add mentions into my database so I can then notify the mentioned user. I understand the CI/DB side of things, but how would I strip the username out? With regex? [EDIT] I can't seem to post my actual code, it is being altered. Here's a screenshot instead: http://cl.ly/3z1z3e0Z0x282E2Y1y2o |