create custom page for statistical data capture and reporting

I am not too comfortable coding in PHP yet, but am currently working on a project where I need to create a custom page for the website, in a member area, where the members of the site can capture certain data, like total income for the day, number of calls made during the day, etc.

Once this has been done I need to be able to display certain reports on this data, such as your statistics for the day, month, year-to-date etc.

Can anyone please point me in the right direction on what will be the best and easiest way to do this.

I am not averse to coding, as I come from n Microsoft coding background, back in the day, I am just unsure where to start in PHP and WordPress.

1 Answer
1

This is a pretty big project you’re talking about.. Using WordPress as the base CMS isn’t necessarily a bad idea as you/an admin could create new users and it would take care of all the logging in procedures.

Firstly I would recommend learning how to make basic WordPress themes. You could try hacking about the default themes but they have a lot of complexities you don’t need. There are plenty of tutorials out there for learning how to do this.

Once you have yourself a basic theme, the main thing to do will be to create various custom page templates that control the views you show to users. So in your basic theme you should have created a file called page.php, to make a custom template add the following to the very top of the file and rename it something like template-my-view.php :

<?php
/*
Template name: My view
*/
?>

Then when you go to add a new page in the admin, you can select “My view” in the “template” dropdown on the right. This means any custom code you put in this file will appear on that page.

Using some code such as this:

WordPress: Redirect Users After Log In

you can control where your users go to after logging in. By default they would be sent to the wordpress admin but you want them to stay in the frontend, so set it up to send them to some kind of frontend homepage you create for your users.

From here it’s a case of learning the necessary PHP/MySQL to actually perform the functions you want to do and display/process them on all the custom page templates you create. There’s no shortcut to this except learning the languages, I would advise buying a book/ebook. You can create custom MySQL tables to sit alongside the WordPress created ones to hold all the data you need to perform the functions you want.

As I say this is a pretty big undertaking and your best bet is to get a book on beginner PHP/MySQL, as well as learn the basics on WordPress theming. From what you’ve said it sounds like the things you actually need to do are fairly straightforward though so once you get the basics you should be good to go.

The above suggestions aren’t really WP best practices, but will do the job, and as you get more involved in WP you can start to discover the power of developing dedicated plugins etc to do what you want to do natively and within the WP infrastructure.

Good luck!

Leave a Comment