I have searched for the answer to this for the last hour. I am sure it is here somewhere, I must just not be looking in the right place. I must say here that I am new to wordpress and php.
I have created a plugin that requires users to enter data, so I have a seperate php file that is called and shows the form, and also processes the submission. The issue is that I need to access the current user name when processing: and I can't figure out how. I am thinking "get_currentuserinfo();", but I can't seem to figure out how to get access to that.
Thanks for any help you can provide.
Below is the php file
br />
<?php
if (array_key_exists('_submit_check', $_REQUEST)) {
$aa = !empty($_REQUEST['a_a']) ? $_REQUEST['a_a'] : '';
$bb = !empty($_REQUEST['b_b']) ? $_REQUEST['b_b'] : '';
echo $aa;
echo $bb;
} else {
wp_show_page();
}
function wp_show_page()
{
global $userdata;
get_currentuserinfo();
echo('Username: ' . $userdata->user_login . '\n');
echo('User level: ' . $userdata->user_level . '\n');
echo('User ID: ' . $userdata->ID . '\n');
?>
<form name="linkform" id="linkform" class="wrap" method="post" action="/wp-content/plugins/subm.php">
<input type="hidden" name="_submit_check" value="1"/>
<div style="float: left; width: 98%; clear: both;" class="top">
<fieldset class="small"><legend>Add new</legend>
<table>
</table>
</fieldset>
<input type="submit" name="save" class="button bold" value="Save »" />
</div>
<div style="clear:both; height:1px;"> </div>
</form>
<?php
}
?>