Mediterranean Gardening France

What's New? / Quoi de neuf ?

FAQ
Join / Adhérer
Contact Us / Nous contacter

Anatomy of a WordPress Site

Themes

When building a WordPress site, it has to be assigned a theme. This controls the site’s appearance: layout, typography, colour, and other design elements. As a bare minimum, a theme will consist of a stylesheet of standard CSS statements (‘style.css’) to control the appearance of the site and a functions file (‘functions.php’). The latter is a collection of PHP functions and code snippets to perform custom functions not provided by the basic WordPress installation. The theme can also have

  • additional CSS files;
  • a collection of special WordPress elements – templates, headers, sidebars and footers (see below);
  • JavaScript files.

WordPress installations come with a number of default themes and others can be downloaded from the official WordPress theme directory. Many are free; others have paid premium versions. It is also possible to create your own custom themes for a unique website design – which is the case with the MGF site.

Templates

When creating a WordPress page, the user assigns to it a template. This frames the content of the page and, together with the CSS files of the theme, determines its appearance. Templates, which belong to a theme, are executable files which WordPress runs when the page is selected for display. WordPress has a default set of templates but users can create their own and the MGF site makes extensive use of these. Some pages, particularly in the Member App, have a template to themselves; other pages use the same template. For example, all gardening article pages will use the Gardening Articles template thus ensuring that they all have the same general appearance.

Templates are written in PHP but may also contain HTML, CSS and JavaScript. The PHP code is usually a combination of standard PHP statements and special WordPress functions. For example, the WordPress function ‘get_the_title()’ will retrieve the page title*. The primary function of a template is to determine the appearance of the page but it may also contain code carrying out functions specific to the page content. This is particularly so with the Member App where the templates contain the code to carry out the tasks required by the page in question such as updating a member’s profile or sending a message to all members. The templates used in the MGF site fall into three categories:

  • WordPress generic templates;
  • templates formatting the pages of the public site (and also the site documentation);
  • templates used by the Member App.

For more information about how themes and templates are used in the MGF site, click here.

* For a description of all WordPress functions, see the Code Reference.

Pages

Pages, the part of the site that is visible to users, are created by using the WordPress editor (known as ‘Gutenberg’).

All web pages (including WordPress ones) consist of two sections: head and body (enclosed in <head> and <body> tag pairs, respectively) with the whole page enclosed in an <html> tag pair. However, unlike other websites, a WordPress site has no self-standing and permanent HTML files. When a user creates a WordPress page using the editor, WordPress stores the content in a database. Then, when the page is to be displayed, it is constructed dynamically by the WordPress code.

A WordPress page can have four elements:

  • a header;
  • the content area;
  • sidebars (optional);
  • a footer (also optional).

As their name suggests, headers and footers are blocks of content which precede and follow the principal content on the page. A header for each page is mandatory as it contains the <head> section of the page as well as the initial lines of the <body> section. How much of the body section is included in the header is optional; the MGF header includes the logo, title and the menu bars.

Sidebars are blocks of content within a page. Originally (again as their name suggests) sidebars had to be placed to either the left or right of the principal content but now they can be placed anywhere within the page by using CSS. It is possible to have different versions of the header, sidebar and footer elements for different pages. However, for presentation reasons it is likely that the header and footer elements are will be the same across the whole site (as is the case for MGF). Which of these elements (and which version thereof) is included on any given page is determined by the page template. For a full description of these special WordPress elements and how they are used in the MGF site, see the Headers, Footers, and Sidebars page. Headers, footers and sidebars are part of a theme.

Code

Driving the presentation of pages on the site is the underlying code. The basic code which operates any WordPress site and which is common to all WordPress installations is known as the ‘core’. It is regularly updated and administrators should ensure that the site uses the latest version. Customisation of the code is possible in a number of ways. For more on the code used in a WordPress system, see The System Code.

Loading

Site Documentation

These pages describe the structure and composition of the MGF website as well as the requirements and means to administer it. The functionality, structure and composition of the Member App are also described.

The MGF site is based upon the content management system WordPress. Except when strictly necessary, these pages will not describe how to create websites using WordPress nor the detailed working of its different components for which there is ample documentation on the Internet. For the detailed workings of WordPress, consult the official WordPress site. Searching the internet for specific items will usually reveal helpful tutorials and other information.

Anatomy of a WordPress Site sets out in generic terms how a WordPress site is constructed and how its various components fit together.

Technical Implementation describes how the generic WordPress framework is implemented in the MGF site.

Site Management and Administration identifies the various components of the site which must be maintained and how that maintenance is performed. A final section describes the financial aspects of the site.

The Member App describes the functionality of the Member App and how this is implemented technically.

Members, Users and Roles describes the different WordPress and MGF roles, what holders of them can do, and how to manage the assignment of roles.

Protection of Personal Information discusses MGF’s obligations under EU privacy legislation and how the site meets them.

Loading

The Member App

Introduction

The Member App is a tool for use by the members and MGF management. It also includes the form for new people to join the association. For members, it allows them to manage the personal information that they supplied to MGF when joining and (where explicit consent has been given) to communicate with other members. For management, in addition to being a record of who is (and has been) a member of MGF, it allows for the management of subscriptions and provides a means for communicating to members either individually or as a whole.

The data for the Member App is held in the WordPress database; the procedures to process it are a combination of standard WordPress functionality, downloaded plug-ins, and custom-built code. The code is written in PHP with a small amount of JavaScript.

The Member Area

