problem about wordpress-plugin-dev-Collection of common programming errors
Jonathan
database wordpress plugins wordpress-plugin wordpress-plugin-dev
I’m currently writing a plugin for a customer, and while it’s usually working good, I found that dbDelta does not allow me to create the table I need on plugin activation.I’m running the below code to bind the activation function:register_activation_hook(__FILE__, ‘adminInstallation’);And this is the function itself:function adminInstallation(){global $wpdb;$objectEquipment = ‘wp_object_equipment’;$equipmentSQL = “CREATE TABLE “.$objectEquipment.” (id mediumint(9) NOT NULL AUTO_INCREMENT,name ti
markh
wordpress wordpress-plugin-dev
I am attempting to validate fields on a custom post type in the admin panel Edit Post page.When the user clicks “Publish” I want to validate fields in the POST data, and change the post_status to “pending” if the data does not pass the tests. When this occurs, I’d also like to add errors to the page in the admin notices area.I’ve been trying this with an added hook to the “wp_insert_post” action which also saves our own data. I’m not certain of the order of operations, but I’m assuming that the
hakre
php wordpress wordpress-plugin-dev
Seems like a simple problem, but I can’t find an answer.With cacheing disabled, everything works fine. With cacheing enabled the following javascript include returns a WordPress ‘page unfound’ error.http://myserver/wp-content/plugins/myplugin/js/jquery.cycle.all.min.jsI’m disabling the cache using the Firefox web developer tool, but I can’t see that that should have any bearing in the issue. For some reason, WordPress can’t find a legit file.The script is properly registered and queued with the
Scott B
php wordpress-plugin-dev
I’m getting this message each time I activate my plugin:The plugin generated 80 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.The only way I can suppress the message is to wrap my activation function code in a conditional (**see below).How should I rewrite this to prevent the alert?function myPlugin($post) {echo “Whatever is here throws an unexpected outpu
kingkero
php wordpress-plugin wordpress-plugin-dev
the server gave me this error but i can’t understand why!The error is”Parse error: syntax error, unexpected end of file in /homepages/43/d514350324/htdocs/wp-content/plugins/NetClass/nw_NetClass_init_CustomBoxes.php on line 227″Line 227 is the last line of the file.That’s the code. Help me please!<?php /* Define the custom box */add_action( ‘add_meta_boxes’, ‘aggiungiMetaBox’ ); add_action( ‘save_post’, ‘salvaMetaBox’, 10, 2 );add_action( ‘wp_ajax_nc_savePortable_lezioni_action’, ‘nc_savePort
1Line
php javascript wordpress wordpress-plugin wordpress-plugin-dev
I am facing an issue with creating a shortcode in my functions.php file, it seems it works and pulls the data set in the shortcode but within the function it sets some javascript and html however it is adding on everything and breaking the JS any ideas?Error:SyntaxError: invalid property id [Break On This Error] key: ‘#$7bbad3b0fdd52cc4277’,</p>Code:// Set Video URL and Subtitle URL// shortcode function show_video( $atts ){$video_details=””;// get attibutes and set defaultsextra
user2671221
php wordpress-plugin-dev jqgrid-php
I am developing a plugin in WordPress, whenever I try to load a local Java Script file I get the following errors on firebug console.Not allowed to load local resource: file:///C:/xampp/htdocs/site/wp-content/plugins/wp-dbpresent/themes/redmond/jquery-ui-custom.css tools.php:289Not allowed to load local resource: file:///C:/xampp/htdocs/site/wp-content/plugins/wp-dbpresent/themes/ui.jqgrid.css tools.php:290Not allowed to load local resource: file:///C:/xampp/htdocs/site/wp-content/plugins/wp-dbp
Obmerk Kronen
php javascript wordpress constants wordpress-plugin-dev
I am facing a problem that I can not understand .During a plugin development I am including a file.js.php (register/enqueue). <? /* File.js.php */ Header(“content-type: application/javascript”); $path = constant(‘WP_PLUGIN_DIR’); //test with function $path_2 = WP_PLUGIN_DIR; // test directly //can cause a problem with older browsers?? use text/javascript ?> //////////////////// Begin Tests //////////// var templateDir = “<?php echo WP_PLUGIN_URL ?>” ; var templateDir2 = “<?php
NoBugs
wordpress plugins login wordpress-plugin-dev wordpress-3.5
A plugin provides login for a WordPress multi-site network. This plugin now fails under WP 3.5 because the user.php file was changed. The old lines in /wp-includes/user.php can be added back in and the plugin would work. Obviously this is not a long term solution.This is the old code from user.phpif ( empty( $user ) )$user = wp_get_current_user(); else$user = new WP_User( $user );if ( ! isset( $user->ID ) )return false;This is the new code from 3.5if ( empty( $user ) )$user = get_current_user
EM-Creations
php wordpress wordpress-plugin wordpress-plugin-dev image-uploading
I am trying to receive files from a webservice and save them into wordpress but I have following issues,Some of the files will be uploaded but they are corrupted and I can’t open them, although their webservice address is correct. It shows the following errors (although it shows these errors but upload the files anyway, which is good 😀 but I am wondering why I am receiving them).Notice: Constant ABSPATH already defined in /Applications/MAMP/htdocs/wordpress/wp-load.php on line 22Fatal error: Ca
rpophessagr
javascript wordpress wordpress-plugin-dev long-polling
I am building a WordPress plugin. The plugin works beautifully on one site. But on every other site I’ve tried so far one of the resource files used it getting a 404 (Not Found) error in the console. If I post the url, displayed in the console as not found, in the address bar the file is accessible.The site it works on is not in a root directory, while one it doesn’t work on is on the same server, in the root directory and is a multisite installation. I’ve tried it on other servers, and sometime
Nikhil Khullar
php wordpress wordpress-plugin multilingual wordpress-plugin-dev
I am new to plugin development/editing with WordPress. I am using a famous plugin called Polylang for multilingual support. And I am using another plugin called Clean and Simple contact form for creating an AJAX based contact form. Now, looking into the documentation for Polylang I have found the following function:Register String Allows plugins to add their own strings in the “strings translation” panel. The function must be called on admin side (the functions.php file is OK for themes). Usage:
brentonstrine
php wordpress wordpress-plugin-dev wordpress-loop
I am creating a plugin which has just one setting which is set with add_option(‘myinfo’) in my main plugin php file. However, I have a second php file which is almost freestanding, except that I want it to get that setting. I tried using get_option(‘myinfo’), which works in the first file, but in the second file, it gives this error:Fatal error: Call to undefined function get_option()Basically, I think that my second php file is totally outside of WordPress. No WordPress specific code works, it
randy
wordpress wordpress-plugin wordpress-plugin-dev
I am creating my first wordpress plugin. one of the questions i have is understanding what files i should be included in php files that are not directly called by wordpress.For example: I have the user submitting a form. In the form on a page i use the constant WP_PLUGIN_URL, which works fine. The form posts to <form action=”<?=WP_PLUGIN_URL?>/myplugin/lib/functions.php” method=”post”>The constant works fine. In functions.php I have and it does not recognize WP_PLUGIN_DIR. i get the
SeCorp
wordpress wordpress-plugin-dev
I write that code<?php /** * @package ppa * @version 0.1 */ /* Plugin Name: PPAPlugin Description: PPAPlugin desct Author: Sekhmet Version: 0.1 */register_activation_hook( plugin_basename( __FILE__ ), array( ‘PPA’, ‘activate’ ) );register_deactivation_hook( plugin_basename( __FILE__ ), array( ‘PPA’, ‘deactivate’ ) );register_uninstall_hook( plugin_basename( __FILE__ ), array( ‘PPA’, ‘uninstall’ ) );class PPA{const NAME = “PPA”;public static function activate() {self :: ppa_add_dashboard();}pu
petusek
javascript css firefox google-chrome wordpress-plugin-dev
I’ve been using a javascript code (see below) to create custom tooltips. Their style is defined in a separate CSS file. Everything works fine in FireFox and IE, but Chrome keeps it transparent and totally ignores the text formatting. What can I do to make it work in Chrome as well? What am I missing?Many thanks in advance!The JS code is as follows://div ID var myDivId = ‘ZHintDiv’; //movements on the X axis var movingX = 20; //px //movements on the Y axis var movingY = 10; //px//vychozi pozice v
Todd German
javascript jquery wordpress-plugin-dev
I am creating a WordPress plugin and I have created an object literal in which I would like to encapsulate all my logic, but I can’t seem to get the event handler to fire.I am using jQuery 1.7.1First, I have rows of data that is being created via php:<div class=”table-wrapper”><?php global $wpdb;$students = $wpdb->get_results(“SELECT studentID, lname, fname, email FROM student”); foreach($students as $student) : ?><div class=”row” id=”<?php echo $student->studentID; ?&
Richard M
php wordpress wordpress-plugin wordpress-plugin-dev
I’m using the code below to deactivate the plugin itself when the user’s PHP version is not sufficient. One problem is that the yellow message box appears saying that the plugin is activated although it is successfully denied by this function. So is there a way not to display the yellow message? function Plugin_Requirements() {global $wp_version;$plugin = plugin_basename( __FILE__ );$plugin_data = get_plugin_data( __FILE__, false );$numPHPver=’5.1.2′; $strMsg .= $plugin_data[‘Name’] . ‘: ‘ .
Mir Moorido
wordpress wordpress-plugin-dev
I am trying to find the plugin and webcontent URL addresses but the php does not recognize the functionsCall to undefined function plugins_url()Call to undefined function content_url()$wp_plugin_url = plugins_url();$wp_content_url = content_url();echo $wp_plugin_url;
Coombesy
php wordpress wordpress-plugin wordpress-plugin-dev
I’m trying to get the current user info in my plugin using the func wp_get_current_user(). But am getting Call to undefined function wp_get_current_user()Apparently this is happening because the file /wp-includes/pluggable which contains the function doesn’t get loaded until after the plugins are loaded.Anybody any ideas on how to get the user details in my plugin? any help would be appreciated 😉 regards, Daithi
Gazillion
php wordpress wordpress-plugin wordpress-plugin-dev
I recently got into WordPress plugin development and I would like to add a menu page (the links in the left hand side menu). Previous SO questions and the WordPress codex say that it’s as simple as calling:add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );However when I try this in my plugin setup file it tells me that the function is undefined:PHP Fatal error: Call to undefined function add_menu_page()This seems like a very simple thing to do a
logic-unit
wordpress wordpress-plugin wordpress-plugin-dev
I’m writing a plugin and trying to request some data from a custom table in my database using:$current_text = $wpdb->get_results(“SELECT text FROM addtext ORDER BY id DESC LIMIT 1”);but just get the error Undefined variable: wpdbAny idea why this isn’t working? I’ve followed the docs and scoured Google, with no luck. Still pretty new to WP plugins so probably something obvious.Thanks!
I-M-JM
j0k
jquery wordpress wordpress-plugin-dev jquery-validation-engine
I have a rather complicated form in a file I’ve named newuser.php. I am using a WordPress plugin that allows in post/page php to include the file inside a WordPress page (I’m using the Suffusion theme). I am also trying to develop my own plugin (first time) and I am using that to enqueue all the necessary script and css files. I am loading my javascript files in the footer and jquery itself is being loaded in the header.As near as I can tell I have instantiated jquery.validationEngine correctly
Web site is in building
I discovery a place to host code、demo、 blog and websites.
Site access is fast but not money