Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have managed to create my private messaging system, but now I want to make the user experience similar to both front-end users and to back end users.

What I have is a screen like gmail, which when clicked you can see the "conversation" and the form to make a reply. How can I have a wordpress plugin to handle this both on the admin site and on the front end site.

I remind that I have a custom admin solution, which can:

  • Read wp-load.php
  • Create wpnonce (as an extra security reason)
  • Utilize wpdb for database (My messaging system is database build on, thinking on moving it on redis if it gets too bloated)

Actually I have set some things in a wordpress plugin; mainly I have made a plugin to have the private messaging system class available to front end and to back end but I don't know how to post (either traditionally or with ajax) from the back end and from the front end. Specifically, in my plugin folder there is a process.php file that is the target of the used for the PMS (either by POST or AJAX).

What should I do to have wp functions available there? Do I have to include wp-load as well?

Also specifically, since the only change in both backend frontend users would be the user id, how can I have a template rendering that would satisfy both the backend and the frontend? Do I have to make function calls to my plugin for rendering screens?

UPDATE

Since yesterday I've been trying to find a way for showing the elements in a common template (either by POST/GET or AJAX), which I see it cannot work, so I would utilize twig for maintaining a series of templates. So now the real question is how can a user on the frontend (someone who is registered to wordpress with a role like customer, no admin rights) can post on process.php and a backend user (role:siteadmin, has full custom backend).

I have seen for a fact that in the plugin you can simply render a form by using a function like

// plugin code+definition
function doRenderForm() {
?> 
<form method="post" action="">
<form elements>
</form>
<?php
}
[.. rest of plugin code ...]

and this can be called from the backend as well. But what I can't understand is what should I put to the action (what path?) so that it's seen common from both users.

share|improve this question
I refer to both questions in one "Ask question" because I would like to know some ways or some tips about how to handle such thing if it exists. I can give you any info you want, just ask, don't start downvote. – Panagiotis Mar 15 at 16:14
I think it'd be better to analyse this in terms of code. Also, are you sure it's practical to embed so many questions into a single Q? Do they relate with a single issue? What is not working for you? Or you haven't started and are looking for advice? – brasofilo Mar 15 at 18:39
They are related. In the beginning I was starting to find a solution that could satisfy all in one plugin. Mainly the processing directives would eventually work for both admin users (role: siteadmins, different from admin) and registered users (role: customers) via the plugin, while the interface would be different (in admin it's just pages via POST/GET, but in frontend it would eventually be AJAX or POST/GET for the present time being). But I can see that such solution does not work so I will change my q. – Panagiotis Mar 16 at 2:32

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.