Wednesday 14 December 2011

Google PlusOne button not displaying

I was having an issue on our mobile site with the Google PlusOne button not displaying. When the HTML was generated the iframe had a height of zero. I have no idea why this was happening. Anybody have any clues please let me know.

Anyway to fix it I placed this CSS in my code which resolved it:


#___plusone_0 iframe {
height: 25px !important;
left: 0 !important;
top: 0 !important;
position: static
}

Thursday 8 December 2011

Umbraco error: The current user doesn't have access to this application. Please contact the system administrator.

We were alerted to this error when editors tried inserting links or images using the toolbar for tinymce. This is the error the got:


It was only happening for user type "editor" and not the administrators.

The solution mentioned in this post http://forum.umbraco.org/yaf_postst4772_The-current-user-doesnt-have-access-to-this-application.aspx states that you only need the Content section selected for the user, but this was already selected for my user experiencing the error.

The solution for me was to select the Media section for the user as well.

Wednesday 7 December 2011

Umbraco table trigger to update a non-Umbraco table

Due to the way our system is setup I had to write a database trigger to monitor move and sort changes and log those changes into a non-Umbraco table with the node ID and a date. Below is the trigger I created:

USE (yourumbracodatabase)
GO

IF  EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[TR_CNI_UmbracoNode_AfterUpdate]'))
DROP TRIGGER [dbo].[TR_CNI_UmbracoNode_AfterUpdate]
GO

/*
There are two very special tables that can exist only within triggers: the inserted and deleted tables. These tables are 
used to store the before and after state of the table that was affected by the INSERT, UPDATE, or DELETE statement that 
caused the trigger to fire in the first place. 
*/

CREATE TRIGGER TR_CNI_UmbracoNode_AfterUpdate ON dbo.umbracoNode AFTER UPDATE
AS
 DECLARE @id INT 
 
 CREATE TABLE #NodeIds
 (
  nodeId INT
 ) 
  
 IF UPDATE(parentID) OR UPDATE(sortOrder)
 BEGIN 
   
  SELECT  @id = d.id
  FROM  inserted i
  INNER JOIN deleted d ON i.id = d.id
  WHERE  d.parentID <> i.parentID
  OR   d.sortOrder <> i.sortOrder
  
  IF (@id IS NOT NULL)
  BEGIN     
   INSERT INTO #NodeIds
   SELECT @id -- Parent
   UNION ALL
   SELECT un.id -- Children
   FROM dbo.umbracoNode un
   WHERE un.[path] LIKE '%,' + CONVERT(NVARCHAR(40), @id) + ',%'   
  END
 END 
 
 -- Delete existing nodeId rows
 DELETE FROM dbo.T_CNI_PublishNodeData
 WHERE nodeId IN
 (
  SELECT nodeId
  FROM #NodeIds
 )

 -- Insert new dates for nodeIds   
 INSERT INTO dbo.T_CNI_PublishNodeData (nodeId, publishedDate)
 SELECT nodeId,
   GETUTCDATE()
 FROM #NodeIds

 DROP TABLE #NodeIds