ClassicPress Plugin Development: Get Options Page Title

ClassicPress PluginsThis post is part of the ClassicPress Plugin Development series in which I am going to look at both best practice for developing plugins and how I approach some requirements as well as some of the functions I commonly use.

Over the last couple of posts in this series, I’ve discussed how options can be loaded and saved, loaded with defaults and loaded with multilevel defaults. Over the next couple of pages, I’m going to show how an options page can be created and the options saved, but first a quick post on how the options page title can be populated.

I’ve seen a lot of plugins where the options page title has been a string which has been echoed. However, when the options page is added to the settings main menu, the first parameter is the page title. So instead of echoing a new string, we can use the get_admin_page_title function to get the title set when the options page was added to the menu.

<h1>
	<?php
		esc_html_e(get_admin_page_title());
	?>
</h1>

As you can see from the example code, above, the call to get_admin_page_title has been wrapped with a esc_html_e to echo and escape the page title.

Click to show/hide the ClassicPress Plugin Development Series Index

Vivaldi Active Tab Darker Than Other Tabs

Vivaldi BrowserI started using Vivaldi browser while it was still in beta test and have seen a number of iterations over the years. Most of the changes have been neutral or beneficial, but one of the latest I’ve found very annoying. I first encountered this in April and forgot to post about it, but I’ve been creating some new VMs and have had the same issue again recently so thought I’d post as a reminder.

The issue is that the active tab is darker than the active tabs when you’re using a dark theme. While I like dark themes, I prefer the active tab to be lighter than inactive ones. The previous version of Vivaldi did have a lighter active tab:

Lighter active tab

Continue reading “Vivaldi Active Tab Darker Than Other Tabs”

Microsoft Office Jump Lists Not Updating

Microsoft OfficeI had a problem recently where the ump lists for Microsoft Office stopped updating. I did some checking around and a recommended solution I found is to remove large files (> 1MB) from the %AppData%\Microsoft\Windows\Recent\AutomaticDestinations.

I had a look in the folder and did find some large files and so deleted them. Over the next couple of hours, I checked the jump lists and they still weren’t updating, so I deleted the rest of the files to see if there was a smaller corrupt file.

The jump lists didn’t immediately start working, but I noticed after a few days that they were again recording recently accessed files.

Management Reporter Does Show All Account Descriptions

Microsoft Dynamics GPWe’ve recently been implementing Microsoft Dynamics GP for a manufacturing company in England. When verifying that opening balances had imported correctly, the user reported that not all of the rows in Management Reporter were displaying an account description. A quick check around and I found a blog post from nJevity covering this exact subject.

Typically Management Reporter is run only to show posted transactions, but you can also set it to include unposted transactions. In this testing , we were returning both posted and unposted as we had imported the opening balances, but not yet posted them in case any changes were required.

The rows which included only unposted transactions did not display the account descriptions, but rows with even a single posted transaction did. As soon as the opening balances were verified and posted, all rows did display the account description. As the client would not usually be reporting on unposted activity, this was deemed a non issue.

Script Error on Dynamics GP Homepage

Microsoft Dynamics GPDuring a recent upgrade of Microsoft Dynamics GP, the client supplied a link to be used for a repurposed Intelligent Edge section on the home page. However, once their Intranet site link had been added, users started getting a script error like the below:

Internet Explorer Script Error

An error has occurred in the script on this page
Line: 320

Char: 6

Error: The system cannot find the file specified
Code: 0
URL: file:///D:/Documents%20and%20Settings/gptestuser/Local%20Settings/Temp/1/tmp10.tmp
Do you want to continue running scripts on this page?

I wasn’t able to get a screenshot of the error at the time, and the above is taken from Microsoft KB article which covered this issue in Q31.

The solution is to create a UserData folder in each users %appdata%\Microsoft\Internet Explorer\. Once we did this, the error did cease to be displayed.

Management Reporter Upgrade Fails The Users Can’t Connect

