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.

213 Like 54 Dislike
Previous php-forum Next php-forum
Other php-forum

Include with Parameters
In a particular page I would like to include a file that requires $_GET parameters.

when I go

what does this mean? +=
is anyone able to explain what this code is saying?

i had it written for me awhile back and n

PHP search multiple input field box help
I am having a problem with my search script. At current it will simply search by a selected date whi

How to get variable value on next page
Hello friends
i am working on payentry page ..there i have this code.........

Curl & sessions PLS HELP
Hello,

I have a problem with curl and sessions and i will try to explain the best i could.

Automatic Webpage ??
I have a page www.mysite.com/test.php with a
<form>
<textarea name=&q

Fatal error: Call to a member function fetchrow() on a non-object in C:xamppht
okay i have this query and everytime i add `item_id`=? to it... it gives me the error in the title..

Beginners syntax and loop questions - help please!
Hi everyone,

I have some problems with php code. I'm currently in the middle of learning php,

How to convert this array to string
I am having problems converting this array to a string
using print_r($val[1]); I get:
Code: [

Search function
I am looking for some guidance from the experts.

I am trying to create a search function. It

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