Help with forum quoting?


Posted on 16th Feb 2014 07:03 pm by admin

Hi im working on a forum and I have alomost finished it but i want a user quote system like twitter and facebook with the @ sign to start it off, however even though im good at php coding and have done a code with preg_match and preg_replace to change them quotes to link.

For example if someone wrote "to quote @123456 which he said this." what would come up is "to quote 123456 which he said this." and the 123456 would be a link to their profile.

Did you know?Explore Trending and Topic pages for more stories like this.
I also did the username change and got this to work but when I did that the code only got the first quoted id number and if there was two users quoted in one comment then it would have the same username going to two different profile links.

What I want to do is what facebook does, I want that @123456 link to change to the user's username. Lets say the id "123456" goes to the user "Test User" then the link would be: Code: <a href="http://tester.com/123456">Test User</a>
What I need help with is how to make a function that gets the comment looks through it for each quoted user and looks in the database for that id number and then prints out a link to their profile with the link having their username showing on the page and a link like "http://tester.com/<userid>".

For example if the php function was called "comment" then i would do this:
Code: print comment('to quote @123456 and @654321 which they said this.');

And what prints out on the page is: to quote Test User and Guest User which they said this.

And the html code would be:
Code: to quote <a href="http://tester.com/123456">Test User</a> and
<a href="http://tester.com/654321">Guest User</a> which they said this.

If anyone can help me please reply Thank You.
No comments posted yet

Your Answer:

Login to answer
213 Like 54 Dislike
Previous forums Next forums
Other forums

Issue Parsing XML into table
Hello all,

Im a bit new to php and new to phpfreaks. But thanks in advance for the help!
<

Help building / using array
First - this is a cross-posting, if this is wrong I apologise! What started out as a MySQL query que

Extracting Long text from message class with parameters
Hi,

I would like to extract the long text from a message class. However, the long text ha

PHP/Database issue
My friend is helping me make a database where you go to a certain webpage of my site and the page wi

Help to integrate whois Domain Details to website
Hi,

can i know is their any php script r methods to add domain details to my website.

Checking if multidimensional array is empty?
I have a for with multiple test input fields. Specifically the user submits multiple names and ages

dropdown box help - open php files to textarea
Hi, I am using tinymce to edit content located in several php files. The code I attached works but i

Program with calculate Meteorologic measurements
Hello I'm a beginner and I want to make a program with calculate Meteorologic measurements:
ba

IF Statement & Two Tables With Different Echoes
I'm retrieving two tables in a single query using UNION ALL, like so:

Code: $query = "SE

Check premium expire
Hi,

I am making a simple file hosting site and want to check if users premium subscriptions h

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash