Support Forum

Every time that you post a problem, PLEASE add the Joomla and the extension's versions and revisions (for example: Joomla 3.3.6, Contact Enhanced 3.3.5), PHP version and Server's Operating System. If you only manage only one site it is easier if you edit your profile and just add that information to your signature. Don't forget to add a detailed description of the problem. If possible, write down all steps to simulate the problem.

Before submitting a new post, PLEASE make sure you are running the latest version, test in different browsers (IE, FF, Chrome,..) and clear Joomla and browser's cache after every change you make.

Also, most questions are already answered in our FAQ and in iFAQ and Contact Enhanced documentation pages.

loadcontact

11 years 7 months ago #12366 by garek007
I know we can loadcontact with

{loadcontact id=|55|}

it would be really cool if we could do

{loadcontact country=|"Germany"|}

where it loads any contacts located in Germany. Is that possible, and if not, an easy thing to do myself?

Please Log in or Create an account to join the conversation.

11 years 7 months ago #12367 by douglas
Dear garek007,

This would require some customization, which you can do yourself in case you have PHP knowledge;

This is the first time I get this request, so I'll probably not include this feature in my to do list; I hope you understand;

All the best,

Please Log in or Create an account to join the conversation.

11 years 7 months ago #12370 by garek007
I can customize, I know PHP, Which file(s) would need modification? I could send to you when done.

Please Log in or Create an account to join the conversation.

11 years 7 months ago #12373 by douglas
Dear Garek007,

You will have to edit this file:
/plugins/content/contactenhanced/contactenhanced.php
Perform an SQL query to find out a contact id and then set the $contactId variable in the processContacts method;

Please feel free to send it to me, however I'd appreciate if you could add the attribute like this:
{loadcontact search=|country=Germany&city=blahblah| }

This way you can make it search by any contact field; You can take a look how I've done with the "fields" attribute in that same file;

All the best,

Please Log in or Create an account to join the conversation.

11 years 7 months ago #12421 by garek007
doug, I think I can do this. But it will take some time to figure out. If and when I get around to it, I will email to you. I may post questions here along the way, but I think it would be a cool feature to have.

Please Log in or Create an account to join the conversation.

11 years 7 months ago #12422 by garek007
Doug,
Ok I've successfully queried the database and made a simple function for getting any field I want by passing the parameters into the function.

What I need your help on is where to find this "fields" attribute you mentioned. I see several variables called fields, but am not sure which line of code you are referencing.

Please Log in or Create an account to join the conversation.

11 years 7 months ago #12423 by douglas
Dear garek007,

Can you wait a couple of weeks? If so, I'll create a this feature for you.

All the best,

Please Log in or Create an account to join the conversation.

11 years 7 months ago #12426 by garek007
Sure I can wait, but I like to learn and I'm happy to help so if you just point me in the right direction I can probably get you 80% of the way there.

Please Log in or Create an account to join the conversation.

11 years 7 months ago - 11 years 7 months ago #12452 by garek007
Doug,

So I've written this function and it works

function getContact($searchAttr,$searchWord){

$db =& JFactory::getDBO();//this gets the database and stores it in the variable $db



$query = "SELECT `id` FROM `jos_contact_details` WHERE ".$searchAttr."='".$searchWord."'";
$db->setQuery($query);//this runs the query
$theID = $db->loadResult();//this loads the result of the query


$result = "Contact ".$searchAttr." is ".$searchWord." and ID is ".$theID;



return $result;



}//function

I found the fields bit of code you mentioned

$field_matches = array();
preg_match( "#fields=\|(.*?)\|#s", $inline_params, $field_matches );
if (isset($field_matches[1])){

$field_matches[1] = str_replace( '&', '&', $field_matches[1] );

// Get all Fields
$custom_fields = array();
parse_str($field_matches[1], $custom_fields);

//Encode email field
if(isset($custom_fields) AND $custom_fields){
$custom_fields = ceHelper::encode($custom_fields);

}
if($pluginParams->get('plg_display_type') == 'modal'){
$pluginParams->set('plg_modal_fields', http_build_query($custom_fields));
}else{
foreach ($custom_fields as $key => $value) {
$jinput->set($key, $value);
}
}
}



I'm just not sure how I modify the code here to call the function. Which lines in YOUR function do I need to edit to get the information from MY function? Do I have everything or is there more code somewhere that I need?

PS, I know you said you'd do this, but I really want to help with it, since it's my custom need.

Please Log in or Create an account to join the conversation.

11 years 7 months ago #12459 by douglas
Dear Garek,

I have implemented this feature for you. It took me about two hours to implement and test it;

I have sent the file to you;

Contact Enhanced plugin syntax:
search=|field=value&field2=value2|
search_operator=|value| where value might be =, <>, >, <, LIKE
searchphrase=|value| where value might be all (all search terms are required) OR any;

Kind regards,

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum

Copyright © 2018 IdealExtensions.com. All Rights Reserved.

This site is not affiliated with or endorsed by the Joomla!™ Project. It is not supported or warranted by the Joomla!™ Project or Open Source Matters™. The Joomla!™ logo is used under a limited license granted by Open Source Matters™, the trademark holder in the United States and other countries.
We may collect your IP address and your browser's User Agent string while using our site for security reasons and deriving aggregate information (analytics). This information is retained for a minimum of 1 and a maximum of 24 months.
Feedback