I am trying to implement an opt-in on a website to add a newly registered user to a mailing list on Mailchimp. This user can either be an individual or a business client and has to be in different groups.
Now what I've done is, I created 1 list with 1 group and in that group I created 2 subgroups(?)
Like there's a group title and there's groupings underneath. Now I try to use the API Wrapper provided over here: https://github.com/drewm/mailchimp-api/ and used this method for the API request:
$r = $mailchimp->call('lists/subscribe', array(
'id' => 'REMOVED_ID',
'email' => array(
'email' => 'REMOVED_EMAIL'
),
'merge_vars' => array(
'groupings' => array(
'id' => REMOVED_ID,
'groups' => array('REMOVED_NAME')
)
)
));
For obvious reasons I've replaced the actual values with placeholders.
What happens is: The user with the opt-in gets a email asking for their confirmation, and then the email adres gets added to the list but they're not in any groups.
Am I doing something wrong or am I being impatient?
I've found out what the problem is for this particulair problem. The JSON produced by the MailChimp class looks like this:
{"id":"ID_REMOVED","email":{"email":"EMAIL_REMOVED"},"merge_vars":{"FNAME":"Captain","LNAME":"Jack","groupings":{"id":ID_REMOVED,"groups":["GROUP_NAME_REMOVED"]}},"apikey":"API_KEY_REMOVED"}
But it should have [] around the groupings like so:
"groupings":[{"id":ID_REMOVED,"groups":["GROUP_NAME_REMOVED"]}]
Now I don't know how to achieve this, but for future reference, this is what caused my problem
Related
Our current SAML setup has been working just fine with the more or less default setup provided by the library SimpleSAMLPHP. However, one new IDP specifically needs to bind to the SP via a POST binding.
It seems like SimpleSAMLPHP will always redirect to the IDP using a GET request, as can be clearly seen here for example:
There also seems to be no distinct configuration setting which controls this.
We have tried to play with the NameID Policy settings with no success. The SP lists the following NameID Policy in their metadata:
urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST
Our own NameID Policy is as follows:
urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
Any tip here will really be highly appreciated
You want the IdP's metadata to have a urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST binding for SingleSignOnService and have that binding be listed first in the list of SingleSignOnService options supported. This is often in the file metadata/saml20-idp-remote.php. This is different from NameId and from the AssertionConsumerService SP bindings with the same binding name. Your SP will pick the first SingleSignOnService option listed for the IdP in the IdP's metadata.
$metadata['https://some.idp.co'] = array (
'entityid' => 'https://some.idp.co',
'metadata-set' => 'saml20-idp-remote',
'SingleSignOnService' =>
array (
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
'Location' => 'https://some.idp.co/idp/profile/SAML2/POST/SSO',
),
1 =>
array (
'other options, etc'
),
),
I'm trying to add a Product Bundle to an Order (or a Cart, add_bundle_to_cart uses the same args). The Bundle has several child products, all of which have variations. The args I need to be providing according to the documentation are:
$args = array(
81 => array(
'product_id' => 1543,
'quantity' => 3,
),
84 => array(
'product_id' => 1386,
'quantity' => 1,
'variation_id' => 3535,
'attributes' => array(
'attribute_pa_attribute-1' => 'value-1b',
'attribute_pa_attribute-2' => 'value-2b',
),
)
);
Where the second bundled product (84) is a variable product. My issue: I cannot verify whether the values I am providing for the 'attributes' array are correct.
My attribute is named 'Servings' and there are two options - '2 People' and '4 People'. I am not sure how to format the attribute name to replace 'attribute_pa_attribute-1'. I have tried 'servings', 'attribute_pa_servings', etc. If I return the variation information for the product it gives me: 'attribute_servings' as the name and '2 People' as the value. But that doesn't seem to work either.
I am not getting any errors returned in debug.log, and I cannot find any examples of someone using this in the land of Google.
If anyone has any experience with this, I would greatly appreciate a tip as to what I am doing wrong.
Many thanks.
I came to realise there are two different types of 'attributes' in Woo: global attributes (across all products), and local attributes (specific to one product). The quoted instructions from the documentation are referring to how to reference global attributes - I am using local ones. So that is why the terms weren't working.
General overview here.
Information on the syntax between the two here.
For a Web-Application with many Database related events I want to build a Changelog. That should log what users have done, so its a Userlog too.
The App is huge, has a complex role based user access system and there will be hundreds of different events (changes) that may occur.
This all should be Database-Driven, in PHP and needs at least a View to search the Logs.
But in short, I have totally no idea how to design that all and need some tips or inspirations, maybe what others have done.
I've done this in the past and found basically 2 approaches: Model-based and Controller-based.
Model-based within the model itself override the save and update methods (assuming an ActiveRecord pattern) to create a new entry in the ChangeLog table.
Controller-based add the ChangeLog record creation logic to each controller that you want to track.
I prefer the Controller-based approach since you have more control over what's going on and when. Also, you have full access to the user session so it's easier to add tracking for auditing purposes.
Have solved that much more easy as it appears with my first thoughts.
This should do it most times without a comment:
protected function log($comment = ''){
$user = $this->user();
ORM::factory('Changelog')->vaules(array(
'user_id' => $user->pk(),
'section_id' => $user->section->pk(),
'username' => $user->username.'#'.$user->section->name,
'time' => time(),
'uri' => $this->uri($this->request->param(), $this->request->query()),
'controller' => $this->request->controller(),
'action' => $this->request->action(),
'post' => serialize($this->request->post()),
'comment' => $comment,
))->save();
}
A simple $this->log() and all is done.
Result: http://charterix.sourceforge.net/log.jpg
i'm searching for a solution to solve the following problem in zf2:
i have a list of destinations, and i want a search-formular on my page with auto-completion.
also the list is used to translate parts of my web-page, so i will use zend_translate to do this.
it it possible to "reverse-search" the list of translations with zend_translate?
Example:
$translate->getKeysByExpression('*ger*');
result:
array (
array ( 'key' => '__germany__', 'name' => 'germany'),
array ( 'key' => '__trn_landwithger__', 'name' => 'landwithger'
)
it is not the biggest problem if i have to load the complete list of translations, it is not that much.
or is it better to use mongodb as backend for zend_translate, and use direct queries to find the completion-candidates?
I am using
SugarCRM Pro 6.4.4
php 5.3.0
apache 2.2.11
My problem is that clicking the Reports module would display a text-formatted response (JSON format). When clicking the Create Report would also respond the same. I was expecting the Report Wizard wherein I could choose whether my report would be in Rows and Columns, Summation or more.
Below is a part of the response sent by Sugar.
ACLAllowedModules = ["Leads","Cases","Bugs","Prospects","Project","ProjectTask","Campaigns","CampaignLog","Releases","Contacts","Accounts","Opportunities","Notes","Calls","Emails","Meetings","Tasks","Users","Currencies","Trackers","TrackerSessions","TrackerPerfs","TrackerQueries","Documents","DocumentRevisions","EmailAddresses","Teams","Quotes","Products","ProductTypes","ProductCategories","Forecasts","Contracts","KBDocuments"]; var module_defs = new Object(); default_summary_columns = ['count'];
I tested the reports module in sugarcrm pro 6.1.6 but the result is okay.
Update:
I have fixed the problem. Turns out, sugar is calling a classname that is invalid. Corrected the classname and it is now working. By the way, the classname sugar is calling is a customized/overriden classname.
I had this error occur as a result of a bad vardefs.php custom field definition in a custom module. In my specific instance, I was trying to make a custom field pull from a custom list of values with the following code.
Bad vardefs code:
'customField' => array(
...
'type' => 'enum',
'function' => array(
'name' => 'getCustomListOfValues',
'params' => array('foobar')
)
...
),
My issue was fixed by breaking out the function params:
'customField' => array(
...
'type' => 'enum',
'function' => 'getCustomListOfValues',
'function_params' => array('foobar')
...
),