geowb
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Cannot hide title with CSSAn observation: the
<h1...title only appears when editing a page. For a site visitor that title is not displayed. Two questions: What is the advantage of having an immense title appear when one is trying to create a page and no visitor will ever see that title? Is there any way to create and edit a page without that large scale header?Forum: Fixing WordPress
In reply to: Cannot hide title with CSSThanks. I’d forgotten how opaque WordPress is. It’s going to take few more hours to get oriented. I appreciate your efforts but I’m starting back at the bottom of my learning curve. Patience is required.
Be well.
Forum: Fixing WordPress
In reply to: Cannot hide title with CSSThanks for your reply. The page only exists on my development server and is not available in the wild. I take it that “…CSS, nothing to do with WordPress” means that website styles are not accessible to casual users/developers such as myself. I can see the classes of site elements using the browser’s inspector. And I’m used to having control over the css. I’ll probably have to dig deeper to learn how to better control the appearance of pages. Thanks anyway.
Forum: Fixing WordPress
In reply to: Why do some plugins ask for ftp access?Fascinating! That makes it possible to install Woo Commerce. New one on me! Thanks.
Forum: Fixing WordPress
In reply to: Why do some plugins ask for ftp access?Thanks for the reply. Here’s an example that does not meet those criteria:
I’m working on a Windows 10 system that has a WordPress installation on a VirtualBox Ubuntu VM. The WP installation has my name as its file owner and I log in to admin on my name. Yet an attempt to install WooCommerce presents the FTP credentials screen. Not sure of the php process owner – it’s either me or www-data. The latter is unlikely to ever be the log in for a WP admin.
Forum: Developing with WordPress
In reply to: Activate and/or init pluginThanks for your reply. I suppose it really answers my question if it can be read as, “If you can make it work without throwing errors or bogging the system down you’re about as good as you can be.” Test, test, then retest. And I’ll ignore the support question checkbox in the future, provided I truly think I’ve exhausted all other remedies.
Forum: Developing with WordPress
In reply to: PHP Notice: is_tax was called; depends on function callQuestion is withdrawn.
The fundamental error appears to be the method of activating the plugin. I’d built the plugin about an autoloader methodology that activated with the use of
plugins_loaded. By changing toregister_activation_hook()the PHP Notice disappeared. The downside is that some working code has ceased to work. But I’m sure I’ll find a fix somehow.Thanks for reading.
Forum: Developing with WordPress
In reply to: Validate plugin settingI think you’re right about add_settings_error() as the missing link. I’d not seen that before; it’ll be much easier to add to existing code than starting over again. Thanks.
Forum: Developing with WordPress
In reply to: Validate plugin settingThanks for your reply. Having read this I got the impression that WP_Customize_Settings::validate() was a step toward true full-form validation. The register_setting() callback argument appears to be intended to tidy up settings rather than perform validation. Also, the form I’m trying to validate is a plugin’s settings form.
It appears that to validate a form by requiring all inputs to be valid before saving any values requires coding the form from scratch. So be it.
Forum: Developing with WordPress
In reply to: Validate plugin settingHere is how the current form is created:
rma.phpfunction rma_init() { $plugin = new Plugin(); // Create container $plugin['path'] = realpath(plugin_dir_path(__FILE__)) . DIRECTORY_SEPARATOR; $plugin['url'] = plugin_dir_url(__FILE__); $plugin['version'] = '0.1.0'; $plugin['properties'] = [ 'parent_slug' => 'options-general.php', 'page_title' => '<h2>Remote Member Authentication</h2>', 'menu_title' => 'Remote Member Authentication', 'capability' => 'manage_options', 'menu_slug' => 'rma-settings', 'option_group' => 'rma_option_group', 'section_heading' => '', 'submit_label' => 'Save stuff', 'options' => [ ['fieldName' => 'rma_user_data_uri', 'label' => 'User data URI',], ['fieldName' => 'rma_auth_type', 'label' => 'Authentication type'], ['fieldName' => 'rma_auth_type_none', 'label' => ''], ['fieldName' => 'rma_auth_type_api_key', 'label' => 'API key'], ['fieldName' => 'rma_auth_type_basic_username', 'label' => 'Username'], ['fieldName' => 'rma_auth_type_basic_password', 'label' => 'Password'], ], ]; $plugin['settings_page'] = function ( $plugin ) { static $object; if (null !== $object) { return $object; } return new SettingsPage($plugin['properties']); }; $templates = [ './Templates/member-content.php' => 'Restricted Member Content', ]; //initialization functions $templater = new Rma\PageTemplater($templates); add_action('init', ['Rma\Tools', 'member_password_check']); add_action( 'admin_enqueue_scripts', 'rmaQueueScripts' ); add_action('plugins_loaded', array('Rma\PageTemplater', 'get_instance')); add_shortcode('member_sign_in', ['Rma\Shortcodes\SigninForm', 'createSignInForm']); $plugin->run(); }SettingsPage.php
namespace Rma; class SettingsPage extends WpSubPage { public function render_settings_page() { $option_group = $this->properties['option_group']; $page = $this->properties['menu_slug']; $submit = $this->properties['submit_label']; echo $this->properties['page_title']; ?> <div class="wrap"> <form method="post" action="options.php"> <?php settings_fields($option_group); do_settings_sections($page); submit_button($submit); ?> </form> </div> <?php } }WpSubPage.php
namespace Rma; abstract class WpSubPage { protected $properties; public function __construct($properties) { $this->properties = $properties; } public function run() { add_action('admin_menu', array($this, 'add_menu_and_page')); add_action('admin_init', array($this, 'register_settings')); } public function add_menu_and_page() { add_submenu_page( $this->properties['parent_slug'], $this->properties['page_title'], $this->properties['menu_title'], $this->properties['capability'], $this->properties['menu_slug'], array($this, 'render_settings_page') ); } public function register_settings() { $group = $this->properties['option_group']; $options = $this->properties['options']; $page = $this->properties['menu_slug']; add_settings_section($page . '_main', '', function() { echo $this->properties['section_heading']; }, $page); foreach ($options as $option) { $fieldName = $option['fieldName']; if (method_exists('Rma\Tools', 'validate_' . $fieldName)) { register_setting($group, $fieldName, ['Rma\Tools', 'validate_' . $fieldName]); } else { register_setting($group, $fieldName); } add_settings_field($fieldName, $option['label'], ['Rma\Fields', 'fieldHtml'], $page, $page . '_main', ['fieldName' => $fieldName]); } } public function render_settings_page() { } }Forum: Fixing WordPress
In reply to: Requirements for remote member authenticationThanks for your reply. The user database will reside on a remote host. I’m looking to create a REST request for user data and use a positive response to allow access to certain areas. All I’ve seen so far of WP RESTful API and associated plugins is exposing WP stuff. Probably means that I’ll have to do a lot more programming than I was hoping. But at least I now have a proxy for the remote host that can return the json response a RESTful request will need.