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.
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
54
Other forums
Multiple Options for a Single Page
For this example I want to use the Handlers option which is under Fed Admin and all the related codi
Saving data from a form into a file
Hey everybody,
Sorry, I am really new to PHP coding and such but a project kind of got thrust
Log $_POST
How would i log submits on a form, by everyone? I want to then echo the number of submissions.
iMatch stored value with the current value in a loop
Hello,
I have a MySQL db were I store articles in.
I have a form to fill these article
File upload issues
Hi Guys,
Can anyone see any issues with this code:
Code: [Select]$setImage= 'productimages
defining website tags
Hi,
What would be the best way to define tags for my site, such as website title, url etc.
ereg_replace()
Basically what i need to do is
$title = "This Suck's"
$striped = ereg_repl
help me, how to find text on an external html site using PHP
Would anyone know how to search an external html file for a work or phrase ?
I was thinking s
Deleting pointers froms vector?
Hi. I have a vector filled with pointers and I want to delete the pointers. I could do a loop and do
How to limit the calls to an API
Hello, in my simple script I call an api which effectively involves me getting an xml file.
H