Jump to content

Need a solid php developer to help me complete project


quickjeff
 Share

Recommended Posts

Originally posted in general section, but after extensive search, I need to call in someone more experienced to help me complete this project. I need someone As soon as possible.

Basically, I created a site for a client that is a marketing and advertising site for personal ads. The site is intended to allow a user to view the site and if the user wants to post a personal ad to promote their services such as music performing, dancing etc. they can for a small fee.

(It's pretty much like back page.com and craigslist.com without the ugly design. More focused to look like a website, with 1 page personal ads.)

Currently the site is using the latest Processwire release on Foundation framework. I have users coming to the site and if they decide to post, they click on a link located on the bottom that says post new profile. Once clicked, they arrive to a page that has a form builder embedded form.

I am using form builder forms to process the user information and create a new page under the category of their choice.

This is working and creates pages quickly for anyone that wants to post an ad.

(I was advised not to use this method but due to lack of time, I had to run with Form Builder.)

Here is what the system does now:

Once a user completes the form, they submit the data and the page is automatically created. The user receives an auto response email with a message asking them to make a payment via a link contained in the auto response email. The link goes to a paypal subscription. Once the paypal subscription is paid, we are manually sending the user a user name and password to manage their page through a front end editor that we setup in Processwire. If they do not pay in 24 hours, we manually delete the page. As far as spam goes, we only have the spam filter enabled on the forms with the turing test question and answer.

Here is what I need the system to do:

I need help setting up a way to ask for a credit card first, then process the card for the payment, then post the page.

I also need help redirecting the user to the newly created page after they have submitted the data through the form builder form.

I also need a way to automatically create a user and password and assign it to the newly created page.

I am up for any suggestions and welcome all of your input. I would like to essentially make this an automatic type thing. Where all we are doing is checking to make sure things work. Versus manually adding users, manually deleting pages etc. if you feel it's best to restructure the site to create a user registration first, I'm open.

Feel free to PM me as well.

If a heavily experienced user feels that they can accomplish this build another method via API etc. please provide some details.

Link to comment
Share on other sites

What's your timeframe? Which credit card processor do you want to use (I recommend Stripe, then Auth.net or PayPal)? Do you have an ample budget for custom development? 

Contact me if you'd like to discuss further. Thanks.

Steve Shaw

info@sshaw.co

Link to comment
Share on other sites

Help setting up a way to ask for a credit card first, then process the card for the payment, then post the page.
This is probably the trickier one. I have no idea about credit card processing but there have been posts in the forums about processing payments, e.g. using paypal...Others can chip (no pun intended!) in here...

I have re-read your post and see payment will be made via paypal. From what I have read in the forums (and I agree with that approach), if you can avoid it, do not handle, take or store credit card details on your site. There are "cheaper" payment gateways that can handle that for you....or redirect users to paypal. Let them deal with the security issues. Anyway, I don't know much about this area so search and/or wait for other responses :-)

Help redirecting the user to the newly created page after they have submitted the data through the form builder form. 
The potential issue with this is when two or more pages have been created at the same time. Creating a page via API is easy though. Redirecting is also easy:

$session->redirect($url). I don't know how you are creating your pages but one way to grab the page created by "this particular visitor" is: You could get the sanitized name of the page and save that to a variable as you save the page. If the name has not been rejected, then use that name and the template of that page to grab the newly created page and use that as the $url variable in the $session method..e.g. something like....$pages->get("name=$name, template=my-template"); where $name is the sanitized value you saved in this variable before you saved the page [but only proceed with redirecting the user to the new page if one was actually created! So, you will have to check for a page id. If no id exist, the page was not created and you need to tell the user that]. You don't want to use title to get the new page since titles don't have to be unique.

There could be other ways of doing it (using cookies and all that...) but the above is probably simpler...Others here will have better ideas ;-)

Automatically create a user and password and assign it to the newly created page. 

I am not sure about creating a password. Why not ask the user to create their own password when registering? Then, save the page but as unpublished which you will then publish after you receive payment. In this case, there is no need to redirect the user to their newly created page. It is of no use to them anyway until they have made a payment they won't be able to log in. So, I would take them to a "thank you" page, awaiting confirmation and payment, blah blah message....

Creating a user is easy. Have a look at the API docs: http://processwire.com/api/variables/user/

Just my 2p

  • Like 3
Link to comment
Share on other sites

I concur with letting a payment gateway handle the card processing, PCI compliance is a big deal and a lot of gateways have API's that are easy to implement.  In your case, PayPal's API has the IPN (instant payment notification) messaging service that is free for merchant accounts.  It sends POST data to the page you specify so you could just point to a page you've created in PW and handle account/page creation after a successful payment has been made.  It's done like this:  https://developer.paypal.com/webapps/developer/docs/classic/ipn/gs_IPN/

As far as making the deletion of pages automatic, you could try the LazyCron module : http://modules.processwire.com/modules/lazy-cron/ You can test against the creation of the page by using $page->created, it returns a Unix timestamp of the date/time the page was initially created. You can store the anticipated delete time by adding 24 hrs to the $page->created value