Microsoft Dynamics GPI recently did a Microsoft Dynamics GP upgrade for a client which included Management Reporter. During the upgrade of Management Reporter to the latest hotfix, we found that the upgrade of the legacy connector failed every time. We spent quite a bit of time looking into the problem and eventually got it to install correctly.

When legacy connector was first added, it was added using the FQDN of the SQL Server Instance (SQL01.example.com\GP), the upgrade failed every time we tried to use the FQDN, but when we switched to just the machine name (SQL01\GP), the upgrade was successful.

Management Reporter has been used by this client since the release of the 2012 version and it has been upgraded previously without issue, so I am unsure of what had changed in this version.

That was not the end of the story though. When I tested Management Reporter was working fine, it was. However, I’d logged in using the sa account. When users started logging in they were finding that they were unable to connect to the GP company database:

Management Reporter unable to connect

Unable to connect to the 'Example Limited' company.

The connection to the Microsoft Dynamics GP database failed. Contact your system administrator.

I’d seen this error message before and it is because the System DSN used by Dynamics GP was using the FQDN, but now the legacy connector in Management Reporter i using the server name so the password encryption will be different.

I didn’t want to remove the legacy connector and try to install it again as I was pretty sure we’d have the same problem as previously. Instead I decided to have a go at updating the connection used by Management reporter which is stored in the Reporting.ControlCompany table and which I noted I’d done in the previous bog post.

However, I didn’t post the SQL I’d used, so I needed to recreate it. The two highlighted sections are the server name which needed to be changed and to what:

/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk) This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int). */
UPDATE Reporting.ControlCompany SET GLEntityConnectionInformation = REPLACE(CAST(GLEntityConnectionInformation AS VARCHAR(8000)), 'SQL01\GP', 'SQL01.example.com\GP') GO

Obviously, take a backup of the database before running the script and test that it has worked correctly before allowing users back into Management Reporter.

ClassicPress Turns 3

ClassicPressIt does’t seem like it, but ClassicPress is now three years old. Many open source projects don;t last very long, but this hard fork of WordPress 4.9 is still going with a new release in beta test at the moment and the version after in planning.

Viktor Nagornyy has written a blog post reviewing what has been accomplished over the last three years, covering topics like improved security and developer experience, removal of some bloat with plans to remove more, creation of an easy migration route for those moving from WordPress and more; all of which you can read about here.

Birthday cake for ClassicPress

ClassicPress is a volunteer effort which welcomes all the help people are able to provide. If you’re already using ClassicPress or looking to leave WordPress, there are a number of ways you can help out, even if youre not a developer:

  • Make a donation to help pay infrastructure costs. They are tax-deductible in the US.
  • If you’re a PHP programmer, please consider contributing to core development. The more core contributors working on the project, the faster it can reach the roadmap goals.
  • If you have WordPress plugins, make them compatible with ClassicPress and mention ClassicPress in your readme.txt file. There are some popular plugins officially supporting ClassicPress, such as Beaver Builder and Shield Security. You should also submit your plugin to the Directory to reach ClassicPress users.
  • If you can translate English text to your native language, help with translations.
  • If you can write, you can help with blog posts for our ClassicPress blog and/or write documentation guides to help others learn ClassicPress.
  • Help promote ClassicPress by writing a blog post on your own blog, or mentioning ClassicPress in your podcast or YouTube channel, or sharing a blog post from the ClassicPress blog to your social media channels.

If you’re unsure how you can help, join the forum or Slack channel. Share your skills and experience, and the community will be happy to help you find a place in the ClassicPress community.

I joined the ClassicPress community in November 2018 and migrated all of my sites to it in February 2019; I then subsequently forked all of my WordPress plugins for ClassicPress. I didn’t just fork them though, I improved the functionality and security of them all, making many improvements with advice and assistance from people in the community. As well as writing the ClassicPress plugins, I’ve also been involved in writing some documentation and guidelines for the ClassicPress Plugin Directory.

It’s the first large open source project with which I’ve been involved and I have found the community vey welcoming and friendly. As ClassicPress starts it’s fourth year, I’m looking forward to continuing as an active member of the community.

