{"id":303,"date":"2015-02-26T12:26:05","date_gmt":"2015-02-26T12:26:05","guid":{"rendered":"http:\/\/localhost\/syllogic\/wp\/?p=303"},"modified":"2024-02-02T12:22:27","modified_gmt":"2024-02-02T12:22:27","slug":"boosting-registration-forms","status":"publish","type":"post","link":"http:\/\/localhost:10008\/boosting-registration-forms\/","title":{"rendered":"Boosting Registration forms"},"content":{"rendered":"\n

In a recent project we had to make a custom registration form with a various dynamic categories loaded on the form from which a new user can select using a radio button.<\/p>\n\n\n\n

Simpler Registration Form Plus<\/h3>\n\n\n\n

We discovered the wonderful plugin<\/a> which is the Swiss-army plugin for registration forms.  Why do I call it the Swiss-army of registration forms?  Simply because the author seems to have thought of all the possibilities.  To start with, the form automatically creates the additional user meta fields inside your WordPress installation for any elements you create in the registration form, hence ensuring that your logged-in users have all the extra registered fields integrated into their profile.<\/p>\n\n\n\n

The other beautiful aspect is that it is allows for users to view and edit their profiles using a separate [profile_page]<\/code> shortcode provided by the plugin and you can independently identify which of the fields should be visible in the profile page.<\/p>\n\n\n\n

Video tutorial<\/h4>\n\n\n\n

The plugin comes with an embeded video tutorial which comes quite handy initially to figure out how to display the custom registration form using the shortcode provided.<\/p>\n\n\n\n

Callback function for more customisation<\/h4>\n\n\n\n

Recently the fully loaded commercial version of the plugin was released to the WordPress community (blessings on the author for his next life-time for this good karma \ud83d\ude42 and it comes with an additional functionality that allows for a custom field to be added to the the registration form (select type = Callback) which call a user defined function to determine the shade and content of that field.  Brilliant I hear you say?  Sure it is.<\/p>\n\n\n\n

How to get it to work is a little more complex to figure out since the documentation is thin if not non-existent…hence this post actually.<\/p>\n\n\n\n

When you add a new field, selete the ‘Callback’ type and in the option field, enter the name of your function, for example… echo_registration_categories<\/code> the plugin will call your function with 1 argument, the value of the field saved in the database… this is in order to ensure the field is pre-populated when loaded on the profile page for example.  Here is an example,<\/p>\n\n\n\n

\/\/display registration categories in sign up form\nfunction echo_registration_categories($args){\n   \/\/let's get the categories for this conference\n   $categories = array();\n   $categories[name] = get_option(\"conf_registration_categories_name\");\n   $categories[currency]= get_option(\"conf_registration_categories_currency\");\n   $categories[early_bird_fees] = get_option(\"conf_registration_categories_early_bird\");\n   $categories[full_fees] = get_option(\"conf_registration_categories_full\");\n    \n   $today = strtotime(date('d M Y'));\n   $earlyDate = strtotime(get_option(\"early_bird_date\"));\n   $isEarly = ($today<=$earlyDate);\n  \/\/ if($text)\n   $output ='<div id=\"css-user_category\" class=\"option-field radio \">';\n   $output .='  <label for=\"user_category\">Registration category<span class=\"required\">*<\/span><\/label>';\n   $output .='      <ul>';\n   $userCategory =$args;\n   if ( empty($args) && is_user_logged_in() ) {\n      $user_ID = get_current_user_id();\n      $userCategory = get_user_meta($user_ID, 'user_category', true);\n   }\n   for($idx=0; $idx < sizeof($categories[name]); $idx++){\n      $checked = '';\n      $text = $categories[name][$idx];\n      if($text == $userCategory) $checked = 'checked';\n      $cur = $categories[currency][$idx];\n      $cost = $categories[full_fees][$idx];\n      if(  $isEarly ) $cost = $categories[early_bird_fees][$idx];\n      $output .='<li><input name=\"user_category\" '.$checked.'  value=\"'.$text.'\" type=\"radio\">'.$text.' <span class=\"category-cost\">'.$cost.' '.$cur.'<\/span><\/li>';\n   }\n   $output .='      <\/ul><\/div>';\n   echo $output;\n}\n<\/code><\/pre>\n\n\n\n

As you can see, the above outputs a list of radio input<\/code> elements for a conference registration category.  The user value is passed as the argument $args<\/code> when the field has a value saved in the database.  I have also added a check for getting the currently logged-in user’s value in case we want to call this function separately outside the context of the plugin….and that piece of code could be left out.<\/p>\n","protected":false},"excerpt":{"rendered":"

In a recent project we had to make a custom registration form with a various dynamic categories loaded on the form from which a new user can select using a radio button. Simpler Registration Form Plus We discovered the wonderful plugin which is the Swiss-army plugin for registration forms.  Why do I call it the […]<\/p>\n","protected":false},"author":2,"featured_media":325,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[22],"yoast_head":"\nBoosting Registration forms - Tiffin Consulting<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/localhost:10008\/boosting-registration-forms\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Boosting Registration forms - Tiffin Consulting\" \/>\n<meta property=\"og:description\" content=\"In a recent project we had to make a custom registration form with a various dynamic categories loaded on the form from which a new user can select using a radio button. Simpler Registration Form Plus We discovered the wonderful plugin which is the Swiss-army plugin for registration forms.  Why do I call it the […]\" \/>\n<meta property=\"og:url\" content=\"http:\/\/localhost:10008\/boosting-registration-forms\/\" \/>\n<meta property=\"og:site_name\" content=\"Tiffin Consulting\" \/>\n<meta property=\"article:published_time\" content=\"2015-02-26T12:26:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-02T12:22:27+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/localhost:10008\/wp-content\/uploads\/2015\/02\/reg.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"460\" \/>\n\t<meta property=\"og:image:height\" content=\"306\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Aurovrata V.\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Aurovrata V.\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t \"@context\": \"https:\/\/schema.org\",\n\t \"@graph\": [\n\t {\n\t \"@type\": \"Article\",\n\t \"@id\": \"http:\/\/localhost:10008\/boosting-registration-forms\/#article\",\n\t \"isPartOf\": {\n\t \"@id\": \"http:\/\/localhost:10008\/boosting-registration-forms\/\"\n\t },\n\t \"author\": {\n\t \"name\": \"Aurovrata V.\",\n\t \"@id\": \"http:\/\/localhost:10008\/#\/schema\/person\/361f7db128e2b6858c7deb2a43f85f99\"\n\t },\n\t \"headline\": \"Boosting Registration forms\",\n\t \"datePublished\": \"2015-02-26T12:26:05+00:00\",\n\t \"dateModified\": \"2024-02-02T12:22:27+00:00\",\n\t \"mainEntityOfPage\": {\n\t \"@id\": \"http:\/\/localhost:10008\/boosting-registration-forms\/\"\n\t },\n\t \"wordCount\": 433,\n\t \"publisher\": {\n\t \"@id\": \"http:\/\/localhost:10008\/#\/schema\/person\/e7549052d5ca8cb5891c059c2424a9f6\"\n\t },\n\t \"keywords\": [\n\t \"registration\"\n\t ],\n\t \"articleSection\": [\n\t \"Input forms\"\n\t ],\n\t \"inLanguage\": \"en-US\"\n\t },\n\t {\n\t \"@type\": \"WebPage\",\n\t \"@id\": \"http:\/\/localhost:10008\/boosting-registration-forms\/\",\n\t \"url\": \"http:\/\/localhost:10008\/boosting-registration-forms\/\",\n\t \"name\": \"Boosting Registration forms - Tiffin Consulting\",\n\t \"isPartOf\": {\n\t \"@id\": \"http:\/\/localhost:10008\/#website\"\n\t },\n\t \"datePublished\": \"2015-02-26T12:26:05+00:00\",\n\t \"dateModified\": \"2024-02-02T12:22:27+00:00\",\n\t \"breadcrumb\": {\n\t \"@id\": \"http:\/\/localhost:10008\/boosting-registration-forms\/#breadcrumb\"\n\t },\n\t \"inLanguage\": \"en-US\",\n\t \"potentialAction\": [\n\t {\n\t \"@type\": \"ReadAction\",\n\t \"target\": [\n\t \"http:\/\/localhost:10008\/boosting-registration-forms\/\"\n\t ]\n\t }\n\t ]\n\t },\n\t {\n\t \"@type\": \"BreadcrumbList\",\n\t \"@id\": \"http:\/\/localhost:10008\/boosting-registration-forms\/#breadcrumb\",\n\t \"itemListElement\": [\n\t {\n\t \"@type\": \"ListItem\",\n\t \"position\": 1,\n\t \"name\": \"Home\",\n\t \"item\": \"http:\/\/localhost:10008\/\"\n\t },\n\t {\n\t \"@type\": \"ListItem\",\n\t \"position\": 2,\n\t \"name\": \"Boosting Registration forms\"\n\t }\n\t ]\n\t },\n\t {\n\t \"@type\": \"WebSite\",\n\t \"@id\": \"http:\/\/localhost:10008\/#website\",\n\t \"url\": \"http:\/\/localhost:10008\/\",\n\t \"name\": \"Tiffin Consulting\",\n\t \"description\": \"digital business transformation\",\n\t \"publisher\": {\n\t \"@id\": \"http:\/\/localhost:10008\/#\/schema\/person\/e7549052d5ca8cb5891c059c2424a9f6\"\n\t },\n\t \"potentialAction\": [\n\t {\n\t \"@type\": \"SearchAction\",\n\t \"target\": {\n\t \"@type\": \"EntryPoint\",\n\t \"urlTemplate\": \"http:\/\/localhost:10008\/?s={search_term_string}\"\n\t },\n\t \"query-input\": \"required name=search_term_string\"\n\t }\n\t ],\n\t \"inLanguage\": \"en-US\"\n\t },\n\t {\n\t \"@type\": [\n\t \"Person\",\n\t \"Organization\"\n\t ],\n\t \"@id\": \"http:\/\/localhost:10008\/#\/schema\/person\/e7549052d5ca8cb5891c059c2424a9f6\",\n\t \"name\": \"Aurovrata V.\",\n\t \"image\": {\n\t \"@type\": \"ImageObject\",\n\t \"inLanguage\": \"en-US\",\n\t \"@id\": \"http:\/\/localhost:10008\/#\/schema\/person\/image\/\",\n\t \"url\": \"http:\/\/localhost:10008\/wp-content\/uploads\/2024\/02\/tiffin-dabbawalla.png\",\n\t \"contentUrl\": \"http:\/\/localhost:10008\/wp-content\/uploads\/2024\/02\/tiffin-dabbawalla.png\",\n\t \"width\": 1060,\n\t \"height\": 644,\n\t \"caption\": \"Aurovrata V.\"\n\t },\n\t \"logo\": {\n\t \"@id\": \"http:\/\/localhost:10008\/#\/schema\/person\/image\/\"\n\t },\n\t \"sameAs\": [\n\t \"http:\/\/localhost:10008\"\n\t ]\n\t },\n\t {\n\t \"@type\": \"Person\",\n\t \"@id\": \"http:\/\/localhost:10008\/#\/schema\/person\/361f7db128e2b6858c7deb2a43f85f99\",\n\t \"name\": \"Aurovrata V.\",\n\t \"image\": {\n\t \"@type\": \"ImageObject\",\n\t \"inLanguage\": \"en-US\",\n\t \"@id\": \"http:\/\/localhost:10008\/#\/schema\/person\/image\/\",\n\t \"url\": \"http:\/\/2.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\n\t \"contentUrl\": \"http:\/\/2.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\n\t \"caption\": \"Aurovrata V.\"\n\t },\n\t \"url\": \"http:\/\/localhost:10008\/author\/aurovrata\/\"\n\t }\n\t ]\n\t}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Boosting Registration forms - Tiffin Consulting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/localhost:10008\/boosting-registration-forms\/","og_locale":"en_US","og_type":"article","og_title":"Boosting Registration forms - Tiffin Consulting","og_description":"In a recent project we had to make a custom registration form with a various dynamic categories loaded on the form from which a new user can select using a radio button. Simpler Registration Form Plus We discovered the wonderful plugin which is the Swiss-army plugin for registration forms.  Why do I call it the […]","og_url":"http:\/\/localhost:10008\/boosting-registration-forms\/","og_site_name":"Tiffin Consulting","article_published_time":"2015-02-26T12:26:05+00:00","article_modified_time":"2024-02-02T12:22:27+00:00","og_image":[{"width":460,"height":306,"url":"http:\/\/localhost:10008\/wp-content\/uploads\/2015\/02\/reg.jpg","type":"image\/jpeg"}],"author":"Aurovrata V.","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Aurovrata V.","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/localhost:10008\/boosting-registration-forms\/#article","isPartOf":{"@id":"http:\/\/localhost:10008\/boosting-registration-forms\/"},"author":{"name":"Aurovrata V.","@id":"http:\/\/localhost:10008\/#\/schema\/person\/361f7db128e2b6858c7deb2a43f85f99"},"headline":"Boosting Registration forms","datePublished":"2015-02-26T12:26:05+00:00","dateModified":"2024-02-02T12:22:27+00:00","mainEntityOfPage":{"@id":"http:\/\/localhost:10008\/boosting-registration-forms\/"},"wordCount":433,"publisher":{"@id":"http:\/\/localhost:10008\/#\/schema\/person\/e7549052d5ca8cb5891c059c2424a9f6"},"keywords":["registration"],"articleSection":["Input forms"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/localhost:10008\/boosting-registration-forms\/","url":"http:\/\/localhost:10008\/boosting-registration-forms\/","name":"Boosting Registration forms - Tiffin Consulting","isPartOf":{"@id":"http:\/\/localhost:10008\/#website"},"datePublished":"2015-02-26T12:26:05+00:00","dateModified":"2024-02-02T12:22:27+00:00","breadcrumb":{"@id":"http:\/\/localhost:10008\/boosting-registration-forms\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/localhost:10008\/boosting-registration-forms\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/localhost:10008\/boosting-registration-forms\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/localhost:10008\/"},{"@type":"ListItem","position":2,"name":"Boosting Registration forms"}]},{"@type":"WebSite","@id":"http:\/\/localhost:10008\/#website","url":"http:\/\/localhost:10008\/","name":"Tiffin Consulting","description":"digital business transformation","publisher":{"@id":"http:\/\/localhost:10008\/#\/schema\/person\/e7549052d5ca8cb5891c059c2424a9f6"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/localhost:10008\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"http:\/\/localhost:10008\/#\/schema\/person\/e7549052d5ca8cb5891c059c2424a9f6","name":"Aurovrata V.","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/localhost:10008\/#\/schema\/person\/image\/","url":"http:\/\/localhost:10008\/wp-content\/uploads\/2024\/02\/tiffin-dabbawalla.png","contentUrl":"http:\/\/localhost:10008\/wp-content\/uploads\/2024\/02\/tiffin-dabbawalla.png","width":1060,"height":644,"caption":"Aurovrata V."},"logo":{"@id":"http:\/\/localhost:10008\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/localhost:10008"]},{"@type":"Person","@id":"http:\/\/localhost:10008\/#\/schema\/person\/361f7db128e2b6858c7deb2a43f85f99","name":"Aurovrata V.","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/localhost:10008\/#\/schema\/person\/image\/","url":"http:\/\/2.gravatar.com\/avatar\/?s=96&d=mm&r=g","contentUrl":"http:\/\/2.gravatar.com\/avatar\/?s=96&d=mm&r=g","caption":"Aurovrata V."},"url":"http:\/\/localhost:10008\/author\/aurovrata\/"}]}},"_links":{"self":[{"href":"http:\/\/localhost:10008\/wp-json\/wp\/v2\/posts\/303"}],"collection":[{"href":"http:\/\/localhost:10008\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/localhost:10008\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/localhost:10008\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/localhost:10008\/wp-json\/wp\/v2\/comments?post=303"}],"version-history":[{"count":2,"href":"http:\/\/localhost:10008\/wp-json\/wp\/v2\/posts\/303\/revisions"}],"predecessor-version":[{"id":327,"href":"http:\/\/localhost:10008\/wp-json\/wp\/v2\/posts\/303\/revisions\/327"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/localhost:10008\/wp-json\/wp\/v2\/media\/325"}],"wp:attachment":[{"href":"http:\/\/localhost:10008\/wp-json\/wp\/v2\/media?parent=303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/localhost:10008\/wp-json\/wp\/v2\/categories?post=303"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/localhost:10008\/wp-json\/wp\/v2\/tags?post=303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}