Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am coding a custom register page for my wordpress site. I am actually hiding the WP registering/member function a bit. This means that people fill in their info, automatically a username is created (combination first + lastname), auto a password is created, and people get logged in automatically. No confirmation e-mail is sent, so people are not aware that they actually created an account and are logged in. Now i have 2 questions:
I was wondering if it would be possible that if a username already exists, people get logged in automatically, for instance by updating all the fields (including password) and log in the user.
If that is not possible (I guess it is not); would it be possible that when the username exists, automatically the username is changed to a combination of: firstname, lastname+number. So: Peter Hanks, Peter Hanks 1, Peter hanks 2 etc. when a username exists?
Hope someone can help me out on this.
Thanks a lot!
You can update the password with wp_set_password
http://codex.wordpress.org/Function_Reference/wp_set_password
After that, you can auto login with wp_signon
http://codex.wordpress.org/Function_Reference/wp_signon
Example (Not tested)
wp_set_password($new_password);
$creds = array();
$creds['user_login'] = $username;
$creds['user_password'] = $new_password;
wp_signon( $creds, false );
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Hi I try to call some data using API but it shows error message of "invalid key". But In the function I didn't figure out where I can input my key. The code is shown below:
sahie_years <- getCensus(
name = "timeseries/healthins/sahie",
vars = c("NAME", "PCTUI_PT"),
region = "state:01",
time = "from 2006 to 2018")
head(sahie_years)
Can anybody have some ideas?
See documentation here for setting up your API key.
You need to sign up for an API key here.
Once you've done that you can either specify your API key by setting an environment variable using Sys.setenv(CENSUS_KEY="YOUR_CENSUS_KEY_GOES_HERE"), or
just set it directly in your getCensus call by adding the argument key = "YOUR_CENSUS_KEY_GOES_HERE".
For API keys in general, it is often easiest to set them in a .Renviron file, which will make them available in each session using Sys.getenv.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
I have uploaded an app with Apple SignIn, In that after sign in success we are taking user info like First name, Last name , email But i got a rejection from apple .
1.1 Legal: Privacy - Data Collection and Storage
Guideline 5.1.1 - Legal - Privacy - Data Collection and Storage
We noticed that your app requires users to register with personal information that is not directly relevant to your app's core functionality. Specifically, the following fields are required but do not appear to be directly relevant to your app's core functionality:
First and Last Name (when using Sign In with Apple)
Email (when using Sign In with Apple)
Name and Email are supplied by Sign In with Apple, so asking for these separately is not appropriate. We encourage you to utilize Sign In with Apple and honor its intentions, to respect users privacy and personal information.
Next Steps
To resolve this issue, please either remove all required fields that are not relevant to the app or make those fields optional. Information requested during registration must be relevant to the features the app provides.
*Save all the data in keychain When you get the success data didCompleteWithAuthorization and after use keychain data.
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
if let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential {
// Create an account in your system.
// For the purpose of this demo app, store the these details in the keychain.
KeychainItem.currentUserIdentifier = appleIDCredential.user
KeychainItem.currentUserFirstName = appleIDCredential.fullName?.givenName
KeychainItem.currentUserLastName = appleIDCredential.fullName?.familyName
KeychainItem.currentUserEmail = appleIDCredential.email
print("User Id - \(appleIDCredential.user)")
print("User Name - \(appleIDCredential.fullName?.description ?? "N/A")")
print("User Email - \(appleIDCredential.email ?? "N/A")")
print("Real User Status - \(appleIDCredential.realUserStatus.rawValue)")
}
}
For changing any state of credentials you can track with the following code.
let appleIDProvider = ASAuthorizationAppleIDProvider()
appleIDProvider.getCredentialState(forUserID: KeychainItem.currentUserIdentifier) { (credentialState, error) in
switch credentialState {
case .authorized:
// The Apple ID credential is valid.
break
case .revoked:
// The Apple ID credential is revoked.
break
case .notFound:
// No credential was found, so show the sign-in UI.
}
default:
break
}
}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
Is there any woocommerce API for add to cart
So that I can add product to cart via mobile app.
Please help me.
Did not found any "add to cart" functionality in the woocommerce api.
What had been done is that my "add to cart" button will save the product id and its quantity(and other properties) to the shared preferences object.
Firstly getting the products json object from the already shared preferences object and find out that the to-be-added product already is present on the shared preferences object.If it is present already then the execution returns.Otherwise it will advance to add the product property to the shared preferences object.
SharedPreferences pref = getSharedPreferences("CartPref", 0);
String strJson = pref.getString("productCartJson","[]");
JSONArray productsSaveDetailJsonArray = new JSONArray(strJson);
//checking if the product-to-be-added is already present in the shared preferences object
for(int i=0;i<productsSaveDetailJsonArray.length();i++){
if(productsSaveDetailJsonArray.getJSONObject(i).getString("product_id").contentEquals(productIdForDetailsPage)){
strJson = pref.getString("productCartJson","0");
Log.d("strJson",""+strJson);
//if already present then returns.
return;
}
}
JSONObject productSaveDetailJsonObject = new JSONObject();
productSaveDetailJsonObject.put("product_id",""+productIdForDetailsPage);
productSaveDetailJsonObject.put("quantity","1");
productsSaveDetailJsonArray.put(productSaveDetailJsonObject);
SharedPreferences.Editor editor = pref.edit();
editor.putString("productCartJson", ""+productsSaveDetailJsonArray);
editor.apply();
strJson = pref.getString("productCartJson","0");
Log.d("strJson",""+strJson);
If any doubt please comment.
This works for me.Hope it works for you as well.
Please find the following steps to achieve this:
Get the persistent cart. It may be _woocommerce_persistent_cart or _woocommerce_persistent_cart_1; check in the user_meta table.
Create a new cart object.
Add the old cart data to the newly created cart object.
Add the product and quantities coming in from the request to the new cart object.
If there is a current session cart, overwrite it with the new cart.
Update the wp_session table with the updated cart data.
Overwrite the persistent cart with the new cart data.
Please check my answer to the following question with integration of these steps in working code:
Rest API to store products in cart based on the user id in woocommerce
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
{
"likes" : {
"-K_4PuiqVo6BsIsL0tMD" : {//post reference id
"-K_4Pv_JXQHW_LoDNUJY" : {//'like' id(randomely generated)
"id" : "TYS111088",
"photoUrl" : "https://web.smm:8081/Emp_Images/Upload/Emp_Photo/t_TYS111088-c22cbe899f.JPG",
"username" : "Anubhav"
},
"-K_4QP-lGvH9K2cljSIh" : {//'like' id(randomely generated)
"id" : "TYS111088",
"photoUrl" : "https://web.smm:8081/t_TYS111088-c22cbe899f.JPG",
"username" : "Anubhav"
}
}
}
I want to delete particular 'like'id node(with details),on click of dislike button. I am using android app.
We don't know the platform but the answer is very similar
let ref = myRootRef.child("likes")
.child("-K_4Fbj0wBmZf3_l-uXe")
.child("-K_4FdjaJgPoR0EGwexB")
ref.removeValue()
you can also delete data by setting using ref.setValue and setting it to nil.
I think that you have structured your data wrongly. You want to use on("child_added") on "likes". Once you have all childs,
you want to delete a child via user input (e.g. you have a delete button with the referense to the current key)
When storing: ref("likes").push()
When retrieving: ref("likes").on("child_added")
In the data viewer (what you're looking at) you can hover over a node and you'll have the ability to add a new child (green + button) or delete the node (red X button).
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm using fr3dLdapBundle with fosUserBundle.
Symfony - version=v2.0.9
fosUserBundle - version=1.2.0
I have done everything as typed in the installation documents. But I catch one error.
ErrorException: Notice: Undefined offset: 0 in ...\vendor\bundles\FR3D\LdapBundle\Ldap\LdapManager.php line 27
Can you give me advice on what to do?
The Ldap field for identify a single entry is not the default value setted or is not the first in the config.
At config.yml
attributes:
- { ldap_attr: uid, user_method: setUsername }
Means uid will be the Ldap Attribute used for identify a user by his username in the login form.
This entry must match with your Ldap Attribute and must be the first in the list after attributes