31Jan

Restrict Pages to Logged in Users

Written by Mark in General | 10 Comments »

Have you ever wanted a way to protect pages or post on your WordPress blog or website, so that only logged in users can see them?  If so then this is the post for you, as it tells you how to protect your posts and/or pages.

First of all my appologies to all you readers out there who are not viewing this site for my WordPress posts and want to see photos of a cute little baby Harry, but this post is all about how you can code your WordPress theme so that you can stop the general public looking at certain pages and allow only logged in users to see them.

It took me a long time to work this out.  I don’t know why really because it is a doddle.  I initially wanted it for the school website so that teachers could add pages to their sites that they did not want to let pupils have access to, such as answer pages etc.  But I have been recently developing WordPress to use for invoicing customers and did not want general viewers to be able to see the invoices.  Therefore I wanted to protect the posts that held the invoices to logged in users only.

The answer to this is a simple WordPress if else statement.  The code below is what you need:

<?php if (is_user_logged_in()) { ?>

//do whatever you want if the user is logged in here

<?php } else { ?>

//do whatever you want if the user is NOT logged in here

<?php } ?>

Line one of the code above checks to see if the user is logged in (I guess it checks to see whether you have the correct cookie).  If you are logged in then it will do whatever you put directly underneath that.  I have included a simple loop in here displaying the content, title and dates etc.  The else part basically means if you user is not logged in then it will do what is under the else part.  You can add this to posts and pages, simply by adding the code to the appropriate file in your themes template files.

Pretty simple but a really effective way to protect parts of your WordPress blog or website so that only logged in users can see your posts or pages.

View RSS Feed
28Jan

Addicted to Wii Tennis

Written by Mark in Technology | 1 Comment »

Just before Christmas I invested in a Nintendo Wii and Wii Fit for all the family to indulge in.  I have to say that over the last month (after I finally got it set up with Harry taking up a lot of time) I am now addicted to Wii Tennis.

The guy who invented this very different games console is an absolute genius, not to mention that he must be a very wealthy man right now.  The games is one of the most addictive games ever, primarily because it is so interactive and you are actively engaged in the game itself. Currently my Tennis score is 1540 which is not bad considering I have only really been playing on it for about a fortnight.  I am well into Pro status already!

I am sure that this Wii is going to provide hours of entertainment throughout its life here.  Have you got a Wii?  What is your favourite game?

View RSS Feed
19Jan

Rowland Homes Fiasco

Written by Mark in General | 10 Comments »

About 2 months before Christmas it became clear that the derelict land that was next door but one to our house was going to be development by Roland Homes.  Since then the whole thing has been a nightmare and it has brought to my attention the terrible way in which Rowland Homes have gone about working with the local residents in order to keep disruption to a minimum.

Work started back in late October 2008 when the company were preparing the site for development of around 22 4 and 5 bed homes we are led to believe.  The company had large lorries ( and by large I mean really large!) coming down a residential road that leads to around 20 homes.  As you can imagine the width of the road is not wide and there are usually cars parked down the side of the road and often children playing on bikes and other toys.  Lorries were coming down at speeds in excess of 30 mph which was incredibly dangerous.  As I wrote late last year in the post entitled “What A Day” the disruption has been horrendous.

Parked across the driveway

First of all the staff that Rowland have working for them are most unpleasant and have not taken into account the disruption that is being caused to the residents.  On that day back in August several of them were verbally offensive towards 1 or 2 of the residents, swearing at them and also making rude hand gestures.

Also at this time we were ensured by the director of Rowland Homes himself that every time lorries were turning in and around the entrance to the new development and around all of the houses and cars belonging to the residents, a banks-man would be used in order to safely direct the lorry into position.  I would say that this happens about 30% of the time.  You can see in the video above, there is no banks-man present.

Well today the situation was getting back to the same again hence the reason why I am motivated to write this blog post.  A delivery wagon came along the road with what I assume were breeze blocks for building with and parked right across the front of mine a next doors drive ways.  He could easily have parked across the other side of the road where there are no driveways or better still pulled into the development and unloaded there, but no they had to cover our driveway.  This prompted a call to Rowland Homes and we were told that this would be actioned.  Sure enought 10 minuntes later the lorry was moved.

