Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration
You are here: Home

msaohiostate

  • Profile
  • Topics Started
  • Replies Created
  • Engagements
  • Favorites

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • February 13, 2018 at 3:09 pm in reply to: eMember Smart Form Integration #77253
    msaohiostate
    Member

    I apologize for the ambiguity.

    This plugin is called Smart Forms, its a plugin that allows for more complex forms to be inserted in to WP. We are currently using this plugin to run our elections as a student organization. We are currently collecting applications which is working fine however in the near future we will be voting and we would like to restrict voting to a one time submission. I reached out to the developer and he adjusted to code to only allow one submission per WP user however since we use WP eMember for our database it does seem to be compatible. He advised us to alter the code according to your php shortcodes etc however that didn’t solve the issue. The current issue is that eMembers can still submit more than one submission.

    Here is the code for to php files, the 1st is part of the original plugin that should connect to the current user database and the 2nd is the full code for the extension for one time submission validation.

    1st:

    private function InsertEntryData(){

    $emember_auth = Emember_Auth::getInstance();

    $user_id = $emember_auth->getUserInfo(‘user_name’);

    $currentuser=$user_id;

    global $wpdb;

    $result= $wpdb->insert(SMART_FORMS_ENTRY,array(

    ‘form_id’=>$this->FormId,

    ‘user_id’=>$currentuser->ID,

    ‘date’=>date(‘Y-m-d H:i:s’),

    ‘data’=>$this->FormString,

    ‘ip’=>$_SERVER,

    ‘reference_id’=>$this->ReferenceId

    ));

    if($result==false)

    return false;

    $this->EntryId=$wpdb->insert_id;

    $this->FormEntryData[“_formid”]=$this->EntryId;

    $this->InsertedValuesString[“_formid”]=$this->EntryId;

    $result=$this->ParseAndInsertDetail($this->EntryId,$this->FormEntryData,$this->GetFormElementsDictionary());

    return $result;

    }

    2nd:

    <?php

    /**

    Plugin Name: One time submission

    */

    add_filter(‘sf_before_saving_form’,’smart_forms_one_time_submission’);

    function smart_forms_one_time_submission($preInsertEntry)

    {

    if ($preInsertEntry->FormId != 21)

    {

    return;

    }

    require_once SMART_FORMS_API;

    $query = new SmartFormsQuery(21);

    $emember_auth = Emember_Auth::getInstance();

    $user_id = $emember_auth->getUserInfo(‘user_name’);

    $query->AddCondition(‘_UserId’,’=’, $user_id);

    $result = $query->GetResults();

    if (count($result) > 0)

    {

    $preInsertEntry->ContinueInsertion = false;

    $preInsertEntry->AddAction(new ShowMessageInsertEntryAction(“Sorry you can not submit this form again”));

    }

    }

    If we need to proceed with custom coding we have no problem however if its a simple fix we appreciate the help.

    February 9, 2018 at 6:49 am in reply to: eMember Smart Form Integration #77251
    msaohiostate
    Member

    Still not working unfortunately

    February 9, 2018 at 3:19 am in reply to: eMember Smart Form Integration #77249
    msaohiostate
    Member

    Do you think you’d be able to alter it for me please. If tried several times but I still can’t seem to get it to work. What do I have to add to this code to make it work.

    Thanks

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