// LazyCron function on template page
function deletingThePage(HookEvent $e) { 
  // Maybe have a checkbox field == 1 to indicate if payment was processed by Paypal
  // Find all pages with unpaid statuses
  $unpaidPages = $pages->find("paymentCheckbox=0"); 
  
  // iterate the results
  foreach($unpaidPages as $k){
    // When the page was created
    $timestamp = $k->created;  

    // $timestamp + 1 day 
    $deleteTime = strtotime('+1 day', $timestamp);
    
    // If the time to delete the page has been met or exceeded
    if($deleteTime <= time(){
      // Delete the page
      $k->delete;
    }
  }
}

// Add a hook to the function. Check every hour
wire()->addHook('LazyCron::everyHour', null, 'deletingThePage');

All pseudo-code - absolutely no promises that any of that works as I've never used the LazyCron module.

From what you've listed as requirements, it sounds like you're almost there. Is the PW API the part giving you a hard time or the implementation of using payment gateway API's?

  • Like 3
Link to comment
Share on other sites

@Mindfull in response: my problem is the API, as I'm not that familiar with it to make it work with my wishes, yet. I'm sure I'll get there. But yes the payment will be the last step. Right now I just made the registration form, users can now register and they are automatically given a front editor role.

Now here is my new dilemma, I am going to add an if statement at the top of the posting ad page. To only show the page if the user is logged in or redirect them to login or register for posing privileges.

When they are logged in, they can visit the posting page. Here they select a category to post in, that category will direct them to a category page with a form builder iframe form. Right now I am using form builder to build pages. I need help creating a way to auto assign the user to the page they just created through form builder. By auto assign I mean editing privileges.

Note: I already setup editing privileges on a per user per page basis. Through the module. So the role frontend-editor has ability to edit pages I manually assign to it. This is where I want to make it automatic.

Any help?

Thanks again to everyone who has helped me walk over this bridge, I'm almost there!

Link to comment
Share on other sites

Great to hear you're making progress. The Page Edit Per User adds a new field to every users' page; it's name is editable_pages.  This is a Page Field and behaves like any other so to add a value to it when the user creates a page with the form-builder you could do something like:

// Get user that made the page
$owner = $page->createdUser;

// If this is the same user: (Should be on page creation, but anyway)
if($user == $owner){
        
        // Turn off outputting formatting for user's page
	$user->of(false);
        
        // Add this current page to the editable_pages field
	$user->editable_pages->add($page);
        // Don't forget to save the user's page
	$user->save();
        // Turn output formatting back on
	$user->of(true);
}

Just remember that the page created by the using the form builder must have been saved before you can add it to the user's editable_pages field.  

For clarity purposes: Users in PW are Pages.  So accessing the user's fields would be like any other page's field. I haven't used the module but I'm pretty sure you could dynamically add pages to this field with the API as shown in the pseudo-code. Keep at it, you'll get it.

BTW: I saw this in the Modules Section: http://modules.processwire.com/modules/schedule-pages/  and thought you might be interested in checking it out, does pretty much what I was demonstrating a couple of posts up.

  • Like 3
Link to comment
Share on other sites

Great! 

Thanks again for the help!

Now, implementing this into the form builder form, would I create a form builder.inc file?  I ask because I have 5 categories and 5 different form builder forms building pages. 

Link to comment
Share on other sites

Now that, I could not tell you - I have no access to form builder code and have never seen the module outside of the video demo.  It would make sense to include a file with this sort of thing wrapped into a function/hook so as to keep the code you're adding separate from the module, for updating/upgrading purposes.

Can't sleep...

Assuming you would like to add it as a hooked method you could do something simple like:

// Attach the hook in the FormBuilder Class
$this->pages->addHookAfter('save', $this, 'hookAfterPageSave');

//Define what you want to do after the page is saved
function hookAfterPageSave($event) {
  // argument(0) is the current page on the save $event
  $anEditablePage = $event->arguments(0);
  
  // add the page to editable_pages field (if in FormBuilder Class)
  $this->user->editable_pages->add($anEditablePage);
}

This would do essentially the same thing but the FormBuilder class, (or whatever it may be called), would run this method on page save.  Look here:  http://processwire.com/api/hooks/ for details on how hooks work. Again, the code is coming out of my 3am brain: so no warranty that any of it works.

  • Like 3
Link to comment
Share on other sites

Haha, MindFull no worries. The code didn't work.  I added it to a form-builder.inc file and figured it would work . No luck, I guess I have to keep thinking of something unless you think of something else. 

Thanks!!

Link to comment
Share on other sites

If you want, I can PM you my email: so we don't clutter your job posting with code snippets. I have a general understanding of what you need and though I might not be a "solid" developer, I'm good enough to be employed by some. I honestly don't know if I have the time to commit to a whole other project right now, I spend most of the day & night punching a virtual time card trying to finish an application for work.  PS, it's really hard to see what you're doing/not doing without seeing some of your code, lol. Maybe start  a thread in General Support and post some code?  If not, you have a PM, sir.

Link to comment
Share on other sites

 Share

×
×
  • Create New...