• hawkeye126

    (@hawkeye126)


    innergameprofile.com

    I’m working on a custom made plugin. This plugin has an admin menu with two additional admin sub menu settings pages. This plugins stores information (mainly instructional text/html and test quesions with form HTML) in the database which I am able to access and edit information via /wp-admin/options.php

    Here is how I add a question:

    $igp_form_question_six_html_DB = <<<EOT
    			<!-- 6 -->
    			<div id="form-question-6" class="form-question-holder">
    			<p>I have unlimited potential.</p>
    			<input required type="radio" name="q6" value="7-And, you feel your potential to improve and become better at your sport is a reflection of true ability. This kind of mental strength and positive attitude will inspire others. -1">1
    			<input required type="radio" name="q6" value="6-And, most of the time you are able to focus on your potential, rather than being held back by seeming failures that have been a part of your sports history.  Good.  Move on! -2">2
    			<input required type="radio" name="q6" value="5-And, you believe in your potential, but there are still shadows of failure in your background, from a big loss or a nagging injury. Time to stop blaming yourself? -3">3
    			<input required type="radio" name="q6" value="4-And, about half the time you have things in your background that are bothering. They get in the way when you think about your potential to be successful in your sport. -4">4
    			<input required type="radio" name="q6" value="3-And, you may be caught in beliefs about injuries, losses or failures from your past.   These memories get in the way of future success in your sport.  Can you let them go? -5">5
    			<input required type="radio" name="q6" value="2-And, you may need to analyze your own beliefs; consider your background [sports history, physical growth, previous injuries, etc.] that you think is hindering your current performance. -6">6
    			<input required type="radio" name="q6" value="1-And, when you think about your potential there maybe a heartbreaking loss, a serious injury, or some similar problem that you believe will keep you for winning. -7">7
    			<p class="last-p">My background limits me.</p>
    			</div>
    
    EOT;
    
    add_option('igp_form_question_5_html', $igp_form_question_five_html_DB);
    		  register_setting('igp_form', 'igp_form_question_5_html', array($this, 'check_ID'));

    In the admin page I then am trying to add the options to edit the settings (so as not to have to access /wp-admin/options.php potentially changing something that breaks the site).

    I am using this code:

    echo"<div class=wrap>";
         	 echo screen_icon();
         	 echo "<form method='post' action='options.php'>";
           // This prints out all hidden setting fields
    	    echo settings_fields('igp_form');
    	    echo do_settings_sections('igp_form');
    		 echo submit_button();
    	    echo "</form>";

    Only the submit button and outer form/div html work. I’m no pro with php so I may be doing something obviously wrong. Any help is very appreciated 😀

    I’ve been referring to these pages:
    http://codex.wordpress.org/Settings_API
    http://codex.wordpress.org/Function_Reference/add_settings_field

  • The topic ‘Unable to access database settings with custom plugin’ is closed to new replies.