I’m struggeling with the philosophy of WordPress and I’d like to know what “the WordPress” way would be to manage a database from the administrative interface.
To illustrate my needs, consider the following toy example:
ToyAnim: A WordPress plugin that displays animated circles using shortcodes. In any post, the user may enter [toyanim template="crazy-red-one" /]
. The plugin would then look in its animation database for an animation object with the ID crazy-red-one, load all the values (e.g. radius 50, color red, background white, speed 200, threshold 2, randomness 80 etc.) and substitute the shortcode by an animated circle.
ToyAnim would provide a menu in the administrative interface: ToyAnim -> Manage animations. Clicking the menu entry would open a list of the user-defined animations that the user can edit or delete, as well as a button “add new animation”. When creating a new anim or editing an existing one, another admin page should open and display a form letting the user enter the new values for the animation (name, radius, color, …). Upon pressing the “Save”-button, the database would be updated and thus all the shortcodes referring to that animation ID would produce a different animation (whee!).
My problem is how to modify the database from the administrative area. I tried to use a menu page and I managed to read in content of a custom table. However:
-> I don’t know how I could implement the “Add new animation”- or “Edit”-Buttons: What would href be? Writing something like <a href="<?php echo plugins_url('editor.php', __FILE__); ?>">Edit</a>
produces a working link, but since editor.php is an admin page, it is simply wrapped in <div class="wrap"><p>content</p></div>
, therefore the page is not displayed correctly as it would if a menu button pointing to it was clicked.
-> For the same reason, I don’t know what action of the edit form would be. Outside WordPress I’d simply have used something like <form method="post" action="submit.php">...</form>
, but here submit.php cannot be used as action since admin pages are called in WordPress using GET, not the direct URL pointing to them.
I conclude that I’m thinking the wrong way. Alternative solutions would be to forget the idea of a custom data base and:
-> Save my animation objects as custom post types. This doesn’t seem very elegant to me, since we’re not really talking about posts (animation objects are simply read when generating the shortcode, never displayed to the visitor).
-> Or save them as options: again, this seems wrong since animation objects are not options. Especially, a user may create an arbitrary amount of them which is conceptually different from static options.
So what would be the WordPress way to save / edit such animation objects?
Sorry for the long post! I hope the toy example illustrates my need well enough. I’m happy to clarify anything that I explained badly. Any idea would be much appreciated.
Cheers,
Kalsan
I’ve just upgraded my WP site to the latest 3.3 release and noticed that the subscriber admin panel now has additional features than before.
Previously subscribers were only able to see and edit their profiles under the admin panel, but now they are able to see “Posts”, “Comments” and “Tools” under their admin panel.
I am wondering if there might be any way to hide these features from the subscribers admin panel. I am worried it adds a layer of complexity to my subscribers who ultimately have no need for any of these additional features.
Please help! Thank you so much in advance.
Alberto
]]>Please let me know if I’m missing something. I’ve looked through all of the Support pages and it’s just not making sense.
]]>Any Ideas?
]]>Thanks for any ideas.
]]>I am a beginner to using this program, and I just installed it on my website. I’m trying to reach the Administration Panel. Under the META tag, where it says Log in, I click that an typed in my username and password but it redirects me to the home page of my website, not the Administration Panel. How do I get to the Administration Panel?
]]>help!
]]>