contact forms 7 how to add cookie and ip 24 hours on submission button - cookies

i want to make user use submit button every 24 hours
function dd_handle_form_submission( $contact_form ) { // Check Form ID if( 2744 !== $contact_form->id() ) return; // Use your form ID here $submission = WPCF7_Submission::get_instance();

Related

Changing the position of submit button (windows wrap credential provider )

I have been recently working on customizing windows wrap credential provider.Added secondary password field(OTP) but problem arise as i am unable to adjust the position of submit button.i have tried couple of thing but have failed
Here is the login interface of the wrap credential provider
image
Here is the function of the submit button
HRESULT CSampleCredential::GetSubmitButtonValue(
DWORD dwFieldID,
DWORD* pdwAdjacentTo
)
{
HRESULT hr = E_UNEXPECTED;
if (_pWrappedCredential != NULL)
{
hr = _pWrappedCredential->GetSubmitButtonValue(dwFieldID,
pdwAdjacentTo);
}
return hr;
}
The new password field that is OTP field is named as "SFI_PASSWORD"
and the submit button field needs to be adjacent to this field.
How can this be achieved?
May be I am answering this too late but could be of some help to others. You need to set the index of the field that submit button should be placed adjacent to, for example if you want the submit button to be adjacent to the password input field it should be *pdwAdjacentTo = SFI_PASSWORD;. In your case I think you need to give index of that one time password input field.

Ionic 2/3 :Dynamically set RootPage

I have a scenario where I have 2 profiles (user and admin) and I have a selection page once a person logs in. On the selection page, there are 2 radio buttons for (User and Admin profiles), what I am trying to achieve is, the person can choose only 1 profile (this is achieved by the radio button), now assuming I have saved the selected value, I want to set the rootPage to AdminPage or UserPage, but I don't want to immediately navigate, I just want to update/set the path so that when the person goes back (by pressing the back key or previous button) it will take the person to the desired page. Please let me know your thoughts.
Maby this will put you in the right direction:
https://ionicframework.com/docs/api/navigation/NavController/#insert
do not set adminPage or userPage as rootPage but insert the page on the stack
The trick here is that you want to set the root to a new page after the user tries to go back, the easiest way to achieve this is using the NavController navguards to execute a code before leaving the page, this way it'll check wich page the user has selected and then set the root.
Since the select can be easy impemented following the docs i'll leave that aside. Let's just say you have a property userType that is a string and can be 'user' or 'admin', in your select page you'll do the following:
public canLeave: boolean = false; //this'll controll if the user can leave the page or not
public userType: string = 'user'; // just setting a default value to your select
// this is a navguard
ionViewCanLeave() {
if(!this.canLeave){
if(this.userType == 'user'){
this.canLeave = true; // you'll need to set canLeave to true so when setting the rootpage it doesn't enters the if statemente again
this.navCtrl.setRoot('UserPage');
} else {
this.canLeave = true;
this.navCtrl.setRoot('AdminPage');
}
}
return true;
}
Hope this helps.
I got the solution to the error,
ionViewCanLeave() {
if(!this.canLeave){
if(this.userType == 'user'){
this.canLeave = true; // you'll need to set canLeave to true so when setting the rootpage it doesn't enters the if statemente again
this.navCtrl.setRoot('UserPage'); // <-- this should be UserPage instead of 'UserPage'
} else {
this.canLeave = true;
this.navCtrl.setRoot('AdminPage'); // <-- this should be AdminPage instead of 'AdminPage'
}
}
return true;
}

HTML Redirect After Load

I’m displaying dropdowns in HTML to alter a SAS output. The values of the dropdowns only affect SAS each time the page loads. I want to link to a second page and pass the values of the dropdown. However SAS is unaware of what the values are unless the current page reloads and saves the dropdown values. So I want to reload the same page when the user clicks a button. Then redirect the user to a second page. All of the redirect code I see redirects the user 100% of the time while I only want to redirect the based on a condition.
The method I described in my comment would look something like this.
HTML:
<button onclick="saveData()">Save</button>
JS:
(function() {
if ( getQueryVariable("data") == "saved" ) {
alert("true");
}
})();
function saveData() {
var newPage = window.location.href + "?data=saved";
window.location.replace(newPage);
}
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
I added this to the dropdownlists
onchange='this.form.submit()'
Which made the refresh button not needed.

JomSocial - Registration Redirection

I am working on jomsocial. I have installed the "Redirect Registration for JomSocial" plugin for redirecting the registration page to jomsocial registration. I am getting the registration page but once the first step in registration in completed the page redirects to login page showing the message as "Please Login first".
This is happens only if I disables the menu "Jomsocial" that is created during jomsocial installation.
Is there any other way to redirect the registration page to jomsocial registration.
It seems that you have menu item issue. probably you create some menu items outside JomSocial toolbar and you've set for one of this menu item (the one with highest menu item ID) privacy restriction.
So You get to registration page and when clicking next Joomla! is taking menu item ID from menu item I mentioned above... this cause redirection to "Please, login first". Just check your menu items ;)
You may not disable the jomsocial menu items, if you don't want to show them just put them in a new menu, which you won't create a module for (or create a module and don't assign it to any position). This is why it's failing now. The function requiring this is getMenuItem() in the redirect plugin.
What you will find next is that a visitor clicking on a link that requires login will be sent to the login page with a &return parameter with the encoded url it's supposed to go back to after login. This is not handled by jomsocial plugin, just change is like this:
file plugins/system/jomsocialredirect/jomsocialredirect.php
/**
* Method to override Login / Logout redirect
*/
private function overrideRedirectLoginLogout() {
$mainframe =& JFactory::getApplication();
$task = JRequest::getVar ( 'task' );
switch ($task) {
case 'user.login' : //Joomla 1.6 and later
case 'login' : /* on logging */
/**
* krz This next line restores working status of login redirects.
* (the purpose of jomsocialredirect plugin is to redirect after login, but some links for guests
* point to com_login with a return url set; if this is the case, the next line makes the feature work,
* otherwise it would be overridden;
* note: redirect is to be avoided on logout.
*/
if (JRequest::getVar('return','')!='') return;
if ($this->login ()) { /* we do login by self */
/* redirect if login success */
$link = $this->getMenuLink ( $this->pluginParams->get ( 'redirect_login', 1 ) );
$mainframe->redirect ( $link, JText::_ ( $this->pluginParams->get ( 'redirect_login_msg', 'LOGIN_SUCCESSFUL' ) ), 'message' );
} else {
/* redirect if login failed */
$link = $this->getMenuLink ( $this->pluginParams->get ( 'redirect_login_failed', 1 ) );
$mainframe->redirect ( $link, JText::_ ( $this->pluginParams->get ( 'redirect_login_failed_msg', 'LOGIN_FAILED' ) ), 'notice' );
}
break;
case 'user.logout' : //Joomla 1.6 and later
case 'logout' :
$link = $this->getMenuLink ( $this->pluginParams->get ( 'redirect_logout', 1 ) );
JFactory::getApplication ()->logout ();
$mainframe->redirect ( $link, JText::_ ( $this->pluginParams->get ( 'redirect_logout_msg', 'YOU_HAVE_LOGGED_OUT' ) ), 'message' );
break;
default :
/* override redirect after login / logout */
$view = JRequest::getVar('view','');
if ($view=='profile') {
$link = $this->getMenuLink ( $this->pluginParams->get ( 'redirect_login', 1 ) );
$mainframe->redirect ( $link);
}
break;
}
}

Django's filter_horizontal - stop enter presses submitting the form

I'm not sure if I'm doing something wrong, if there's something broken about filter_horizontal, or if my expectations of the way it should behave are wrong. Any insights appreciated!
In my mind, when you use filter_horizontal, type a few characters into the text box to narrow down your choice such that there's a single item, and hit enter, it should:
Add the item to the selected list
clear your entered text (allowing you to add another).
What it actually does is:
Add your item to the selected list
Keep the text in the filter box
Submit the form, without saving your new selection
Am I doing something wrong? Is this the behaviour everyone sees? Is there a way to work around this?
I'm using Django 1.2.3, and I've tested this in Chrome 8.0.552.237, Firefox 3.6.13, and IE 8.
I can confirm the behavior on Django 1.2.1.
Problem:
It looks like admin/js/SelectFilter2.js registers a key up handler to do the filtering. This handler also returns false if the key was the enter key, which tries to cancel the form submit.
From admin/js/SelectFilter2.js line 85 or so:
// don't submit form if user pressed Enter
if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
from.selectedIndex = 0;
SelectBox.move(field_id + '_from', field_id + '_to');
from.selectedIndex = 0;
return false;
}
This seemed fine to me, so I added an event handler at the end of the init method to catch the form's submit event:
addEvent(document.forms[0], 'submit', function(event) {
console.log("Form submitted");
}
After doing that, it's clear that submit fires before the keyUp event. Thus, pressing enter submits the form, and the keyUp event never gets to the field.
Workaround:
I was able to work around the behavior by discarding all enter keyUp's on the form itself. Add this to the end of the init method in SelectFilter2.js:
addEvent(document.forms[0], 'keyup', function(event) {
if (event.keyCode && event.keyCode == 13) {
return false;
}
});
This is the quick and dirty way to fix the problem, but the form event fires after the field's event, so it seems to work. But it also stops the enter key from submitting the form everywhere else too.
This should probably be filed as a django bug.