When a member logs into the Member App, they are taken to the Member Area dashboard. This consists of three sections. On the left is the standard WordPress administrative sidebar. For all except administrators, this sidebar serves no function. To the right is the Member Area proper. This is divided into two sections. At the top is the menu of functions available to all members (e.g. update your profile). Below is the menu of administrative functions. Access to this lower section is determined by the member’s WordPress role; only contributors and administrators can see it. Whether or not a member with access to this lower section can use a specific function there depends upon what privileges have been given to their MGF role. The content and layout of the Member Area (as well as the controls which determine access to it) are managed by the White Label CMS plugin (q.v.).

Processes

The member app consists of the processes listed below. Click on a process to see details of what it does functionally and how it is implemented technically.

General public

MGF Members

MGF members with an assigned MGF role

Member Information in the WordPress Database

In standard WordPress installations, member information is added by an administrator using the ‘Users’ option in the dashboard sidebar. Members can add to that information by logging in and then amending their profile. In the MGF site, this is replaced by the Member App using a combination of the WPForms plugin and custom MGF-developed code.

The principal file for holding user/member information is the table wp_mgf_users. However, this table only contains some of the items necessary for any WordPress site (see Table 1 below). All other data (including some necessary items) is held in the wp_mgf_usermeta table. For each member, there is a record for each additional data item and this is stored as a name/value pair (meta-key/meta-value), together with the member’s WordPress id to link the pair with the entry in wp_mgf_users (see Table 2). In addition to the WordPress necessary ones, wp_mgf_usermeta contains entries for the additional items required by the Member App. These are created in the User Registration setting of the two WPForms which deal with membership, linking the name of the item on the form with the meta-key. In addition, there are a number of management items which are entered by an administrator or else generated automatically by the Member App (e.g. subscription expiry year). Table 3 details all of these additional elements. There are also entries in wp_mgf_usermeta which are used internally by WordPress. These are not included in Table 3.

WordPress functions which retrieve user information (such as wp_get_current_user) collect it from both tables and present a single object containing all the information for the member(s) concerned. There are some other MGF-specific tables which also contain member information:

  • wp_mgf_former_members: the retained information of former members;
  • wp_mgf_member_change_log: changes to member profiles;
  • wp_mgf_subscriptions: subscription payments;
  • wp_mgf_email_addresses: the slug to email address table.

For further information on these tables, see the relevant process page.

Item nameDescriptionUsage by MGF?
IDUnique identifier for the userYes
user_loginUser’s login nameMGF: username
user_passUser’s passwordMGF: password
user_nicenameSlug for login name (default is the same valueNo
user_emailUser’s email addressMGF: email address
user_urlA user’s own URL (e.g. to personal websiteNo
user_registeredA date/time stamp for the creation of the user recordMGF: join date
user_activation_keyUsed to authenticate a password reset requestNo
user_statusNo longer usedNo
display_nameUser’s name that is shown publicly (e.g. post author)MGF: first name plus last name
Table 1 – The wp_mgf_users table
NameDescriptonExample
umeta_idUnique identifier for the record
user_idThe id of the user concerned
meta_keyName of the data itemcountry
meta_valueValue of the data itemFrance
Table 2 – The wp_mgf_usermeta table
Namemeta_key nameNotes
Addressaddress_1First line of member address
Address 2address_2Second line of member address
Post codepost_codeMember’s post code
TowntownMember’s town / village / commune
CountrycountryMember’s country
Telephone (home)telephone_homeMember’s home telephone number
Telephone (mobile)telephone_mobileMember’s mobile telephone number
Subscriptionsubscription_length**Subscription validity length in years. Used to calculate subscription expiry year when joining or renewing membership. Usually 1 but can change if member over pays their subscription.
Member Directorymember_directoryIndicates if member is in the Member Directory (Y or N)
First namefirst_nameMember’s first name
Last namelast_nameMember’s last name
Languagelocale*Member’s preferred language. Uses WordPress standard values: en_GB or fr_FR.
How did you hear about MGFhow_did_you_hearValue as entered by the member
Nicknamenickname*Set by WordPress to the same as username. Not used by MGF.
Additional information or Biographical Info (WPForms)description*Value as entered by the member
WordPress rolewp_mgf_capabilities*Indicates member’s WordPress role (subscriber, contributor, administrator). Stored in serialized format.
Statusstatus**Member’s subscription status, e.g. ‘Good Standing’
Expiry yearsubscription_expiry_year**Year at which the member’s subscription will expire
MGF rolemgf_role**Member’s role in MGF (Member, Event Coordinator, etc.)
Table 3 – Additional user elements in wp_mgf_usermeta. * indicates a standard WordPress item.

** These are management items which are either generated automatically by the system or entered / modified by MGF management rather than by members themselves. Processing and maintenance of these items as follows:

Subscription Length: Formerly, MGF offered members the choice of one or three year subscriptions and members selected their preferred option when joining or renewing their subscription. Since 2021, however, only one year subscriptions are available which means, in theory, that this item is no longer required. Upon joining, subscription length will be automatically set to 1 and, in normal circumstances, will remain so. The exception is when members, on their own initiative, pay for more than a single year’s subscription. In such cases, before processing the payment, their subscription length must be set to the number of years for which they have paid by modifying their member profile so that the correct new expiry year can be calculated. After processing the payment, the subscription length will be automatically reset to 1.

Expiry year: When a new member joins, this is set to the year of their joining (i.e. the date that their membership form was completed) unless that date is after 30 September in which case it will be set to the year following. When members renew their subscription, their subscription length is added to the old expiry year to create their new one.

Status: When a new member joins, this is set to ‘Applicant’. Once their subscription has been paid, it is changed to ‘Good standing’. The process which sends out subscription renewal notices will change the status of members concerned to ‘Subscription renewal notice sent’, to be returned to ‘Good standing’ once they have paid their new subscription.

MGF role: When a new member joins, this is set to ‘Member’ and will remain so unless they take on an administrative role within MGF – in which case, their profile must be updated accordingly.

Loading