Wordpress template - create native Wordpress plugins
Using this template you can convert any PHPRunner or ASPRunner.NET project into a native WordPress plugin. Using WordPress shortcodes you can insert any page of your application into WordPress post or page. Users logged in to WordPress will be logged in into your application and will be assigned corresponding permissions.
You can get this template for $50.
List page in Wordpress
Edit page in Wordpress
If you try to access a page without logging in
Inserting your application into Wordpress page using shortcodes
Version 1 - September 2020
- Native Wordpress plugins based on PHPRunner or ASPRunner.NET projects
- Security settings for automated login
- Version 10.7 or better of PHPRunner, ASPRunner.NET or ASPRunnerPro
- Supported databases are MySQL, Oracle, MS Access, SQL Server and Postgre
- Create a new project based on WordPress template or add WordPress template to existing project. You can use any database, doesn't need to be the same database that Wordpress uses, doesn't even need to be MySQL.
- Recommended project settings: use 'AJAX seacrh, pagination and sorting', choose to open Add, Edit and View pages in the popup. This can be done on 'Pages' screen under 'List page settings'.
- Projects without security. If your project doesn't require login you can skip bullets 4-8.
- If your project has security enabled proceed to the login page in Page Designer, and insert the HTML snippet above the login form and paste the following text there 'You need to be logged in to WordPress in order to see this page'. Also set Item ID of this snippet to be wptext. The idea is to show a message to the users that they need to be logged in to the WordPress first.
- We have two options of how WordPress users will be logged in automatically into your PHPRunner or ASPRunner.NET project. To switch between these two options proceed to 'WordPress settings' menu item. Make sure to create corresponding user or users in your login table.
You can either logon users using their WordPress username or you can assign the same username to all WordPress users. To make sure you have access to WPSettings Edit page add a user to the login table with the same username as the one you use to logon to WordPress.
- If you created a new project from scratch you can skip steps 6-9 as this code will be created automatically.
Add the following code to Login page: Before Display event:
- Add the following code to AfterAppInit event:
- Add the following code to Events screen->custom_fucntions.js section:
- For all tables you add to the project later specify the following code in the following events.
- Now it is time to build the project! Once built, proceed to the folder on the web server, where Wordpress installed, go to wp-content\plugins and create subfolder named wpphprunner there. Copy all files from the output folder to wpphprunner. Now proceed to Wordpress control panel and enable wpPHPRunner plugin there.
- If the plugin was activated successfully you are ready to use it. Proceed to any post or page in Wordpress and use the following shortcode to insert your app. You can use the URL of any of the pages from your project.
- Now it is the time to make it look better. Depending on what theme is selected in WordPress your application may not look the best. We tested it with several different themes and these are the ones where it looks the best: Twenty Nineteen, Hello Elementor, Head Blog, Vilva, Sydney, Zakra.
Even with these themes, you may want to makes some changes to CSS so your application utilizes the whole width of the page. The following CSS can be either added to your theme Custom CSS area or to the Custom CSS section in your PHPRunner or ASPRunner.NET project.
Additional ASPRunner.NET instructions
WordPress is PHP software and the plugin's code itself is PHP which makes the interaction with your ASPRunner.NET a bit more complicated. These are additional steps that you need to take in order to make it work.
- The following folder needs to be set as 'an application' in IIS:
- If your ASPRunner.NET uses MySQL and connects to the same database as WordPress there is nothing else to do. If your project connects to another database i.e. to SQL Server the easiest option is to create and populate wpsettings table in WordPress database manually. Here is the SQL script you can use to create this table.
More code examples
Due to changes in the way how your project works under WordPress you may make some changes to your event code. For instance, if you need to redirect the user to another page after the record was added or edited here is how you can do this. Just replace cars_list.php
with the name of your actual page.