Forum Replies Created
-
I like your idea about calling a function from the php for the modal window.
Just FYI .. this is what I have set up for colorbox (which isn’t a real ajax call, you’ll see):
echo '<a class="ajax cboxElement launch-dashboard" href="' . get_stylesheet_directory_uri() . '/buddypress/members/single/dashboard.php?username=' . $row->username . '" title="Dashboard">Launch Dashboard</a>';
If you aren’t familiar with how colorbox works … note that the modal window is being enabled by simply adding the “ajax” class to the link … similar to how a lightbox popup works.
Ideally .. it’d be great if I didn’t have to call these 2 lines in my dashboard.php file either:
require("../../../../../../wp-blog-header.php"); require('../../../../../../wp-load.php');
It’s my understanding that this is a terrible approach anyways .. since the WordPress engine is supposed to be already loaded in the background (making it redundant).
So how would I implement something like what you’ve suggested? Could you show me an example, maybe? I’m assuming that if I don’t load the WordPress engine in my dashboard.php file, that I wouldn’t be able to call a function that’s been added to my functions.php file, right?
Here’s a dumb question. Should I maybe just place my dashboard.php file in a different location within my child theme directory structure, perhaps? I ask because I’m starting to think that I might need to treat this as a normal WordPress template file .. instead of a standalone PHP script. Any thoughts?
Although that would definitely work (and I have considered using this approach) … that would definitely be a security breach, as the PHP script could simply be linked to directly by any logged in WordPress user. So that obviously wouldn’t work in my situation.
Any other suggestions?
– Yvan