Doing something in the middle of the road for about 20 minutes holding up traffic

It is just disappointing, that although this development is going to happen, Rowland Homes have gone about it in a poor way, blaming any problems on the tradesman that they are contracting out and not taking responsibility for what is happening.  I don’t think that develops a good company image, but maybe that is just me.

View RSS Feed
15Jan

Which Domain Name?

Written by Mark in General | 5 Comments »

The other week my brother was renewing his domain name when he came across the domain that he wanted in the first place.  I have always wanted the domain name markwilkinson.co.uk or even markwilkinson.com, but as they are registered by a large furniture group this is not likely to happen.  My point is that this got me thinking about what domain name I should be using.

My blog has always resided on penn4them.com which is what it was always intended to do.  The name comes from the old saying that I used to here, when someone is day-dreaming we used to say “penny for them”, meaning we would give you a penny for your thoughts.  Blogging is a lot about thought and opinions and therefore I thought that appropriate for a blog.

My blog is not up for discussion.  Since I started getting into web design and the Internet back in late 2004 I registered the domain name markdw.co.uk.  This is what I use for email and so on and for a while it was where I shared photographs and videos.  However my blog has taken over all that now.  So all I use this for is hosting my email.

I suppose the question I want to ask is which domain do you think I should be using for my personal domain.  I have a few that are registered and therefore was wondering what other people thought was the best to use.  I you could answer the poll below then that would be great.

[poll id="2"]

View RSS Feed
14Jan

New Features

Written by Mark in General | No Comments »

I have been using Flickr now for some time in order to host all of the photographs that you see on this site.  I wanted a way to show my latest photographs on this site however without the need to go across to Flickr.  I remembered using a plugin a while ago that did the trick called FlickrRSS and it works a treat.

The FlickRSS plugin is great as it allows you to pull photographs from a Flick user into your WordPress blog, and display them, styled as you like.  There are also many options available to choose such as what type of photos you want in terms of the tags and also what size of photo you want to display.  I opted to show all photos from my photostream feed as a small size.

Therefore you can now see all the latest photos that I update by clicking on the Latest Photographs in the sidebar to the right or you can go straight there simply by going to penny4them.com/photos.

The other thing that I have added in the last few weeks (when I have had a minute between Harry’s feeds etc.) is my Facebook status.  To do this I have just created a widgetized area of the sidebar and then used the RSS widget to pull my status updates from Facebook.  The hardest thing here was finding my status updates RSS feed in Facebook.  After much search you can find it, and your own once you are logged in here – http://www.new.facebook.com/minifeed.php?filter=11

Tags:
View RSS Feed
10Jan

Changing Harry Wilkinson

Written by Mark in General | 4 Comments »

Harry is now getting on for almost 2 weeks old and during this time I have had to master the art of changing a nappy.  Although by no means perfect I think I am some way towards acheiving this as you can see below!

The trick is to work fast and not be too gentle.  Too gentle and Harry seems to have his own way straight away and the nappy never gets in place correctly and he usually ends up weeing everywhere!

Tags: ,
View RSS Feed
05Jan

Harry Photos and Video

Written by Mark in General | 3 Comments »

Well you have all been asking for more photos of Harry and so I thought I would let you have some of the photos that we have taken over the last couple of days.

Harry Wilkinson

This afternoon Harry lay on his back on his changing mat for a good 1 hour with Helen whilst awake and alert and Helen managed to get some good shots of him.

Harry Wilkinson

As we have been trying hard to get Harry into a routine of night sleep and day feeds due to his night time winging we have been trying to regluarly feed him during the day so that he gets enough during the night.  Therefore we need to wake him up to feed which is harder than you would think, as you can see from the video below:



View the Flickr slideshow of these photos.

Tags: , ,
View RSS Feed
« Older Entries