Overwrite Author Name

Are you currently giving multiple users the same login details? If ‘yes’ then read on…

I came across the need to create a consistent author name across a site, very much like how wordpress.tv seems to be, looking from the public front end.  If you see any of the posts that wordpress.tv make its always the same author name even though all the content is obviously being provided by many different users/authors.

So in comes ‘Overwrite Author Name‘ to do a similar job for any of your sites which has multiple authors providing content but you want to have a clean authorship used across the site.  The obvious workround for this would be to give all the users (for example office staff) the same username and password details, but this is very inflexible and weakens site security.  It would be much better to allow all users to login to the site with their own access rights and capabilities and automatically change the name of the author at the time of post save and this is the reason I created the ‘Overwrite Author Name‘ plugin.

Off-course to to re-edit the post/page users will need the ‘edit_others_posts‘ or ‘edit_others_pages‘ wordpress capability respectively and likewise for any custom post types used.

You could always put something like the following code into your functions.php file..

add_action('save_post', 'overwrite_author_name');

function overwrite_author_name($post_id) {
    //this is the user name ID to be enforced.
    $enforced_author = 7797;
    //this is the post types to have an enforced user name.
    $author_post_types = array('post', 'page');
    if ($parent_id = wp_is_post_revision($post_id))
        $post_id = $parent_id;
    $post = get_post( $post_id );
    if (( $post->post_author != $enforced_author ) && (in_array($post->post_type, $author_post_types))) {
        // unhook this function so it doesn't loop infinitely due to the use of save_post within overwrite_author_name
        remove_action('save_post', 'overwrite_author_name');
        // update the post, which calls save_post again
        wp_update_post(array('ID' => $post_id, 'post_author' => $enforced_author));
        // re-hook this function
        add_action('save_post', 'overwrite_author_name');

..but that ties you into the theme, having the plugin allows you to swap themes and not loose the functionality.

I’ll be releasing to the wordpress plugin repository in the next day or so.

GitHub page.


Teams Are A Good Thing

I have picked up the motto years back that I tell my kids to encourage them at school  ‘work hard and play hard’.  I’d like to say its stood me in good stead.  It may come across with a sense of ‘work‘ is the bad guy and ‘play‘ the good guy but my experience is that both can be positive or negative, which I’m sure you’d agree.  So the question isn’t really about doing either work or play or in varying amounts but how to get the most out of each and doing them at the right time.

Work for me is great if I am learning, working with new people or meeting new challenges.  It’s more of when you look back at how something went that you begin to see what makes you tick.  When I was a teenager (a while ago now) I built myself a classical guitar which at times would get intense so much so that rather than go on holiday with the family I stayed at home for two weeks not speaking to a sole to crack on a get it built.  With high interest factor and without distraction it looked more like a guitar after the fortnight than lumps of wood.  However, a few months later when I was low, tired and depressed it dawned on me how I had been lonely during the time without human interaction, the effect wasn’t seen at the time but afterwards.  Its good to understand yourself a little more each day and since then I know I like working with others (some of the time).

When I got married to Alison I remember the words “For this reason a man will leave his father and mother and be united to his wife” it comes from Mark 10:6-8.  You could say the simplest team going is a couple having tied the knot and I’ve learnt more about life and myself in a team of two than anywhere else.

Its not surprising that working in teams at home, work or on the football pitch that life is more rewarding than doing it alone.  After all God is three persons Father, Son and Holy Spirit so teams have been around an awful long time!  The next time you decide to ‘work hard and play hard’ in the context of a team in some way you reflect the nature of God himself, now there’s a thought.

Role Based Help Notes

"Taking Notes" - By Krissy.Venosdale
“Taking Notes” – By Krissy.Venosdale

I have published my ‘Role Based Help Notes’ wordpress plugin to the wordpress community to help groups work together in activities and content where logged in users of a wordpress site are already allocated role(s). The plugin basically allows you to quickly create helpful guides/content for any defined user role and opens up the Content Management Site (CMS) capability for your site.  This lends itself to help you talor the helpful guides/content to each separate role and allows the group to update and maintain the content.

As all people in history benefit from standing on the shoulders of giants in their field so this plugin is no different it has been given an “Extension” section to provide a quick and easy route to installing plugins that compliment Help Notes just choose those you want if not already installed on your site.  All this is possible with TGM-Plugin-Activation (by Thomas Griffin and Gary Jones.) an amazingly useful way to bundle plugins into your themes, or as I have here a plugin!

The plugin uses custom post types for user roles. This allows users, with a specific role, the ability to create and edit their own ‘help notes’ providing a private set of notes for use. It can be used for anything else that fits with that role (e.g. creating minutes-of-meetings notes etc…).
To add new roles to the basic wordpress roles (Administrator, Editor, Subscriber ..etc) you will need to use another plugin refer to Roles_and_Capabilities and Resources.. Plugins. You can then use one of these plugins (e.g. User Role Editor) to allocate users to multiple roles.

So if you want to quickly give a group a private area to share and post ideas/notes ..

  1. Create a new role.
  2. Add users to the role.
  3. Enable the Help Notes from the settings.

A global ‘General Help Notes’ type is also available which is not tided to a specific role, this has the same access/capabilities as the standard wordpress ‘post’ type for read/write access.



Helpful references used along the way..