markseymour
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Creating my first plugin, echoing JS and get_option.I hate triple-posting, but I cannot edit my posts past a certain time limit. Anyways, I have the admin page working, it was just a matter of swapping
minuserlevel
foradministrator
.Now all that I need help with it getting the string entered in the text box into a MySQL table,
mes_google_analytics_uid
, and a description on how to get the ID from the Google Analytics code. Which BTW I am not sure whether the prefix for all GA ID’s areUA-
.Oh, and BTW, Thanks for helping me, I really appreciate it. ??
Forum: Fixing WordPress
In reply to: Creating my first plugin, echoing JS and get_option.Okay, I have updated the code at https://wordpress.pastebin.ca/331176 ; The only thing that I can see that needs to be done is the Administration panel, and possibly a link in the Dashboard to Google Analytics login.
I have the code in for the panel, but it doesn’t seem to appear.
//Adding the Admin options page...
function mes_google_analytics_options() {
if (function_exists('add_options_page')) {
add_options_page('Google Analytics', 'Google Analytics', minuserlevel, basename(__FILE__), 'mes_google_analytics_options_subpanel');
}
}Forum: Fixing WordPress
In reply to: Creating my first plugin, echoing JS and get_option.I am not entirely sure where I am supposed to place the hooks, I’ve looked at the code for a couple of plugins, and they are either at the top, the bottom, or interspersed in the code. Right now I have all of my hooks at the bottom:
//Google Analytics Plugin hooks (bottom)
//add_option('mes_google_analytics_uid');
if ( isset( $_POST['uid'] ) ) { update_option('mes-google-analytics-uid',$_POST['uid']); }
add_action('admin_menu', 'mes_google_analytics_options');
add_action ('wp_footer', 'mes_google_analytics');Forum: Fixing WordPress
In reply to: Creating my first plugin, echoing JS and get_option.When I tested the plugin, I got an error within WordPress:
Warning: call_user_func_array(): First argumented is expected to be a valid callback, 'mes_google_analytics_options' was given in /home/dreadhol/public_html/hidden/wordpress/wp-includes/plugin.php on line 123
Would this have to do with
function mes_google_analytics($unused)
?The full code can be found at https://wordpress.pastebin.ca/331028
note: I am still working on the admin contol panel.