Set item email field in Podio - email

I'm having a hard time trying to guess how to set the item email field value, since there is nothing about this in the documentation (http://podio.github.io/podio-php/fields/)
I have tried :
$item->fields['email']->values = array("type"=>"work","value"=>"a#a.com");
$item->fields['email']->values = array("value"=>"a#a.com");
$item->fields['email']->values = "a#a.com";
$item->fields[$field_id]->value ="i#i.com";
$item->fields[$field_id]->type ="work";
$item->save();
Nothing works, please help! Thank you!

I have figured it out , here is the code that works (if anyone runs into the same problem)
$field_id = 'email';
$emails=$item->fields[$field_id]->values;
$item->fields[$field_id]->values =array('value'=>"i#oooo.com",'type'=>'work');
$item->save();

Related

Net.Mail.MailAddress and adding an email address to established variable

If I go
[Net.Mail.MailAddress]$email = 'mytest#domain.com'
Then later in my code I want to add an address. I can't figure out how to add an additional email address.
I have tried
[Net.Mail.MailAddress]$email = $($email,newemail#domain.com)
[Net.Mail.MailAddress]$email = $($email,"newemail#domain.com")
[Net.Mail.MailAddress]$email = "$email,newemail#domain.com"
[Net.Mail.MailAddress]$email = "$email","newemail#domain.com"
It was as simple as
[Net.Mail.MailAddress]$email = 'mytest#domain.com'
[Net.Mail.MailAddress[]]$email = 'mytest#domain.com','newaddress#domain.com'
It should be noted that I read about $Message.To.Add($email2) given in the comments but was not sure how to get that going in my code or get it going at all :)
Thanks
TheMadTechnician
and
Santiago Squarzon

FileMaker PHP API newEditCommand() not found..?

Here's what I'm working with...
$FindInvoiceRecord = $FMInvoices->newFindCommand('Data Entry (XGA)');
$FindInvoiceRecord->addFindCriterion('InvoiceNumber', $InvoiceNumber);
$FindInvoiceRecord->setScript('wa_CommitRecord');
$FindInvoiceRecordResult = $FindInvoiceRecord->execute();
$FoundRecords = $FindInvoiceRecordResult->getRecords();
$FMInvoiceRecordID = $FoundRecords[0]->getField('zRecordID');
$OriginalInvoiceNotes = $FoundRecords[0]->getField('InternalNotes');
This works fine and loads my data as expected from the FileMaker record. Then I'm trying to update the record...
$InvoiceUpdateData = array('InternalNotes' => $NewInvoiceNotes);
$InvoiceUpdateRecord = $FoundRecords[0]->newEditCommand('Data Entry (XGA)', $FMInvoiceRecordID, $InvoiceUpdateData);
$InvoiceUpdateRecordResult = $InvoiceUpdateRecord->execute();
But this is telling me that newEditCommand() method is not found..?? Any information on what I'm doing wrong here would be greatly appreciated. Thanks!
The newEditCommand is a method in the record object, not the result object.
Try this:
$InvoiceUpdateRecord = $FMInvoices->newEditCommand('Data Entry (XGA)', $FMInvoiceRecordID, $InvoiceUpdateData);

Adding placeholder text to Drupal 7 user_register_form

So I can get the email and username field to work just fine.
here is the code
if ( TRUE === in_array( $form_id, array('user_register_form'))) {
$form['account']['name']['#attributes']['placeholder'] = t(' Username ');
$form['account']['name']['#title_display'] = "invisible";
$form['account']['mail']['#attributes']['placeholder'] = t(' Your Email ');
$form['account']['mail']['#title_display'] = "invisible";
}
This works fine. But it seems the person who set this up is using custom field in the form because the it shows:
name="profile_installer_contractor[field_installer_first_name][und][0][value]"
How can I get these fields to show the placeholder text? I have tried:
$form['account']['field_installer_first_name'][und][0]['value']['#attributes']['placeholder'] = t(' First Name ');
but that doesn't seem to work. Any help is greatly appreciated.
Thanks,
Kevin
nevermind I figured it out on my own.
$form[profile_installer_contractor]['field_installer_first_name'][und][0]['value']['#attributes']['placeholder'] = t(' First Name ');
this worked

How to get the current courseid for the current page in moodle

i have an addres moodle/course/modedit.php?add=page&type=&course=4&section=1&return=0&sr=0 in moodle. How can i get the courseid that is 4? I tried $COURSE->id but it doesnot worked.
Please help me with the solution.
Could you show the code?
You could try
$courseid = $PAGE->course->id
or
$courseid = optional_param('course', null, PARAM_INT);
make sure that you are using global $COURSE firstly.
function getCourses(){
global $COURSE;
echo $COURSE->id;
}

preg_replace troubles

I am struggling with this regular expression.
$glossary_search[] = "/(^|>|\\s)".$glossary["glossary_name"]."($|<|\\s)/i";
$glossary_replace[] = "\$1<a href='/jargon-buster/".tapestry_hyphenate($glossary["glossary_name"]).".html' title='".$glossary["glossary_name"]."' target='_blank'>".$glossary["glossary_name"]."</a>\$2";
return preg_replace($glossary_search,$glossary_replace,$text);
I am trying to replace words in a product description with a hyperlink. The code above works if the word has a space either side but does not work if it has a full stop, comma or "<". Can anyone spot my mistake?
Thanks,
Simon
I think you might need to use preg_quote and htmlentities?
$glossary_search[] = "/(^|>|\\s)".preg_quote(htmlentities($glossary["glossary_name"],ENT_COMPAT,'UTF8'))."($|<|\\s)/i";
$glossary_replace[] = "\$1<a href='/jargon-buster/".tapestry_hyphenate($glossary["glossary_name"]).".html' title='".$glossary["glossary_name"]."' target='_blank'>".$glossary["glossary_name"]."</a>\$2";
return preg_replace($glossary_search,$glossary_replace,$text);