Hook when switching between blogs in WordPress multisite? - hook

Is there a hook for WordPress multisite that I can use when a user switches between blogs in the Dashboard?
I need to clear some transients when the user is logged in the Dashboard, but only if she switched from one blog to another.

Hookr is your friend.
/**
* Fires when the blog is switched.
*
* #since MU
*
* #param int $new_blog New blog ID.
* #param int $new_blog Blog ID.
*/
do_action( 'switch_blog', $new_blog, $new_blog );
http://hookr.io/3.9.1/actions/do_action/switch_blog/

Related

Netsuite: How to generate a UPS return label from a return authorization

I am trying to add the ability to generate UPS return labels to our Return Authorization forms. A button for this already exists on the RA form, and there's a suitelet that it's calling that's been mostly finished as far as I can tell (see below, I am not a developer and the developer for this departed before it was completed), but it calls a "test" label with incorrect weight/dimensions/shipping fee. Does anyone have any suggestions for generating the return labels directly from the RA? We have an API with UPS/Netsuite already for generating our outbound labels.
#NApiVersion 2.x
#NScriptType Suitelet
#NModuleScope SameAccount
RA界面打印label
*/
define(["require","exports","N/log","N/file","./core.lib.min"],function(e,s,t,r,i){Object.defineProperty(s,"__esModule",{value:!0}),s.onRequest=function(e){t.audit("ctx",e);
var s=i.ups.create_return_label(e.request.parameters.ra_id,e.request.parameters.so_id);
if("1"!=s.ShipmentResponse.Response.ResponseStatus.Code);
else{var n=r.create({name:e.request.parameters.so_id+"-return-label.gif",fileType:r.Type.GIFIMAGE,contents:s.ShipmentResponse.ShipmentResults.PackageResults.ShippingLabel.GraphicImage});
e.response.writeFile({file:n,isInline:!0})}}});

#author tag for javadoc missing in Android Studio

I have migrated from Eclipse (ADT) to Android Studio but it's saying that #author is an invalid tag for javadoc.
First, we need to create #author tag within command line. Then only you can see the results. Like this:
/**
* #author author_name
*/
Between /** and */, if you type the # symbol and then click ctrl+space, all available tags will be shown automatically in android studio.
If before a method definition you type /** then click ENTER, parameters and return type of method
tags with names will be shown automatically.

CMSMS How to move menu element from Extensions to Content section in the admin area?

I've installed Form Builder module in the CMSMS. "Form Builder" submenu was automatically added to the Extensions tab. But I'd like to add this submenu to the Content tab instead of Extensions. Does anybody know how to do that?
Thanks in advance.
Best reagards,
Igor
Well, it is quite old question, I did find it by accident, but since there is no response I will answer, maybe someone will find it useful later. I don't know if you are able to do that directly via cms panel. However it is doable, you have to modify main module file. Find FormBuilder.module.php file in /modules/FormBuilder in your CMS location. There is function responsible for putting modules in desired sections. Extension sections is default for all modules unless you will specify other section using function below:
/**
* GetAdminSection()
* If your module has an Admin Panel, you can specify
* which Admin Section (or top-level Admin Menu) it shows
* up in. This method returns a string to specify that
* section. Valid return values are:
*
* main - the Main menu tab.
* content - the Content menu
* layout - the Layout menu
* usersgroups - the Users and Groups menu
* extensions - the Extensions menu (this is the default)
* siteadmin - the Site Admin menu
* viewsite - the View Site menu tab
* logout - the Logout menu tab
*
* Note that if you place your module in the main,
* viewsite, or logout sections, it will show up in the
* menus, but will not be visible in any top-level
* section pages.
* #return string Which admin section this module belongs to
*/
By default there is no such function in FormBuilder module definition, so you have to add it on your own and then it should change its location. Cheers!
function GetAdminSection()
{
return 'content';
}

How to edit controller in Sencha Architect 2?

Editing of controller or any js file of sencha touch application bield from Sencha Architect 2 are editable or not?
Manually or via the UI?
Manually you add a controller and then in the designer view choose CODE
and then OVERWRITE.
The original is saved (look in the dir structure)
Next time open this screen, choose (in the first selector of code view) the VIEW OVERRIDE CODE
so that you see your latest work.
I work with intellij to edit the file. Then paste it into the field, and it automatically updates both files (there's a .js and an Architect metadata file)
Via the UI of course: That's simple. Use the config inspector to select the views models and stores you wish to control.
Moshe
If you are using architect each time you save the project architect edits the code of all the files in the app folder & app.html & app.js so any manual edits you make on the actual file will always be overwritten...
This is actually displayed as comment in each file eg:
/*
* File: app/controller/MyController.js
*
* This file was generated by Sencha Architect version 2.1.0.
* http://www.sencha.com/products/architect/
*
* This file requires use of the Sencha Touch 2.0.x library, under independent license.
* License of Sencha Architect does not include license for Sencha Touch 2.0.x. For more
* details see http://www.sencha.com/license or contact license#sencha.com.
*
* This file will be auto-generated each and everytime you save your project.
*
* Do NOT hand edit this file.
*/
I hope this was what you were looking for

how can I override as well node/x/edit as node/x/add with just one panel?

I'm using durpal 6 and have some panel pages. The one for /node/%node/edit is overriding the node edit pages. but on my regarding node/add page the panel page is not applied.
Do I have to add a new page? There is a panel context "node add form" - if I add this, can I anyway use one panel page variant for as node/edit as node/add ? Or would I have to use 2 different forms ?
Finally resolved the problem. In our case it was a collision with the i18n module. I reported it to drupal.org but it seems it's working as designed.
In your case, if you are not using i18n, there may be some module overriding the node_page_edit on top of ctools. Check the menu_router table to see which function (module) is has their callback registered for the node/add/% and node/edit/% routes and then try to lower the weight of that module or increase the weight of ctools page manager. Clear your caches and check the callback for the node add and edit routes is page_manager_node_edit.
/**
* Entry point for our overridden node edit.
*
* This function asks its assigned handlers who, if anyone, would like
* to run with it. If no one does, it passes through to Drupal core's
* node edit, which is node_page_edit().
*/
function page_manager_node_edit($node) {
...
You can check my hack and the module author's comments here: http://drupal.org/node/1561046#comment-5997776

Resources