I have a Wordpress site and a front end posting form on it.
When form is submitted, the user gets link to his email with unique string (example 432879374982) saved as a custom field and post gets status "pending":
http://www.mysite.com/verify.php?verify=432879374982
I now want to change status to "published" when user click on a link.
I know that I should use GET parameter, and check if the string is saved in database, and publish the post where there is a match in db, but dont know how to code this.
EDIT:
Made it working!
In the landing page- on wordpress I created a page named "verify" and in template (php) I included code from @Bora- only the database connection has to be established before and it changes the status of a post.
Status has to be set as "publish", not "published"