Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm looking for a best practice/ideas for modifying the status/data of a page after an event.

Here's an example of what I'm trying to accomplish - This WordPress site would allow users to sponsor people (just one sponsor per person). Each person that is eligible for sponsorship has their own page, which is created via a custom content type I created called "People". That's all the easy part, it's just a basic page that give descriptive information about the person looking to be sponsored. You can then go to PayPal and pay to sponsor them.

Now, the part I need help with is after they have paid and get sent back to the site how could I trigger the status of that now sponsored person's page to switch to "Sponsored". So, that no one else tries to sponsor them. I'm assuming I should go about this with Hooks, Actions and Filters, though, I haven't used them much.

Anybody have any thoughts on how to accomplish something like this? If I had the basics I could take it and run with.

Thank you!

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

What you could do is create a metabox for the 'People' custom post type which would have radio values 'Not Sponsored' and 'Sponsored' (Not Sponsored b default). PayPal posts some transaction details to the notify url you have specified. Once you recieve the proper information from PayPal, like payment status is completed, then you could update the particular 'People' custom post's sponsored meta info with 'Sponsored'. To create metaboxes you could check this out -> Add "Post Options" for new wordpress post

Hope this helps.

share|improve this answer
    
Thanks for the reply. I haven't had a chance to breakdown the markup in the link you have included, but does it include the piece of functionality that changes the status to "Sponsored" via the front-end of the site? By that I mean when the successful payment goes through and returns to the page it would auto-update the post_meta? Wouldn't I still need some type of action to trigger an auto-save of the modified data? –  bcoyour Dec 7 '11 at 13:35
    
When you recieve transaction details on the notify url specified by you ( return url and notify url are diffrent ). You would have to check if the payment status is completed then based on that you could updated the status to sponsoredd using update_post_meta() function –  Joshua Abenazer Dec 7 '11 at 18:50
    
That sounds like it's what I needed. Thank you for your help! –  bcoyour Dec 7 '11 at 19:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.