0

Hello,

I have setup a wordpress locally in WAMP.

Every user is given points for writing. I want to write a piece of code that will add two points to the user's existing points every time he writes a blog.

Can this be done usng php? Also, where should I deploy this code so that it will run everytime any user of the website writes a blog?

Any help is appreciated.

Thanks in advance.

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by vijiraghs
0

Yes, on logging in each user will have a session, also opening the data relevant to them from an SQL query... Look at where the sumbit blog button code is and add the 2point's global variable to the user's total points variable which can then be stored in the user's records of the backend database using an INSERT SQL query.

PHP Sessions
http://www.w3schools.com/php/php_sessions.asp

PHP/MYSQL
http://www.w3schools.com/php/php_mysql_insert.asp

Edited by StephNicolaou: n/a

0

the simplest way is to pull the users current points from say TABLE users

so a row in USERS will be mypoints

return mypoints on the submission

and do the following

$oldpoints = $row;
$newpoints = 2;

$totalpoints = $oldpoints + $newpoints;

this will add 2 points on top of the users oldpoints / currentpoints

this can also be used when you want to subtract points for a action

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.