TNG SHORTCODE CONSTRUCTOR V 1.05A FOR WORDPRESS
- Security Update
- Jquery version jquery-1.10.2.min.js replaced with jquery-3.5.0.min.js in /js folder
- Coy of current 3.5.0 version is jquery-current.min.js in /js folder
- Modified familyuser.html.php and submit_images.html.htp to use jquery-current.min.js.
- Deleted js/jquery-1.10.2.min.js
You may download latest version, here.
[tabs style=”1″]
[tab title=”Background”]
Background
When my son, Neel and I published TngApi plugin for WordPress, back in 2014, we also added TngApi-Custom where users could add their own shortcodes to explore TNG database and these customised shortcodes would not be over written in TngApi updates.
Since then, there have been sevaral changes to TNG, PHP and MySql databases. With recent changes in TNG and MySql database, I am finding it difficult to maintain some the routines in TNG which update the database with changes submitted by users.
TNG SHORTCODE CONSTRUCTOR is a standalone plugin. I have added some of the shortcodes from TngApi-Custom and as it does not change any data in the TNG database, it should be easy enough to maintain.
[/tab]
[tab title=”Download”]
Download
You may download latest version, V 1.5, here.
-
Added shortcode
TngWp_familyuser. A reconstructed family page from my TngApi plugin.- As the default person for this page is the logged-in User, the page is only available to logged-in users.
I am open to suggestions if this has to be changed. - Displays All family data including notes and media
- Option to upload Profile Image
- Option (in Settings) to display Button Links to TNG Person, Ancestors and Descendents.
- Option (in Settings) to track ONE Special Event. Please note that if there are more than on entry for that person, only first one will be displayed.
- As the default person for this page is the logged-in User, the page is only available to logged-in users.
-
Added files,
- /TngWp/Shortcode/FamilyUser
- /templates/Familyuser.html
- /templates/processupload
-
Modified files,
- tng-shortcode-constructor
- /TngWp/ShortcodeContent
- /css/tngwp
- this file, readme
- This shortcode adds extra column to TngWp_manniversaries, with header title “Years – First Death”. This displays years between marriage date and first death. Feel free to suggest changes in header titles. For test purposes, this column will display “Living” if both spouses are living.
New search widjet, TNG Names Search, ‘TngWp_Widget_TngSearch’ is under test.
- The widget requires a WordPress page to display search results. To create the page, navigate to Settings>TNG Shortcodes and enter a page name (slug). A WordPress page will be created when changes are saved.
- Widget will only be activate if a WordPress page for the widget is created.
See Set Up for more details.
I have uploaded the files with the new Shortcode and Search Widget to the repository, ( https://github.com/upavadi/TngApi_shortcodeConstructor ). This will be the developement version 1.03 dev.
To test out the new Shortcode & the Search Widget, please download the developemnet version here.
License
The code is licenced under the MIT licence
-
This allows you to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so.
-
All I ask is that you share your changes, perhaps by creating a GithubPull or Fork Request.
[/tab]
[tab title=”Introduction”]
Introduction
TNG Shortcode Constructor is a stripped down version of The TngApi V3.3 plugin for WordPress.
TngApi V3.3, a stand-alone plugin, was published in 2015. It integrates smoothly with TNG (The Next Generation of Genealogy Sitebuilding) to display genealogy data in WordPress pages. It’s main attraction was the ability of the user to add / amend family data and ability of the administrator to perform one-click transfer of this data to tng database. With changes to MySQL and TNG database structure, I have found it virtually imposible to support this feature.
I understand that, now, a TNG mod, the Family Group Worksheet , has the facility for administrators to merge data in to TNG database.
Plan is to have the TNG Shortcode Constructor do everything the TngApi did, except update TNG data.
- It implements Privacy Credentials in the TNG General SetUp>Privacy
- Require Login:
- Show Living Data:
- Show Names for Living:
- Show Names for Private:
- I may implement the following in the next update
- Show LDS Data: Current shortcodes do not show LDS data, as do not have LDS data my database.
- Restrict access to assigned tree. As I only have one tree,
- I have not implemented this. Perhaps on next version.
- It implements Privacy Credentials for the User
- Allow User to view information for living individuals
- Allow User to view information for private individuals
- I may implement the following in the next update
- Allow User to view LDS information
- Restrict User access to specific trees and branches.
[/tab]
[tab title=”Change Log”]
Change Log
Current Released Version 1.05
-
Added shortcode
TngWp_familyuser. A reconstructed family page from my TngApi plugin.- As the default person for this page is the logged-in User, the page is only available to logged-in users.
I am open to suggestions if this has to be changed. - Displays All family data including notes and media
- Option to upload Profile Image
- Option (in Settings) to display Button Links to TNG Person, Ancestors and Descendents.
- Option (in Settings) to track ONE Special Event. Please note that if there are more than on entry for that person, only first one will be displayed.
- As the default person for this page is the logged-in User, the page is only available to logged-in users.
-
Added files,
- /TngWp/Shortcode/FamilyUser
- /templates/Familyuser.html
- /templates/processupload
-
Modified files,
- tng-shortcode-constructor
- /TngWp/ShortcodeContent
- /css/tngwp
- this file, readme
- 1.04a
Corrected stupid typo in tng-shortcode-constructor.php which prevented style sheet, tngwp.css, to load
- Style Sheet Bootstrap.css seems to cause conflicts in some themes.
- Modified admin_set_paths.php to add an option to disable bootstrap.css in Settings>TNG Shortcodes.
- Modified option to load bootstrap.css in tng-shortcode-constructor.php
-
1.04 – Repository for the TNG Shortcode Constructor Version 1.04 is here
-
Added Legacy Widget,
TngWp_searchwhich searches names in TNG database.- The widget requires a WordPress page to display search results.
- Page Name, “TNG Name Search”, which is same as Widget name, is defined in /widget/TngSearch.php
- The widget obeys credentials setup in TNG admin.
- To create the WordPress page, navigate to Settings>TNG Shortcodes and enter a page name (slug) such as tng-search. Do not leave blanks
- A WordPress page will be created, with shortcode as content, when changes are saved.
- Do not leave space between words such as “tng search”
- Avoid using “search” as page name as this may clash with the widget in TngApi.
- Widget will only be activate if a WordPress page for the widget is created and page name is shown in the Plugin Paths.
- Note: I use a WordPress Classic Widget Plugin to work in the Widget area. Makes it very easy to work with Legacy Widgets.
-
Added shortcode,
TngWp_RandomMediawhich is set to display- Default images of deceased
- images set to “AlwaysOn”
- headstones
- For Documents, default image, /img/doc01.jpg, is shown, with description and link of the document.
- This is added subsequent to user request and it may be modified to suit user needs.
- Display of Document is fluid and I am open to suggestions.
-
Added shortcode,
TngWp_RandomPhotowhich is set to display images of deceased OR images set to be ‘always on’.- current condition is set to display default images of deseased OR images marked as ‘Always On’
- This is added susequent to user request and it may be modified to suit user needs.
- Functionality may change depending on comments / suggestions from users
-
Added shortcode
TngWp_manniversariesDeceasedwhich Calculates years between marriage and first death.- This shortcode adds extra column to
TngWp_manniversaries, with header title “Years – First Death”. This displays years between marriage date and first death. Feel free to suggest changes in header titles. For test purposes, this column will display “Living” if both spouses are living.
- This shortcode adds extra column to
-
- 1.02
- Special characters (eg Norwegian Æ, Ø, Å ) from TNG database showing up as ? or similar. A charset to UTF applied to all TNG tables in ‘shortcodeContent.php’
- 1.01 -Incorrect file name /TngWp/shortcodes/gone.php. Changed to /TngWp/shortcodes/Gone.php.
- Omitted to add /templates in gone.html.php. Fixed
- Undeclared variable when using PHP 8.01 in /templates in gone.html.php Fixed
- Released Version 1.0
[/tab]
[tab title=”Setup”]
Setup
The plugin should work with all versions of TNG.
-
Plugin obtains it’s credentials from TNG setup.
-
Plugin shares it’s variables with TngApi
-
Plugin Settings are in WordPress Admin>Settings
-
The variables are
- TNG Root Path: TNG Root Path is the absolute path to TNG. You may look this up from TNG Admin Setup or config.php ($rootpath) in TNG folder.
- URL to TNG Folder: TNG URL is path to TNG (http://www.mysite.com/tng). You may look this up from TNG Admin Setup or config.php ($tngdomain) in TNG folder.
- TNG Photo Folder: Name of TNG Photo Folder. Derived from TNG setup.
- TNG Integration Path Enter TNG folder name here. If you are using WordPress Integration by Mark Barnes, enter the name of the page you have specified to display TNG pages within WordPress container. Otherwise enter name of TNG folder.
- TNG Collection ID for Photo Uploads: User images are uploaded in to one of TNG folders with the collection name specified by you in the admin set up. Enter the name for the collection you have set up in TNG admin > media. Mine is called “My Uploads”.
Important Variable is the TNG Root Path. If it can not find the TNG file it will complain, bitterly.
Tested on
- WordPress platform: 5.9.3
- PHP version 7.xx and 8.01
- WP-TNG Integration
- Mike Barnes Method using a Stripped Down tng.php
- Kloosterman method
- Alongside my plugins, TngApi V3.3.2 and tng-wp-login v3.1.3.beta
[/tab]
[tab title=”Shortcodes”]
Shortcodes In This Release
TngWp_birthdaysList birthdays for the selected month. ViewTngWp_danniversariesList death anniversaries for the selected month. ViewTngWp_familyuserA reconstructed family page from my TngApi plugin. ViewTngWp_gone(Gone But Not Forgotten). Gives birth dates and deat hdates for yesterday, today and tomorrow. It is encapsulated in a DIV and it may be possible to include that in your content. ( I have used similar in my Home Page) ViewTngWp_LandingPageThis is similar to ‘TngWp_gone’ but has user name, birthdays, marriage anniversaries and death anniversaries added. ViewTngWp_manniversariesList of marriage anniversaries for the selected month. ViewTngWp_manniversariesDeceasedwhich Calculates years between marriage and first death. ViewTngWp_RandomMediadisplays random default photo ( of deceased) OR headstones or link to a document ViewTngWp_RandomPhotodefault photo ( of deceased ) OR Image set as Always ON ViewTngWp_MyShortcodeTemplate for adding your own shortcode
TngWp_submitImageUpload images from WordPress. Image will be stored in a TNG Media Collection specified by you. View
[/tab]
[tab title=”Search Widget”]
Added Legacy Widget, TngWp_search which searches names in TNG database.
- The widget requires a WordPress page to display search results.
- Page Name, “TNG Name Search”, which is same as Widget name, is defined in /widget/TngSearch.php
- The widget obeys credentials setup in TNG admin.
- To create the WordPress page, navigate to Settings>TNG Shortcodes and enter a page name (slug) such as tng-search. Do not leave blanks
- A WordPress page will be created, with shortcode as content, when changes are saved.
- Do not leave space between words such as “tng search”
- Avoid using “search” as page name as this may clash with the widget in TngApi.
- Widget will only be activate if a WordPress page for the widget is created and page name is shown in the Plugin Paths.
- Note: I use a WordPress Classic Widget Plugin to work in the Widget area. Makes it very easy to work with Legacy Widgets.
[/tab]
[tab title=”Create Shortcode”]
Add Your Own Shortcode
- Create a file for your page. (e.g. myShortcode.html.php)
- Create a file with the class for the shortcode (e.g. myShortcode.php)
class TngWp_Shortcode_MyShortcode extends TngWp_Shortcode_AbstractShortcode
{
const SHORTCODE = 'TngWp_MyShortcode'; //This is your shortcode name
public function show()
{
// This may best place to define general variables.
//Array $conext will be available in your page.
$context = array(
);
//This html file will show your page
return $this->templates->render('myshortcode.html', $context);
}
}
-
Add Short code class in the plugin file tng-shortode-constructop.php
$content->addShortcode(new TngWp_Shortcode_MyShortcode()); -
Hopefully, that Should work
To Do
- Add Privacy Credentials for Assigned Tree
- Add Privacy Credentials for LDS Data
- Shortcode for Family Page similar to TngApi
- Shortcode widjet for TNG Person Search similar to TngApi
Patches & contributions
This is very much a project that can evolve so please feel free to fork and submit pull requests.
I would really love to have your feedback, so if you download, let me know. Thanks.
[/tab]
[/tabs]