Victor’s blog post can be read here.

Recent ISC Software Webinar: Lesser Used Modules In Microsoft Dynamics GP

ISC Software SolutionsIn our most recent webinar, we took a look at Lesser Used Modules In Microsoft Dynamics GP. In this webinar, we took a look at some of the lesser known, but very useful modules in Microsoft Dynamics GP. If you want to catch up on this, or any other, webinar, you can do so here.

  1. Introduction
  2. Licensing
  3. Available Modules
  4. Lesser User Modules
  5. Conclusion

Introduction ^

Microsoft Dynamics GP is a mature enterprise resource planning (ERP) system which has lot of functionality available. I find when working with client that many of them are familiar with the core modules such as General, Purchase and Sales Ledgers as well as Purchase and Sales Order Processing and Fixed Asset Management, but don’t know much of what is available outside of these modules. this is why in this webinar, we took a look at some of the lesser used modules in Microsoft Dynamics GP so we can give people an insight into the functionality available to them within the licensing they already own.

Much of the focus was on modules in the a href=’#lesser-used-starter-pack’>Starter Pack as all clients on Dynamics GP 2013 or later have access to this, but we did also take a look at some of the functionality in the Extended Pack.

Continue reading “Recent ISC Software Webinar: Lesser Used Modules In Microsoft Dynamics GP”

New ClassicPress Documentation Hub Now Live

ClassicPressThe new ClassicPress Documentation Hub is now live with user and developer guides as well as the Plugins Guidelines for the ClassicPress Plugin Directory, but the big addition is the ClassicPress Code Reference.

The bulk of the work done to build the new site was done by Beda Schmid who also wrote the announcement post on the ClassicPress blog.

The code reference means that developers can now look up any of the 2,814 methods, 2,874 functions, 280 classes and 2,063 hooks from the ClassicPress code instead of having to use the old WordPress code reference which would include all of the Gutenberg additions.

Full details on what has been added to the ClassicPress Documentation Hub can be read in the announcement.

ClassicPress Plugin Development: Load Multilevel Options with Defaults

ClassicPress PluginsThis post is part of the ClassicPress Plugin Development series in which I am going to look at both best practice for developing plugins and how I approach some requirements as well as some of the functions I commonly use.

Over the last couple of posts, I’ve taken a look at saving and loading options and how to load options with defaults. The defaults in the last post was a single dimension array, but you can also do the same with multi dimensional arrays using a ustom recursive parse of the arrays.

The below is an example of loading options with multi dimensional defaults from my Widget Announcements plugin:

/**
 * Get options including defaults.
 *
 * @since 1.1.0
 *
 */
function azrcrv_wa_get_option($option_name){
 
	$defaults = array(
						'widget' => array(
											'width' => 300,
											'height' => 300,
										),
						'to-twitter' => array(
												'integrate' => 0,
												'tweet' => 0,
												'retweet' => 0,
												'retweet-prefix' => 'ICYMI:',
												'tweet-format' => '%t %h',
												'tweet-time' => '10:00',
												'retweet-time' => '16:00',
												'use-featured-image' => 1,
											),
						'toggle-showhide' => array(
												'integrate' => 0,
											),
					);

	$options = get_option($option_name, $defaults);

	$options = azrcrv_wa_recursive_parse_args($options, $defaults);

	return $options;

}

/**
 * Recursively parse options to merge with defaults.
 *
 * @since 1.1.0
 *
 */
function azrcrv_wa_recursive_parse_args( $args, $defaults ) {
	$new_args = (array) $defaults;

	foreach ( $args as $key => $value ) {
		if ( is_array( $value ) && isset( $new_args[ $key ] ) ) {
			$new_args[ $key ] = azrcrv_wa_recursive_parse_args( $value, $new_args[ $key ] );
		}
		else {
			$new_args[ $key ] = $value;
		}
	}

	return $new_args;
}

Click to show/hide the ClassicPress Plugin Development Series Index